mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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",
|
"name": "hydrooj",
|
||||||
"version": "3.2.28",
|
"version": "3.2.29",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
|||||||
this.response.etag = file.etag;
|
this.response.etag = file.etag;
|
||||||
this.response.body = await storage.get(target);
|
this.response.body = await storage.get(target);
|
||||||
this.response.type = file['Content-Type'] || fileType;
|
this.response.type = file['Content-Type'] || fileType;
|
||||||
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
if (!noDisposition) this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
target, noDisposition ? undefined : filename, false, 'user',
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ module.exports = function videoPlugin(md) {
|
|||||||
pdf: videoUrl,
|
pdf: videoUrl,
|
||||||
};
|
};
|
||||||
md.renderer.rules.video = function tokenizeReturn(tokens, idx) {
|
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 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,}/;
|
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;
|
let num;
|
||||||
@@ -120,6 +120,7 @@ module.exports = function videoPlugin(md) {
|
|||||||
+ ' }); </script>';
|
+ ' }); </script>';
|
||||||
}
|
}
|
||||||
if (service === 'pdf') {
|
if (service === 'pdf') {
|
||||||
|
if (videoID.startsWith('file://')) videoID += '?noDisposition=1';
|
||||||
return `\
|
return `\
|
||||||
<object classid="clsid:${randomUUID().toUpperCase()}">
|
<object classid="clsid:${randomUUID().toUpperCase()}">
|
||||||
<param name="SRC" value="${videoID}" >
|
<param name="SRC" value="${videoID}" >
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.27.13",
|
"version": "4.27.14",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user