diff --git a/Dockerfile b/Dockerfile index d6ae9da..de53dfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -110,4 +110,21 @@ RUN apk add --no-cache gettext inotify-tools RUN mkdir -p /data/uploads # 暴露 80 端口 -EXPOSE 80 \ No newline at end of file +EXPOSE 80 + +# 使用 linuxserver/firefox:latest 作为基础镜像 +FROM linuxserver/firefox:latest + +# 安装中文字体和语言包 +RUN apt-get update && \ + apt-get install -y fonts-noto-cjk language-pack-zh-hans && \ + locale-gen zh_CN.UTF-8 && \ + update-locale LANG=zh_CN.UTF-8 + +# 设置环境变量 +ENV LANG=zh_CN.UTF-8 \ + LANGUAGE=zh_CN:zh \ + LC_ALL=zh_CN.UTF-8 + +# 继续使用基础镜像的入口点 +ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/apps/web/browserCheck.js b/apps/web/browserCheck.js new file mode 100644 index 0000000..701c4bd --- /dev/null +++ b/apps/web/browserCheck.js @@ -0,0 +1,58 @@ +// browserCheck.js + +// 检查浏览器版本的函数 +function checkBrowserVersion() { + const userAgent = navigator.userAgent; + const chromeMatch = userAgent.match(/Chrome\/(\d+)/); + + if (chromeMatch) { + const chromeVersion = parseInt(chromeMatch[1], 10); + if (chromeVersion < 80) { + showMustDownloadPrompt(); + } else if (chromeVersion < 100) { + showUpdatePrompt(); + } + } else if (userAgent.includes("MSIE") || userAgent.includes("Trident/")) { + showUpdatePrompt(); + } +} + +function showUpdatePrompt() { + const result = window.confirm( + "检测到您的浏览器版本较低,建议更新到最新版本以获得更好的体验。是否下载新版浏览器?" + ); + + if (result) { + // 提供下载链接 + const link = document.createElement("a"); // 创建一个链接元素 + link.href = "/chrome.exe"; // 替换为您在 public 目录中的安装包路径 + link.download = "chrome.exe"; // 设置下载文件名 + document.body.appendChild(link); // 将链接添加到文档中 + link.click(); // 模拟点击下载 + document.body.removeChild(link); // 下载后移除链接 + + // 打开预览地址 + // window.open(previewUrl, "_blank"); // 在新标签页中打开预览地址 + } +} +function showMustDownloadPrompt() { + const previewUrl = "http://192.168.139.239:8095"; // 获取预览地址 + const result = window.confirm( + "检测到您的浏览器版本过低,可能无法正常使用网站功能。是否立即下载推荐浏览器并打开预览地址进行预览?" + ); + + if (result) { + // 提供下载链接 + const link = document.createElement("a"); // 创建一个链接元素 + link.href = "/chrome.exe"; // 替换为您在 public 目录中的安装包路径 + link.download = "chrome.exe"; // 设置下载文件名 + document.body.appendChild(link); // 将链接添加到文档中 + link.click(); // 模拟点击下载 + document.body.removeChild(link); // 下载后移除链接 + + // 打开预览地址 + window.open(previewUrl, "_blank"); // 在新标签页中打开预览地址 + } +} +// 在页面加载时检查浏览器版本 +window.onload = checkBrowserVersion; diff --git a/apps/web/index.html b/apps/web/index.html index 41393c3..e2f1a2c 100755 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -18,6 +18,7 @@
+