@wonseok-han/confluence-sync 1.8.0 → 2.0.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/README.md +44 -410
- package/dist/cli/args.js +1 -1
- package/dist/cli/help.js +214 -115
- package/dist/cli/init.js +44 -5
- package/dist/cli/main.js +42 -11
- package/dist/cli/status.js +83 -0
- package/dist/confluence/client.js +121 -57
- package/dist/confluence/config.js +12 -8
- package/dist/confluence/env-file.js +23 -0
- package/dist/confluence/links.js +18 -0
- package/dist/conversion/asset-paths.js +5 -0
- package/dist/conversion/attachments.js +29 -7
- package/dist/conversion/convert.js +10 -22
- package/dist/conversion/footnotes.js +114 -11
- package/dist/conversion/markdown.js +26 -0
- package/dist/conversion/pdf-pages.js +10 -8
- package/dist/documents/anchors.js +9 -0
- package/dist/documents/callout-roundtrip.js +75 -0
- package/dist/documents/callouts.js +74 -0
- package/dist/documents/catalog.js +2 -2
- package/dist/documents/footnote-roundtrip.js +96 -0
- package/dist/documents/format.js +116 -0
- package/dist/documents/html-tables.js +30 -0
- package/dist/documents/html-to-markdown.js +47 -13
- package/dist/documents/markdown.js +46 -4
- package/dist/documents/obsidian.js +6 -3
- package/dist/documents/tables.js +89 -0
- package/dist/runtime/network.js +4 -0
- package/dist/shared/colors.js +2 -2
- package/dist/shared/progress.js +164 -0
- package/dist/shared/version.js +12 -0
- package/dist/site/assets/Monaco-LICENSE.txt +21 -0
- package/dist/site/assets/Monaco-ThirdPartyNotices.txt +448 -0
- package/dist/site/assets/PDFJS-LICENSE.txt +177 -0
- package/dist/site/assets/app.css +1 -0
- package/dist/site/assets/app.js +4 -0
- package/dist/site/assets/chunks/chunk-TEW74QPN.js +35 -0
- package/dist/site/assets/chunks/markdown-S6623E66.js +1 -0
- package/dist/site/assets/chunks/monaco-36ZGUH4Y.js +897 -0
- package/dist/site/assets/chunks/monaco-HFLEBJTI.css +1 -0
- package/dist/site/assets/chunks/pdf-DDN7TXTP.js +55 -0
- package/dist/site/assets/confluence-env-example.txt +32 -0
- package/dist/site/assets/editor.worker.js +1 -0
- package/dist/site/assets/favicon.svg +3 -0
- package/dist/site/assets/guide/01-account-settings.png +0 -0
- package/dist/site/assets/guide/02-atlassian-security.png +0 -0
- package/dist/site/assets/guide/03-api-tokens.png +0 -0
- package/dist/site/assets/guide/04-scope-api-token-step1.png +0 -0
- package/dist/site/assets/guide/05-scope-api-token-step2.png +0 -0
- package/dist/site/assets/guide/06-scope-api-token-step3.png +0 -0
- package/dist/site/assets/guide/07-scope-api-token-step4.png +0 -0
- package/dist/site/assets/guide/web/document-preview.png +0 -0
- package/dist/site/assets/guide/web/remote-diff.png +0 -0
- package/dist/site/assets/guide/web/sync-workspace.png +0 -0
- package/dist/site/assets/pdf/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Add-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Add-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/B5pc-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/B5pc-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS1-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS1-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS2-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/CNS2-V.bcmap +3 -0
- package/dist/site/assets/pdf/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/site/assets/pdf/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Ext-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Ext-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GB-H.bcmap +4 -0
- package/dist/site/assets/pdf/cmaps/GB-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBT-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBT-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Hankaku.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Hiragana.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Katakana.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/LICENSE +36 -0
- package/dist/site/assets/pdf/cmaps/NWP-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/NWP-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/Roman.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/V.bcmap +0 -0
- package/dist/site/assets/pdf/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/site/assets/pdf/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/site/assets/pdf/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/site/assets/pdf/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/site/assets/pdf/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/site/assets/pdf/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/site/assets/pdf/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/site/assets/pdf/wasm/LICENSE_JBIG2 +196 -0
- package/dist/site/assets/pdf/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/site/assets/pdf/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/site/assets/pdf/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/site/assets/pdf/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/site/assets/pdf/wasm/LICENSE_QCMS +21 -0
- package/dist/site/assets/pdf/wasm/jbig2.wasm +0 -0
- package/dist/site/assets/pdf/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/site/assets/pdf/wasm/openjpeg.wasm +0 -0
- package/dist/site/assets/pdf/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/site/assets/pdf/wasm/qcms_bg.wasm +0 -0
- package/dist/site/assets/pdf/wasm/quickjs-eval.js +16 -0
- package/dist/site/assets/pdf/wasm/quickjs-eval.wasm +0 -0
- package/dist/site/assets/pdf.worker.min.mjs +29 -0
- package/dist/site/assets/workspace.worker.js +409 -0
- package/dist/site/index.html +253 -0
- package/dist/sync/baseline.js +45 -0
- package/dist/sync/changes.js +51 -0
- package/dist/sync/diff.js +80 -0
- package/dist/sync/fetch.js +287 -0
- package/dist/sync/ignore.js +4 -4
- package/dist/sync/local-state.js +12 -0
- package/dist/sync/mapping.js +31 -8
- package/dist/sync/metadata.js +57 -0
- package/dist/sync/prepare.js +52 -0
- package/dist/sync/pull.js +618 -141
- package/dist/sync/push.js +260 -213
- package/dist/sync/reconcile.js +51 -0
- package/dist/sync/references.js +2 -2
- package/dist/sync/remap.js +17 -5
- package/dist/sync/render.js +3 -2
- package/dist/sync/restore.js +28 -0
- package/dist/sync/scope.js +47 -0
- package/dist/sync/staging.js +193 -0
- package/dist/sync/workspace.js +100 -0
- package/dist/web/assets/PDFJS-LICENSE.txt +177 -0
- package/dist/web/assets/app.css +1 -1
- package/dist/web/assets/app.js +3 -938
- package/dist/web/assets/chunks/chunk-TEW74QPN.js +35 -0
- package/dist/web/assets/chunks/markdown-S6623E66.js +1 -0
- package/dist/web/assets/chunks/monaco-36ZGUH4Y.js +897 -0
- package/dist/web/assets/chunks/monaco-HFLEBJTI.css +1 -0
- package/dist/web/assets/chunks/pdf-DDN7TXTP.js +55 -0
- package/dist/web/assets/confluence-env-example.txt +32 -0
- package/dist/web/assets/editor.worker.js +1 -30
- package/dist/web/assets/favicon.svg +3 -0
- package/dist/web/assets/guide/01-account-settings.png +0 -0
- package/dist/web/assets/guide/02-atlassian-security.png +0 -0
- package/dist/web/assets/guide/03-api-tokens.png +0 -0
- package/dist/web/assets/guide/04-scope-api-token-step1.png +0 -0
- package/dist/web/assets/guide/05-scope-api-token-step2.png +0 -0
- package/dist/web/assets/guide/06-scope-api-token-step3.png +0 -0
- package/dist/web/assets/guide/07-scope-api-token-step4.png +0 -0
- package/dist/web/assets/guide/web/document-preview.png +0 -0
- package/dist/web/assets/guide/web/remote-diff.png +0 -0
- package/dist/web/assets/guide/web/sync-workspace.png +0 -0
- package/dist/web/assets/pdf/cmaps/78-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Add-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Add-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/B5pc-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/B5pc-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS1-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS1-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS2-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/CNS2-V.bcmap +3 -0
- package/dist/web/assets/pdf/cmaps/ETHK-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/ETHK-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/ETen-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/ETen-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/ETenms-B5-H.bcmap +3 -0
- package/dist/web/assets/pdf/cmaps/ETenms-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Ext-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Ext-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GB-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GB-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GB-H.bcmap +4 -0
- package/dist/web/assets/pdf/cmaps/GB-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBK-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBK-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBK2K-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBK2K-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBT-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBT-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBT-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBT-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKdla-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKdla-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKm314-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKm314-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKm471-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKm471-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKscs-B5-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/HKscs-B5-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Hankaku.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Hiragana.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-Johab-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-Johab-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Katakana.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/LICENSE +36 -0
- package/dist/web/assets/pdf/cmaps/NWP-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/NWP-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/RKSJ-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/RKSJ-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/Roman.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/V.bcmap +0 -0
- package/dist/web/assets/pdf/cmaps/WP-Symbol.bcmap +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/web/assets/pdf/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/web/assets/pdf/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/web/assets/pdf/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/web/assets/pdf/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/web/assets/pdf/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/web/assets/pdf/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/web/assets/pdf/wasm/LICENSE_JBIG2 +196 -0
- package/dist/web/assets/pdf/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/web/assets/pdf/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/web/assets/pdf/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/web/assets/pdf/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/web/assets/pdf/wasm/LICENSE_QCMS +21 -0
- package/dist/web/assets/pdf/wasm/jbig2.wasm +0 -0
- package/dist/web/assets/pdf/wasm/jbig2_nowasm_fallback.js +15 -0
- package/dist/web/assets/pdf/wasm/openjpeg.wasm +0 -0
- package/dist/web/assets/pdf/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/dist/web/assets/pdf/wasm/qcms_bg.wasm +0 -0
- package/dist/web/assets/pdf/wasm/quickjs-eval.js +16 -0
- package/dist/web/assets/pdf/wasm/quickjs-eval.wasm +0 -0
- package/dist/web/assets/pdf.worker.min.mjs +29 -0
- package/dist/web/assets/workspace.worker.js +409 -0
- package/dist/web/document-source.js +14 -0
- package/dist/web/hosted-files.js +189 -0
- package/dist/web/hosted.js +316 -0
- package/dist/web/node-runner.js +26 -0
- package/dist/web/preview.js +74 -0
- package/dist/web/server.js +85 -240
- package/dist/web/sync.js +364 -70
- package/dist/web/table-editor-script.js +99 -0
- package/dist/web/table-format.js +224 -0
- package/dist/web/views/help.js +15 -10
- package/dist/web/views/sync-panel.js +90 -19
- package/dist/web/views/token-guide.js +27 -0
- package/dist/web/views/usage-guide.js +12 -0
- package/dist/web/views/workspace.js +85 -15
- package/dist/web/workspace-api.js +371 -0
- package/docs/user/CLI.md +366 -0
- package/docs/user/CONFIGURATION.md +125 -0
- package/docs/user/OBSIDIAN.md +117 -0
- package/docs/user/WEB.md +90 -0
- package/docs/user/images/web/document-preview.png +0 -0
- package/docs/user/images/web/remote-diff.png +0 -0
- package/docs/user/images/web/sync-workspace.png +0 -0
- package/package.json +23 -6
package/dist/web/server.js
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { createServer } from 'node:http';
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
-
import {
|
|
4
|
-
import { resolve,
|
|
5
|
-
import { homedir
|
|
3
|
+
import { realpath, stat, readFile } from 'node:fs/promises';
|
|
4
|
+
import { resolve, extname } from 'node:path';
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { execFile, spawn } from 'node:child_process';
|
|
8
8
|
import { promisify } from 'node:util';
|
|
9
|
-
import { collectMarkdown } from '../documents/catalog.js';
|
|
10
9
|
import { webPage } from './views/workspace.js';
|
|
11
|
-
import {
|
|
10
|
+
import { createWorkspaceApi } from './workspace-api.js';
|
|
12
11
|
import { chooseFolder } from './folder-dialog.js';
|
|
13
|
-
import {
|
|
12
|
+
import { readPkgVersion } from '../shared/version.js';
|
|
14
13
|
const execute = promisify(execFile);
|
|
15
14
|
const message = (error) => error instanceof Error ? error.message : String(error);
|
|
15
|
+
export function deployedUi(value) {
|
|
16
|
+
const url = new URL(value);
|
|
17
|
+
if (url.username || url.password || url.pathname !== '/' || url.search || url.hash || (url.protocol !== 'https:' && !(url.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname))))
|
|
18
|
+
throw new Error('--ui에는 경로·쿼리 없는 HTTPS 웹 주소를 지정하세요. 로컬 개발 주소는 HTTP도 가능합니다.');
|
|
19
|
+
return url;
|
|
20
|
+
}
|
|
16
21
|
export async function startWeb(options = {}) {
|
|
22
|
+
const ui = options.ui ? deployedUi(options.ui) : undefined;
|
|
23
|
+
const remoteToken = ui ? randomBytes(32).toString('hex') : undefined;
|
|
17
24
|
const start = await realpath(resolve(options.start ?? homedir()));
|
|
18
25
|
if (!(await stat(start)).isDirectory())
|
|
19
26
|
throw new Error('시작 경로가 폴더가 아닙니다.');
|
|
20
27
|
const token = randomBytes(32).toString('hex');
|
|
28
|
+
const previewNonce = randomBytes(24).toString('hex');
|
|
21
29
|
let origin = '';
|
|
22
30
|
const allowedHosts = new Set();
|
|
23
|
-
let busy = false;
|
|
24
|
-
let picking = false;
|
|
25
31
|
const assetsRoot = fileURLToPath(new URL('../../dist/web/assets/', import.meta.url));
|
|
26
|
-
const
|
|
27
|
-
|
|
32
|
+
const api = createWorkspaceApi({ start, previewNonce, syncRunner: options.syncRunner,
|
|
33
|
+
pickFolder: options.pickFolder ?? chooseFolder,
|
|
34
|
+
open: async (path) => { const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'explorer.exe' : 'xdg-open'; await execute(command, [path], { timeout: 10_000 }); },
|
|
35
|
+
convert: async (args) => {
|
|
36
|
+
const source = import.meta.url.endsWith('.ts');
|
|
37
|
+
const worker = fileURLToPath(new URL(source ? '../conversion/worker.ts' : '../conversion/worker.js', import.meta.url));
|
|
38
|
+
return execute(process.execPath, [...(source ? process.execArgv : []), worker, ...args], { env: { ...process.env, NO_COLOR: '1' }, timeout: 120_000, maxBuffer: 2 * 1024 * 1024 });
|
|
39
|
+
},
|
|
40
|
+
});
|
|
28
41
|
const server = createServer(async (req, res) => {
|
|
29
42
|
const json = (status, value) => {
|
|
30
43
|
res.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
@@ -32,12 +45,39 @@ export async function startWeb(options = {}) {
|
|
|
32
45
|
};
|
|
33
46
|
res.setHeader('Cache-Control', 'no-store');
|
|
34
47
|
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
35
|
-
res.setHeader('Content-Security-Policy',
|
|
48
|
+
res.setHeader('Content-Security-Policy', `default-src 'self'; script-src 'self' 'nonce-${previewNonce}'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-src 'self'; font-src 'self'; worker-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'`);
|
|
49
|
+
const remote = !!req.headers.origin && req.headers.origin === ui?.origin;
|
|
36
50
|
if (!req.headers.host || !allowedHosts.has(req.headers.host)
|
|
37
|
-
|| (req.headers.origin && req.headers.origin !== `http://${req.headers.host}`)) {
|
|
51
|
+
|| (req.headers.origin && !remote && req.headers.origin !== `http://${req.headers.host}`)) {
|
|
38
52
|
json(403, { error: '이 웹 화면에서만 요청할 수 있습니다.' });
|
|
39
53
|
return;
|
|
40
54
|
}
|
|
55
|
+
if (remote) {
|
|
56
|
+
res.setHeader('Access-Control-Allow-Origin', ui.origin);
|
|
57
|
+
res.setHeader('Vary', 'Origin');
|
|
58
|
+
if (!req.url?.startsWith('/api/')) {
|
|
59
|
+
json(403, { error: '로컬 API만 연결할 수 있습니다.' });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (req.method === 'OPTIONS') {
|
|
63
|
+
const headers = String(req.headers['access-control-request-headers'] ?? '').toLowerCase().split(',').map(s => s.trim()).filter(Boolean);
|
|
64
|
+
if (!['GET', 'POST'].includes(String(req.headers['access-control-request-method'])) || headers.some(h => !['x-csync-token', 'content-type'].includes(h))) {
|
|
65
|
+
json(403, { error: '허용되지 않은 연결 요청입니다.' });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
|
|
69
|
+
res.setHeader('Access-Control-Allow-Headers', 'X-Csync-Token, Content-Type');
|
|
70
|
+
if (req.headers['access-control-request-private-network'] === 'true')
|
|
71
|
+
res.setHeader('Access-Control-Allow-Private-Network', 'true');
|
|
72
|
+
res.writeHead(204);
|
|
73
|
+
res.end();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (req.headers['x-csync-token'] !== remoteToken) {
|
|
77
|
+
json(403, { error: '로컬 실행기 연결이 만료되었습니다. 실행기의 연결 링크로 다시 연결하세요.' });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
41
81
|
try {
|
|
42
82
|
const url = new URL(req.url ?? '/', origin);
|
|
43
83
|
if (req.method === 'GET' && url.pathname === '/') {
|
|
@@ -47,11 +87,11 @@ export async function startWeb(options = {}) {
|
|
|
47
87
|
}
|
|
48
88
|
if (req.method === 'GET' && url.pathname.startsWith('/assets/')) {
|
|
49
89
|
const path = resolve(assetsRoot, decodeURIComponent(url.pathname.slice('/assets/'.length)));
|
|
50
|
-
if (!
|
|
90
|
+
if (!path.startsWith(assetsRoot)) {
|
|
51
91
|
json(403, { error: '잘못된 파일 경로입니다.' });
|
|
52
92
|
return;
|
|
53
93
|
}
|
|
54
|
-
const types = { '.js': 'text/javascript', '.css': 'text/css', '.ttf': 'font/ttf' };
|
|
94
|
+
const types = { '.js': 'text/javascript', '.css': 'text/css', '.ttf': 'font/ttf', '.png': 'image/png', '.svg': 'image/svg+xml', '.txt': 'text/plain; charset=utf-8' };
|
|
55
95
|
if (!types[extname(path)]) {
|
|
56
96
|
json(404, { error: '없는 파일입니다.' });
|
|
57
97
|
return;
|
|
@@ -60,238 +100,32 @@ export async function startWeb(options = {}) {
|
|
|
60
100
|
res.end(await readFile(path));
|
|
61
101
|
return;
|
|
62
102
|
}
|
|
63
|
-
if (req.headers['x-csync-token'] !== token) {
|
|
103
|
+
if (!remote && req.headers['x-csync-token'] !== token) {
|
|
64
104
|
json(403, { error: '페이지를 새로고침해 주세요.' });
|
|
65
105
|
return;
|
|
66
106
|
}
|
|
67
|
-
if (req.method === 'GET' && url.pathname === '/api/
|
|
68
|
-
json(200, {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (req.method === 'GET' && url.pathname === '/api/browse') {
|
|
72
|
-
const path = await realpath(url.searchParams.get('path') || start);
|
|
73
|
-
const entries = (await readdir(path, { withFileTypes: true }))
|
|
74
|
-
.filter(e => !e.name.startsWith('.') && e.name !== 'node_modules' && (e.isDirectory() || (e.isFile() && /\.md$/i.test(e.name))))
|
|
75
|
-
.map(e => ({ name: e.name, path: join(path, e.name), directory: e.isDirectory() }))
|
|
76
|
-
.sort((a, b) => Number(b.directory) - Number(a.directory) || a.name.localeCompare(b.name, 'ko'));
|
|
77
|
-
json(200, { path, parent: dirname(path), home: homedir(), entries });
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (req.method === 'GET' && url.pathname === '/api/search') {
|
|
81
|
-
const root = await realpath(url.searchParams.get('path') || start);
|
|
82
|
-
const query = (url.searchParams.get('q') || '').trim().normalize('NFC').toLocaleLowerCase();
|
|
83
|
-
if (!(await stat(root)).isDirectory())
|
|
84
|
-
throw new Error('검색 기준 폴더를 확인해 주세요.');
|
|
85
|
-
const entries = [];
|
|
86
|
-
let skipped = 0;
|
|
87
|
-
const pending = query ? [root] : [];
|
|
88
|
-
while (pending.length) {
|
|
89
|
-
if (res.destroyed)
|
|
90
|
-
return;
|
|
91
|
-
const dir = pending.pop();
|
|
92
|
-
let children;
|
|
93
|
-
try {
|
|
94
|
-
children = await readdir(dir, { withFileTypes: true });
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
if (dir === root)
|
|
98
|
-
throw error;
|
|
99
|
-
skipped++;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
for (const entry of children) {
|
|
103
|
-
if (entry.name.startsWith('.') || entry.name === 'node_modules')
|
|
104
|
-
continue;
|
|
105
|
-
const path = join(dir, entry.name);
|
|
106
|
-
// Do not follow symlinks: avoid cycles and paths outside the selected tree.
|
|
107
|
-
if (entry.isDirectory())
|
|
108
|
-
pending.push(path);
|
|
109
|
-
else if (entry.isFile() && /\.md$/i.test(entry.name)
|
|
110
|
-
&& entry.name.normalize('NFC').toLocaleLowerCase().includes(query)) {
|
|
111
|
-
entries.push({ name: entry.name, path, relativePath: relative(root, path), directory: false });
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
entries.sort((a, b) => a.relativePath.localeCompare(b.relativePath, 'ko'));
|
|
116
|
-
json(200, { root, entries, skipped });
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (req.method !== 'POST' || !['/api/convert', '/api/open', '/api/pick-folder', '/api/sync/config', '/api/sync/preview', '/api/sync/push'].includes(url.pathname)) {
|
|
120
|
-
json(404, { error: '없는 요청입니다.' });
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (!req.headers['content-type']?.startsWith('application/json')) {
|
|
124
|
-
json(415, { error: 'JSON 요청이 필요합니다.' });
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
let raw = '';
|
|
128
|
-
for await (const chunk of req) {
|
|
129
|
-
raw += chunk;
|
|
130
|
-
if (Buffer.byteLength(raw) > 16_384) {
|
|
131
|
-
json(413, { error: '요청이 너무 큽니다.' });
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
const body = JSON.parse(raw);
|
|
136
|
-
if (!body || typeof body !== 'object' || Array.isArray(body))
|
|
137
|
-
throw new Error('요청 내용을 확인해 주세요.');
|
|
138
|
-
if (url.pathname === '/api/sync/config') {
|
|
139
|
-
if (typeof body.base !== 'string' || typeof body.envFile !== 'string')
|
|
140
|
-
throw new Error('설정 경로를 확인해 주세요.');
|
|
141
|
-
json(200, await sync.config(body.base, body.envFile));
|
|
107
|
+
if (req.method === 'GET' && url.pathname === '/api/connection') {
|
|
108
|
+
json(200, { version: readPkgVersion(), mode: remote ? 'connector' : 'local' });
|
|
142
109
|
return;
|
|
143
110
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
111
|
+
let body;
|
|
112
|
+
if (req.method === 'POST') {
|
|
113
|
+
if (!req.headers['content-type']?.startsWith('application/json')) {
|
|
114
|
+
json(415, { error: 'JSON 요청이 필요합니다.' });
|
|
147
115
|
return;
|
|
148
116
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
json(409, { error: '이미 열린 폴더 다이얼로그를 먼저 닫아 주세요.' });
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
if (body.kind !== 'base' && body.kind !== 'out' && body.kind !== 'reference')
|
|
159
|
-
throw new Error('폴더 선택 용도를 확인해 주세요.');
|
|
160
|
-
let initial = start;
|
|
161
|
-
if (typeof body.start === 'string' && body.start) {
|
|
162
|
-
try {
|
|
163
|
-
const path = await realpath(body.start);
|
|
164
|
-
if ((await stat(path)).isDirectory())
|
|
165
|
-
initial = path;
|
|
117
|
+
let raw = '';
|
|
118
|
+
for await (const chunk of req) {
|
|
119
|
+
raw += chunk;
|
|
120
|
+
if (Buffer.byteLength(raw) > 16_384) {
|
|
121
|
+
json(413, { error: '요청이 너무 큽니다.' });
|
|
122
|
+
return;
|
|
166
123
|
}
|
|
167
|
-
catch { /* Use initial folder for new paths. */ }
|
|
168
|
-
}
|
|
169
|
-
if (picking) {
|
|
170
|
-
json(409, { error: '이미 열린 폴더 다이얼로그를 먼저 닫아 주세요.' });
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
picking = true;
|
|
174
|
-
try {
|
|
175
|
-
const selected = await (options.pickFolder ?? chooseFolder)(initial, body.kind === 'reference' ? '참조 문서의 동기화 폴더 선택' : body.kind === 'base' ? '문서의 기준 폴더 선택' : '변환 결과를 저장할 출력 폴더 선택');
|
|
176
|
-
const path = selected ? await realpath(selected) : null;
|
|
177
|
-
if (path && !(await stat(path)).isDirectory())
|
|
178
|
-
throw new Error('폴더를 선택해 주세요.');
|
|
179
|
-
json(200, { path });
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
picking = false;
|
|
183
|
-
}
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
if (url.pathname === '/api/open') {
|
|
187
|
-
if (typeof body.path !== 'string' || !results.has(body.path))
|
|
188
|
-
throw new Error('이번 실행에서 저장한 결과만 열 수 있습니다.');
|
|
189
|
-
const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'explorer.exe' : 'xdg-open';
|
|
190
|
-
await execute(command, [body.path], { timeout: 10_000 });
|
|
191
|
-
json(200, { ok: true });
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (busy || sync.running()) {
|
|
195
|
-
json(409, { error: '다른 작업이 진행 중입니다. 완료 후 다시 시도해 주세요.' });
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (typeof body.base !== 'string' || typeof body.file !== 'string'
|
|
199
|
-
|| !['markdown', 'obsidian', 'repair'].includes(body.to)
|
|
200
|
-
|| typeof body.fix !== 'boolean' || typeof body.preview !== 'boolean')
|
|
201
|
-
throw new Error('변환 옵션을 확인해 주세요.');
|
|
202
|
-
const browseBase = await realpath(body.base);
|
|
203
|
-
const file = await realpath(body.file);
|
|
204
|
-
const scope = body.scope ?? 'legacy';
|
|
205
|
-
if (!['file', 'folder', 'legacy'].includes(scope))
|
|
206
|
-
throw new Error('파일 또는 폴더를 선택해 주세요.');
|
|
207
|
-
const info = await stat(file);
|
|
208
|
-
if (!(await stat(browseBase)).isDirectory() || !within(browseBase, file)
|
|
209
|
-
|| (scope === 'folder' ? !info.isDirectory() : !info.isFile() || !/\.md$/i.test(file))) {
|
|
210
|
-
throw new Error('탐색 폴더 안의 Markdown 파일 또는 폴더를 선택해 주세요.');
|
|
211
|
-
}
|
|
212
|
-
const components = relative(browseBase, file).split(/[\\/]/);
|
|
213
|
-
if ((scope === 'folder' ? components : components.slice(0, -1)).some(p => p.startsWith('.') || p === 'node_modules')) {
|
|
214
|
-
throw new Error('숨김 폴더와 node_modules 안의 문서는 변환 대상이 아닙니다.');
|
|
215
|
-
}
|
|
216
|
-
const base = scope === 'legacy' ? browseBase : scope === 'folder' ? file : dirname(file);
|
|
217
|
-
if (dirname(base) === base)
|
|
218
|
-
throw new Error('문서가 있는 하위 폴더를 선택해 주세요.');
|
|
219
|
-
const documents = scope === 'folder' ? collectMarkdown(file) : [file];
|
|
220
|
-
if (!documents.length)
|
|
221
|
-
throw new Error('선택한 폴더에 변환할 Markdown 문서가 없습니다.');
|
|
222
|
-
if (body.out !== undefined && typeof body.out !== 'string')
|
|
223
|
-
throw new Error('출력 경로를 확인해 주세요.');
|
|
224
|
-
const approved = body.approvedOverwrites ?? {};
|
|
225
|
-
if (!approved || typeof approved !== 'object' || Array.isArray(approved)
|
|
226
|
-
|| Object.values(approved).some(value => typeof value !== 'string' || !/^[a-f0-9]{64}$/.test(value)))
|
|
227
|
-
throw new Error('덮어쓰기 확인 정보를 확인해 주세요.');
|
|
228
|
-
const requestedOut = body.out?.trim() ? await canonical(resolve(body.out.trim())) : null;
|
|
229
|
-
if (requestedOut && (within(base, requestedOut) || within(requestedOut, base))) {
|
|
230
|
-
throw new Error('출력 폴더는 기준 폴더와 겹치지 않는 별도 경로로 지정해 주세요.');
|
|
231
|
-
}
|
|
232
|
-
// Validation above awaits filesystem reads; another request may have acquired the slot.
|
|
233
|
-
if (busy || sync.running()) {
|
|
234
|
-
json(409, { error: '다른 작업이 진행 중입니다. 완료 후 다시 시도해 주세요.' });
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
busy = true;
|
|
238
|
-
let out;
|
|
239
|
-
let destination = null;
|
|
240
|
-
let generatedDestination = false;
|
|
241
|
-
let response;
|
|
242
|
-
let responseStatus = 200;
|
|
243
|
-
let saved;
|
|
244
|
-
try {
|
|
245
|
-
out = await mkdtemp(join(tmpdir(), 'csync-preview-'));
|
|
246
|
-
const args = ['--base', base, file, '--out', out];
|
|
247
|
-
if (body.to !== 'repair')
|
|
248
|
-
args.push('--to', body.to);
|
|
249
|
-
if (body.fix || body.to === 'repair')
|
|
250
|
-
args.push('--fix');
|
|
251
|
-
const fromSource = import.meta.url.endsWith('.ts');
|
|
252
|
-
const worker = fileURLToPath(new URL(fromSource ? '../conversion/worker.ts' : '../conversion/worker.js', import.meta.url));
|
|
253
|
-
const { stdout } = await execute(process.execPath, [...(fromSource ? process.execArgv : []), worker, ...args], {
|
|
254
|
-
env: { ...process.env, NO_COLOR: '1' }, timeout: 120_000, maxBuffer: 2 * 1024 * 1024,
|
|
255
|
-
});
|
|
256
|
-
const readPreview = async (path) => {
|
|
257
|
-
if ((await stat(path)).size > 200_000)
|
|
258
|
-
return '문서가 200KB를 넘어 본문 미리보기를 생략합니다.';
|
|
259
|
-
return readFile(path, 'utf8');
|
|
260
|
-
};
|
|
261
|
-
const previews = await Promise.all(documents.slice(0, 20).map(async (path) => ({
|
|
262
|
-
path: relative(base, path), before: await readPreview(path), after: await readPreview(join(out, relative(base, path))),
|
|
263
|
-
})));
|
|
264
|
-
const { before, after } = previews[0];
|
|
265
|
-
if (!body.preview) {
|
|
266
|
-
destination = requestedOut ?? await mkdtemp(join(dirname(base), `${basename(base)}-converted-`));
|
|
267
|
-
generatedDestination = !requestedOut;
|
|
268
|
-
saved = await publishOutput(out, destination, approved);
|
|
269
|
-
results.add(destination);
|
|
270
124
|
}
|
|
271
|
-
|
|
125
|
+
body = JSON.parse(raw);
|
|
272
126
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
await rm(destination, { recursive: true, force: true });
|
|
276
|
-
if (error instanceof OverwriteRequired) {
|
|
277
|
-
responseStatus = 409;
|
|
278
|
-
response = { error: error.message, code: 'OVERWRITE_REQUIRED', conflicts: error.conflicts };
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
const failure = error;
|
|
282
|
-
throw new Error(failure.killed ? '변환 시간이 2분을 초과했습니다.' : failure.stderr?.trim() || message(error));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
finally {
|
|
286
|
-
try {
|
|
287
|
-
if (out)
|
|
288
|
-
await rm(out, { recursive: true, force: true });
|
|
289
|
-
}
|
|
290
|
-
finally {
|
|
291
|
-
busy = false;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
json(responseStatus, response);
|
|
127
|
+
const response = await api.request(req.method ?? 'GET', url, body);
|
|
128
|
+
json(response.status, response.body);
|
|
295
129
|
}
|
|
296
130
|
catch (error) {
|
|
297
131
|
if (!res.writableEnded)
|
|
@@ -327,19 +161,30 @@ export async function startWeb(options = {}) {
|
|
|
327
161
|
throw error;
|
|
328
162
|
}
|
|
329
163
|
}
|
|
330
|
-
|
|
164
|
+
if (ui)
|
|
165
|
+
ui.hash = new URLSearchParams({ csyncEndpoint: origin, csyncToken: remoteToken }).toString();
|
|
166
|
+
return { server, url: origin, token, isRunning: api.isRunning, connectUrl: ui?.href };
|
|
331
167
|
}
|
|
332
168
|
export async function runWeb(argv) {
|
|
169
|
+
if (argv.includes('--hosted')) {
|
|
170
|
+
const { runHostedWeb } = await import('./hosted.js');
|
|
171
|
+
return runHostedWeb(argv);
|
|
172
|
+
}
|
|
333
173
|
const value = (name) => { const i = argv.indexOf(name); return i < 0 ? undefined : argv[i + 1]; };
|
|
334
174
|
const port = Number(value('--port') ?? 4318);
|
|
335
175
|
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
336
176
|
throw new Error('--port는 1~65535 사이의 숫자여야 합니다.');
|
|
337
|
-
const
|
|
177
|
+
const ui = value('--ui');
|
|
178
|
+
if (argv.includes('--ui') && !ui)
|
|
179
|
+
throw new Error('--ui 뒤에 배포 웹 주소를 지정하세요.');
|
|
180
|
+
const { url, server, connectUrl } = await startWeb({ start: value('--base'), port, ui });
|
|
338
181
|
console.log(`문서 웹: ${url}\n로컬 주소: ${url.replace('127.0.0.1', 'localhost')}\n종료: Ctrl+C`);
|
|
182
|
+
if (connectUrl)
|
|
183
|
+
console.log(`배포 웹 연결: ${connectUrl}\n이 웹에 로컬 파일 작업 권한을 부여합니다. 연결 링크는 공유하지 마세요. csync 종료 시 연결 권한도 만료됩니다.`);
|
|
339
184
|
if (!argv.includes('--no-open')) {
|
|
340
185
|
const command = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'explorer.exe' : 'xdg-open';
|
|
341
|
-
const child = spawn(command, [url], { stdio: 'ignore' });
|
|
342
|
-
child.on('error', () => console.log(
|
|
186
|
+
const child = spawn(command, [connectUrl ?? url], { stdio: 'ignore' });
|
|
187
|
+
child.on('error', () => console.log('브라우저 자동 열기에 실패했습니다. 위 주소로 접속해 주세요.'));
|
|
343
188
|
child.unref();
|
|
344
189
|
}
|
|
345
190
|
await new Promise(done => server.once('close', done));
|