mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: enhanced pdf support
This commit is contained in:
1 parent
ead0d54a55
commit
a3fb2cbd47
4 files changed
+5
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.2.28",
|
||||
"version": "3.2.29",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -628,7 +628,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
||||
this.response.etag = file.etag;
|
||||
this.response.body = await storage.get(target);
|
||||
this.response.type = file['Content-Type'] || fileType;
|
||||
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||
if (!noDisposition) this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||
} else {
|
||||
this.response.redirect = await storage.signDownloadLink(
|
||||
target, noDisposition ? undefined : filename, false, 'user',
|
||||
|
||||
@@ -103,7 +103,7 @@ module.exports = function videoPlugin(md) {
|
||||
pdf: videoUrl,
|
||||
};
|
||||
md.renderer.rules.video = function tokenizeReturn(tokens, idx) {
|
||||
const videoID = md.utils.escapeHtml(tokens[idx].videoID);
|
||||
let videoID = md.utils.escapeHtml(tokens[idx].videoID);
|
||||
const service = md.utils.escapeHtml(tokens[idx].service).toLowerCase();
|
||||
const checkUrl = /http(?:s?):\/\/(?:www\.)?[a-zA-Z0-9-:.]{1,}\/render(?:\/)?[a-zA-Z0-9.&;?=:%]{1,}url=http(?:s?):\/\/[a-zA-Z0-9 -:.]{1,}\/[a-zA-Z0-9]{1,5}\/\?[a-zA-Z0-9.=:%]{1,}/;
|
||||
let num;
|
||||
@@ -120,6 +120,7 @@ module.exports = function videoPlugin(md) {
|
||||
+ ' }); </script>';
|
||||
}
|
||||
if (service === 'pdf') {
|
||||
if (videoID.startsWith('file://')) videoID += '?noDisposition=1';
|
||||
return `\
|
||||
<object classid="clsid:${randomUUID().toUpperCase()}">
|
||||
<param name="SRC" value="${videoID}" >
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.27.13",
|
||||
"version": "4.27.14",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user