diff --git a/server/src/main/resources/static/pdfjs/web/viewer.html b/server/src/main/resources/static/pdfjs/web/viewer.html index 629bb8585..48548ca8e 100644 --- a/server/src/main/resources/static/pdfjs/web/viewer.html +++ b/server/src/main/resources/static/pdfjs/web/viewer.html @@ -1221,8 +1221,8 @@ - - + +
diff --git a/server/src/main/resources/static/pdfjs/web/viewer.mjs b/server/src/main/resources/static/pdfjs/web/viewer.mjs index 7d29b129f..78f47697e 100644 --- a/server/src/main/resources/static/pdfjs/web/viewer.mjs +++ b/server/src/main/resources/static/pdfjs/web/viewer.mjs @@ -23083,24 +23083,26 @@ initCom(PDFViewerApplication); } { const HOSTED_VIEWER_ORIGINS = new Set(["null", "http://mozilla.github.io", "https://mozilla.github.io"]); - var validateFileURL = function (file) { - if (!file) { - return; - } - const viewerOrigin = URL.parse(window.location)?.origin || "null"; - if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) { - return; - } - const fileOrigin = URL.parse(file, window.location)?.origin; - if (fileOrigin === viewerOrigin) { - return; - } - const ex = new Error("file origin does not match viewer's"); - PDFViewerApplication._documentError("pdfjs-loading-error", { - message: ex.message - }); - throw ex; - }; +var validateFileURL = function (file) { + if (!file) { + return; + } + const viewerOrigin = URL.parse(window.location)?.origin || "null"; + if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) { + return; + } + /* 注释掉跨域检查 + const fileOrigin = URL.parse(file, window.location)?.origin; + if (fileOrigin === viewerOrigin) { + return; + } + const ex = new Error("file origin does not match viewer's"); + PDFViewerApplication._documentError("pdfjs-loading-error", { + message: ex.message + }); + throw ex; + */ +}; var onFileInputChange = function (evt) { if (this.pdfViewer?.isInPresentationMode) { return; diff --git a/server/src/main/resources/web/pdf.ftl b/server/src/main/resources/web/pdf.ftl index fb2e44c50..39ca6e4c5 100644 --- a/server/src/main/resources/web/pdf.ftl +++ b/server/src/main/resources/web/pdf.ftl @@ -1,55 +1,90 @@ - + PDF预览 <#include "*/commonHeader.ftl"> + - + <#if pdfUrl?contains("http://") || pdfUrl?contains("https://")> <#assign finalUrl="${pdfUrl}"> <#else> <#assign finalUrl="${baseUrl}${pdfUrl}"> - + + + <#if "false" == switchDisabled> - 使用图片预览 + 使用图片预览 - - + + \ No newline at end of file