diff --git a/copyparty/__init__.py b/copyparty/__init__.py
index 6756b8b5..4c64e2b0 100644
--- a/copyparty/__init__.py
+++ b/copyparty/__init__.py
@@ -135,6 +135,7 @@ web/tl/vie.js
web/ui.css
web/up2k.js
web/util.js
+web/wopi.html
"""
RES = set(zs.strip().split("\n"))
RESM = {
diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py
index 22762ffe..9a226a78 100644
--- a/copyparty/authsrv.py
+++ b/copyparty/authsrv.py
@@ -3343,6 +3343,8 @@ class AuthSrv(object):
zs2 = getattr(self.args, zs, "")
if zs2:
js_htm[zs] = zs2
+ if self.args.wopi:
+ js_htm["have_wopi"] = True
zs = "have_emp md_no_br"
md_htm = {x: js_htm[x] for x in zs.split(" ")}
@@ -3984,7 +3986,7 @@ class AuthSrv(object):
def derive_args(args: argparse.Namespace) -> None:
args.have_idp_hdrs = bool(args.idp_h_usr or args.idp_hm_usr)
- args.have_ipu_or_ipr = bool(args.ipu or args.ipr)
+ args.have_ipu_or_ipr = bool(args.ipu or args.ipr or args.wopi)
def n_du_who(s: str) -> int:
diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py
index 0ec4a6d8..8156154e 100644
--- a/copyparty/httpcli.py
+++ b/copyparty/httpcli.py
@@ -176,6 +176,27 @@ RSS_SORT = {"m": "mt", "u": "at", "n": "fn", "s": "sz"}
ACODE2_FMT = set(["opus", "owa", "caf", "mp3", "flac", "wav"])
IDX_HTML = set(["index.htm", "index.html"])
+# coolwsd-26.04.2.3 discovery editnew; browser.js wopi_set is superset of this
+WOPI_NEW = (
+ ".odt",
+ ".fodt",
+ ".ott",
+ ".docx",
+ ".dotx",
+ ".rtf",
+ ".odm",
+ ".ods",
+ ".fods",
+ ".ots",
+ ".xlsx",
+ ".odp",
+ ".fodp",
+ ".otp",
+ ".pptx",
+ ".fodg",
+ ".otg",
+)
+
A_FILE = os.stat_result(
(0o644, -1, -1, 1, 1000, 1000, 8, 0x39230101, 0x39230101, 0x39230101)
)
@@ -3824,6 +3845,9 @@ class HttpCli(object):
True,
)
+ if self.args.wopi and sanitized.endswith(WOPI_NEW):
+ return self.redirect(vjoin(vfs.vpath, rem), "?wopi=" + quotep(sanitized))
+
vpath = "{}/{}".format(self.vpath, sanitized).lstrip("/")
self.redirect(vpath, "?edit")
return True
diff --git a/copyparty/web/wopi.html b/copyparty/web/wopi.html
new file mode 100644
index 00000000..80c8a849
--- /dev/null
+++ b/copyparty/web/wopi.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+ {{ title|e }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/scripts/sfx.ls b/scripts/sfx.ls
index 48637e05..dbbe45f4 100644
--- a/scripts/sfx.ls
+++ b/scripts/sfx.ls
@@ -141,3 +141,4 @@ copyparty/web/tl/vie.js,
copyparty/web/ui.css,
copyparty/web/up2k.js,
copyparty/web/util.js,
+copyparty/web/wopi.html,
diff --git a/tests/util.py b/tests/util.py
index 6774f04d..c0762162 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -145,7 +145,7 @@ class Cfg(Namespace):
def __init__(self, a=None, v=None, c=None, **ka0):
ka = {}
- ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt dlni dothidden e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only http_no_tcp ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_dupe_m no_fnugg no_html no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_script no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip no_zls nrand nsort nw og og_no_head og_s_title ohead opds q rand re_dirsz reflink rm_partial rmagic rss show_hist smb srch_dbg srch_excl srch_icase stats ui_noacci ui_nocpla ui_noctxb ui_nolbar ui_nombar ui_nonav ui_notree ui_norepl ui_nosrvi uqe usernames vague_403 vc ver vol_nospawn vol_or_crash wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
+ ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt dlni dothidden e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only http_no_tcp ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_dupe_m no_fnugg no_html no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_script no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip no_zls nrand nsort nw og og_no_head og_s_title ohead opds q rand re_dirsz reflink rm_partial rmagic rss show_hist smb srch_dbg srch_excl srch_icase stats ui_noacci ui_nocpla ui_noctxb ui_nolbar ui_nombar ui_nonav ui_notree ui_norepl ui_nosrvi uqe usernames vague_403 vc ver vol_nospawn vol_or_crash wo_up_readme wopi write_uplog xdev xlink xvol zipmaxu zs"
ka.update(**{k: False for k in ex.split()})
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump wram re_dhash see_dots plain_ip"