wiki-viewer 1.2.0 → 1.3.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.html +1 -1
- package/.next/standalone/.next/server/app/signin.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/signin/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/signin.segments/signin.segment.rsc +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/README.md +7 -1
- package/.next/standalone/bin/wiki-viewer.js +181 -0
- package/.next/standalone/package.json +1 -1
- package/README.md +7 -1
- package/bin/wiki-viewer.js +181 -0
- package/package.json +1 -1
- /package/.next/standalone/.next/static/{Rg1RfvRWNzfcK3n1DDIQs → R5pAJFCIncBd90BC7hUpr}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{Rg1RfvRWNzfcK3n1DDIQs → R5pAJFCIncBd90BC7hUpr}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{Rg1RfvRWNzfcK3n1DDIQs → R5pAJFCIncBd90BC7hUpr}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/0ocp.6r7w_saw.js"/><script src="/_next/static/chunks/0quh-cfcrp2ib.js" async=""></script><script src="/_next/static/chunks/0vp-ahhagxptc.js" async=""></script><script src="/_next/static/chunks/turbopack-12~z-mr7b9b50.js" async=""></script><script src="/_next/static/chunks/057umwogp53v_.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/0ocp.6r7w_saw.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[902063,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n3:I[259666,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\"]\n4:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"ViewportBoundary\"]\na:I[62711,[\"/_next/static/chunks/057umwogp53v_.js\"],\"MetadataBoundary\"]\nc:I[514743,[\"/_next/static/chunks/057umwogp53v_.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"R5pAJFCIncBd90BC7hUpr\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"
|
|
1
|
+
self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"o6PnydZ24z6qATK/oQuAoqO6Ur7OwwgwnEjRf9k2IFw=\"\n}"
|
|
@@ -47,7 +47,11 @@ Single-user, no-auth mode still works. Auth turns on automatically once anyone s
|
|
|
47
47
|
## Quick start
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
#
|
|
50
|
+
# Guided setup: directory, host/port, HTTPS, app settings, and optional
|
|
51
|
+
# install as a reboot-persistent service. Recommended for first run.
|
|
52
|
+
npx wiki-viewer init
|
|
53
|
+
|
|
54
|
+
# Or run directly. Point it at a directory
|
|
51
55
|
npx wiki-viewer ~/notes
|
|
52
56
|
|
|
53
57
|
# No directory? Pick one in the browser
|
|
@@ -57,6 +61,8 @@ npx wiki-viewer
|
|
|
57
61
|
npx wiki-viewer ~/notes --https
|
|
58
62
|
```
|
|
59
63
|
|
|
64
|
+
The wizard walks you through every option and writes `~/.wiki-viewer/config.json`, so you do not have to remember flags. You can re-run it any time, or edit the config with `wiki-viewer config set`.
|
|
65
|
+
|
|
60
66
|
Open **http://localhost:3000** (or **https://localhost:3000** with `--https`).
|
|
61
67
|
|
|
62
68
|
To switch the served directory later, click **Change** at the bottom of the sidebar and pick a new folder. No restart needed.
|
|
@@ -7,6 +7,8 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync } from "node
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { stdin, stdout } from "node:process";
|
|
10
12
|
|
|
11
13
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
14
|
const appRoot = path.resolve(__dirname, "..");
|
|
@@ -34,6 +36,7 @@ function printUsage() {
|
|
|
34
36
|
console.error(" -e, --env <KEY=VALUE> Set an app env var (repeatable; persisted with service install)");
|
|
35
37
|
console.error("");
|
|
36
38
|
console.error("Commands:");
|
|
39
|
+
console.error(" init Interactive setup wizard (dir, host/port, https, env, service)");
|
|
37
40
|
console.error(" service install [dir] [options] Install as a user service (persists across reboot)");
|
|
38
41
|
console.error(" service uninstall Remove the user service");
|
|
39
42
|
console.error(" service status Show service status");
|
|
@@ -46,6 +49,7 @@ function printUsage() {
|
|
|
46
49
|
console.error(" update Update wiki-viewer to the latest version and restart");
|
|
47
50
|
console.error("");
|
|
48
51
|
console.error("Examples:");
|
|
52
|
+
console.error(" wiki-viewer init");
|
|
49
53
|
console.error(" wiki-viewer ~/notes");
|
|
50
54
|
console.error(" wiki-viewer ~/notes --https");
|
|
51
55
|
console.error(" wiki-viewer ~/notes -p 8080 -H 0.0.0.0");
|
|
@@ -689,6 +693,170 @@ function update() {
|
|
|
689
693
|
console.log("Update complete.");
|
|
690
694
|
}
|
|
691
695
|
|
|
696
|
+
// ── interactive setup wizard ──────────────────────────────────────────────
|
|
697
|
+
|
|
698
|
+
// Common app env vars worth offering during setup. Anything not listed can
|
|
699
|
+
// still be added later with `wiki-viewer config set KEY=VALUE`.
|
|
700
|
+
const WIZARD_ENV_VARS = [
|
|
701
|
+
{ key: "AUTH_ALLOWED_DOMAIN", hint: "Restrict signup to an email domain, e.g. example.com" },
|
|
702
|
+
{ key: "AUTH_ALLOWED_EMAILS", hint: "Restrict signup to specific emails (comma-separated)" },
|
|
703
|
+
{ key: "GOOGLE_CLIENT_ID", hint: "Google OAuth client ID (enables Google sign-in)" },
|
|
704
|
+
{ key: "GOOGLE_CLIENT_SECRET", hint: "Google OAuth client secret" },
|
|
705
|
+
{ key: "WIKI_OWNER_HOSTS", hint: "Extra hostnames trusted for the AI panel owner cookie" },
|
|
706
|
+
{ key: "AGENT_RATE_LIMIT", hint: "Per-minute agent API rate limit (default 60)" },
|
|
707
|
+
];
|
|
708
|
+
|
|
709
|
+
// A prompt helper that survives piped (non-TTY) stdin. node:readline/promises
|
|
710
|
+
// closes the stream between awaited questions when input is piped, so we buffer
|
|
711
|
+
// every line via the 'line' event and hand them out one at a time instead.
|
|
712
|
+
function makePrompter() {
|
|
713
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
714
|
+
const queue = [];
|
|
715
|
+
const waiters = [];
|
|
716
|
+
let closed = false;
|
|
717
|
+
|
|
718
|
+
rl.on("line", (line) => {
|
|
719
|
+
if (waiters.length) waiters.shift()(line);
|
|
720
|
+
else queue.push(line);
|
|
721
|
+
});
|
|
722
|
+
rl.on("close", () => {
|
|
723
|
+
closed = true;
|
|
724
|
+
while (waiters.length) waiters.shift()(null);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
const nextLine = () =>
|
|
728
|
+
new Promise((resolve) => {
|
|
729
|
+
if (queue.length) resolve(queue.shift());
|
|
730
|
+
else if (closed) resolve(null);
|
|
731
|
+
else waiters.push(resolve);
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
const prompt = async (text) => {
|
|
735
|
+
stdout.write(text);
|
|
736
|
+
const line = await nextLine();
|
|
737
|
+
return line == null ? "" : line;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
return { prompt, close: () => rl.close() };
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
async function runWizard() {
|
|
744
|
+
const io = makePrompter();
|
|
745
|
+
const existing = loadConfig();
|
|
746
|
+
|
|
747
|
+
const ask = async (label, def) => {
|
|
748
|
+
const suffix = def ? ` [${def}]` : "";
|
|
749
|
+
const answer = (await io.prompt(`${label}${suffix}: `)).trim();
|
|
750
|
+
return answer || def || "";
|
|
751
|
+
};
|
|
752
|
+
const askYesNo = async (label, defYes) => {
|
|
753
|
+
const def = defYes ? "Y/n" : "y/N";
|
|
754
|
+
const answer = (await io.prompt(`${label} [${def}]: `)).trim().toLowerCase();
|
|
755
|
+
if (!answer) return defYes;
|
|
756
|
+
return answer === "y" || answer === "yes";
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
try {
|
|
760
|
+
console.log("\nwiki-viewer setup\n");
|
|
761
|
+
console.log("Answer a few questions. Press Enter to accept the [default].\n");
|
|
762
|
+
|
|
763
|
+
// 1. directory
|
|
764
|
+
const dirInput = await ask(
|
|
765
|
+
"Directory to serve (blank = choose later in the browser)",
|
|
766
|
+
existing.rootDir ?? process.cwd(),
|
|
767
|
+
);
|
|
768
|
+
const rootDir = dirInput ? path.resolve(dirInput) : null;
|
|
769
|
+
if (rootDir && !existsSync(rootDir)) {
|
|
770
|
+
console.log(` Note: ${rootDir} does not exist yet; it will be served once created.`);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// 2. host
|
|
774
|
+
const host = await ask(
|
|
775
|
+
"Host to bind (localhost for this machine only, 0.0.0.0 for the network)",
|
|
776
|
+
existing.host ?? "localhost",
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
// 3. port
|
|
780
|
+
const port = await ask("Port", String(existing.port ?? "3000"));
|
|
781
|
+
|
|
782
|
+
// 4. https
|
|
783
|
+
const httpsDefault = existing.https ?? (!isLocalHost(host) && host !== "0.0.0.0");
|
|
784
|
+
const useHttps = await askYesNo(
|
|
785
|
+
"Enable HTTPS? (recommended for any non-localhost access)",
|
|
786
|
+
Boolean(httpsDefault),
|
|
787
|
+
);
|
|
788
|
+
|
|
789
|
+
// 5. app env vars
|
|
790
|
+
const env = { ...(existing.env ?? {}) };
|
|
791
|
+
const wantEnv = await askYesNo(
|
|
792
|
+
"\nConfigure app settings now? (OAuth, signup allowlist, rate limit)",
|
|
793
|
+
false,
|
|
794
|
+
);
|
|
795
|
+
if (wantEnv) {
|
|
796
|
+
console.log("Leave blank to skip a setting.\n");
|
|
797
|
+
for (const { key, hint } of WIZARD_ENV_VARS) {
|
|
798
|
+
const cur = env[key];
|
|
799
|
+
const val = await ask(` ${key} — ${hint}`, cur);
|
|
800
|
+
if (val) env[key] = val;
|
|
801
|
+
else delete env[key];
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Build and preview the config.
|
|
806
|
+
const cfg = {
|
|
807
|
+
rootDir,
|
|
808
|
+
host,
|
|
809
|
+
port,
|
|
810
|
+
https: useHttps,
|
|
811
|
+
...(Object.keys(env).length ? { env } : {}),
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
console.log("\nConfiguration:");
|
|
815
|
+
console.log(` directory : ${rootDir ?? "(choose in browser)"}`);
|
|
816
|
+
console.log(` host : ${host}`);
|
|
817
|
+
console.log(` port : ${port}`);
|
|
818
|
+
console.log(` https : ${useHttps}`);
|
|
819
|
+
if (cfg.env) console.log(` app env : ${Object.keys(cfg.env).join(", ")}`);
|
|
820
|
+
|
|
821
|
+
// Secure-context guidance before committing.
|
|
822
|
+
const { warnings } = computeServerEnv({ host, port: String(port), useHttps, configEnv: cfg.env ?? {} });
|
|
823
|
+
for (const w of warnings) console.log(`\n⚠️ ${w}`);
|
|
824
|
+
|
|
825
|
+
// 6. what to do now
|
|
826
|
+
console.log("");
|
|
827
|
+
console.log("What next?");
|
|
828
|
+
console.log(" 1) Install as a service (starts now and on every reboot)");
|
|
829
|
+
console.log(" 2) Run once now (foreground)");
|
|
830
|
+
console.log(" 3) Save config only");
|
|
831
|
+
const choice = (await io.prompt("Choose [1/2/3]: ")).trim() || "1";
|
|
832
|
+
|
|
833
|
+
saveConfig(cfg);
|
|
834
|
+
console.log(`\nSaved ${configPath}`);
|
|
835
|
+
|
|
836
|
+
io.close();
|
|
837
|
+
|
|
838
|
+
if (choice === "1") {
|
|
839
|
+
const p = platform();
|
|
840
|
+
if (!p) {
|
|
841
|
+
console.log("Service install is only supported on Linux and macOS.");
|
|
842
|
+
console.log("Run it yourself with: wiki-viewer service run");
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (p === "linux") installSystemd();
|
|
846
|
+
else installLaunchd();
|
|
847
|
+
} else if (choice === "2") {
|
|
848
|
+
start(resolveRunOptions([]));
|
|
849
|
+
} else {
|
|
850
|
+
console.log("\nStart it any time with:");
|
|
851
|
+
console.log(" wiki-viewer service install # persistent service");
|
|
852
|
+
console.log(" wiki-viewer service run # run from this config");
|
|
853
|
+
}
|
|
854
|
+
} finally {
|
|
855
|
+
// io may already be closed; closing twice is a no-op.
|
|
856
|
+
io.close();
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
692
860
|
// ── dispatch ──────────────────────────────────────────────────────────────
|
|
693
861
|
|
|
694
862
|
const argv = process.argv.slice(2);
|
|
@@ -720,10 +888,23 @@ switch (cmd) {
|
|
|
720
888
|
case "config":
|
|
721
889
|
configCommand(rest);
|
|
722
890
|
break;
|
|
891
|
+
case "init":
|
|
892
|
+
case "setup":
|
|
893
|
+
runWizard();
|
|
894
|
+
break;
|
|
723
895
|
case "update":
|
|
724
896
|
update();
|
|
725
897
|
break;
|
|
726
898
|
default:
|
|
899
|
+
if (argv.includes("--setup") || argv.includes("--init")) {
|
|
900
|
+
runWizard();
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
727
903
|
// No recognized command → ad-hoc serve (directory + flags only).
|
|
904
|
+
// On a bare interactive run, point users at the guided setup first.
|
|
905
|
+
if (argv.length === 0 && stdin.isTTY) {
|
|
906
|
+
console.log("Tip: run `wiki-viewer init` for guided setup (directory, host/port, HTTPS,");
|
|
907
|
+
console.log(" app settings, and optional install as a reboot-persistent service).\n");
|
|
908
|
+
}
|
|
728
909
|
start(resolveServeOptions(argv));
|
|
729
910
|
}
|
package/README.md
CHANGED
|
@@ -47,7 +47,11 @@ Single-user, no-auth mode still works. Auth turns on automatically once anyone s
|
|
|
47
47
|
## Quick start
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
#
|
|
50
|
+
# Guided setup: directory, host/port, HTTPS, app settings, and optional
|
|
51
|
+
# install as a reboot-persistent service. Recommended for first run.
|
|
52
|
+
npx wiki-viewer init
|
|
53
|
+
|
|
54
|
+
# Or run directly. Point it at a directory
|
|
51
55
|
npx wiki-viewer ~/notes
|
|
52
56
|
|
|
53
57
|
# No directory? Pick one in the browser
|
|
@@ -57,6 +61,8 @@ npx wiki-viewer
|
|
|
57
61
|
npx wiki-viewer ~/notes --https
|
|
58
62
|
```
|
|
59
63
|
|
|
64
|
+
The wizard walks you through every option and writes `~/.wiki-viewer/config.json`, so you do not have to remember flags. You can re-run it any time, or edit the config with `wiki-viewer config set`.
|
|
65
|
+
|
|
60
66
|
Open **http://localhost:3000** (or **https://localhost:3000** with `--https`).
|
|
61
67
|
|
|
62
68
|
To switch the served directory later, click **Change** at the bottom of the sidebar and pick a new folder. No restart needed.
|
package/bin/wiki-viewer.js
CHANGED
|
@@ -7,6 +7,8 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync } from "node
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
|
+
import { createInterface } from "node:readline";
|
|
11
|
+
import { stdin, stdout } from "node:process";
|
|
10
12
|
|
|
11
13
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
14
|
const appRoot = path.resolve(__dirname, "..");
|
|
@@ -34,6 +36,7 @@ function printUsage() {
|
|
|
34
36
|
console.error(" -e, --env <KEY=VALUE> Set an app env var (repeatable; persisted with service install)");
|
|
35
37
|
console.error("");
|
|
36
38
|
console.error("Commands:");
|
|
39
|
+
console.error(" init Interactive setup wizard (dir, host/port, https, env, service)");
|
|
37
40
|
console.error(" service install [dir] [options] Install as a user service (persists across reboot)");
|
|
38
41
|
console.error(" service uninstall Remove the user service");
|
|
39
42
|
console.error(" service status Show service status");
|
|
@@ -46,6 +49,7 @@ function printUsage() {
|
|
|
46
49
|
console.error(" update Update wiki-viewer to the latest version and restart");
|
|
47
50
|
console.error("");
|
|
48
51
|
console.error("Examples:");
|
|
52
|
+
console.error(" wiki-viewer init");
|
|
49
53
|
console.error(" wiki-viewer ~/notes");
|
|
50
54
|
console.error(" wiki-viewer ~/notes --https");
|
|
51
55
|
console.error(" wiki-viewer ~/notes -p 8080 -H 0.0.0.0");
|
|
@@ -689,6 +693,170 @@ function update() {
|
|
|
689
693
|
console.log("Update complete.");
|
|
690
694
|
}
|
|
691
695
|
|
|
696
|
+
// ── interactive setup wizard ──────────────────────────────────────────────
|
|
697
|
+
|
|
698
|
+
// Common app env vars worth offering during setup. Anything not listed can
|
|
699
|
+
// still be added later with `wiki-viewer config set KEY=VALUE`.
|
|
700
|
+
const WIZARD_ENV_VARS = [
|
|
701
|
+
{ key: "AUTH_ALLOWED_DOMAIN", hint: "Restrict signup to an email domain, e.g. example.com" },
|
|
702
|
+
{ key: "AUTH_ALLOWED_EMAILS", hint: "Restrict signup to specific emails (comma-separated)" },
|
|
703
|
+
{ key: "GOOGLE_CLIENT_ID", hint: "Google OAuth client ID (enables Google sign-in)" },
|
|
704
|
+
{ key: "GOOGLE_CLIENT_SECRET", hint: "Google OAuth client secret" },
|
|
705
|
+
{ key: "WIKI_OWNER_HOSTS", hint: "Extra hostnames trusted for the AI panel owner cookie" },
|
|
706
|
+
{ key: "AGENT_RATE_LIMIT", hint: "Per-minute agent API rate limit (default 60)" },
|
|
707
|
+
];
|
|
708
|
+
|
|
709
|
+
// A prompt helper that survives piped (non-TTY) stdin. node:readline/promises
|
|
710
|
+
// closes the stream between awaited questions when input is piped, so we buffer
|
|
711
|
+
// every line via the 'line' event and hand them out one at a time instead.
|
|
712
|
+
function makePrompter() {
|
|
713
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
714
|
+
const queue = [];
|
|
715
|
+
const waiters = [];
|
|
716
|
+
let closed = false;
|
|
717
|
+
|
|
718
|
+
rl.on("line", (line) => {
|
|
719
|
+
if (waiters.length) waiters.shift()(line);
|
|
720
|
+
else queue.push(line);
|
|
721
|
+
});
|
|
722
|
+
rl.on("close", () => {
|
|
723
|
+
closed = true;
|
|
724
|
+
while (waiters.length) waiters.shift()(null);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
const nextLine = () =>
|
|
728
|
+
new Promise((resolve) => {
|
|
729
|
+
if (queue.length) resolve(queue.shift());
|
|
730
|
+
else if (closed) resolve(null);
|
|
731
|
+
else waiters.push(resolve);
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
const prompt = async (text) => {
|
|
735
|
+
stdout.write(text);
|
|
736
|
+
const line = await nextLine();
|
|
737
|
+
return line == null ? "" : line;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
return { prompt, close: () => rl.close() };
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
async function runWizard() {
|
|
744
|
+
const io = makePrompter();
|
|
745
|
+
const existing = loadConfig();
|
|
746
|
+
|
|
747
|
+
const ask = async (label, def) => {
|
|
748
|
+
const suffix = def ? ` [${def}]` : "";
|
|
749
|
+
const answer = (await io.prompt(`${label}${suffix}: `)).trim();
|
|
750
|
+
return answer || def || "";
|
|
751
|
+
};
|
|
752
|
+
const askYesNo = async (label, defYes) => {
|
|
753
|
+
const def = defYes ? "Y/n" : "y/N";
|
|
754
|
+
const answer = (await io.prompt(`${label} [${def}]: `)).trim().toLowerCase();
|
|
755
|
+
if (!answer) return defYes;
|
|
756
|
+
return answer === "y" || answer === "yes";
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
try {
|
|
760
|
+
console.log("\nwiki-viewer setup\n");
|
|
761
|
+
console.log("Answer a few questions. Press Enter to accept the [default].\n");
|
|
762
|
+
|
|
763
|
+
// 1. directory
|
|
764
|
+
const dirInput = await ask(
|
|
765
|
+
"Directory to serve (blank = choose later in the browser)",
|
|
766
|
+
existing.rootDir ?? process.cwd(),
|
|
767
|
+
);
|
|
768
|
+
const rootDir = dirInput ? path.resolve(dirInput) : null;
|
|
769
|
+
if (rootDir && !existsSync(rootDir)) {
|
|
770
|
+
console.log(` Note: ${rootDir} does not exist yet; it will be served once created.`);
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// 2. host
|
|
774
|
+
const host = await ask(
|
|
775
|
+
"Host to bind (localhost for this machine only, 0.0.0.0 for the network)",
|
|
776
|
+
existing.host ?? "localhost",
|
|
777
|
+
);
|
|
778
|
+
|
|
779
|
+
// 3. port
|
|
780
|
+
const port = await ask("Port", String(existing.port ?? "3000"));
|
|
781
|
+
|
|
782
|
+
// 4. https
|
|
783
|
+
const httpsDefault = existing.https ?? (!isLocalHost(host) && host !== "0.0.0.0");
|
|
784
|
+
const useHttps = await askYesNo(
|
|
785
|
+
"Enable HTTPS? (recommended for any non-localhost access)",
|
|
786
|
+
Boolean(httpsDefault),
|
|
787
|
+
);
|
|
788
|
+
|
|
789
|
+
// 5. app env vars
|
|
790
|
+
const env = { ...(existing.env ?? {}) };
|
|
791
|
+
const wantEnv = await askYesNo(
|
|
792
|
+
"\nConfigure app settings now? (OAuth, signup allowlist, rate limit)",
|
|
793
|
+
false,
|
|
794
|
+
);
|
|
795
|
+
if (wantEnv) {
|
|
796
|
+
console.log("Leave blank to skip a setting.\n");
|
|
797
|
+
for (const { key, hint } of WIZARD_ENV_VARS) {
|
|
798
|
+
const cur = env[key];
|
|
799
|
+
const val = await ask(` ${key} — ${hint}`, cur);
|
|
800
|
+
if (val) env[key] = val;
|
|
801
|
+
else delete env[key];
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Build and preview the config.
|
|
806
|
+
const cfg = {
|
|
807
|
+
rootDir,
|
|
808
|
+
host,
|
|
809
|
+
port,
|
|
810
|
+
https: useHttps,
|
|
811
|
+
...(Object.keys(env).length ? { env } : {}),
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
console.log("\nConfiguration:");
|
|
815
|
+
console.log(` directory : ${rootDir ?? "(choose in browser)"}`);
|
|
816
|
+
console.log(` host : ${host}`);
|
|
817
|
+
console.log(` port : ${port}`);
|
|
818
|
+
console.log(` https : ${useHttps}`);
|
|
819
|
+
if (cfg.env) console.log(` app env : ${Object.keys(cfg.env).join(", ")}`);
|
|
820
|
+
|
|
821
|
+
// Secure-context guidance before committing.
|
|
822
|
+
const { warnings } = computeServerEnv({ host, port: String(port), useHttps, configEnv: cfg.env ?? {} });
|
|
823
|
+
for (const w of warnings) console.log(`\n⚠️ ${w}`);
|
|
824
|
+
|
|
825
|
+
// 6. what to do now
|
|
826
|
+
console.log("");
|
|
827
|
+
console.log("What next?");
|
|
828
|
+
console.log(" 1) Install as a service (starts now and on every reboot)");
|
|
829
|
+
console.log(" 2) Run once now (foreground)");
|
|
830
|
+
console.log(" 3) Save config only");
|
|
831
|
+
const choice = (await io.prompt("Choose [1/2/3]: ")).trim() || "1";
|
|
832
|
+
|
|
833
|
+
saveConfig(cfg);
|
|
834
|
+
console.log(`\nSaved ${configPath}`);
|
|
835
|
+
|
|
836
|
+
io.close();
|
|
837
|
+
|
|
838
|
+
if (choice === "1") {
|
|
839
|
+
const p = platform();
|
|
840
|
+
if (!p) {
|
|
841
|
+
console.log("Service install is only supported on Linux and macOS.");
|
|
842
|
+
console.log("Run it yourself with: wiki-viewer service run");
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
if (p === "linux") installSystemd();
|
|
846
|
+
else installLaunchd();
|
|
847
|
+
} else if (choice === "2") {
|
|
848
|
+
start(resolveRunOptions([]));
|
|
849
|
+
} else {
|
|
850
|
+
console.log("\nStart it any time with:");
|
|
851
|
+
console.log(" wiki-viewer service install # persistent service");
|
|
852
|
+
console.log(" wiki-viewer service run # run from this config");
|
|
853
|
+
}
|
|
854
|
+
} finally {
|
|
855
|
+
// io may already be closed; closing twice is a no-op.
|
|
856
|
+
io.close();
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
692
860
|
// ── dispatch ──────────────────────────────────────────────────────────────
|
|
693
861
|
|
|
694
862
|
const argv = process.argv.slice(2);
|
|
@@ -720,10 +888,23 @@ switch (cmd) {
|
|
|
720
888
|
case "config":
|
|
721
889
|
configCommand(rest);
|
|
722
890
|
break;
|
|
891
|
+
case "init":
|
|
892
|
+
case "setup":
|
|
893
|
+
runWizard();
|
|
894
|
+
break;
|
|
723
895
|
case "update":
|
|
724
896
|
update();
|
|
725
897
|
break;
|
|
726
898
|
default:
|
|
899
|
+
if (argv.includes("--setup") || argv.includes("--init")) {
|
|
900
|
+
runWizard();
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
727
903
|
// No recognized command → ad-hoc serve (directory + flags only).
|
|
904
|
+
// On a bare interactive run, point users at the guided setup first.
|
|
905
|
+
if (argv.length === 0 && stdin.isTTY) {
|
|
906
|
+
console.log("Tip: run `wiki-viewer init` for guided setup (directory, host/port, HTTPS,");
|
|
907
|
+
console.log(" app settings, and optional install as a reboot-persistent service).\n");
|
|
908
|
+
}
|
|
728
909
|
start(resolveServeOptions(argv));
|
|
729
910
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|