texlite 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +174 -22
- package/OPERATIONS.md +23 -3
- package/README.md +44 -37
- package/README.zh-CN.md +38 -31
- package/addon.md +76 -0
- package/dist/client/assets/AdminUsers-xuVuiwoh.js +1 -0
- package/dist/client/assets/AdminUsers-xuVuiwoh.js.br +0 -0
- package/dist/client/assets/AdminUsers-xuVuiwoh.js.gz +0 -0
- package/dist/client/assets/{AgentIcon-dCMgWJG-.css → AgentIcon-DJGGRJnV.css} +1 -1
- package/dist/client/assets/AgentIcon-DJGGRJnV.css.br +0 -0
- package/dist/client/assets/AgentIcon-DJGGRJnV.css.gz +0 -0
- package/dist/client/assets/{AgentManagement-0n1UkKZ5.js → AgentManagement-D-0hrv6f.js} +1 -1
- package/dist/client/assets/AgentManagement-D-0hrv6f.js.br +0 -0
- package/dist/client/assets/AgentManagement-D-0hrv6f.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-DZo-22RN.js +2 -0
- package/dist/client/assets/AgentTerminal-DZo-22RN.js.br +0 -0
- package/dist/client/assets/AgentTerminal-DZo-22RN.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js +16 -0
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-ChKrdDqp.js +1 -0
- package/dist/client/assets/AvatarSettingsDialog-ChKrdDqp.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-ChKrdDqp.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-BZIU4Lif.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js +3 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-D3CjBD0p.js +1 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js +5 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js.br +0 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js.gz +0 -0
- package/dist/client/assets/GitDialog-CA68baSd.js +4 -0
- package/dist/client/assets/GitDialog-CA68baSd.js.br +0 -0
- package/dist/client/assets/GitDialog-CA68baSd.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js +1 -0
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js +8 -0
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js.br +0 -0
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js.gz +0 -0
- package/dist/client/assets/InfoPopover-BJYnFn1P.js +1 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js +25 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.br +0 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.gz +0 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js +36 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js.br +0 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js.gz +0 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js +1 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js.gz +0 -0
- package/dist/client/assets/{ProjectIconPickerDialog-DAiP7wVe.js → ProjectIconPickerDialog-ChiEUQ0g.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-ChiEUQ0g.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-ChiEUQ0g.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js +1 -0
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js +4 -0
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js.br +0 -0
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js +25 -0
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js.gz +0 -0
- package/dist/client/assets/{QuickOpenDialog-kW-97LBY.js → QuickOpenDialog-B7NTqOpu.js} +1 -1
- package/dist/client/assets/QuickOpenDialog-B7NTqOpu.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-B7NTqOpu.js.gz +0 -0
- package/dist/client/assets/{ReadOnlySource-B-ZZIpJq.js → ReadOnlySource-DIalHHvP.js} +2 -2
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js +3 -0
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js +2 -0
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js.gz +0 -0
- package/dist/client/assets/{SystemMetricsDialog-Dz_zxjfR.js → SystemMetricsDialog-Bycm88U1.js} +1 -1
- package/dist/client/assets/SystemMetricsDialog-Bycm88U1.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-Bycm88U1.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js +1 -0
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-RSqZi7kx.js +1 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css +1 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css.br +0 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css.gz +0 -0
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js +1 -0
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js.br +0 -0
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-ByxE-RUs.js +1 -0
- package/dist/client/assets/WordCountDialog-ByxE-RUs.js.br +0 -0
- package/dist/client/assets/WordCountDialog-ByxE-RUs.js.gz +0 -0
- package/dist/client/assets/{bibtexFormatterWorker-B_jvobIv.js → bibtexFormatterWorker-Bp8kjjvw.js} +14 -14
- package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.br +0 -0
- package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.gz +0 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js +2 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.br +0 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.gz +0 -0
- package/dist/client/assets/bibtexNames-CPGbBJxd.js +1 -0
- package/dist/client/assets/bibtexReferences-xpSF8IXH.js +1 -0
- package/dist/client/assets/bot-ClmnQ29j.js +1 -0
- package/dist/client/assets/{chktex-CCcr_9m7.js → chktex-22lKGvKa.js} +2 -2
- package/dist/client/assets/citationAuthors-BWHXhKvT.js +1 -0
- package/dist/client/assets/citationAuthors-BWHXhKvT.js.br +0 -0
- package/dist/client/assets/citationAuthors-BWHXhKvT.js.gz +0 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js +1 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js.br +0 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js.gz +0 -0
- package/dist/client/assets/dist-Dxkdrap6.js +2 -0
- package/dist/client/assets/dist-Dxkdrap6.js.br +0 -0
- package/dist/client/assets/dist-Dxkdrap6.js.gz +0 -0
- package/dist/client/assets/editor-CkUEg2La.js +14 -0
- package/dist/client/assets/editor-CkUEg2La.js.br +0 -0
- package/dist/client/assets/editor-CkUEg2La.js.gz +0 -0
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js +36 -0
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js.br +0 -0
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js +1 -0
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.gz +0 -0
- package/dist/client/assets/generatedParser-CZa2vsK6.js +1 -0
- package/dist/client/assets/generatedParser-CZa2vsK6.js.br +0 -0
- package/dist/client/assets/generatedParser-CZa2vsK6.js.gz +0 -0
- package/dist/client/assets/git-compare-arrows-158rS_vn.js +1 -0
- package/dist/client/assets/i18n-Wn96VbWM.js +13 -0
- package/dist/client/assets/i18n-Wn96VbWM.js.br +0 -0
- package/dist/client/assets/i18n-Wn96VbWM.js.gz +0 -0
- package/dist/client/assets/index-CemLYDYL.js +2 -0
- package/dist/client/assets/index-CemLYDYL.js.br +0 -0
- package/dist/client/assets/index-CemLYDYL.js.gz +0 -0
- package/dist/client/assets/index-DSF5eT29.css +1 -0
- package/dist/client/assets/index-DSF5eT29.css.br +0 -0
- package/dist/client/assets/index-DSF5eT29.css.gz +0 -0
- package/dist/client/assets/katex-Ca9qmXPj.js +257 -0
- package/dist/client/assets/katex-Ca9qmXPj.js.br +0 -0
- package/dist/client/assets/katex-Ca9qmXPj.js.gz +0 -0
- package/dist/client/assets/katex.min-VLoWtPY0.js +1 -0
- package/dist/client/assets/{latexFormatterWorker-BIDCSZPd.js → latexFormatterWorker-BWiogBYE.js} +1 -1
- package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.br +0 -0
- package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.gz +0 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js +6 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js.br +0 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js.gz +0 -0
- package/dist/client/assets/palette-8_-Y5XON.js +1 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js +1 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js.br +0 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js +1 -0
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js.gz +0 -0
- package/dist/client/assets/{spellCheck-D-tYd_ac.js → spellCheck-kxvnxrvw.js} +1 -1
- package/dist/client/assets/spellCheck-kxvnxrvw.js.br +0 -0
- package/dist/client/assets/spellCheck-kxvnxrvw.js.gz +0 -0
- package/dist/client/assets/{textLanguageSupport-Kz9ESEVW.js → textLanguageSupport-Ck8lMOWz.js} +1 -1
- package/dist/client/assets/{textLanguages-Dac6mieP.js → textLanguages-CwWstpJ5.js} +5 -5
- package/dist/client/assets/textLanguages-CwWstpJ5.js.br +0 -0
- package/dist/client/assets/textLanguages-CwWstpJ5.js.gz +0 -0
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js +1 -0
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js.gz +0 -0
- package/dist/client/assets/{vimSupport-DWYaSMuX.js → vimSupport-C-WiMLjc.js} +6 -6
- package/dist/client/assets/vimSupport-C-WiMLjc.js.br +0 -0
- package/dist/client/assets/{vimSupport-DWYaSMuX.js.gz → vimSupport-C-WiMLjc.js.gz} +0 -0
- package/dist/client/index.html +3 -3
- package/dist/server/agentChanges.js +149 -0
- package/dist/server/agents/sessions.js +1 -1
- package/dist/server/agents/workspaces.js +21 -28
- package/dist/server/app.js +15 -6
- package/dist/server/boundedExpiringCache.js +69 -0
- package/dist/server/citationFolderTransfer.js +5 -5
- package/dist/server/citationInput.js +1 -0
- package/dist/server/cli.js +12 -1
- package/dist/server/collaboration.js +8 -4
- package/dist/server/config.js +10 -0
- package/dist/server/db.js +23 -0
- package/dist/server/editHistory.js +71 -12
- package/dist/server/git.js +58 -7
- package/dist/server/history.js +58 -9
- package/dist/server/i18n.js +12 -0
- package/dist/server/locales/zh-Hant.js +6 -0
- package/dist/server/projectReferences.js +110 -9
- package/dist/server/routes/auth.js +3 -0
- package/dist/server/routes/citations.js +28 -61
- package/dist/server/routes/comments.js +8 -3
- package/dist/server/routes/compile.js +56 -4
- package/dist/server/routes/projectGit.js +10 -0
- package/dist/server/routes/projectHistory.js +42 -0
- package/dist/server/routes/system.js +1 -0
- package/dist/server/routes/tikzGallery.js +38 -0
- package/dist/server/routes/users.js +2 -2
- package/dist/server/tikzEditorAddon.js +115 -0
- package/dist/server/tikzEditorRelease.js +9 -0
- package/dist/server/tikzGallery.js +63 -0
- package/dist/shared/bibtexBraces.js +20 -0
- package/dist/shared/bibtexNames.js +82 -0
- package/dist/shared/bibtexReferences.js +52 -12
- package/dist/shared/bibtexText.js +175 -0
- package/dist/shared/gitProtocol.js +2 -0
- package/dist/shared/historyProtocol.js +5 -0
- package/dist/shared/textDiff.js +36 -1
- package/dist/shared/tikzStandalone.js +15 -0
- package/package.json +2 -1
- package/templates/agents/AGENTS.md +12 -0
- package/texlite.config.example.json +4 -0
- package/dist/client/assets/AdminUsers-Cpj29JD6.js +0 -1
- package/dist/client/assets/AdminUsers-Cpj29JD6.js.br +0 -0
- package/dist/client/assets/AdminUsers-Cpj29JD6.js.gz +0 -0
- package/dist/client/assets/AgentIcon-dCMgWJG-.css.br +0 -0
- package/dist/client/assets/AgentIcon-dCMgWJG-.css.gz +0 -0
- package/dist/client/assets/AgentManagement-0n1UkKZ5.js.br +0 -0
- package/dist/client/assets/AgentManagement-0n1UkKZ5.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js +0 -2
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js.br +0 -0
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js +0 -16
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js +0 -1
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-B4ITqbxl.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js +0 -3
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js +0 -36
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js.br +0 -0
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js.gz +0 -0
- package/dist/client/assets/Dashboard-Dc3ANXhG.js +0 -5
- package/dist/client/assets/Dashboard-Dc3ANXhG.js.br +0 -0
- package/dist/client/assets/Dashboard-Dc3ANXhG.js.gz +0 -0
- package/dist/client/assets/GitDialog-CzLmo9Z_.js +0 -3
- package/dist/client/assets/GitDialog-CzLmo9Z_.js.br +0 -0
- package/dist/client/assets/GitDialog-CzLmo9Z_.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js +0 -8
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js.br +0 -0
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Dkz742vJ.js +0 -1
- package/dist/client/assets/LatexEditor-BRPiyMbH.js +0 -25
- package/dist/client/assets/LatexEditor-BRPiyMbH.js.br +0 -0
- package/dist/client/assets/LatexEditor-BRPiyMbH.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-DAiP7wVe.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-DAiP7wVe.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js +0 -1
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-CARW1k8M.js +0 -4
- package/dist/client/assets/ProjectSettings-CARW1k8M.js.br +0 -0
- package/dist/client/assets/ProjectSettings-CARW1k8M.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js +0 -31
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-kW-97LBY.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-kW-97LBY.js.gz +0 -0
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js +0 -2
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-Dz_zxjfR.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-Dz_zxjfR.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js +0 -1
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js +0 -1
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js.br +0 -0
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js +0 -1
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js.br +0 -0
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js.gz +0 -0
- package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.br +0 -0
- package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.gz +0 -0
- package/dist/client/assets/citationLibrary-BzlqZiFU.js +0 -26
- package/dist/client/assets/citationLibrary-BzlqZiFU.js.br +0 -0
- package/dist/client/assets/citationLibrary-BzlqZiFU.js.gz +0 -0
- package/dist/client/assets/clipboard-CslquMx4.js +0 -1
- package/dist/client/assets/editor-fyrvjoqA.js +0 -14
- package/dist/client/assets/editor-fyrvjoqA.js.br +0 -0
- package/dist/client/assets/editor-fyrvjoqA.js.gz +0 -0
- package/dist/client/assets/editor-languages-D1a-K8dK.js +0 -36
- package/dist/client/assets/editor-languages-D1a-K8dK.js.br +0 -0
- package/dist/client/assets/editor-languages-D1a-K8dK.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js +0 -1
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js.gz +0 -0
- package/dist/client/assets/eye-BnslGpqB.js +0 -1
- package/dist/client/assets/i18n-DNTfpttY.js +0 -13
- package/dist/client/assets/i18n-DNTfpttY.js.br +0 -0
- package/dist/client/assets/i18n-DNTfpttY.js.gz +0 -0
- package/dist/client/assets/index-CfSDaTd4.js +0 -2
- package/dist/client/assets/index-CfSDaTd4.js.br +0 -0
- package/dist/client/assets/index-CfSDaTd4.js.gz +0 -0
- package/dist/client/assets/index-PNFHDg2W.css +0 -1
- package/dist/client/assets/index-PNFHDg2W.css.br +0 -0
- package/dist/client/assets/index-PNFHDg2W.css.gz +0 -0
- package/dist/client/assets/katex-CBRBI6nR.js +0 -257
- package/dist/client/assets/katex-CBRBI6nR.js.br +0 -0
- package/dist/client/assets/katex-CBRBI6nR.js.gz +0 -0
- package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.br +0 -0
- package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.gz +0 -0
- package/dist/client/assets/relativeTime-DKEihsTa.js +0 -1
- package/dist/client/assets/relativeTime-DKEihsTa.js.br +0 -0
- package/dist/client/assets/relativeTime-DKEihsTa.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js +0 -1
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js.gz +0 -0
- package/dist/client/assets/spellCheck-D-tYd_ac.js.br +0 -0
- package/dist/client/assets/spellCheck-D-tYd_ac.js.gz +0 -0
- package/dist/client/assets/textLanguages-Dac6mieP.js.br +0 -0
- package/dist/client/assets/textLanguages-Dac6mieP.js.gz +0 -0
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js +0 -1
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.gz +0 -0
- package/dist/client/assets/vimSupport-DWYaSMuX.js.br +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js → AgentIcon-qmglBc3M.js} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.br → AgentIcon-qmglBc3M.js.br} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.gz → AgentIcon-qmglBc3M.js.gz} +0 -0
package/dist/server/git.js
CHANGED
|
@@ -23,6 +23,7 @@ export class ProjectGitService {
|
|
|
23
23
|
assertNoSourceSymlinks(this.config, project.id);
|
|
24
24
|
const settings = this.settings(project.id);
|
|
25
25
|
const account = this.userSettings(project.owner_id);
|
|
26
|
+
const commitIdentity = this.identityForUser(project.owner_id);
|
|
26
27
|
const gitDirectory = path.join(sourceRoot(this.config, project.id), ".git");
|
|
27
28
|
let gitStat = null;
|
|
28
29
|
try {
|
|
@@ -49,7 +50,8 @@ export class ProjectGitService {
|
|
|
49
50
|
restorable: false,
|
|
50
51
|
changedFiles: 0,
|
|
51
52
|
ahead: 0,
|
|
52
|
-
latestCommit: null
|
|
53
|
+
latestCommit: null,
|
|
54
|
+
commitIdentity
|
|
53
55
|
};
|
|
54
56
|
const root = sourceRoot(this.config, project.id);
|
|
55
57
|
const porcelain = (await this.git(root, ["status", "--porcelain=v1"])).stdout.trim();
|
|
@@ -77,12 +79,35 @@ export class ProjectGitService {
|
|
|
77
79
|
restorable: porcelain.split("\n").some((line) => Boolean(line) && !line.startsWith("??")),
|
|
78
80
|
changedFiles: porcelain ? porcelain.split("\n").length : 0,
|
|
79
81
|
ahead: aheadResult?.code === 0 ? Number.parseInt(aheadResult.stdout.trim(), 10) || 0 : 0,
|
|
80
|
-
latestCommit: latestResult.code === 0 ? parseCommit(latestResult.stdout.trim()) : null
|
|
82
|
+
latestCommit: latestResult.code === 0 ? parseCommit(latestResult.stdout.trim()) : null,
|
|
83
|
+
commitIdentity
|
|
81
84
|
};
|
|
82
85
|
}
|
|
83
86
|
githubAccountStatus(userId) {
|
|
84
87
|
const settings = this.userSettings(userId);
|
|
85
|
-
|
|
88
|
+
const identity = this.identityForUser(userId);
|
|
89
|
+
return {
|
|
90
|
+
tokenConfigured: Boolean(settings?.token_ciphertext),
|
|
91
|
+
githubLogin: settings?.github_login ?? null,
|
|
92
|
+
gitUsername: identity.name,
|
|
93
|
+
gitEmail: identity.email
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
updateGitIdentity(userId, usernameInput, emailInput) {
|
|
97
|
+
const username = usernameInput.trim();
|
|
98
|
+
const email = emailInput.trim();
|
|
99
|
+
const controlCharacter = /\p{Cc}/u;
|
|
100
|
+
if (!username || username.length > 100 || controlCharacter.test(username) || /[<>]/.test(username)
|
|
101
|
+
|| !email || email.length > 254 || controlCharacter.test(email) || !/^[^\s<>@]+@[^\s<>@]+$/.test(email)) {
|
|
102
|
+
throw httpError(400, "GIT_IDENTITY_INVALID");
|
|
103
|
+
}
|
|
104
|
+
const timestamp = new Date().toISOString();
|
|
105
|
+
this.db.prepare(`INSERT INTO user_github_settings (user_id, git_username, git_email, created_at, updated_at)
|
|
106
|
+
VALUES (?, ?, ?, ?, ?)
|
|
107
|
+
ON CONFLICT(user_id) DO UPDATE SET
|
|
108
|
+
git_username = excluded.git_username, git_email = excluded.git_email, updated_at = excluded.updated_at`)
|
|
109
|
+
.run(userId, username, email, timestamp, timestamp);
|
|
110
|
+
return this.githubAccountStatus(userId);
|
|
86
111
|
}
|
|
87
112
|
async configureUserToken(userId, tokenInput) {
|
|
88
113
|
const token = tokenInput.trim();
|
|
@@ -101,7 +126,11 @@ export class ProjectGitService {
|
|
|
101
126
|
return this.githubAccountStatus(userId);
|
|
102
127
|
}
|
|
103
128
|
removeUserToken(userId) {
|
|
104
|
-
|
|
129
|
+
// Keep the row so a separately configured commit identity survives
|
|
130
|
+
// disconnecting GitHub.
|
|
131
|
+
this.db.prepare(`UPDATE user_github_settings
|
|
132
|
+
SET token_ciphertext = NULL, github_login = NULL, updated_at = ? WHERE user_id = ?`)
|
|
133
|
+
.run(new Date().toISOString(), userId);
|
|
105
134
|
return this.githubAccountStatus(userId);
|
|
106
135
|
}
|
|
107
136
|
async createGitHubRepository(project, name, isPrivate) {
|
|
@@ -148,13 +177,24 @@ export class ProjectGitService {
|
|
|
148
177
|
const staged = await this.git(root, ["diff", "--cached", "--quiet"], [1]);
|
|
149
178
|
if (staged.code === 0)
|
|
150
179
|
throw httpError(409, "GIT_NO_CHANGES");
|
|
180
|
+
const identity = this.identityForUser(owner.id);
|
|
181
|
+
// GIT_AUTHOR_* / GIT_COMMITTER_* take precedence over -c configuration.
|
|
182
|
+
// Pin them to the saved identity so a host-level environment cannot
|
|
183
|
+
// replace the author shown in the UI or on GitHub.
|
|
184
|
+
const identityEnvironment = {
|
|
185
|
+
...process.env,
|
|
186
|
+
GIT_AUTHOR_NAME: identity.name,
|
|
187
|
+
GIT_AUTHOR_EMAIL: identity.email,
|
|
188
|
+
GIT_COMMITTER_NAME: identity.name,
|
|
189
|
+
GIT_COMMITTER_EMAIL: identity.email
|
|
190
|
+
};
|
|
151
191
|
await this.git(root, [
|
|
152
|
-
"-c", `user.name=${
|
|
153
|
-
"-c", `user.email=${
|
|
192
|
+
"-c", `user.name=${identity.name}`,
|
|
193
|
+
"-c", `user.email=${identity.email}`,
|
|
154
194
|
"-c", "commit.gpgSign=false",
|
|
155
195
|
"-c", "core.hooksPath=/dev/null",
|
|
156
196
|
"commit", "-m", message
|
|
157
|
-
]);
|
|
197
|
+
], [], identityEnvironment);
|
|
158
198
|
const result = await this.git(root, ["log", "-1", "--format=%H%x1f%h%x1f%an%x1f%ae%x1f%aI%x1f%s"]);
|
|
159
199
|
return parseCommit(result.stdout.trim());
|
|
160
200
|
}
|
|
@@ -282,6 +322,17 @@ export class ProjectGitService {
|
|
|
282
322
|
userSettings(userId) {
|
|
283
323
|
return this.db.prepare("SELECT * FROM user_github_settings WHERE user_id = ?").get(userId);
|
|
284
324
|
}
|
|
325
|
+
/** Resolve the effective author identity, applying account defaults. */
|
|
326
|
+
identityForUser(userId) {
|
|
327
|
+
const row = this.db.prepare(`SELECT users.username, settings.git_username, settings.git_email
|
|
328
|
+
FROM users LEFT JOIN user_github_settings settings ON settings.user_id = users.id
|
|
329
|
+
WHERE users.id = ?`).get(userId);
|
|
330
|
+
const username = row?.username ?? "texlite";
|
|
331
|
+
return {
|
|
332
|
+
name: row?.git_username?.trim() || username,
|
|
333
|
+
email: row?.git_email?.trim() || `${username}@texlite.com`
|
|
334
|
+
};
|
|
335
|
+
}
|
|
285
336
|
requireUserTokenSettings(userId) {
|
|
286
337
|
const settings = this.userSettings(userId);
|
|
287
338
|
if (!settings?.token_ciphertext)
|
package/dist/server/history.js
CHANGED
|
@@ -5,6 +5,19 @@ import { assertNoSourceSymlinks, listProjectFiles, outputRoot, projectRoot, reso
|
|
|
5
5
|
import { httpError } from "./http.js";
|
|
6
6
|
import { MAX_TEXT_PREVIEW_BYTES } from "./limits.js";
|
|
7
7
|
import { defaultHistoryTracking, historyTextCandidate, historyTrackingOverride } from "../shared/historyTracking.js";
|
|
8
|
+
const HOUR_MS = 60 * 60_000;
|
|
9
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
10
|
+
/** Server-local hour or day, matching the local days the timeline is grouped by. */
|
|
11
|
+
function historyBucket(time, size) {
|
|
12
|
+
const date = new Date(time);
|
|
13
|
+
const day = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
|
|
14
|
+
return size === "day" ? `day:${day}` : `hour:${day}:${date.getHours()}`;
|
|
15
|
+
}
|
|
16
|
+
/** Every version younger than this is kept. */
|
|
17
|
+
const HISTORY_KEEP_ALL_MS = DAY_MS;
|
|
18
|
+
/** Up to this age one version per hour is kept; older history keeps one per day. */
|
|
19
|
+
const HISTORY_KEEP_HOURLY_MS = 7 * DAY_MS;
|
|
20
|
+
/** Fixed window, from a run's first save, in which autosaves (or one user's agent writes) share a snapshot. */
|
|
8
21
|
const AUTOSAVE_COALESCE_MS = 2 * 60_000;
|
|
9
22
|
// Logical stored payload; SQLite pages, indexes and WAL are shared database overhead.
|
|
10
23
|
function historyMetadataBytes(row) {
|
|
@@ -55,7 +68,16 @@ export class ProjectHistoryService {
|
|
|
55
68
|
return null;
|
|
56
69
|
}
|
|
57
70
|
const createdAt = new Date().toISOString();
|
|
58
|
-
|
|
71
|
+
// Autosaves coalesce across authors, but agent and human changes never
|
|
72
|
+
// share a snapshot, so the state before an agent started stays a separate
|
|
73
|
+
// restore point. A coding agent's file writes, seen by separate source
|
|
74
|
+
// polls, coalesce only with the same user's previous agent write.
|
|
75
|
+
const hasAgent = Boolean(options.hasAgent);
|
|
76
|
+
const sameRun = reason === "autosave"
|
|
77
|
+
? previous?.reason === "autosave" && Boolean(previous.has_agent) === hasAgent
|
|
78
|
+
: reason === "file" && hasAgent && previous?.reason === "file"
|
|
79
|
+
&& Boolean(previous.has_agent) && previous.author_id === authorId;
|
|
80
|
+
if (!policyChanged && sameRun && previous && !previous.label
|
|
59
81
|
&& JSON.stringify(parseManifest(previous.manifest_json).tracking) === JSON.stringify(tracking)
|
|
60
82
|
&& Date.parse(createdAt) - Date.parse(previous.created_at) < AUTOSAVE_COALESCE_MS) {
|
|
61
83
|
const merged = [...new Set([...parseStringArray(previous.changed_paths_json), ...changedPaths])].sort();
|
|
@@ -73,9 +95,9 @@ export class ProjectHistoryService {
|
|
|
73
95
|
}
|
|
74
96
|
const id = randomUUID();
|
|
75
97
|
this.db.prepare(`INSERT INTO project_history_versions
|
|
76
|
-
(id, project_id, author_id, reason, manifest_json, changed_paths_json, created_at)
|
|
77
|
-
VALUES (?, ?, ?, ?, ?, ?, ?)`)
|
|
78
|
-
.run(id, projectId, authorId, reason, JSON.stringify(manifest), JSON.stringify(changedPaths), createdAt);
|
|
98
|
+
(id, project_id, author_id, reason, has_agent, manifest_json, changed_paths_json, created_at)
|
|
99
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
100
|
+
.run(id, projectId, authorId, reason, options.hasAgent ? 1 : 0, JSON.stringify(manifest), JSON.stringify(changedPaths), createdAt);
|
|
79
101
|
this.saveBaseline(projectId, manifest);
|
|
80
102
|
if (!options.deferRetention)
|
|
81
103
|
this.pruneVersions(projectId);
|
|
@@ -573,15 +595,41 @@ export class ProjectHistoryService {
|
|
|
573
595
|
}
|
|
574
596
|
};
|
|
575
597
|
// 1. Cap by historyMaxVersions (prune excess ordinary versions when configured; 0 = unlimited)
|
|
598
|
+
const remainingOrdinary = () => ordinaryDesc.filter((row) => !toDeleteIds.has(row.id));
|
|
576
599
|
if (this.config.historyMaxVersions > 0 && ordinaryDesc.length > this.config.historyMaxVersions) {
|
|
577
600
|
const obsolete = ordinaryDesc.slice(this.config.historyMaxVersions);
|
|
578
601
|
for (const row of obsolete)
|
|
579
602
|
removeVersionRefs(row.id);
|
|
580
603
|
}
|
|
581
|
-
// 2.
|
|
604
|
+
// 2. Over the storage budget, first thin older history so the budget
|
|
605
|
+
// covers a longer period: keep every version from the last day, the newest
|
|
606
|
+
// of each local hour for the last week, and the newest of each local day
|
|
607
|
+
// before that. The latest version occupies its own hour or day. Labeled,
|
|
608
|
+
// initial, restore and pre-restore checkpoint versions are never thinned.
|
|
609
|
+
// Under the budget nothing is removed.
|
|
610
|
+
if (retainedBytes > this.config.historyMaxStorageBytes) {
|
|
611
|
+
const now = Date.now();
|
|
612
|
+
const keptBuckets = new Set();
|
|
613
|
+
for (const row of remainingOrdinary()) {
|
|
614
|
+
const time = Date.parse(row.created_at);
|
|
615
|
+
if (!Number.isFinite(time) || now - time <= HISTORY_KEEP_ALL_MS)
|
|
616
|
+
continue;
|
|
617
|
+
const bucket = historyBucket(time, now - time <= HISTORY_KEEP_HOURLY_MS ? "hour" : "day");
|
|
618
|
+
if (row.id === latestId || row.reason === "restore" || row.reason === "checkpoint") {
|
|
619
|
+
if (row.id === latestId)
|
|
620
|
+
keptBuckets.add(bucket);
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (keptBuckets.has(bucket))
|
|
624
|
+
removeVersionRefs(row.id);
|
|
625
|
+
else
|
|
626
|
+
keptBuckets.add(bucket);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
// 3. Still over the budget: prune remaining eligible versions from oldest to newest.
|
|
582
630
|
if (retainedBytes > this.config.historyMaxStorageBytes) {
|
|
583
|
-
const remainingEligibleAsc =
|
|
584
|
-
.filter((row) => row.id !== latestId
|
|
631
|
+
const remainingEligibleAsc = remainingOrdinary()
|
|
632
|
+
.filter((row) => row.id !== latestId)
|
|
585
633
|
.reverse();
|
|
586
634
|
for (const row of remainingEligibleAsc) {
|
|
587
635
|
if (retainedBytes <= this.config.historyMaxStorageBytes)
|
|
@@ -591,13 +639,13 @@ export class ProjectHistoryService {
|
|
|
591
639
|
}
|
|
592
640
|
if (!toDeleteIds.size)
|
|
593
641
|
return;
|
|
594
|
-
//
|
|
642
|
+
// 4. Batch delete rows in a single transaction
|
|
595
643
|
const remove = this.db.prepare("DELETE FROM project_history_versions WHERE id = ? AND project_id = ?");
|
|
596
644
|
this.db.transaction(() => {
|
|
597
645
|
for (const id of toDeleteIds)
|
|
598
646
|
remove.run(id, projectId);
|
|
599
647
|
})();
|
|
600
|
-
//
|
|
648
|
+
// 5. Remove unreferenced CAS objects on disk
|
|
601
649
|
for (const [digest, count] of refCounts.entries()) {
|
|
602
650
|
if (count === 0)
|
|
603
651
|
fs.rmSync(this.objectPath(projectId, digest), { force: true });
|
|
@@ -758,6 +806,7 @@ function versionJson(row) {
|
|
|
758
806
|
username: row.author_username ?? "deleted-user",
|
|
759
807
|
name: row.author_name ?? "Deleted User"
|
|
760
808
|
} : null,
|
|
809
|
+
hasAgent: Boolean(row.has_agent),
|
|
761
810
|
changedPaths: parseStringArray(row.changed_paths_json),
|
|
762
811
|
fileCount: files.length,
|
|
763
812
|
totalSize: files.reduce((sum, file) => sum + file.size, 0)
|
package/dist/server/i18n.js
CHANGED
|
@@ -48,8 +48,13 @@ const enMessages = {
|
|
|
48
48
|
COMPILE_ARTIFACTS_NOT_FOUND: "No compiled artifacts are available yet.",
|
|
49
49
|
COMPILE_CLEAN_BUSY: "This root document is compiling. Try recovery again after it finishes.",
|
|
50
50
|
COMPILE_FORBIDDEN: "You do not have permission to compile this project.",
|
|
51
|
+
TIKZ_GALLERY_DISABLED: "The TikZ gallery is not enabled on this server.",
|
|
52
|
+
TIKZ_GALLERY_UNAVAILABLE: "The TikZ gallery add-on was not found on this server. Ask an administrator to install it.",
|
|
53
|
+
TIKZ_GALLERY_INCOMPATIBLE: "The installed TikZ gallery is not compatible with this version of TexLite. Ask an administrator to update it.",
|
|
51
54
|
COMPILE_SNAPSHOT_BUSY: "The project source is still being saved. Try compiling again shortly.",
|
|
52
55
|
CURRENT_PASSWORD_INVALID: "The current password is incorrect.",
|
|
56
|
+
PASSWORD_CHANGE_REQUIRED: "Change your temporary password before continuing.",
|
|
57
|
+
PASSWORD_UNCHANGED: "Choose a password different from your temporary password.",
|
|
53
58
|
DICTIONARY_EDIT_FORBIDDEN: "You do not have permission to maintain this project's dictionary.",
|
|
54
59
|
DIRECTORY_NOT_FOUND: "The destination folder does not exist.",
|
|
55
60
|
FILE_CONTENT_INVALID: "The file content is invalid.",
|
|
@@ -62,6 +67,7 @@ const enMessages = {
|
|
|
62
67
|
GIT_COMMAND_FAILED: "The Git command failed. Check the server log for details.",
|
|
63
68
|
GIT_COMMIT_MESSAGE_INVALID: "Enter a commit message of 300 characters or fewer.",
|
|
64
69
|
GIT_DETACHED_HEAD: "The repository is in detached HEAD state. Return to the default branch first.",
|
|
70
|
+
GIT_IDENTITY_INVALID: "Enter a valid Git author name and email address (at most 100 and 254 characters).",
|
|
65
71
|
GIT_REPOSITORY_NAME_INVALID: "Enter a GitHub repository name.",
|
|
66
72
|
GIT_REPOSITORY_NOT_INITIALIZED: "Git is not initialized for this project.",
|
|
67
73
|
GIT_REPOSITORY_RESPONSE_INVALID: "GitHub did not return a valid repository.",
|
|
@@ -195,8 +201,13 @@ const zhMessages = {
|
|
|
195
201
|
COMPILE_ARTIFACTS_NOT_FOUND: "尚无可用的编译产物。",
|
|
196
202
|
COMPILE_CLEAN_BUSY: "当前主文档正在编译,请完成后再执行故障恢复。",
|
|
197
203
|
COMPILE_FORBIDDEN: "你没有编译此项目的权限。",
|
|
204
|
+
TIKZ_GALLERY_DISABLED: "此服务器未启用 TikZ 图库。",
|
|
205
|
+
TIKZ_GALLERY_UNAVAILABLE: "此服务器上找不到 TikZ 图库插件,请联系管理员安装。",
|
|
206
|
+
TIKZ_GALLERY_INCOMPATIBLE: "已安装的 TikZ 图库与当前 TexLite 版本不兼容,请联系管理员更新。",
|
|
198
207
|
COMPILE_SNAPSHOT_BUSY: "项目源码仍在保存,请稍后重新编译。",
|
|
199
208
|
CURRENT_PASSWORD_INVALID: "当前密码错误。",
|
|
209
|
+
PASSWORD_CHANGE_REQUIRED: "请先修改初始密码再继续。",
|
|
210
|
+
PASSWORD_UNCHANGED: "新密码不能与初始密码相同。",
|
|
200
211
|
DICTIONARY_EDIT_FORBIDDEN: "你没有维护本项目词典的权限。",
|
|
201
212
|
DIRECTORY_NOT_FOUND: "目标文件夹不存在。",
|
|
202
213
|
FILE_CONTENT_INVALID: "文件内容格式不正确。",
|
|
@@ -209,6 +220,7 @@ const zhMessages = {
|
|
|
209
220
|
GIT_COMMAND_FAILED: "Git 命令执行失败,请查看服务器日志了解详情。",
|
|
210
221
|
GIT_COMMIT_MESSAGE_INVALID: "请输入不超过 300 个字符的提交说明。",
|
|
211
222
|
GIT_DETACHED_HEAD: "当前处于 detached HEAD,请先返回默认分支。",
|
|
223
|
+
GIT_IDENTITY_INVALID: "请输入有效的 Git 作者名和邮箱地址(分别不超过 100 和 254 个字符)。",
|
|
212
224
|
GIT_REPOSITORY_NAME_INVALID: "请输入 GitHub 仓库名称。",
|
|
213
225
|
GIT_REPOSITORY_NOT_INITIALIZED: "该项目尚未初始化 Git。",
|
|
214
226
|
GIT_REPOSITORY_RESPONSE_INVALID: "GitHub 没有返回有效的仓库信息。",
|
|
@@ -42,8 +42,13 @@ export const zhHantMessages = {
|
|
|
42
42
|
COMPILE_ARTIFACTS_NOT_FOUND: "尚無可用的編譯產出。",
|
|
43
43
|
COMPILE_CLEAN_BUSY: "目前主文件正在編譯,請完成後再執行故障排除。",
|
|
44
44
|
COMPILE_FORBIDDEN: "你沒有編譯此專案的權限。",
|
|
45
|
+
TIKZ_GALLERY_DISABLED: "此伺服器未啟用 TikZ 圖庫。",
|
|
46
|
+
TIKZ_GALLERY_UNAVAILABLE: "此伺服器上找不到 TikZ 圖庫外掛,請聯絡管理員安裝。",
|
|
47
|
+
TIKZ_GALLERY_INCOMPATIBLE: "已安裝的 TikZ 圖庫與目前 TexLite 版本不相容,請聯絡管理員更新。",
|
|
45
48
|
COMPILE_SNAPSHOT_BUSY: "專案原始碼仍在儲存,請稍後重新編譯。",
|
|
46
49
|
CURRENT_PASSWORD_INVALID: "目前密碼錯誤。",
|
|
50
|
+
PASSWORD_CHANGE_REQUIRED: "請先變更初始密碼再繼續。",
|
|
51
|
+
PASSWORD_UNCHANGED: "新密碼不能與初始密碼相同。",
|
|
47
52
|
DICTIONARY_EDIT_FORBIDDEN: "你沒有維護本專案字典的權限。",
|
|
48
53
|
DIRECTORY_NOT_FOUND: "目標資料夾不存在。",
|
|
49
54
|
FILE_CONTENT_INVALID: "檔案內容格式不正確。",
|
|
@@ -56,6 +61,7 @@ export const zhHantMessages = {
|
|
|
56
61
|
GIT_COMMAND_FAILED: "Git 命令執行失敗,請檢視伺服器記錄以了解詳情。",
|
|
57
62
|
GIT_COMMIT_MESSAGE_INVALID: "請輸入不超過 300 個字元的提交說明。",
|
|
58
63
|
GIT_DETACHED_HEAD: "目前處於 detached HEAD,請先返回預設分支。",
|
|
64
|
+
GIT_IDENTITY_INVALID: "請輸入有效的 Git 作者名稱和電子郵件地址(分別不超過 100 和 254 個字元)。",
|
|
59
65
|
GIT_REPOSITORY_NAME_INVALID: "請輸入 GitHub 儲存庫名稱。",
|
|
60
66
|
GIT_REPOSITORY_NOT_INITIALIZED: "該專案尚未初始化 Git。",
|
|
61
67
|
GIT_REPOSITORY_RESPONSE_INVALID: "GitHub 未傳回有效的儲存庫資訊。",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { BoundedExpiringCache } from "./boundedExpiringCache.js";
|
|
2
3
|
import { listProjectFilesAsync, resolveSourcePath } from "./files.js";
|
|
3
4
|
import { findLatexReferenceDefinitions, lineAndColumnAt } from "../shared/latexReferences.js";
|
|
4
5
|
import { documentSourceOrder, latexDocumentDirectives, resolveProjectReferencePath, uniqueProjectPaths } from "./latexDocumentGraph.js";
|
|
@@ -6,6 +7,36 @@ const definitionExtensions = /\.(?:tex|sty|cls)$/i;
|
|
|
6
7
|
const texExtension = /\.tex$/i;
|
|
7
8
|
const bibExtension = /\.bib$/i;
|
|
8
9
|
const MAX_REFERENCE_KEY_LENGTH = 512;
|
|
10
|
+
// Hover and navigation can resolve many keys from one project in quick
|
|
11
|
+
// succession. Cache the source snapshot by file metadata so different keys do
|
|
12
|
+
// not re-read and re-parse every LaTeX source inside the same short window.
|
|
13
|
+
const sourceCache = new BoundedExpiringCache({
|
|
14
|
+
ttlMs: 15_000,
|
|
15
|
+
maxEntries: 16,
|
|
16
|
+
maxEntryBytes: 8 * 1024 * 1024,
|
|
17
|
+
maxBytes: 32 * 1024 * 1024
|
|
18
|
+
});
|
|
19
|
+
// A .bib file can be several megabytes and every hover re-resolves its key.
|
|
20
|
+
// Keep only a key -> location index per file revision, not the content, so an
|
|
21
|
+
// unchanged bibliography is neither re-read nor re-scanned. Validity comes
|
|
22
|
+
// from the revision; the sliding lifetime only frees indexes nobody uses.
|
|
23
|
+
const bibliographyIndexCache = new BoundedExpiringCache({
|
|
24
|
+
ttlMs: 5 * 60_000,
|
|
25
|
+
refreshOnHit: true,
|
|
26
|
+
maxEntries: 64,
|
|
27
|
+
maxEntryBytes: 4 * 1024 * 1024,
|
|
28
|
+
maxBytes: 16 * 1024 * 1024
|
|
29
|
+
});
|
|
30
|
+
/** Resident size of the source-snapshot cache, for diagnostics and tests. */
|
|
31
|
+
export function projectReferenceCacheStats() {
|
|
32
|
+
const { entries, bytes } = sourceCache.stats();
|
|
33
|
+
return { projects: entries, bytes };
|
|
34
|
+
}
|
|
35
|
+
/** Resident size of the per-file bibliography index cache, for diagnostics and tests. */
|
|
36
|
+
export function bibliographyIndexCacheStats() {
|
|
37
|
+
const { entries, bytes } = bibliographyIndexCache.stats();
|
|
38
|
+
return { files: entries, bytes };
|
|
39
|
+
}
|
|
9
40
|
export function validReferenceKey(value) {
|
|
10
41
|
return typeof value === "string"
|
|
11
42
|
&& value.trim().length > 0
|
|
@@ -20,21 +51,19 @@ export function validReferenceKey(value) {
|
|
|
20
51
|
* archive or template from shadowing the bibliography used by the selected
|
|
21
52
|
* main document.
|
|
22
53
|
*/
|
|
23
|
-
export async function resolveProjectReference(config, projectId, kind, keyInput,
|
|
24
|
-
// Keep the former preferred-path argument working for internal callers
|
|
25
|
-
// during the transition to the richer main-document-aware lookup options.
|
|
26
|
-
const lookup = typeof options === "string" ? { preferredPath: options } : options;
|
|
54
|
+
export async function resolveProjectReference(config, projectId, kind, keyInput, lookup = {}) {
|
|
27
55
|
const key = keyInput.trim();
|
|
28
56
|
const files = (await listProjectFilesAsync(config, projectId))
|
|
29
57
|
.filter((entry) => entry.type === "file" && (definitionExtensions.test(entry.path) || bibExtension.test(entry.path)));
|
|
30
58
|
const sourceEntries = files.filter((entry) => definitionExtensions.test(entry.path));
|
|
31
59
|
const bibEntries = files.filter((entry) => bibExtension.test(entry.path));
|
|
32
|
-
const sourceContents = await
|
|
60
|
+
const { contents: sourceContents, directives: sourceDirectives } = await projectSourceSnapshot(config, projectId, sourceEntries);
|
|
33
61
|
const sourcePaths = [...sourceContents.keys()].sort((left, right) => left.localeCompare(right));
|
|
34
62
|
const bibPaths = bibEntries.map((entry) => entry.path).sort((left, right) => left.localeCompare(right));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
63
|
+
// Without both size and mtime there is no trustworthy version; an empty
|
|
64
|
+
// revision is omitted from the target and disables server-side caching.
|
|
65
|
+
const revisions = new Map(files.map((entry) => [entry.path,
|
|
66
|
+
entry.size === undefined || entry.mtimeMs === undefined ? "" : `${entry.size}:${entry.mtimeMs}`]));
|
|
38
67
|
const preferredPath = sourceContents.has(lookup.preferredPath ?? "") ? lookup.preferredPath ?? "" : "";
|
|
39
68
|
const mainFile = sourceContents.has(lookup.mainFile ?? "") && texExtension.test(lookup.mainFile ?? "")
|
|
40
69
|
? lookup.mainFile ?? ""
|
|
@@ -48,6 +77,15 @@ export async function resolveProjectReference(config, projectId, kind, keyInput,
|
|
|
48
77
|
? uniqueProjectPaths([...prioritizedSources, ...sourcePaths])
|
|
49
78
|
: citationLookupOrder(sourceDirectives, prioritizedSources, bibPaths, sourcePaths);
|
|
50
79
|
for (const entryPath of orderedPaths) {
|
|
80
|
+
const revision = revisions.get(entryPath) ?? "";
|
|
81
|
+
if (bibExtension.test(entryPath) && !sourceContents.has(entryPath)) {
|
|
82
|
+
if (kind !== "citation")
|
|
83
|
+
continue;
|
|
84
|
+
const location = (await bibliographyIndex(config, projectId, entryPath, revision))?.get(key);
|
|
85
|
+
if (!location)
|
|
86
|
+
continue;
|
|
87
|
+
return { path: entryPath, ...location, kind, source: "bibtex", ...(revision ? { revision } : {}) };
|
|
88
|
+
}
|
|
51
89
|
const source = sourceContents.get(entryPath)
|
|
52
90
|
?? await readProjectFile(config, projectId, entryPath);
|
|
53
91
|
if (source === null)
|
|
@@ -57,10 +95,73 @@ export async function resolveProjectReference(config, projectId, kind, keyInput,
|
|
|
57
95
|
if (!definition)
|
|
58
96
|
continue;
|
|
59
97
|
const location = lineAndColumnAt(source, definition.targetFrom);
|
|
60
|
-
return { path: entryPath, ...location, kind, source: definition.source };
|
|
98
|
+
return { path: entryPath, ...location, kind, source: definition.source, ...(revision ? { revision } : {}) };
|
|
61
99
|
}
|
|
62
100
|
return null;
|
|
63
101
|
}
|
|
102
|
+
async function projectSourceSnapshot(config, projectId, entries) {
|
|
103
|
+
const signature = entries
|
|
104
|
+
.map((entry) => `${entry.path}:${entry.size ?? 0}:${entry.mtimeMs ?? 0}`)
|
|
105
|
+
.sort()
|
|
106
|
+
.join("\n");
|
|
107
|
+
const cached = sourceCache.get(projectId);
|
|
108
|
+
if (cached?.signature === signature)
|
|
109
|
+
return cached;
|
|
110
|
+
const contents = await readProjectSources(config, projectId, entries.map((entry) => entry.path));
|
|
111
|
+
const directives = new Map();
|
|
112
|
+
for (const [entryPath, source] of contents)
|
|
113
|
+
directives.set(entryPath, latexDocumentDirectives(source));
|
|
114
|
+
const bytes = [...contents.values()].reduce((total, source) => total + Buffer.byteLength(source, "utf8"), 0);
|
|
115
|
+
sourceCache.set(projectId, { signature, contents, directives }, bytes);
|
|
116
|
+
return { contents, directives };
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Key -> location index of one .bib file, reused while its revision is
|
|
120
|
+
* unchanged. Returns null when the file has disappeared.
|
|
121
|
+
*/
|
|
122
|
+
async function bibliographyIndex(config, projectId, entryPath, revision) {
|
|
123
|
+
const cacheKey = `${projectId}\0${entryPath}`;
|
|
124
|
+
if (revision) {
|
|
125
|
+
const cached = bibliographyIndexCache.get(cacheKey);
|
|
126
|
+
if (cached?.revision === revision)
|
|
127
|
+
return cached.locations;
|
|
128
|
+
}
|
|
129
|
+
const source = await readProjectFile(config, projectId, entryPath);
|
|
130
|
+
if (source === null) {
|
|
131
|
+
bibliographyIndexCache.delete(cacheKey);
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const locations = new Map();
|
|
135
|
+
let bytes = 0;
|
|
136
|
+
// Definitions arrive in source order, so one forward pass yields every line
|
|
137
|
+
// and column instead of rescanning from the start for each entry.
|
|
138
|
+
let line = 1;
|
|
139
|
+
let lineStart = 0;
|
|
140
|
+
let scanned = 0;
|
|
141
|
+
for (const definition of findLatexReferenceDefinitions(source, "citation", true)) {
|
|
142
|
+
if (locations.has(definition.key))
|
|
143
|
+
continue;
|
|
144
|
+
let location;
|
|
145
|
+
if (definition.targetFrom < scanned) {
|
|
146
|
+
location = lineAndColumnAt(source, definition.targetFrom);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const target = Math.min(definition.targetFrom, source.length);
|
|
150
|
+
for (; scanned < target; scanned += 1) {
|
|
151
|
+
if (source.charCodeAt(scanned) !== 10)
|
|
152
|
+
continue;
|
|
153
|
+
line += 1;
|
|
154
|
+
lineStart = scanned + 1;
|
|
155
|
+
}
|
|
156
|
+
location = { line, column: target - lineStart + 1 };
|
|
157
|
+
}
|
|
158
|
+
locations.set(definition.key, location);
|
|
159
|
+
bytes += definition.key.length * 2 + 64;
|
|
160
|
+
}
|
|
161
|
+
if (revision)
|
|
162
|
+
bibliographyIndexCache.set(cacheKey, { revision, locations }, bytes);
|
|
163
|
+
return locations;
|
|
164
|
+
}
|
|
64
165
|
async function readProjectSources(config, projectId, paths) {
|
|
65
166
|
const contents = new Map();
|
|
66
167
|
await Promise.all(paths.map(async (entryPath) => {
|
|
@@ -70,6 +70,9 @@ export function registerAuthRoutes(app, context) {
|
|
|
70
70
|
if (!(await verifyPassword(currentPassword, user.password_hash))) {
|
|
71
71
|
return apiError(reply, 400, "CURRENT_PASSWORD_INVALID");
|
|
72
72
|
}
|
|
73
|
+
if (user.must_change_password && newPassword === currentPassword) {
|
|
74
|
+
return apiError(reply, 400, "PASSWORD_UNCHANGED");
|
|
75
|
+
}
|
|
73
76
|
const passwordHash = await hashPassword(newPassword);
|
|
74
77
|
db.prepare("UPDATE users SET password_hash = ?, must_change_password = 0 WHERE id = ?")
|
|
75
78
|
.run(passwordHash, user.id);
|
|
@@ -3,8 +3,12 @@ import { requireUser } from "../auth.js";
|
|
|
3
3
|
import { apiError, httpError, ValidationError } from "../http.js";
|
|
4
4
|
import { MAX_CITATION_BIBTEX_BYTES } from "../limits.js";
|
|
5
5
|
import { assertCitationCollectionCapacity, citationCollectionIds, citationCollectionsForEntries, filterCitationCollection, registerCitationCollectionRoutes } from "../citationCollections.js";
|
|
6
|
-
import { comparableCitationBibtex } from "../../shared/citationContent.js";
|
|
7
6
|
import { citationInput } from "../citationInput.js";
|
|
7
|
+
/**
|
|
8
|
+
* The lookup carries only citation keys from one .bib file, which is itself
|
|
9
|
+
* capped at MAX_CITATION_BIBTEX_BYTES; twice that leaves room for JSON quoting.
|
|
10
|
+
*/
|
|
11
|
+
const MAX_LOOKUP_BODY_BYTES = MAX_CITATION_BIBTEX_BYTES * 2;
|
|
8
12
|
const tagColors = ["red", "orange", "yellow", "green", "blue", "purple", "gray"];
|
|
9
13
|
const now = () => new Date().toISOString();
|
|
10
14
|
function escapeLikePattern(value) {
|
|
@@ -26,6 +30,7 @@ function citationJson(row, tags = [], collectionIds = []) {
|
|
|
26
30
|
title: row.title,
|
|
27
31
|
authors: row.authors,
|
|
28
32
|
year: row.year,
|
|
33
|
+
venue: row.venue,
|
|
29
34
|
revision: row.revision,
|
|
30
35
|
collectionIds,
|
|
31
36
|
tags: tags.map((tag) => ({ id: tag.id, name: tag.name, color: tag.color, ownerId: tag.user_id })),
|
|
@@ -102,8 +107,9 @@ export function registerCitationRoutes(app, context) {
|
|
|
102
107
|
OR COALESCE(title, '') LIKE ? ESCAPE '\\'
|
|
103
108
|
OR COALESCE(authors, '') LIKE ? ESCAPE '\\'
|
|
104
109
|
OR COALESCE(year, '') LIKE ? ESCAPE '\\'
|
|
110
|
+
OR COALESCE(venue, '') LIKE ? ESCAPE '\\'
|
|
105
111
|
)`);
|
|
106
|
-
params.push(...Array.from({ length:
|
|
112
|
+
params.push(...Array.from({ length: 6 }, () => `%${escapeLikePattern(search)}%`));
|
|
107
113
|
}
|
|
108
114
|
if (tagId) {
|
|
109
115
|
where.push(`EXISTS (SELECT 1 FROM citation_library_entry_tags filter_link
|
|
@@ -194,31 +200,11 @@ export function registerCitationRoutes(app, context) {
|
|
|
194
200
|
return;
|
|
195
201
|
return apiError(reply, 403, "CITATION_LIBRARY_PRIVATE");
|
|
196
202
|
});
|
|
197
|
-
app.post("/api/citations/lookup", { bodyLimit:
|
|
203
|
+
app.post("/api/citations/lookup", { bodyLimit: MAX_LOOKUP_BODY_BYTES }, async (request, reply) => {
|
|
198
204
|
const user = requireUser(request, reply, db);
|
|
199
205
|
if (!user)
|
|
200
206
|
return;
|
|
201
|
-
const
|
|
202
|
-
let contents = null;
|
|
203
|
-
let keyInput = body?.keys;
|
|
204
|
-
if (body?.entries !== undefined) {
|
|
205
|
-
if (body.keys !== undefined || !Array.isArray(body.entries) || body.entries.length > 5000)
|
|
206
|
-
throw new ValidationError();
|
|
207
|
-
contents = new Map();
|
|
208
|
-
let bytes = 0;
|
|
209
|
-
keyInput = body.entries.map((value) => {
|
|
210
|
-
if (typeof value !== "object" || !value)
|
|
211
|
-
throw new ValidationError();
|
|
212
|
-
const item = value;
|
|
213
|
-
if (typeof item.citationKey !== "string" || typeof item.bibtex !== "string" || !item.bibtex.trim())
|
|
214
|
-
throw new ValidationError();
|
|
215
|
-
bytes += Buffer.byteLength(item.bibtex, "utf8");
|
|
216
|
-
if (bytes > MAX_CITATION_BIBTEX_BYTES)
|
|
217
|
-
throw httpError(413, "CITATION_TOO_LARGE");
|
|
218
|
-
contents.set(item.citationKey.trim().toLowerCase(), comparableCitationBibtex(item.bibtex));
|
|
219
|
-
return item.citationKey;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
207
|
+
const keyInput = request.body?.keys;
|
|
222
208
|
if (!Array.isArray(keyInput) || keyInput.length > 5000
|
|
223
209
|
|| keyInput.some((key) => typeof key !== "string" || !key.trim() || key.length > 512)) {
|
|
224
210
|
throw new ValidationError();
|
|
@@ -228,12 +214,11 @@ export function registerCitationRoutes(app, context) {
|
|
|
228
214
|
for (let offset = 0; offset < keys.length; offset += 500) {
|
|
229
215
|
const chunk = keys.slice(offset, offset + 500);
|
|
230
216
|
const placeholders = chunk.map(() => "?").join(", ");
|
|
231
|
-
const rows = db.prepare(`SELECT id, citation_key, revision
|
|
217
|
+
const rows = db.prepare(`SELECT id, citation_key, revision FROM citation_library_entries
|
|
232
218
|
WHERE user_id = ? AND citation_key COLLATE NOCASE IN (${placeholders})`)
|
|
233
219
|
.iterate(user.id, ...chunk);
|
|
234
220
|
for (const row of rows)
|
|
235
|
-
matches.push({ id: row.id, citationKey: row.citation_key, revision: row.revision
|
|
236
|
-
...(contents ? { sameContent: comparableCitationBibtex(row.bibtex) === contents.get(row.citation_key.toLowerCase()) } : {}) });
|
|
221
|
+
matches.push({ id: row.id, citationKey: row.citation_key, revision: row.revision });
|
|
237
222
|
}
|
|
238
223
|
return { matches };
|
|
239
224
|
});
|
|
@@ -245,46 +230,28 @@ export function registerCitationRoutes(app, context) {
|
|
|
245
230
|
const citation = citationInput(body);
|
|
246
231
|
const tagIds = citationTagIds(db, user.id, body?.tagIds);
|
|
247
232
|
const collectionIds = citationCollectionIds(db, user.id, body?.collectionIds);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (existing && !overwrite)
|
|
252
|
-
return apiError(reply, 409, "CITATION_KEY_EXISTS");
|
|
253
|
-
const expectedRevision = existing ? citationExpectedRevision(body?.expectedRevision) : null;
|
|
254
|
-
if (existing && existing.revision !== expectedRevision) {
|
|
255
|
-
return apiError(reply, 409, "CITATION_CONFLICT");
|
|
256
|
-
}
|
|
257
|
-
const id = existing?.id ?? randomUUID();
|
|
233
|
+
// POST only creates. An existing entry is changed through PATCH, which
|
|
234
|
+
// requires its revision; a key already in the library is a conflict.
|
|
235
|
+
const id = randomUUID();
|
|
258
236
|
const timestamp = now();
|
|
259
237
|
db.transaction(() => {
|
|
238
|
+
const existing = db.prepare("SELECT 1 FROM citation_library_entries WHERE user_id = ? AND citation_key = ? COLLATE NOCASE")
|
|
239
|
+
.get(user.id, citation.citationKey);
|
|
240
|
+
if (existing)
|
|
241
|
+
throw httpError(409, "CITATION_KEY_EXISTS");
|
|
260
242
|
assertCitationCollectionCapacity(db, user.id, id, collectionIds ?? []);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
throw httpError(409, "CITATION_CONFLICT");
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
db.prepare(`INSERT INTO citation_library_entries
|
|
271
|
-
(id, user_id, citation_key, entry_type, bibtex, title, authors, year, notes, revision, created_at, updated_at)
|
|
272
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`)
|
|
273
|
-
.run(id, user.id, citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.notes ?? "", timestamp, timestamp);
|
|
274
|
-
}
|
|
275
|
-
if (tagIds !== null) {
|
|
276
|
-
db.prepare("DELETE FROM citation_library_entry_tags WHERE entry_id = ?").run(id);
|
|
277
|
-
for (const tagId of tagIds)
|
|
278
|
-
db.prepare("INSERT INTO citation_library_entry_tags (entry_id, tag_id, created_at) VALUES (?, ?, ?)").run(id, tagId, timestamp);
|
|
279
|
-
}
|
|
280
|
-
// Saving from a project's .bib adds the chosen folder without removing
|
|
281
|
-
// other placements of an already-saved reference.
|
|
243
|
+
db.prepare(`INSERT INTO citation_library_entries
|
|
244
|
+
(id, user_id, citation_key, entry_type, bibtex, title, authors, year, venue, notes, revision, created_at, updated_at)
|
|
245
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`)
|
|
246
|
+
.run(id, user.id, citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.venue, citation.notes ?? "", timestamp, timestamp);
|
|
247
|
+
for (const tagId of tagIds ?? [])
|
|
248
|
+
db.prepare("INSERT INTO citation_library_entry_tags (entry_id, tag_id, created_at) VALUES (?, ?, ?)").run(id, tagId, timestamp);
|
|
282
249
|
for (const collectionId of collectionIds ?? [])
|
|
283
250
|
db.prepare("INSERT OR IGNORE INTO citation_library_entry_collections (entry_id, collection_id) VALUES (?, ?)").run(id, collectionId);
|
|
284
251
|
})();
|
|
285
252
|
const row = db.prepare("SELECT * FROM citation_library_entries WHERE id = ? AND user_id = ?")
|
|
286
253
|
.get(id, user.id);
|
|
287
|
-
return reply.code(
|
|
254
|
+
return reply.code(201).send({ entry: citationDetails(db, row) });
|
|
288
255
|
});
|
|
289
256
|
app.patch("/api/citations/:citationId/tags", async (request, reply) => {
|
|
290
257
|
const user = requireUser(request, reply, db);
|
|
@@ -360,9 +327,9 @@ export function registerCitationRoutes(app, context) {
|
|
|
360
327
|
if (duplicate)
|
|
361
328
|
return apiError(reply, 409, "CITATION_KEY_EXISTS");
|
|
362
329
|
const result = db.prepare(`UPDATE citation_library_entries SET citation_key = ?, entry_type = ?, bibtex = ?,
|
|
363
|
-
title = ?, authors = ?, year = ?, notes = COALESCE(?, notes), revision = revision + 1, updated_at = ?
|
|
330
|
+
title = ?, authors = ?, year = ?, venue = ?, notes = COALESCE(?, notes), revision = revision + 1, updated_at = ?
|
|
364
331
|
WHERE id = ? AND user_id = ? AND revision = ?`)
|
|
365
|
-
.run(citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.notes ?? null, now(), citationId, user.id, expectedRevision);
|
|
332
|
+
.run(citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.venue, citation.notes ?? null, now(), citationId, user.id, expectedRevision);
|
|
366
333
|
if (!result.changes)
|
|
367
334
|
return apiError(reply, 409, "CITATION_CONFLICT");
|
|
368
335
|
const updated = db.prepare("SELECT * FROM citation_library_entries WHERE id = ? AND user_id = ?")
|