fix (plg_office_wopi): wopi office integration

This commit is contained in:
MickaelK 2025-01-30 17:49:40 +11:00
parent 6e2a99adf1
commit 773fd02871
3 changed files with 23 additions and 12 deletions

View file

@ -9,11 +9,13 @@
"aif": "audio/x-aiff",
"aiff": "audio/x-aiff",
"apk": "application/vnd.android.package-archive",
"arrow": "application/vnd.apache.arrow.file",
"arw": "image/x-sony-arw",
"asf": "video/x-ms-asf",
"asx": "video/x-ms-asf",
"atom": "application/atom+xml",
"avi": "video/x-msvideo",
"avro": "application/vnd.apache.avro",
"bin": "application/octet-stream",
"bmp": "image/x-ms-bmp",
"bz2": "application/x-bz2",
@ -49,6 +51,8 @@
"erf": "image/x-epson-erf",
"exe": "application/octet-stream",
"fbx": "application/fbx",
"fea": "application/vnd.apache.feather",
"feather": "application/vnd.apache.feather",
"flac": "audio/flac",
"flv": "video/x-flv",
"form": "application/x-form",
@ -119,9 +123,11 @@
"odt": "application/vnd.oasis.opendocument.text",
"ogg": "audio/ogg",
"ogv": "application/ogg",
"orc": "application/vnd.apache.orc",
"orf": "image/x-olympus-orf",
"org": "text/org",
"otf": "font/otf",
"parquet": "application/vnd.apache.parquet",
"pdb": "application/x-pilot",
"pdf": "application/pdf",
"pef": "image/x-pentax-pef",
@ -173,6 +179,7 @@
"tiff": "image/tiff",
"tk": "application/x-tcl",
"ts": "text/plain",
"tsv": "text/tab-separated-values",
"ttf": "application/x-font-ttf",
"txt": "text/plain",
"url": "application/x-url",

View file

@ -150,11 +150,12 @@ async function buildRows(rows, legends, $tbody, padding, isInit, withClear) {
const obj = rows[i];
const $tr = createElement(`<div class="tr"></div>`);
legends.forEach(({ name, size }, i) => {
$tr.appendChild(createElement(`
<div data-column="${name}" title="${obj[name]}" class="${withCenter("td ellipsis", size, i === legends.length -1)}" style="${styleCell(size, name, padding)}">
${obj[name] || "<span class=\"empty\">-</span>"}
</div>
`));
const $col = createElement(`<div class="${withCenter("td ellipsis", size, i === legends.length -1)}" style="${styleCell(size, name, padding)}"></div>`);
$col.setAttribute("data-column", name);
$col.setAttribute("title", obj[name]);
if (obj[name]) $col.textContent = obj[name];
else $col.appendChild(createElement(`<span class=\"empty\">-</span>`));
$tr.appendChild($col);
});
$tbody.appendChild($tr);
}
@ -178,11 +179,11 @@ function buildHead(STATE, $dom, padding) {
const $tr = createElement(`<div class="tr"></div>`);
STATE.header.forEach(({ name, size }, i) => {
const $th = createElement(`
<div title="${name}" class="${withCenter("th ellipsis", size, i === STATE.header.length - 1)}" style="${styleCell(size, name, padding)}">
${name}
<img class="no-select" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPHBhdGggc3R5bGU9ImZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MC41MzMzMzMyMSIgZD0ibSA3LjcwNSw4LjA0NSA0LjU5LDQuNTggNC41OSwtNC41OCAxLjQxLDEuNDEgLTYsNiAtNiwtNiB6IiAvPgogIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0wLS4yNWgyNHYyNEgweiIgLz4KPC9zdmc+Cg==" />
</div>
<div class="${withCenter("th ellipsis", size, i === STATE.header.length - 1)}" style="${styleCell(size, name, padding)}"></div>
`);
$th.setAttribute("title", name);
$th.textContent = name;
$th.appendChild(createElement(`<img class="no-select" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgPHBhdGggc3R5bGU9ImZpbGw6IzAwMDAwMDtmaWxsLW9wYWNpdHk6MC41MzMzMzMyMSIgZD0ibSA3LjcwNSw4LjA0NSA0LjU5LDQuNTggNC41OSwtNC41OCAxLjQxLDEuNDEgLTYsNiAtNiwtNiB6IiAvPgogIDxwYXRoIGZpbGw9Im5vbmUiIGQ9Ik0wLS4yNWgyNHYyNEgweiIgLz4KPC9zdmc+Cg==" />`));
let ascending = null;
qs($th, "img").onclick = (e) => {
ascending = !ascending;

View file

@ -124,13 +124,16 @@ func wopiToCommonAPI(fn HandlerFunc) HandlerFunc {
SendErrorResult(res, ErrNotValid)
return
}
urlQuery := req.URL.Query()
urlQuery.Set("path", path)
if shareID != "" {
urlQuery := req.URL.Query()
urlQuery.Set("share", shareID)
urlQuery.Set("path", path)
urlQuery.Del("access_key")
req.URL.RawQuery = urlQuery.Encode()
} else {
urlQuery.Set("authorization", urlQuery.Get("access_token"))
urlQuery.Del("access_key")
}
req.URL.RawQuery = urlQuery.Encode()
fn(ctx, res, req)
})
}