From 608f0fce7123a039d6006550deedd6ab56c2cdcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 14 Jul 2022 10:03:07 +0000 Subject: [PATCH 1/3] optionally split space id from endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer drop unused import Signed-off-by: Jörn Friedrich Dreyer --- src/core/cs3iface.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/cs3iface.py b/src/core/cs3iface.py index 9340148d..57d0b27b 100644 --- a/src/core/cs3iface.py +++ b/src/core/cs3iface.py @@ -53,15 +53,22 @@ def getuseridfromcreds(token, _wopiuser): def _getcs3reference(endpoint, fileref): '''Generates a CS3 reference for a given fileref, covering the following cases: absolute path, relative hybrid path, fully opaque fileid''' + # try splitting endpoint + parts = endpoint.split("$", 2) + endpoint = parts[0] + space_id = "" + if len(parts) == 2: + space_id = parts[1] + if fileref.find('/') > 0: # assume we have a relative path in the form `/`, # also works if we get `//` - ref = cs3spr.Reference(resource_id=cs3spr.ResourceId(storage_id=endpoint, + ref = cs3spr.Reference(resource_id=cs3spr.ResourceId(storage_id=endpoint, space_id=space_id, opaque_id=fileref[:fileref.find('/')]), path='.' + fileref[fileref.find('/'):]) else: # assume we have an opaque fileid - ref = cs3spr.Reference(resource_id=cs3spr.ResourceId(storage_id=endpoint, opaque_id=fileref), path='.') + ref = cs3spr.Reference(resource_id=cs3spr.ResourceId(storage_id=endpoint, space_id=space_id, opaque_id=fileref), path='.') return ref From ec03c785d5814ab4d5cbdb564956aab01bf43823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 14 Jul 2022 10:04:14 +0000 Subject: [PATCH 2/3] update min version for grpcio, grpcio-tools and cs3apis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index b3c277ee..471d18c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -grpcio -grpcio-tools +grpcio>=1.47.0 +grpcio-tools>=1.47.0 cygrpc flask pyOpenSSL @@ -7,5 +7,5 @@ PyJWT requests more_itertools prometheus-flask-exporter -cs3apis>=0.1.dev89 +cs3apis>=0.1.dev95 waitress From 55d1c8ab177ee8ad3b46e4fcf5185ef85fe6f94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 14 Jul 2022 10:06:42 +0000 Subject: [PATCH 3/3] update install instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e8876f61..c29620e7 100644 --- a/README.md +++ b/README.md @@ -69,13 +69,14 @@ This is work in progress. Refer to [these notes](test/wopi-validator.md). ## Run the WOPI server locally for development purposes -1. Install all requirements listed in `requirements.txt` +1. Install all requirements: `pip install -r requirements.txt` 2. Add log file directory: `sudo mkdir /var/log/wopi/ && sudo chmod a+rwx /var/log/wopi` 3. Create the folder for the wopi config: `sudo mkdir /etc/wopi/ && sudo chmod a+rwx /etc/wopi` -4. Create the files `iopsecret` and `wopiscret` in the folder `/etc/wopi/`, create random strings for the secrets -5. Copy the provided `wopiserver.conf` to `/etc/wopi/wopiserver.defaults.conf` -6. Create a config file `/etc/wopi/wopiserver.conf`: start from `docker/etc/wopiserver.conf` for a minimal configuration and add from the defaults file as needed -7. From the WOPI server folder run: `python3 src/wopiserver.py` +4. Create recoveryfolder: `sudo mkdir /var/spool/wopirecovery && sudo chmod a+rwx /var/spool/wopirecovery` +5. Create the files `iopsecret` and `wopiscret` in the folder `/etc/wopi/`, create random strings for the secrets +6. Copy the provided `wopiserver.conf` to `/etc/wopi/wopiserver.defaults.conf` +7. Create a config file `/etc/wopi/wopiserver.conf`: start from `docker/etc/wopiserver.conf` for a minimal configuration and add from the defaults file as needed +8. From the WOPI server folder run: `python3 src/wopiserver.py` ### Test the open-in-app workflow on the local WOPI server