aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: be56c391d20766b90f3f519104159201e33481ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Stud.IP Backend for rclone

This project provides an rclone backend for accessing files from Stud.IP instances.

## Usage

This backend can be used in two ways:

- as a standalone rclone-compatible binary (recommended)

or 

- as an rclone plugin loaded by an existing rclone installation


### AUR Package

```bash
paru rclone-studip-git 
```

### Standalone binary

Download the binary for your platform from the [releases page](https://github.com/Mewsen/rclone-studip-backend-oot/releases).

It is recommended to move the binary somewhere in your `PATH`.

Then continue with the [configuration](#configuration).

### Plugin with existing rclone

To use the plugin artifact with an existing rclone binary:

```bash
cp build/librcloneplugin_backend_studip.so "$RCLONE_PLUGIN_PATH/"
```

Then continue with the [configuration](#configuration).

Notes:

- Linux and MacOS only.
- All plugins in `$RCLONE_PLUGIN_PATH` are loaded.
- If `RCLONE_PLUGIN_PATH` is not set, plugin support is disabled.
- Plugin and rclone must be built from compatible source versions.

## Configuration

Create a remote with `rclone config`, then choose storage type `Stud.IP`.

Backend options:

- `base_url`: Base URL of the Stud.IP JSON API v1 endpoint.  
  Example: `https://elearning.uni-bremen.de/jsonapi.php/v1/`
- `username`: Stud.IP login username.
- `password`: Stud.IP login password (stored obscured by rclone config).
- `course_id`: Stud.IP course ID.
  Example: `59e88658b39093836455413bd1f24f29`
- `license`: License ID applied to uploaded files. Default: `UNDEF_LICENSE`.

Supported `license` values:

- `FREE_LICENSE`
- `SELFMADE_NONPUB`
- `NON_TEXTUAL`
- `TEXT_NO_LICENSE`
- `WITH_LICENSE`
- `UNDEF_LICENSE`

Important:

- If `UNDEF_LICENSE` is used, uploaded files are not readable until a valid license is chosen.

## Usage examples

```bash
# List directories / files at remote root
rclone lsd studip-bremen-ma1:
rclone ls studip-bremen-ma1:
rclone lsf studip-bremen-ma1:

# Create a directory in the configured course
rclone mkdir studip-bremen-ma1:uploads

# Upload a directory recursively
rclone copy ./localdir studip-bremen-ma1:uploads/localdir

# Upload a single file to an exact destination path
rclone copyto ./report.pdf studip-bremen-ma1:uploads/report.pdf

# Stream text into a remote file
printf "hello from rclone\n" | rclone rcat studip-bremen-ma1:uploads/hello.txt

# Download files back to local disk
rclone copy studip-bremen-ma1:uploads ./downloads/uploads

# Show file content
rclone cat studip-bremen-ma1:uploads/hello.txt

# Remove files / empty directories
rclone deletefile studip-bremen-ma1:uploads/hello.txt
rclone rmdir studip-bremen-ma1:uploads/empty-dir

rclone mount studip-bremen-ma1: ./mount
```

## Build

1. Install Mage (one-time):

```bash
go install github.com/magefile/mage@latest
```

2. Build plugin and standalone binaries:

```bash
mage
```

Build output:

- `build/rclone-studip-darwin-amd64`
- `build/rclone-studip-darwin-arm64`
- `build/rclone-studip-linux-amd64`
- `build/rclone-studip-linux-arm64`
- `build/rclone-studip-windows-amd64.exe`
- `build/rclone-studip-windows-arm64.exe`
- `build/librcloneplugin_backend_studip.so`