aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 090a0a2e025976ac2f005067e10d0d7483e7b046 (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
# Stud.IP Backend for rclone

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

Although it should work with all Stud.IP instances, it has currently only been tested with the [University of Bremen](https://elearning.uni-bremen.de) installation.

## 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/librcloneplugin_backend_studip.so`
- `build/rclone-studip`

## Load plugin in rclone

To use the plugin artifact with an existing rclone binary:

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

Notes:

- 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 (UUID/hash-like ID, not course title).  
  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
```