texlite 0.20.0 → 0.22.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 +215 -35
- package/OPERATIONS.md +2 -2
- package/README.md +48 -44
- package/README.zh-CN.md +42 -36
- package/dist/client/assets/AdminUsers-DepqkT6m.js +1 -0
- package/dist/client/assets/AdminUsers-DepqkT6m.js.br +0 -0
- package/dist/client/assets/AdminUsers-DepqkT6m.js.gz +0 -0
- package/dist/client/assets/{AgentIcon-dCMgWJG-.css → AgentIcon-DeoZDwgh.css} +1 -1
- package/dist/client/assets/AgentIcon-DeoZDwgh.css.br +0 -0
- package/dist/client/assets/AgentIcon-DeoZDwgh.css.gz +0 -0
- package/dist/client/assets/{AgentManagement-rIYtm4Bo.js → AgentManagement-DlV6tHez.js} +1 -1
- package/dist/client/assets/AgentManagement-DlV6tHez.js.br +0 -0
- package/dist/client/assets/AgentManagement-DlV6tHez.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js +2 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js.br +0 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js.gz +0 -0
- package/dist/client/assets/{AgentTerminalSurface-B2rwONYs.js → AgentTerminalSurface-COqg_GdK.js} +1 -1
- package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.gz +0 -0
- package/dist/client/assets/{AvatarSettingsDialog-DplRpiJJ.js → AvatarSettingsDialog-C8WQhZBK.js} +1 -1
- package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-SpudGDwi.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js +3 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-D3CjBD0p.js +1 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js +5 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js.br +0 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js.gz +0 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js +4 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js.br +0 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js +1 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js +8 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js.br +0 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Ba7GvcuW.js +1 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.js +25 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.js.br +0 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.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-BH2iwvle.js +1 -0
- package/dist/client/assets/MarkdownPreview-BH2iwvle.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-BH2iwvle.js.gz +0 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js +1 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js.br +0 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js.gz +0 -0
- package/dist/client/assets/{ProjectIconPickerDialog-B9_XvdIC.js → ProjectIconPickerDialog-Bfkaxcnh.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js +1 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js +4 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js.br +0 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js +25 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js +1 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-DKcmDg0e.js +2 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js +3 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js +2 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.gz +0 -0
- package/dist/client/assets/{SystemMetricsDialog-BExTHWxg.js → SystemMetricsDialog-DkmBA4o4.js} +1 -1
- package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.gz +0 -0
- package/dist/client/assets/{TagColorSelect-CzPUDAny.js → TagColorSelect-e-Tq5V3H.js} +1 -1
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js +1 -0
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.gz +0 -0
- package/dist/client/assets/TagMarquee-BLmCTTCt.js +1 -0
- package/dist/client/assets/ThemeSwitcher-dcvtWVCO.js +1 -0
- package/dist/client/assets/{WordCountDialog-CgDcnPdJ.js → WordCountDialog-DI0Jv-fg.js} +1 -1
- package/dist/client/assets/WordCountDialog-DI0Jv-fg.js.br +0 -0
- package/dist/client/assets/WordCountDialog-DI0Jv-fg.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-BeOSrdut.js → chktex-BrzPYHey.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-C9O-A_C4.js +1 -0
- package/dist/client/assets/dist-C9O-A_C4.js.br +0 -0
- package/dist/client/assets/dist-C9O-A_C4.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-Dtn6w-qA.js +13 -0
- package/dist/client/assets/i18n-Dtn6w-qA.js.br +0 -0
- package/dist/client/assets/i18n-Dtn6w-qA.js.gz +0 -0
- package/dist/client/assets/index-BbU2fbRw.css +1 -0
- package/dist/client/assets/index-BbU2fbRw.css.br +0 -0
- package/dist/client/assets/index-BbU2fbRw.css.gz +0 -0
- package/dist/client/assets/index-CPR6YZEf.js +2 -0
- package/dist/client/assets/index-CPR6YZEf.js.br +0 -0
- package/dist/client/assets/index-CPR6YZEf.js.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/plus-Cei21TlT.js +1 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js +1 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js.br +0 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js +1 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.gz +0 -0
- package/dist/client/assets/{spellCheck-P-fMO4iR.js → spellCheck-BTyLQAFH.js} +1 -1
- package/dist/client/assets/spellCheck-BTyLQAFH.js.br +0 -0
- package/dist/client/assets/spellCheck-BTyLQAFH.js.gz +0 -0
- package/dist/client/assets/{textLanguageSupport-BSIE7WPM.js → textLanguageSupport-Ck8lMOWz.js} +1 -1
- package/dist/client/assets/textLanguages-CwWstpJ5.js +78 -0
- 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-Ba_yhkrl.js +1 -0
- package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.gz +0 -0
- package/dist/client/assets/{vimSupport-BwIAfLU0.js → vimSupport-C-WiMLjc.js} +6 -6
- package/dist/client/assets/vimSupport-C-WiMLjc.js.br +0 -0
- package/dist/client/assets/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 +7 -27
- 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/collaboration.js +39 -5
- 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 +9 -0
- package/dist/server/locales/zh-Hant.js +5 -0
- package/dist/server/projectPreview.js +8 -12
- package/dist/server/projectReferences.js +110 -9
- package/dist/server/projectReplace.js +67 -0
- package/dist/server/projectSearch.js +72 -0
- package/dist/server/routes/auth.js +3 -0
- package/dist/server/routes/citations.js +28 -61
- package/dist/server/routes/commentSuggestions.js +1 -1
- package/dist/server/routes/comments.js +8 -3
- package/dist/server/routes/projectGit.js +10 -0
- package/dist/server/routes/projectHistory.js +42 -0
- package/dist/server/routes/projectSearch.js +72 -0
- package/dist/server/routes/projects.js +1 -2
- package/dist/server/routes/users.js +2 -2
- 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/projectSearch.js +17 -0
- package/dist/shared/textDiff.js +36 -1
- package/package.json +1 -1
- package/dist/client/assets/AdminUsers-BghRo_hC.js +0 -1
- package/dist/client/assets/AdminUsers-BghRo_hC.js.br +0 -0
- package/dist/client/assets/AdminUsers-BghRo_hC.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-rIYtm4Bo.js.br +0 -0
- package/dist/client/assets/AgentManagement-rIYtm4Bo.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-BEjiw51y.js +0 -2
- package/dist/client/assets/AgentTerminal-BEjiw51y.js.br +0 -0
- package/dist/client/assets/AgentTerminal-BEjiw51y.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-BnK6nZPi.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js +0 -3
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js +0 -36
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.br +0 -0
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.gz +0 -0
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js +0 -5
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js.br +0 -0
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js.gz +0 -0
- package/dist/client/assets/GitDialog-BeYvUCDv.js +0 -3
- package/dist/client/assets/GitDialog-BeYvUCDv.js.br +0 -0
- package/dist/client/assets/GitDialog-BeYvUCDv.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js +0 -8
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js.br +0 -0
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Dkz742vJ.js +0 -1
- package/dist/client/assets/LatexEditor-CohUJrGD.js +0 -25
- package/dist/client/assets/LatexEditor-CohUJrGD.js.br +0 -0
- package/dist/client/assets/LatexEditor-CohUJrGD.js.gz +0 -0
- package/dist/client/assets/PdfPreview-BvJxduy3.js +0 -1
- package/dist/client/assets/PdfPreview-BvJxduy3.js.br +0 -0
- package/dist/client/assets/PdfPreview-BvJxduy3.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js +0 -4
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.br +0 -0
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js +0 -31
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js +0 -1
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-BZ7WYQO7.js +0 -2
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js +0 -2
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js +0 -1
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js +0 -1
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.br +0 -0
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-CgDcnPdJ.js.br +0 -0
- package/dist/client/assets/WordCountDialog-CgDcnPdJ.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/dist-Bcdl4EAC.js +0 -1
- package/dist/client/assets/dist-Bcdl4EAC.js.br +0 -0
- package/dist/client/assets/dist-Bcdl4EAC.js.gz +0 -0
- package/dist/client/assets/editor-JqCouYk8.js +0 -14
- package/dist/client/assets/editor-JqCouYk8.js.br +0 -0
- package/dist/client/assets/editor-JqCouYk8.js.gz +0 -0
- package/dist/client/assets/editor-languages-CRI2h3Fj.js +0 -36
- package/dist/client/assets/editor-languages-CRI2h3Fj.js.br +0 -0
- package/dist/client/assets/editor-languages-CRI2h3Fj.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js +0 -1
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.gz +0 -0
- package/dist/client/assets/eye-BnslGpqB.js +0 -1
- package/dist/client/assets/i18n-Bv4wFb8D.js +0 -13
- package/dist/client/assets/i18n-Bv4wFb8D.js.br +0 -0
- package/dist/client/assets/i18n-Bv4wFb8D.js.gz +0 -0
- package/dist/client/assets/index-Bdb2ITID.js +0 -2
- package/dist/client/assets/index-Bdb2ITID.js.br +0 -0
- package/dist/client/assets/index-Bdb2ITID.js.gz +0 -0
- package/dist/client/assets/index-wqKiaXZr.css +0 -1
- package/dist/client/assets/index-wqKiaXZr.css.br +0 -0
- package/dist/client/assets/index-wqKiaXZr.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-DlKXhH_h.js +0 -1
- package/dist/client/assets/relativeTime-DlKXhH_h.js.br +0 -0
- package/dist/client/assets/relativeTime-DlKXhH_h.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js +0 -1
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.gz +0 -0
- package/dist/client/assets/spellCheck-P-fMO4iR.js.br +0 -0
- package/dist/client/assets/spellCheck-P-fMO4iR.js.gz +0 -0
- package/dist/client/assets/tags-GrE3ZIQN.js +0 -1
- package/dist/client/assets/textLanguages-DAJ1OXJA.js +0 -78
- package/dist/client/assets/textLanguages-DAJ1OXJA.js.br +0 -0
- package/dist/client/assets/textLanguages-DAJ1OXJA.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-BwIAfLU0.js.br +0 -0
- package/dist/client/assets/vimSupport-BwIAfLU0.js.gz +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js → AgentIcon-CA-PfOka.js} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.br → AgentIcon-CA-PfOka.js.br} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.gz → AgentIcon-CA-PfOka.js.gz} +0 -0
|
@@ -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 = ?")
|
|
@@ -82,7 +82,7 @@ export function registerSuggestionRoutes(app, context) {
|
|
|
82
82
|
};
|
|
83
83
|
validate();
|
|
84
84
|
if (action === "accept")
|
|
85
|
-
await collaboration.
|
|
85
|
+
await collaboration.prepareSourceEditRoom(id);
|
|
86
86
|
return projectMutations.runWrite(id, () => {
|
|
87
87
|
const row = validate();
|
|
88
88
|
const expected = action === "accept" ? "accepted" : "rejected";
|
|
@@ -6,7 +6,7 @@ import { resolveSourcePath, safeRelativePath } from "../files.js";
|
|
|
6
6
|
import { apiError, httpError } from "../http.js";
|
|
7
7
|
import { accessibleProject } from "../projects.js";
|
|
8
8
|
import { isCollaborativeTextFile } from "../collaboration.js";
|
|
9
|
-
import { attachSuggestion, suggestionRow } from "../commentSuggestions.js";
|
|
9
|
+
import { attachSuggestion, suggestionReviewers, suggestionRow } from "../commentSuggestions.js";
|
|
10
10
|
import { registerSuggestionRoutes } from "./commentSuggestions.js";
|
|
11
11
|
import { defaultSuggestionComments } from "../../shared/suggestionMessages.js";
|
|
12
12
|
import { serverLocale } from "../i18n.js";
|
|
@@ -217,8 +217,13 @@ export function registerCommentRoutes(app, context) {
|
|
|
217
217
|
changed = true;
|
|
218
218
|
}
|
|
219
219
|
if (typeof body.resolved === "boolean") {
|
|
220
|
-
if (body.resolved
|
|
221
|
-
|
|
220
|
+
if (body.resolved) {
|
|
221
|
+
const suggestion = suggestionRow(db, id, commentId);
|
|
222
|
+
if (suggestion?.status === "pending" && (suggestion.apply_update
|
|
223
|
+
|| suggestionReviewers(db, id, suggestion.author_id).some(user => user.id === suggestion.reviewer_id))) {
|
|
224
|
+
return apiError(reply, 409, "SUGGESTION_PENDING");
|
|
225
|
+
}
|
|
226
|
+
}
|
|
222
227
|
changed = true;
|
|
223
228
|
}
|
|
224
229
|
if (!changed)
|
|
@@ -38,6 +38,16 @@ export function registerProjectGitRoutes(app, context) {
|
|
|
38
38
|
return apiError(reply, 400, "GIT_TOKEN_INVALID");
|
|
39
39
|
return { status: await projectGit.configureUserToken(user.id, body.token) };
|
|
40
40
|
});
|
|
41
|
+
app.put("/api/account/github/identity", async (request, reply) => {
|
|
42
|
+
const user = requireUser(request, reply, db);
|
|
43
|
+
if (!user)
|
|
44
|
+
return;
|
|
45
|
+
const body = request.body;
|
|
46
|
+
if (typeof body.username !== "string" || typeof body.email !== "string") {
|
|
47
|
+
return apiError(reply, 400, "GIT_IDENTITY_INVALID");
|
|
48
|
+
}
|
|
49
|
+
return { status: projectGit.updateGitIdentity(user.id, body.username, body.email) };
|
|
50
|
+
});
|
|
41
51
|
app.delete("/api/account/github", async (request, reply) => {
|
|
42
52
|
const user = requireUser(request, reply, db);
|
|
43
53
|
if (!user)
|
|
@@ -7,6 +7,8 @@ import { resolveSourcePath, safeRelativePath } from "../files.js";
|
|
|
7
7
|
import { apiError, httpError } from "../http.js";
|
|
8
8
|
import { MAX_TEXT_PREVIEW_BYTES } from "../limits.js";
|
|
9
9
|
import { defaultHistoryTracking, historyTextCandidate } from "../../shared/historyTracking.js";
|
|
10
|
+
/** Files with agent changes examined per request; the newest edits matter most. */
|
|
11
|
+
const MAX_AGENT_CHANGE_FILES = 200;
|
|
10
12
|
import { accessibleProject, canEdit } from "../projects.js";
|
|
11
13
|
import { commentsSummaryForProject, projectJson, projectTextSnapshot, reanchorProjectSnapshot, requireEditableProject, requireProjectOwnerPermission, tagsForProject, text, touchProject } from "./projectShared.js";
|
|
12
14
|
/** Register retained project version listing, inspection, restoration, and cleanup routes. */
|
|
@@ -80,6 +82,46 @@ export function registerProjectHistoryRoutes(app, context) {
|
|
|
80
82
|
throw httpError(404, "PROJECT_NOT_FOUND");
|
|
81
83
|
} });
|
|
82
84
|
});
|
|
85
|
+
/**
|
|
86
|
+
* The caller's own coding-agent changes across the project, mapped to the
|
|
87
|
+
* current sources. Other users' agent work is never returned. Read-only:
|
|
88
|
+
* which changes were reviewed is kept by the browser.
|
|
89
|
+
*/
|
|
90
|
+
app.get("/api/projects/:id/agent-changes", async (request, reply) => {
|
|
91
|
+
const user = requireUser(request, reply, db);
|
|
92
|
+
if (!user)
|
|
93
|
+
return;
|
|
94
|
+
const { id } = request.params;
|
|
95
|
+
if (!accessibleProject(db, id, user))
|
|
96
|
+
return apiError(reply, 404, "PROJECT_NOT_FOUND");
|
|
97
|
+
return await projectMutations.runConsistentRead(id, () => {
|
|
98
|
+
const paths = db.prepare(`SELECT DISTINCT file_path FROM project_edit_segments
|
|
99
|
+
WHERE project_id = ? AND author_id = ? AND has_agent = 1 ORDER BY file_path LIMIT ?`)
|
|
100
|
+
.all(id, user.id, MAX_AGENT_CHANGE_FILES).map((row) => row.file_path);
|
|
101
|
+
const files = [];
|
|
102
|
+
for (const filePath of paths) {
|
|
103
|
+
if (!isCollaborativeTextFile(filePath))
|
|
104
|
+
continue;
|
|
105
|
+
let source;
|
|
106
|
+
try {
|
|
107
|
+
source = resolveSourcePath(config, id, filePath);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!fs.existsSync(source) || !fs.statSync(source).isFile() || fs.statSync(source).size > maxCollaborativeFileBytes(config))
|
|
113
|
+
continue;
|
|
114
|
+
const content = fs.readFileSync(source, "utf8");
|
|
115
|
+
const changes = editHistory.agentChanges(id, filePath, content, user.id);
|
|
116
|
+
if (changes.length)
|
|
117
|
+
files.push({ path: filePath, sourceHash: hashText(content), changes });
|
|
118
|
+
}
|
|
119
|
+
return { files };
|
|
120
|
+
}, { preflight: () => {
|
|
121
|
+
if (!accessibleProject(db, id, user))
|
|
122
|
+
throw httpError(404, "PROJECT_NOT_FOUND");
|
|
123
|
+
} });
|
|
124
|
+
});
|
|
83
125
|
app.get("/api/projects/:id/history", async (request, reply) => {
|
|
84
126
|
const user = requireUser(request, reply, db);
|
|
85
127
|
if (!user)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { isTextContent } from "../../shared/fileTypes.js";
|
|
2
|
+
import { PROJECT_SEARCH_MAX_QUERY_LENGTH, PROJECT_SEARCH_MAX_MATCHES, PROJECT_SEARCH_MAX_REPLACEMENT_LENGTH } from "../../shared/projectSearch.js";
|
|
3
|
+
import { requireUser } from "../auth.js";
|
|
4
|
+
import { apiError, httpError } from "../http.js";
|
|
5
|
+
import { searchProject } from "../projectSearch.js";
|
|
6
|
+
import { accessibleProject } from "../projects.js";
|
|
7
|
+
import { requireEditableProject } from "./projectShared.js";
|
|
8
|
+
import { prepareProjectReplacement } from "../projectReplace.js";
|
|
9
|
+
import { safeRelativePath } from "../files.js";
|
|
10
|
+
function searchOptions(body) {
|
|
11
|
+
if (!body || typeof body.query !== "string" || body.query.length === 0
|
|
12
|
+
|| body.query.length > PROJECT_SEARCH_MAX_QUERY_LENGTH || /[\r\n\0]/.test(body.query)
|
|
13
|
+
|| (body.caseSensitive !== undefined && typeof body.caseSensitive !== "boolean")
|
|
14
|
+
|| (body.wholeWord !== undefined && typeof body.wholeWord !== "boolean"))
|
|
15
|
+
throw httpError(400, "REQUEST_INVALID");
|
|
16
|
+
return { query: body.query, caseSensitive: body.caseSensitive !== false, wholeWord: body.wholeWord !== false };
|
|
17
|
+
}
|
|
18
|
+
export function registerProjectSearchRoutes(app, { config, db, projectMutations, collaboration }) {
|
|
19
|
+
app.post("/api/projects/:id/search", async (request, reply) => {
|
|
20
|
+
const user = requireUser(request, reply, db);
|
|
21
|
+
if (!user)
|
|
22
|
+
return;
|
|
23
|
+
const { id } = request.params;
|
|
24
|
+
if (!accessibleProject(db, id, user))
|
|
25
|
+
return apiError(reply, 404, "PROJECT_NOT_FOUND");
|
|
26
|
+
const options = searchOptions(request.body);
|
|
27
|
+
return await projectMutations.runConsistentRead(id, () => searchProject(config, id, options), {
|
|
28
|
+
preflight: () => { if (!accessibleProject(db, id, user))
|
|
29
|
+
throw httpError(404, "PROJECT_NOT_FOUND"); }
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
app.post("/api/projects/:id/search/replace", async (request, reply) => {
|
|
33
|
+
const user = requireUser(request, reply, db);
|
|
34
|
+
if (!user)
|
|
35
|
+
return;
|
|
36
|
+
const { id } = request.params;
|
|
37
|
+
requireEditableProject(db, id, user);
|
|
38
|
+
const body = request.body;
|
|
39
|
+
const options = searchOptions(body);
|
|
40
|
+
if (typeof body?.replacement !== "string" || body.replacement.length > PROJECT_SEARCH_MAX_REPLACEMENT_LENGTH
|
|
41
|
+
|| !isTextContent(Buffer.from(body.replacement, "utf8")) || !Array.isArray(body.targets)
|
|
42
|
+
|| !body.targets.length || body.targets.length > PROJECT_SEARCH_MAX_MATCHES)
|
|
43
|
+
throw httpError(400, "REQUEST_INVALID");
|
|
44
|
+
const replacement = body.replacement;
|
|
45
|
+
const paths = new Set();
|
|
46
|
+
let totalRanges = 0;
|
|
47
|
+
const targets = body.targets.map((value) => {
|
|
48
|
+
const target = value;
|
|
49
|
+
if (!target || typeof target.path !== "string" || safeRelativePath(target.path) !== target.path || paths.has(target.path)
|
|
50
|
+
|| typeof target.sourceHash !== "string" || !/^[a-f0-9]{64}$/.test(target.sourceHash)
|
|
51
|
+
|| !Array.isArray(target.ranges) || !target.ranges.length
|
|
52
|
+
|| target.ranges.some((range) => !range || !Number.isSafeInteger(range.from) || !Number.isSafeInteger(range.to)
|
|
53
|
+
|| range.from < 0 || range.to <= range.from))
|
|
54
|
+
throw httpError(400, "REQUEST_INVALID");
|
|
55
|
+
const ranges = [...target.ranges].sort((a, b) => a.from - b.from);
|
|
56
|
+
if (ranges.some((range, index) => index > 0 && range.from < ranges[index - 1].to))
|
|
57
|
+
throw httpError(400, "REQUEST_INVALID");
|
|
58
|
+
paths.add(target.path);
|
|
59
|
+
totalRanges += ranges.length;
|
|
60
|
+
return { path: target.path, sourceHash: target.sourceHash, ranges };
|
|
61
|
+
});
|
|
62
|
+
if (totalRanges > PROJECT_SEARCH_MAX_MATCHES)
|
|
63
|
+
throw httpError(400, "REQUEST_INVALID");
|
|
64
|
+
await collaboration.prepareSourceEditRoom(id);
|
|
65
|
+
return projectMutations.runWrite(id, () => {
|
|
66
|
+
const plan = prepareProjectReplacement(config, id, options, replacement, targets);
|
|
67
|
+
if (plan.files.length)
|
|
68
|
+
collaboration.applySourceEdits(id, plan.files, user.id);
|
|
69
|
+
return { replaced: plan.replaced, files: plan.files.length };
|
|
70
|
+
}, { preflight: () => { requireEditableProject(db, id, user); } });
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -185,8 +185,7 @@ export function registerProjectCatalogRoutes(app, context) {
|
|
|
185
185
|
const previews = new Map();
|
|
186
186
|
if (query.previews === "1")
|
|
187
187
|
await Promise.all(projects.map(async (project) => {
|
|
188
|
-
|
|
189
|
-
previews.set(project.id, await projectPreviews.read(project.id, project.main_file));
|
|
188
|
+
previews.set(project.id, await projectPreviews.read(project.id, project.main_file));
|
|
190
189
|
}));
|
|
191
190
|
return {
|
|
192
191
|
projects: projects.map((project) => ({ ...projectJson({ ...project, archived: archivedOnly }, projectTags.get(project.id) ?? [], commentsSummaries.get(project.id), unreadMentionCounts.get(project.id) ?? 0), ...(previews.has(project.id) ? { preview: previews.get(project.id) } : {}) })),
|
|
@@ -58,11 +58,11 @@ export function registerUserManagementRoutes(app, context) {
|
|
|
58
58
|
const user = {
|
|
59
59
|
id: randomUUID(), username, display_name: displayName,
|
|
60
60
|
password_hash: await hashPassword(password), role, disabled: 0,
|
|
61
|
-
must_change_password:
|
|
61
|
+
must_change_password: 1, can_create_projects: body?.canCreateProjects === true ? 1 : 0, created_at: now()
|
|
62
62
|
};
|
|
63
63
|
db.prepare(`INSERT INTO users
|
|
64
64
|
(id, username, display_name, password_hash, role, disabled, must_change_password, can_create_projects, created_at)
|
|
65
|
-
VALUES (?, ?, ?, ?, ?, 0,
|
|
65
|
+
VALUES (?, ?, ?, ?, ?, 0, 1, ?, ?)`)
|
|
66
66
|
.run(user.id, user.username, user.display_name, user.password_hash, user.role, user.can_create_projects, user.created_at);
|
|
67
67
|
return reply.code(201).send({ user: publicUser(user) });
|
|
68
68
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index just after the brace that closes the BibTeX group opened at `start`,
|
|
3
|
+
* or -1 when the group is not closed. A backslash escapes the next character,
|
|
4
|
+
* so `\{` and `\}` are not counted.
|
|
5
|
+
*/
|
|
6
|
+
export function bracedGroupEnd(source, start) {
|
|
7
|
+
let depth = 0;
|
|
8
|
+
for (let index = start; index < source.length; index += 1) {
|
|
9
|
+
const character = source[index];
|
|
10
|
+
if (character === "\\") {
|
|
11
|
+
index += 1;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (character === "{")
|
|
15
|
+
depth += 1;
|
|
16
|
+
else if (character === "}" && --depth === 0)
|
|
17
|
+
return index + 1;
|
|
18
|
+
}
|
|
19
|
+
return -1;
|
|
20
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { bracedGroupEnd } from "./bibtexBraces.js";
|
|
2
|
+
/**
|
|
3
|
+
* Find BibTeX name-list separators: the word `and` (any case) after
|
|
4
|
+
* whitespace, at brace depth 0, so `{Barnes and Noble}` and escaped TeX are
|
|
5
|
+
* never split. A trailing `and` (a list still being typed) counts too, so it
|
|
6
|
+
* never becomes part of a name. Shared by the editor's completion and
|
|
7
|
+
* diagnostics and by author display.
|
|
8
|
+
*/
|
|
9
|
+
export function findTopLevelAndSeparators(text) {
|
|
10
|
+
const separators = [];
|
|
11
|
+
let depth = 0;
|
|
12
|
+
for (let index = 0; index < text.length; index++) {
|
|
13
|
+
const character = text[index];
|
|
14
|
+
if (character === "\\") {
|
|
15
|
+
index++;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (character === "{") {
|
|
19
|
+
depth++;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (character === "}") {
|
|
23
|
+
depth = Math.max(0, depth - 1);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (depth !== 0 || text.slice(index, index + 3).toLowerCase() !== "and")
|
|
27
|
+
continue;
|
|
28
|
+
const before = text[index - 1];
|
|
29
|
+
const after = text[index + 3];
|
|
30
|
+
if (!before || !/\s/.test(before) || (after !== undefined && !/\s/.test(after)))
|
|
31
|
+
continue;
|
|
32
|
+
let from = index;
|
|
33
|
+
while (from > 0 && /\s/.test(text[from - 1]))
|
|
34
|
+
from--;
|
|
35
|
+
let to = index + 3;
|
|
36
|
+
while (to < text.length && /\s/.test(text[to]))
|
|
37
|
+
to++;
|
|
38
|
+
separators.push({ from, to });
|
|
39
|
+
index += 2;
|
|
40
|
+
}
|
|
41
|
+
return separators;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Split a BibTeX name list (`author`, `editor`) into names at its top-level
|
|
45
|
+
* `and` separators. A final `others` is BibTeX's marker for an incomplete
|
|
46
|
+
* list, not a name. Names keep their original form: reordering or
|
|
47
|
+
* abbreviating them would need BibTeX's full von/Jr. rules, and the source
|
|
48
|
+
* text is never wrong.
|
|
49
|
+
*/
|
|
50
|
+
export function splitBibtexNames(value) {
|
|
51
|
+
const names = [];
|
|
52
|
+
let start = 0;
|
|
53
|
+
for (const separator of findTopLevelAndSeparators(value)) {
|
|
54
|
+
names.push(value.slice(start, separator.from));
|
|
55
|
+
start = separator.to;
|
|
56
|
+
}
|
|
57
|
+
names.push(value.slice(start));
|
|
58
|
+
const cleaned = names.map(displayName).filter(Boolean);
|
|
59
|
+
const others = cleaned.length > 1 && cleaned[cleaned.length - 1].toLowerCase() === "others";
|
|
60
|
+
return { names: others ? cleaned.slice(0, -1) : cleaned, others };
|
|
61
|
+
}
|
|
62
|
+
/** Trim a name and drop braces that only protect the whole name, such as `{World Health Organization}`. */
|
|
63
|
+
function displayName(name) {
|
|
64
|
+
const trimmed = name.trim();
|
|
65
|
+
if (trimmed.startsWith("{") && bracedGroupEnd(trimmed, 0) === trimmed.length)
|
|
66
|
+
return trimmed.slice(1, -1).trim();
|
|
67
|
+
return trimmed;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* biblatex's default name-list truncation (`maxnames=3`, `minnames=1`): a list
|
|
71
|
+
* longer than `maxNames` shows only its first `minNames` names followed by
|
|
72
|
+
* "et al.". A list ending in `and others` is already truncated, so it is
|
|
73
|
+
* shortened the same way and always followed by "et al.".
|
|
74
|
+
*/
|
|
75
|
+
export function truncateBibtexNames(list, { maxNames = 3, minNames = 1 } = {}) {
|
|
76
|
+
const tooLong = list.names.length > maxNames;
|
|
77
|
+
return {
|
|
78
|
+
shown: tooLong ? list.names.slice(0, minNames) : list.names,
|
|
79
|
+
truncated: tooLong || list.others,
|
|
80
|
+
total: list.others ? null : list.names.length
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -23,6 +23,16 @@ function readBibtexBlock(source, start) {
|
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
25
|
if (opening === "{") {
|
|
26
|
+
// Comments belong to the entry body, not to its brace structure. Skip
|
|
27
|
+
// them before counting braces so an unpaired } or { in a comment cannot
|
|
28
|
+
// close or extend the entry. Quotes at the top level protect literal
|
|
29
|
+
// percent signs inside quoted values.
|
|
30
|
+
if (depth === 1 && !quoted && isLatexCommentStart(source, index)) {
|
|
31
|
+
index = skipLatexComment(source, index);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (depth === 1 && character === "\"")
|
|
35
|
+
quoted = !quoted;
|
|
26
36
|
if (character === "{") {
|
|
27
37
|
depth += 1;
|
|
28
38
|
continue;
|
|
@@ -51,6 +61,10 @@ function readBibtexBlock(source, start) {
|
|
|
51
61
|
braceDepth -= 1;
|
|
52
62
|
continue;
|
|
53
63
|
}
|
|
64
|
+
if (depth === 1 && isLatexCommentStart(source, index)) {
|
|
65
|
+
index = skipLatexComment(source, index);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
54
68
|
if (character === "{") {
|
|
55
69
|
braceDepth = 1;
|
|
56
70
|
continue;
|
|
@@ -72,24 +86,25 @@ function readBibtexBlock(source, start) {
|
|
|
72
86
|
}
|
|
73
87
|
return null;
|
|
74
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Characters that end a key, as in the editor grammar's key token. A key must
|
|
91
|
+
* then be followed, after whitespace and comments, by `,` or the end of the
|
|
92
|
+
* entry: `@article{f(1), ...}` and `@article{title = {A}}` have no key.
|
|
93
|
+
*/
|
|
94
|
+
const keyTerminator = /[\s,{}()%]/;
|
|
75
95
|
function bibtexKeyRange(source, entry) {
|
|
76
|
-
|
|
77
|
-
while (from < entry.contentTo && /\s/.test(source[from]))
|
|
78
|
-
from += 1;
|
|
96
|
+
const from = skipLatexTrivia(source, entry.contentFrom);
|
|
79
97
|
if (from >= entry.contentTo)
|
|
80
98
|
return null;
|
|
81
99
|
let to = from;
|
|
82
|
-
while (to < entry.contentTo &&
|
|
100
|
+
while (to < entry.contentTo && !keyTerminator.test(source[to]))
|
|
83
101
|
to += 1;
|
|
84
|
-
|
|
85
|
-
while (trimmedTo > from && /\s/.test(source[trimmedTo - 1]))
|
|
86
|
-
trimmedTo -= 1;
|
|
87
|
-
if (trimmedTo <= from)
|
|
102
|
+
if (to <= from)
|
|
88
103
|
return null;
|
|
89
104
|
const separator = skipLatexTrivia(source, to);
|
|
90
105
|
if (separator < entry.contentTo && source[separator] !== ",")
|
|
91
106
|
return null;
|
|
92
|
-
return { key: source.slice(from,
|
|
107
|
+
return { key: source.slice(from, to), from, to };
|
|
93
108
|
}
|
|
94
109
|
/**
|
|
95
110
|
* Find ordinary BibTeX/BibLaTeX entry keys. `@string`, `@preamble`, and
|
|
@@ -111,13 +126,15 @@ export function findBibtexEntryKeys(source) {
|
|
|
111
126
|
index += 1;
|
|
112
127
|
continue;
|
|
113
128
|
}
|
|
129
|
+
// An entry type is a letter followed by letters, digits, `_` or `-`,
|
|
130
|
+
// matching the editor grammar (`@misc1`, `@article-v2`).
|
|
114
131
|
let typeEnd = index + 1;
|
|
115
|
-
|
|
116
|
-
typeEnd += 1;
|
|
117
|
-
if (typeEnd === index + 1) {
|
|
132
|
+
if (!/[A-Za-z]/.test(source[typeEnd] ?? "")) {
|
|
118
133
|
index += 1;
|
|
119
134
|
continue;
|
|
120
135
|
}
|
|
136
|
+
while (typeEnd < source.length && /[A-Za-z0-9_-]/.test(source[typeEnd]))
|
|
137
|
+
typeEnd += 1;
|
|
121
138
|
let opening = typeEnd;
|
|
122
139
|
while (opening < source.length && /\s/.test(source[opening]))
|
|
123
140
|
opening += 1;
|
|
@@ -137,3 +154,26 @@ export function findBibtexEntryKeys(source) {
|
|
|
137
154
|
}
|
|
138
155
|
return entries;
|
|
139
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Where an entry was published. biblatex spells a journal `journaltitle`;
|
|
159
|
+
* BibTeX spells it `journal`. Proceedings and collection parts prefer their
|
|
160
|
+
* book title.
|
|
161
|
+
*/
|
|
162
|
+
export function bibtexVenue(entryType, fields) {
|
|
163
|
+
const journal = fields.journaltitle ?? fields.journal;
|
|
164
|
+
const venue = /inproceedings|conference|incollection/.test(entryType.toLowerCase())
|
|
165
|
+
? fields.booktitle ?? journal
|
|
166
|
+
: journal ?? fields.booktitle;
|
|
167
|
+
return venue?.trim() || null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Publication year: BibTeX's `year`, or the year of biblatex's ISO 8601
|
|
171
|
+
* `date` (`2021-05-03`, `2021/2022`). A `date` without a leading four-digit
|
|
172
|
+
* year gives no year rather than a guess.
|
|
173
|
+
*/
|
|
174
|
+
export function bibtexYear(fields) {
|
|
175
|
+
const year = fields.year?.trim();
|
|
176
|
+
if (year)
|
|
177
|
+
return year;
|
|
178
|
+
return /^\s*(-?\d{4})(?!\d)/.exec(fields.date ?? "")?.[1] ?? null;
|
|
179
|
+
}
|