mirror of
https://github.com/9001/copyparty.git
synced 2026-08-13 13:53:06 -06:00
wopi: add wopi-urls option (#1580);
map different copyparty hosts to different WOPI client addresses
This commit is contained in:
parent
c0c638c917
commit
24a4090fc7
|
|
@ -1587,6 +1587,7 @@ def add_wopi(ap):
|
||||||
ap2.add_argument("--wopi", action="store_true", help="enable integration with office suites using WOPI")
|
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-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-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-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", 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-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)")
|
ap2.add_argument("--wopi-ttl", metavar="SEC", type=int, default=1800, help="session lifetime; allow editing for this many seconds (default is 30 min)")
|
||||||
|
|
|
||||||
|
|
@ -1673,7 +1673,9 @@ class HttpCli(object):
|
||||||
|
|
||||||
uo_kw["context"] = ctx
|
uo_kw["context"] = ctx
|
||||||
|
|
||||||
url = self.args.wopi_url.rstrip("/") + "/hosting/discovery"
|
wopi_urls = dict(x.lower().split("=", 1) for x in self.args.wopi_urls or [])
|
||||||
|
url = wopi_urls.get(self.host.lower(), self.args.wopi_url).rstrip("/")
|
||||||
|
url += "/hosting/discovery"
|
||||||
buf = urlopen(url, **uo_kw).read()
|
buf = urlopen(url, **uo_kw).read()
|
||||||
xml = buf.decode("ascii", "replace").lower()
|
xml = buf.decode("ascii", "replace").lower()
|
||||||
enc = self.get_xml_enc(xml)
|
enc = self.get_xml_enc(xml)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue