diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 8e79a5fa..c5cd35c1 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1585,7 +1585,7 @@ def add_wopi(ap): ap2.add_argument("--wopi", action="store_true", help="enable integration with office suites using WOPI") ap2.add_argument("--wopi-api", metavar="URL", type=u, default="", help="URL that the WOPI-client should use to communicate with copyparty; default is same as user's webbrowser. Example: [\033[32mhttps://party.example.com/\033[0m]") ap2.add_argument("--wopi-url", metavar="URL", type=u, default="", help="URL to your WOPI client; the host of e.g. Collabora Online. Example: [\033[32mhttps://code.example.com/\033[0m]") - ap2.add_argument("--wopi-urls", metavar="HOST=URL", type=u, action="append", help="\033[34mREPEATABLE:\033[0m maps http \033[33mHOST\033[0m copyparty being accessed by to specific WOPI client instance \033[33mURL\033[0m; falls back to \033[33m--wopi-url\033[0m; examples: [\033[32mparty.public.com=https://office.public.com/\033[0m], [\033[32mparty.internal.net:8443=https://office.internal.net:8443/\033[0m]") + ap2.add_argument("--wopi-urls", metavar="H=U", type=u, action="append", help="\033[34mREPEATABLE:\033[0m maps http \033[33mH\033[0mOST copyparty being accessed by to specific WOPI client instance \033[33mU\033[0mRL; falls back to \033[33m--wopi-url\033[0m; examples: [\033[32mparty.public.com=https://office.public.com/\033[0m], [\033[32mparty.internal.net:8443=https://office.internal.net:8443/\033[0m]") ap2.add_argument("--wopi-crt", metavar="TXT", type=u, default="", help="if \033[33m--wopi-url\033[0m is selfsigned: path to ca.pem or cert.pem to expect/verify (can be [\033[32mno\033[0m] for full-yolo)") ap2.add_argument("--wopi-crt-icn", action="store_true", help="if \033[33m--wopi-url\033[0m is selfsigned: ignore the CN (server ip/name) in cert") ap2.add_argument("--wopi-ttl", metavar="SEC", type=int, default=1800, help="session lifetime; allow editing for this many seconds (default is 30 min)") @@ -1744,7 +1744,7 @@ def add_salt(ap, fk_salt, dk_salt, ah_salt, wopi_salt): ap2.add_argument("--fk-salt", metavar="SALT", type=u, default=fk_salt, help="per-file accesskey salt; used to generate unpredictable URLs for hidden files") ap2.add_argument("--dk-salt", metavar="SALT", type=u, default=dk_salt, help="per-directory accesskey salt; used to generate unpredictable URLs to share folders with users who only have the 'get' permission") ap2.add_argument("--warksalt", metavar="SALT", type=u, default="hunter2", help="up2k file-hash salt; serves no purpose, no reason to change this (but delete all databases if you do)") - ap2.add_argument("--wopi-salt", metavar="SALT", type=u, default=wopi_salt, help="WOPI file ID salt; used with \033[33m--wopi\033[0m to generate persistent yet unpredictable WOPI file IDs") + ap2.add_argument("--wopi-salt", metavar="TXT", type=u, default=wopi_salt, help="WOPI file ID salt; used by \033[33m--wopi\033[0m for persistent file IDs") ap2.add_argument("--show-ah-salt", action="store_true", help="on startup, print the effective value of \033[33m--ah-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)") ap2.add_argument("--show-fk-salt", action="store_true", help="on startup, print the effective value of \033[33m--fk-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)") ap2.add_argument("--show-dk-salt", action="store_true", help="on startup, print the effective value of \033[33m--dk-salt\033[0m (the autogenerated value in $XDG_CONFIG_HOME unless otherwise specified)") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 3cd10319..42d44bfb 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -1658,7 +1658,7 @@ class HttpCli(object): "expires": time.time() + self.args.wopi_ttl, } - xml = "?" + xml = url = "?" try: from .dxml import parse_xml @@ -1696,7 +1696,8 @@ class HttpCli(object): url += quotep(zs + "/wopi/files/" + session["file_id"]) except: del wopi_files[atoken] # dont reuse an atoken wopi-client doesnt like - self.log("reading WOPI-client response failed; %s\n%s" % (min_ex(), xml), 3) + t = "reading WOPI-client response from %s failed; %s\n%s" + self.log(t % (url, min_ex(), xml), 3) raise Pebkac(500, "wopi error (see fileserver log)") html = self.j2s( diff --git a/copyparty/svchub.py b/copyparty/svchub.py index 9c5ecc30..430aabb8 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -1127,6 +1127,10 @@ class SvcHub(object): t = "not listening on any ip-addresses (only unix-sockets and/or FDs); cannot enable zeroconf/mdns/ssdp as requested" self.log("root", t, 3) + if al.wopi and not al.wopi_url and not al.wopi_urls: + self.log("root", "disabling wopi; need either wopi-url or wopi-urls", 1) + al.wopi = False + if self.args.wopi or not self.args.no_dav: from .dxml import DXML_OK diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 5a20c63c..d57fc3ee 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -7696,7 +7696,7 @@ var treectl = (function () { if (wopi_set && wopi_set.has(tn.ext)) tn.lead = '📄'; + '" rel="nofollow" target="_blank" name="' + hname + '">📄'; if (tn.lead == '-') tn.lead = 'uuid:' in ln: ln = re.sub(r">uuid:[0-9a-f-]{36}<", ">autogenerated<", ln) - if "-salt SALT" in ln: + if "-salt " in ln and ("-salt SALT" in ln or "-salt TXT" in ln): in_salt = 3 if in_salt: in_salt -= 1 diff --git a/scripts/help2txt.sh b/scripts/help2txt.sh index 27aa1216..44acfac7 100755 --- a/scripts/help2txt.sh +++ b/scripts/help2txt.sh @@ -10,8 +10,8 @@ command -v gsort >/dev/null && { ( ( HLPTXT=CAT && cat || xsel -ob ) | sed -r ' s`/home/ed/`~/`; s/uuid:[0-9a-f-]{36}/autogenerated/; -s/(-salt SALT.*default: )[0-9a-zA-Z/+]{24}\)/\124-character-autogenerated)/; -s/(-salt SALT.*default: )[0-9a-zA-Z/+]{40}\)/\140-character-autogenerated)/; +s/(-salt (SALT|TXT).*default: )[0-9a-zA-Z/+]{24}\)/\124-character-autogenerated)/; +s/(-salt (SALT|TXT).*default: )[0-9a-zA-Z/+]{40}\)/\140-character-autogenerated)/; s/(--name TXT.*default: )[^)]+/\1hostname/; s/(--hash-mt CORES.*default: )[0-9]+/\1numCores if 5 or less/; s/(--mtag-mt|th-mt)( CORES.*default: )[0-9]+/\1\2numCores/;