mirror of
https://github.com/9001/copyparty.git
synced 2026-08-15 06:43:20 -06:00
wopi: new-file, j2-template
This commit is contained in:
parent
d57bb0c701
commit
10db4236bf
|
|
@ -135,6 +135,7 @@ web/tl/vie.js
|
||||||
web/ui.css
|
web/ui.css
|
||||||
web/up2k.js
|
web/up2k.js
|
||||||
web/util.js
|
web/util.js
|
||||||
|
web/wopi.html
|
||||||
"""
|
"""
|
||||||
RES = set(zs.strip().split("\n"))
|
RES = set(zs.strip().split("\n"))
|
||||||
RESM = {
|
RESM = {
|
||||||
|
|
|
||||||
|
|
@ -3343,6 +3343,8 @@ class AuthSrv(object):
|
||||||
zs2 = getattr(self.args, zs, "")
|
zs2 = getattr(self.args, zs, "")
|
||||||
if zs2:
|
if zs2:
|
||||||
js_htm[zs] = zs2
|
js_htm[zs] = zs2
|
||||||
|
if self.args.wopi:
|
||||||
|
js_htm["have_wopi"] = True
|
||||||
|
|
||||||
zs = "have_emp md_no_br"
|
zs = "have_emp md_no_br"
|
||||||
md_htm = {x: js_htm[x] for x in zs.split(" ")}
|
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:
|
def derive_args(args: argparse.Namespace) -> None:
|
||||||
args.have_idp_hdrs = bool(args.idp_h_usr or args.idp_hm_usr)
|
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:
|
def n_du_who(s: str) -> int:
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,27 @@ RSS_SORT = {"m": "mt", "u": "at", "n": "fn", "s": "sz"}
|
||||||
ACODE2_FMT = set(["opus", "owa", "caf", "mp3", "flac", "wav"])
|
ACODE2_FMT = set(["opus", "owa", "caf", "mp3", "flac", "wav"])
|
||||||
IDX_HTML = set(["index.htm", "index.html"])
|
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(
|
A_FILE = os.stat_result(
|
||||||
(0o644, -1, -1, 1, 1000, 1000, 8, 0x39230101, 0x39230101, 0x39230101)
|
(0o644, -1, -1, 1, 1000, 1000, 8, 0x39230101, 0x39230101, 0x39230101)
|
||||||
)
|
)
|
||||||
|
|
@ -3824,6 +3845,9 @@ class HttpCli(object):
|
||||||
True,
|
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("/")
|
vpath = "{}/{}".format(self.vpath, sanitized).lstrip("/")
|
||||||
self.redirect(vpath, "?edit")
|
self.redirect(vpath, "?edit")
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
42
copyparty/web/wopi.html
Normal file
42
copyparty/web/wopi.html
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" id="ht_wopi">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<title>{{ title|e }}</title>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
<meta name="theme-color" content="#{{ tcolor }}">
|
||||||
|
<style>
|
||||||
|
|
||||||
|
body,#w {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style></head><body>
|
||||||
|
<div style="display: none">
|
||||||
|
<form action="{{ url }}" enctype="multipart/form-data" method="post" target="w" id="submit-form">
|
||||||
|
<input name="access_token" value="{{ atoken }}" type="hidden" id="access-token"/>
|
||||||
|
<input name="access_token_ttl" value="{{ ttl }}000" type="hidden" id="access-token_ttl"/>
|
||||||
|
<input type="submit" value="" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<iframe id="w" name="w" allow="clipboard-read *; clipboard-write *; fullscreen *"></iframe>
|
||||||
|
|
||||||
|
<script nonce="{{ js_nonce }}">
|
||||||
|
document.getElementById("submit-form").submit();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
@ -141,3 +141,4 @@ copyparty/web/tl/vie.js,
|
||||||
copyparty/web/ui.css,
|
copyparty/web/ui.css,
|
||||||
copyparty/web/up2k.js,
|
copyparty/web/up2k.js,
|
||||||
copyparty/web/util.js,
|
copyparty/web/util.js,
|
||||||
|
copyparty/web/wopi.html,
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ class Cfg(Namespace):
|
||||||
def __init__(self, a=None, v=None, c=None, **ka0):
|
def __init__(self, a=None, v=None, c=None, **ka0):
|
||||||
ka = {}
|
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()})
|
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"
|
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"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue