diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 285dd68..37a3c83 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -60,6 +60,16 @@ jobs: - name: ASGI import check working-directory: backend run: ../.venv-ci/bin/python -c "from config.asgi import application; print(type(application).__name__)" + - name: Production static assets check + working-directory: backend + env: + DJANGO_DEBUG: "false" + DJANGO_USE_HTTPS: "false" + DJANGO_SECRET_KEY: ci-static-assets-check + DJANGO_ALLOWED_HOSTS: localhost + DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath + REDIS_URL: redis://127.0.0.1:6379/0 + run: ../.venv-ci/bin/python manage.py collectstatic --noinput --clear - name: SQLite tests and coverage run: | .venv-ci/bin/python -m pytest -q \ diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 061774d..85c7bf7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -66,6 +66,17 @@ jobs: working-directory: backend run: ../.venv-release/bin/python -c "from config.asgi import application; print(type(application).__name__)" + - name: 生产静态资源完整性检查 + working-directory: backend + env: + DJANGO_DEBUG: "false" + DJANGO_USE_HTTPS: "false" + DJANGO_SECRET_KEY: release-static-assets-check + DJANGO_ALLOWED_HOSTS: localhost + DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath + REDIS_URL: redis://127.0.0.1:6379/0 + run: ../.venv-release/bin/python manage.py collectstatic --noinput --clear + - name: MySQL 发布迁移检查 env: DATABASE_URL: mysql://root:ci-root-password@mysql:3306/hulumath diff --git a/backend/common/test_frontend_assets.py b/backend/common/test_frontend_assets.py index 1beae50..fd92b75 100644 --- a/backend/common/test_frontend_assets.py +++ b/backend/common/test_frontend_assets.py @@ -1,6 +1,9 @@ +import re from pathlib import Path from django.conf import settings +from django.core.management import call_command +from django.test import override_settings STATIC_ROOT = Path(settings.BASE_DIR) / "static" @@ -71,6 +74,41 @@ def test_toolbox_and_games_资源入口与移动端触控样式存在(): assert "@media (max-width: 700px)" in styles +def test_latex_默认源码可渲染且_katex_静态资源完整(): + template = (settings.BASE_DIR / "templates" / "index.html").read_text(encoding="utf-8") + app = (STATIC_ROOT / "js" / "app.js").read_text(encoding="utf-8") + katex_root = STATIC_ROOT / "vendor" / "katex" + katex_css = (katex_root / "katex.min.css").read_text(encoding="utf-8") + font_paths = set(re.findall(r"url\(fonts/([^)]+)\)", katex_css)) + + assert ( + '" + ) in template + assert r"\\int_{0}^{1}" not in template + assert "function normalizeLatexSource(source)" in app + assert "globalThis.katex.render(normalized, target" in app + assert "throwOnError: true" in app + assert len(font_paths) == 60 + assert all((katex_root / "fonts" / path).is_file() for path in font_paths) + assert (katex_root / "LICENSE.txt").is_file() + + +def test_production_manifest_可处理全部静态资源(tmp_path): + storage = "whitenoise.storage.CompressedManifestStaticFilesStorage" + with override_settings( + STATIC_ROOT=tmp_path, + STORAGES={ + "default": {"BACKEND": "django.core.files.storage.FileSystemStorage"}, + "staticfiles": {"BACKEND": storage}, + }, + ): + call_command("collectstatic", interactive=False, clear=True, verbosity=0) + + assert (tmp_path / "staticfiles.json").is_file() + assert (tmp_path / "vendor" / "katex" / "katex.min.css").is_file() + + def test_realtime_match_联机码与_websocket_前端资源存在(): template = (settings.BASE_DIR / "templates" / "index.html").read_text(encoding="utf-8") realtime = (STATIC_ROOT / "js" / "realtime.js").read_text(encoding="utf-8") diff --git a/backend/static/css/app.css b/backend/static/css/app.css index 2a5d61c..a33aafb 100644 --- a/backend/static/css/app.css +++ b/backend/static/css/app.css @@ -161,7 +161,9 @@ button { color: inherit; } .editor-pane label, .preview-pane > span { display: block; color: #9eaaa2; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; } .editor-pane textarea { width: 100%; height: 330px; margin-top: 22px; resize: none; border: 0; outline: 0; background: transparent; color: #dcefa1; font: 16px/1.8 "SFMono-Regular", Consolas, monospace; } .preview-pane { display: flex; flex-direction: column; } -#latex-preview { margin: auto; max-width: 100%; overflow-wrap: anywhere; font: 28px/1.6 Georgia, serif; } +#latex-preview { margin: auto; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 18px 4px; font-size: 28px; line-height: 1.6; } +#latex-preview .katex-display { margin: 0; overflow-x: auto; overflow-y: hidden; } +#latex-preview.latex-preview-error { color: #b84136; font: 14px/1.7 system-ui, sans-serif; white-space: normal; } .preview-pane button { align-self: flex-end; } .profile-panel { padding: 35px; } .metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; } diff --git a/backend/static/js/app.js b/backend/static/js/app.js index 6f97f9b..3185c34 100644 --- a/backend/static/js/app.js +++ b/backend/static/js/app.js @@ -1060,15 +1060,40 @@ function switchTool(tool) { window.HuluToolbox?.activate(tool); } +function normalizeLatexSource(source) { + let normalized = String(source || "").trim(); + if (normalized.startsWith("$$") && normalized.endsWith("$$")) { + normalized = normalized.slice(2, -2).trim(); + } else if (normalized.startsWith("\\[") && normalized.endsWith("\\]")) { + normalized = normalized.slice(2, -2).trim(); + } else if (normalized.startsWith("$") && normalized.endsWith("$")) { + normalized = normalized.slice(1, -1).trim(); + } + return normalized.replace(/\\\\(?=[A-Za-z,;:!])/g, "\\"); +} + function renderLatexPreview(source) { const target = $("#latex-preview"); target.replaceChildren(); - if (!source.trim()) return; - if (typeof katex === "undefined") { target.textContent = source; return; } + target.classList.remove("latex-preview-error"); + const normalized = normalizeLatexSource(source); + if (!normalized) return; + if (typeof globalThis.katex?.render !== "function") { + target.classList.add("latex-preview-error"); + target.textContent = "公式渲染组件加载失败,请刷新页面后重试。"; + return; + } try { - katex.render(source, target, { throwOnError: false, displayMode: true }); - } catch { - target.textContent = source; + globalThis.katex.render(normalized, target, { + displayMode: true, + throwOnError: true, + trust: false, + maxExpand: 500, + maxSize: 20, + }); + } catch (error) { + target.classList.add("latex-preview-error"); + target.textContent = `公式语法错误:${error.message}`; } } @@ -1077,7 +1102,10 @@ async function saveFormula() { try { await api("latex/documents/", { method: "POST", - body: { title: `公式 ${new Date().toLocaleString()}`, source: $("#latex-source").value }, + body: { + title: `公式 ${new Date().toLocaleString()}`, + source: normalizeLatexSource($("#latex-source").value), + }, }); showToast("公式及首个版本已保存"); } catch (error) { diff --git a/backend/static/vendor/katex/LICENSE.txt b/backend/static/vendor/katex/LICENSE.txt new file mode 100644 index 0000000..37c6433 --- /dev/null +++ b/backend/static/vendor/katex/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2020 Khan Academy and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.ttf new file mode 100644 index 0000000..c6f9a5e Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff new file mode 100644 index 0000000..b804d7b Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 new file mode 100644 index 0000000..0acaaff Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.ttf b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.ttf new file mode 100644 index 0000000..9ff4a5e Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff new file mode 100644 index 0000000..9759710 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 new file mode 100644 index 0000000..f390922 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.ttf new file mode 100644 index 0000000..f522294 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff new file mode 100644 index 0000000..9bdd534 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 new file mode 100644 index 0000000..75344a1 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.ttf b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.ttf new file mode 100644 index 0000000..4e98259 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff new file mode 100644 index 0000000..e7730f6 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 new file mode 100644 index 0000000..395f28b Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.ttf new file mode 100644 index 0000000..b8461b2 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff new file mode 100644 index 0000000..acab069 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 new file mode 100644 index 0000000..735f694 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.ttf b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.ttf new file mode 100644 index 0000000..4060e62 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff new file mode 100644 index 0000000..f38136a Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff2 new file mode 100644 index 0000000..ab2ad21 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Bold.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.ttf b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.ttf new file mode 100644 index 0000000..dc00797 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff new file mode 100644 index 0000000..67807b0 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 new file mode 100644 index 0000000..5931794 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.ttf b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.ttf new file mode 100644 index 0000000..0e9b0f3 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff new file mode 100644 index 0000000..6f43b59 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff2 new file mode 100644 index 0000000..b50920e Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Italic.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.ttf new file mode 100644 index 0000000..dd45e1e Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff new file mode 100644 index 0000000..21f5812 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff2 new file mode 100644 index 0000000..eb24a7b Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Main-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.ttf b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.ttf new file mode 100644 index 0000000..728ce7a Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff new file mode 100644 index 0000000..0ae390d Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 new file mode 100644 index 0000000..2965702 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.ttf b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.ttf new file mode 100644 index 0000000..70d559b Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff new file mode 100644 index 0000000..eb5159d Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff2 new file mode 100644 index 0000000..215c143 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Math-Italic.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.ttf b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.ttf new file mode 100644 index 0000000..2f65a8a Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff new file mode 100644 index 0000000..8d47c02 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 new file mode 100644 index 0000000..cfaa3bd Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.ttf b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.ttf new file mode 100644 index 0000000..d5850df Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff new file mode 100644 index 0000000..7e02df9 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 new file mode 100644 index 0000000..349c06d Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.ttf new file mode 100644 index 0000000..537279f Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff new file mode 100644 index 0000000..31b8482 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 new file mode 100644 index 0000000..a90eea8 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.ttf new file mode 100644 index 0000000..fd679bf Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff new file mode 100644 index 0000000..0e7da82 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff2 new file mode 100644 index 0000000..b3048fc Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Script-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.ttf new file mode 100644 index 0000000..871fd7d Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff new file mode 100644 index 0000000..7f292d9 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 new file mode 100644 index 0000000..c5a8462 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.ttf new file mode 100644 index 0000000..7a212ca Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff new file mode 100644 index 0000000..d241d9b Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 new file mode 100644 index 0000000..e1bccfe Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.ttf new file mode 100644 index 0000000..00bff34 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff new file mode 100644 index 0000000..e6e9b65 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 new file mode 100644 index 0000000..249a286 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.ttf new file mode 100644 index 0000000..74f0892 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff new file mode 100644 index 0000000..e1ec545 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 new file mode 100644 index 0000000..680c130 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.ttf b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.ttf new file mode 100644 index 0000000..c83252c Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.ttf differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff new file mode 100644 index 0000000..2432419 Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff differ diff --git a/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 new file mode 100644 index 0000000..771f1af Binary files /dev/null and b/backend/static/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 differ diff --git a/backend/templates/index.html b/backend/templates/index.html index 04059f2..b4cd826 100644 --- a/backend/templates/index.html +++ b/backend/templates/index.html @@ -328,8 +328,8 @@
LATEX LAB

数学表达实验室

源码、实时预览与版本保存。

-
-
实时预览
\int_{0}^{1} x^2\,dx = \frac{1}{3}
+
+
实时预览
diff --git a/scripts/deploy_production.sh b/scripts/deploy_production.sh index d4fcbe3..6380b82 100755 --- a/scripts/deploy_production.sh +++ b/scripts/deploy_production.sh @@ -228,7 +228,7 @@ test -s "$BACKUP_FILE" || fail "数据库备份为空: $BACKUP_FILE" find "$BACKUP_DIR" -type f -name 'hulumath_*.sql.gz' -mtime +14 -delete log "数据库备份完成: $BACKUP_FILE" -log "执行 Django 发布检查、迁移和静态资源收集" +log "执行 Django 发布检查、静态资源收集和迁移" if [ -d "$PROJECT_DIR/backend/staticfiles" ]; then $SUDO chown -R "$DEPLOY_OWNER" "$PROJECT_DIR/backend/staticfiles" fi @@ -240,8 +240,8 @@ else "$VENV_DIR/bin/python" manage.py check --deploy --fail-level ERROR --database default fi "$VENV_DIR/bin/python" manage.py check_mysql -"$VENV_DIR/bin/python" manage.py migrate --noinput "$VENV_DIR/bin/python" manage.py collectstatic --noinput +"$VENV_DIR/bin/python" manage.py migrate --noinput cd "$PROJECT_DIR" log "安装或更新 systemd 服务"