@pablopunk/webr 0.3.3 → 0.3.4
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 +1 -1
- package/dist/server/entry.mjs +1 -1
- package/package.json +1 -1
- package/server/cli.ts +14 -12
- package/server/plugin/dev.ts +1 -1
- package/server/plugin/index.ts +3 -18
- package/server/plugin/mode.ts +1 -1
- package/server/where.ts +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Zero config, PWA, with Tailscale automation out of the box.
|
|
|
45
45
|
## Install
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
|
-
npx @pablopunk/webr
|
|
48
|
+
npx @pablopunk/webr install
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
This installs the Herdr plugin, starts Webr and opens the dashboard, with Tailscale HTTPS configured automatically when it's available.
|
package/dist/server/entry.mjs
CHANGED
|
@@ -2442,7 +2442,7 @@ var pageMap = /* @__PURE__ */ new Map([
|
|
|
2442
2442
|
]);
|
|
2443
2443
|
//#endregion
|
|
2444
2444
|
//#region \0virtual:astro:manifest
|
|
2445
|
-
var _manifest = deserializeManifest({"rootDir":"file:///home/runner/work/webr/webr/","cacheDir":"file:///home/runner/work/webr/webr/node_modules/.astro/","outDir":"file:///home/runner/work/webr/webr/dist/","srcDir":"file:///home/runner/work/webr/webr/src/","publicDir":"file:///home/runner/work/webr/webr/public/","buildClientDir":"file:///home/runner/work/webr/webr/dist/client/","buildServerDir":"file:///home/runner/work/webr/webr/dist/server/","adapterName":"@astrojs/node","assetsDir":"_astro","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"page","component":"_server-islands.astro","params":["name"],"segments":[[{"content":"_server-islands","dynamic":false,"spread":false}],[{"content":"name","dynamic":true,"spread":false}]],"pattern":"^\\/_server-islands\\/([^/]+?)\\/?$","prerender":false,"isIndex":false,"fallbackRoutes":[],"route":"/_server-islands/[name]","origin":"internal","distURL":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/_image","component":"node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node.js","params":[],"pathname":"/_image","pattern":"^\\/_image\\/?$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"type":"endpoint","prerender":false,"fallbackRoutes":[],"distURL":[],"isIndex":false,"origin":"internal","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/new","isIndex":false,"type":"page","pattern":"^\\/new\\/?$","segments":[[{"content":"new","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/new.astro","pathname":"/new","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/sessions/[session]/tabs/[tab]","isIndex":false,"type":"page","pattern":"^\\/sessions\\/([^/]+?)\\/tabs\\/([^/]+?)\\/?$","segments":[[{"content":"sessions","dynamic":false,"spread":false}],[{"content":"session","dynamic":true,"spread":false}],[{"content":"tabs","dynamic":false,"spread":false}],[{"content":"tab","dynamic":true,"spread":false}]],"params":["session","tab"],"component":"src/pages/sessions/[session]/tabs/[tab].astro","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/settings","isIndex":false,"type":"page","pattern":"^\\/settings\\/?$","segments":[[{"content":"settings","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/settings.astro","pathname":"/settings","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/threads/[id]","isIndex":false,"type":"page","pattern":"^\\/threads\\/([^/]+?)\\/?$","segments":[[{"content":"threads","dynamic":false,"spread":false}],[{"content":"id","dynamic":true,"spread":false}]],"params":["id"],"component":"src/pages/threads/[id].astro","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/","isIndex":true,"type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}}],"serverLike":true,"middlewareMode":"classic","base":"/","trailingSlash":"ignore","compressHTML":"jsx","componentMetadata":[["/home/runner/work/webr/webr/src/pages/new.astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/sessions/[session]/tabs/[tab].astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/settings.astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/threads/[id].astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var l=(n,t)=>{let i=async()=>{await(await n())()},e=typeof t.value==\"object\"?t.value:void 0,s={timeout:e==null?void 0:e.timeout};\"requestIdleCallback\"in window?window.requestIdleCallback(i,s):setTimeout(i,s.timeout||200)};(self.Astro||(self.Astro={})).idle=l;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var n=(a,t)=>{let i=async()=>{await(await a())()};if(t.value){let e=matchMedia(t.value);e.matches?i():e.addEventListener(\"change\",i,{once:!0})}};(self.Astro||(self.Astro={})).media=n;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var a=(s,i,o)=>{let r=async()=>{await(await s())()},t=typeof i.value==\"object\"?i.value:void 0,c={rootMargin:t==null?void 0:t.rootMargin},n=new IntersectionObserver(e=>{for(let l of e)if(l.isIntersecting){n.disconnect(),r();break}},c);for(let e of o.children)n.observe(e)};(self.Astro||(self.Astro={})).visible=a;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000noop-middleware":"virtual_astro_middleware.mjs","\u0000virtual:astro:server-island-manifest":"chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs","\u0000virtual:astro:session-driver":"chunks/_virtual_astro_session-driver_Dp7RXjOf.mjs","\u0000virtual:astro:actions/noop-entrypoint":"chunks/noop-entrypoint_Z3zFhrGC.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/@astrojs+react@7.0.0_@types+node@22.20.4_@types+react-dom@19.3.0_@types+react@19.3.0__@_02aa85dceaccf3d763325676dd8540a8/node_modules/@astrojs/react/dist/vnode-children.js":"chunks/vnode-children_BSi0H4PL.mjs","@astrojs/node/server.js":"entry.mjs","\u0000virtual:astro:page:src/pages/threads/[id]@_@astro":"chunks/_id__kbExCoFS.mjs","\u0000virtual:astro:page:src/pages/sessions/[session]/tabs/[tab]@_@astro":"chunks/_tab__4yg4_FHP.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/sharp@0.35.5_@types+node@22.20.4/node_modules/sharp/dist/index.mjs":"chunks/dist_CpTFMtqT.mjs","\u0000virtual:astro:page:src/pages/index@_@astro":"chunks/index_DRfLd22k.mjs","\u0000virtual:astro:page:src/pages/new@_@astro":"chunks/new_kkCg5K67.mjs","\u0000virtual:astro:page:node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node@_@js":"chunks/node_BcIF-BVp.mjs","\u0000virtual:astro:page:src/pages/settings@_@astro":"chunks/settings_BpXfHFqU.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/services/sharp.js":"chunks/sharp_qIaxzsTp.mjs","/home/runner/work/webr/webr/src/components/App.tsx":"_astro/App.8tCy4opo.js","/home/runner/work/webr/webr/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/ClientRouter.astro?astro&type=script&index=0&lang.ts":"_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js","@astrojs/react/client.js":"_astro/client.BDkzSRUN.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-fit@0.10.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-fit/lib/addon-fit.js":"_astro/addon-fit.jgKqzwky.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-web-links@0.11.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-web-links/lib/addon-web-links.js":"_astro/addon-web-links.C9lyQRxI.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-webgl@0.18.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-webgl/lib/addon-webgl.js":"_astro/addon-webgl.Bd5ox92E.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+xterm@5.5.0/node_modules/@xterm/xterm/lib/xterm.js":"_astro/xterm.B-l5AIf6.js","astro:scripts/before-hydration.js":""},"inlinedScripts":[],"assets":["/apple-touch-icon.png","/brand-mark.png","/favicon-16.png","/favicon-32.png","/favicon.ico","/icon-192.png","/icon-512.png","/icon-maskable-512.png","/manifest.webmanifest","/_astro/App.8tCy4opo.js","/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js","/_astro/addon-fit.jgKqzwky.js","/_astro/addon-web-links.C9lyQRxI.js","/_astro/addon-webgl.Bd5ox92E.js","/_astro/client.BDkzSRUN.js","/_astro/client.Bbg9OBwT.js","/_astro/client.CLSsMr2g.js","/_astro/xterm.B-l5AIf6.js","/_astro/App.B7RjqN_I.css","/_astro/jetbrains-mono.CFJaiWaY.woff2","/_astro/symbols-nerd.CEdkKAK8.woff2"],"buildFormat":"directory","checkOrigin":true,"actionBodySizeLimit":1048576,"serverIslandBodySizeLimit":1048576,"allowedDomains":[],"key":"
|
|
2445
|
+
var _manifest = deserializeManifest({"rootDir":"file:///home/runner/work/webr/webr/","cacheDir":"file:///home/runner/work/webr/webr/node_modules/.astro/","outDir":"file:///home/runner/work/webr/webr/dist/","srcDir":"file:///home/runner/work/webr/webr/src/","publicDir":"file:///home/runner/work/webr/webr/public/","buildClientDir":"file:///home/runner/work/webr/webr/dist/client/","buildServerDir":"file:///home/runner/work/webr/webr/dist/server/","adapterName":"@astrojs/node","assetsDir":"_astro","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"page","component":"_server-islands.astro","params":["name"],"segments":[[{"content":"_server-islands","dynamic":false,"spread":false}],[{"content":"name","dynamic":true,"spread":false}]],"pattern":"^\\/_server-islands\\/([^/]+?)\\/?$","prerender":false,"isIndex":false,"fallbackRoutes":[],"route":"/_server-islands/[name]","origin":"internal","distURL":[],"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/_image","component":"node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node.js","params":[],"pathname":"/_image","pattern":"^\\/_image\\/?$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"type":"endpoint","prerender":false,"fallbackRoutes":[],"distURL":[],"isIndex":false,"origin":"internal","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/new","isIndex":false,"type":"page","pattern":"^\\/new\\/?$","segments":[[{"content":"new","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/new.astro","pathname":"/new","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/sessions/[session]/tabs/[tab]","isIndex":false,"type":"page","pattern":"^\\/sessions\\/([^/]+?)\\/tabs\\/([^/]+?)\\/?$","segments":[[{"content":"sessions","dynamic":false,"spread":false}],[{"content":"session","dynamic":true,"spread":false}],[{"content":"tabs","dynamic":false,"spread":false}],[{"content":"tab","dynamic":true,"spread":false}]],"params":["session","tab"],"component":"src/pages/sessions/[session]/tabs/[tab].astro","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/settings","isIndex":false,"type":"page","pattern":"^\\/settings\\/?$","segments":[[{"content":"settings","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/settings.astro","pathname":"/settings","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[{"type":"external","src":"_astro/App.B7RjqN_I.css"}],"routeData":{"route":"/threads/[id]","isIndex":false,"type":"page","pattern":"^\\/threads\\/([^/]+?)\\/?$","segments":[[{"content":"threads","dynamic":false,"spread":false}],[{"content":"id","dynamic":true,"spread":false}]],"params":["id"],"component":"src/pages/threads/[id].astro","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/","isIndex":true,"type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"fallbackRoutes":[],"distURL":[],"origin":"project","_meta":{"trailingSlash":"ignore"}}}],"serverLike":true,"middlewareMode":"classic","base":"/","trailingSlash":"ignore","compressHTML":"jsx","componentMetadata":[["/home/runner/work/webr/webr/src/pages/new.astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/sessions/[session]/tabs/[tab].astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/settings.astro",{"propagation":"none","containsHead":true}],["/home/runner/work/webr/webr/src/pages/threads/[id].astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var l=(n,t)=>{let i=async()=>{await(await n())()},e=typeof t.value==\"object\"?t.value:void 0,s={timeout:e==null?void 0:e.timeout};\"requestIdleCallback\"in window?window.requestIdleCallback(i,s):setTimeout(i,s.timeout||200)};(self.Astro||(self.Astro={})).idle=l;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var n=(a,t)=>{let i=async()=>{await(await a())()};if(t.value){let e=matchMedia(t.value);e.matches?i():e.addEventListener(\"change\",i,{once:!0})}};(self.Astro||(self.Astro={})).media=n;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var a=(s,i,o)=>{let r=async()=>{await(await s())()},t=typeof i.value==\"object\"?i.value:void 0,c={rootMargin:t==null?void 0:t.rootMargin},n=new IntersectionObserver(e=>{for(let l of e)if(l.isIntersecting){n.disconnect(),r();break}},c);for(let e of o.children)n.observe(e)};(self.Astro||(self.Astro={})).visible=a;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000noop-middleware":"virtual_astro_middleware.mjs","\u0000virtual:astro:server-island-manifest":"chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs","\u0000virtual:astro:session-driver":"chunks/_virtual_astro_session-driver_Dp7RXjOf.mjs","\u0000virtual:astro:actions/noop-entrypoint":"chunks/noop-entrypoint_Z3zFhrGC.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/@astrojs+react@7.0.0_@types+node@22.20.4_@types+react-dom@19.3.0_@types+react@19.3.0__@_02aa85dceaccf3d763325676dd8540a8/node_modules/@astrojs/react/dist/vnode-children.js":"chunks/vnode-children_BSi0H4PL.mjs","@astrojs/node/server.js":"entry.mjs","\u0000virtual:astro:page:src/pages/threads/[id]@_@astro":"chunks/_id__kbExCoFS.mjs","\u0000virtual:astro:page:src/pages/sessions/[session]/tabs/[tab]@_@astro":"chunks/_tab__4yg4_FHP.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/sharp@0.35.5_@types+node@22.20.4/node_modules/sharp/dist/index.mjs":"chunks/dist_CpTFMtqT.mjs","\u0000virtual:astro:page:src/pages/index@_@astro":"chunks/index_DRfLd22k.mjs","\u0000virtual:astro:page:src/pages/new@_@astro":"chunks/new_kkCg5K67.mjs","\u0000virtual:astro:page:node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node@_@js":"chunks/node_BcIF-BVp.mjs","\u0000virtual:astro:page:src/pages/settings@_@astro":"chunks/settings_BpXfHFqU.mjs","/home/runner/work/webr/webr/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/services/sharp.js":"chunks/sharp_qIaxzsTp.mjs","/home/runner/work/webr/webr/src/components/App.tsx":"_astro/App.8tCy4opo.js","/home/runner/work/webr/webr/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/ClientRouter.astro?astro&type=script&index=0&lang.ts":"_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js","@astrojs/react/client.js":"_astro/client.BDkzSRUN.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-fit@0.10.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-fit/lib/addon-fit.js":"_astro/addon-fit.jgKqzwky.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-web-links@0.11.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-web-links/lib/addon-web-links.js":"_astro/addon-web-links.C9lyQRxI.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+addon-webgl@0.18.0_@xterm+xterm@5.5.0/node_modules/@xterm/addon-webgl/lib/addon-webgl.js":"_astro/addon-webgl.Bd5ox92E.js","/home/runner/work/webr/webr/node_modules/.pnpm/@xterm+xterm@5.5.0/node_modules/@xterm/xterm/lib/xterm.js":"_astro/xterm.B-l5AIf6.js","astro:scripts/before-hydration.js":""},"inlinedScripts":[],"assets":["/apple-touch-icon.png","/brand-mark.png","/favicon-16.png","/favicon-32.png","/favicon.ico","/icon-192.png","/icon-512.png","/icon-maskable-512.png","/manifest.webmanifest","/_astro/App.8tCy4opo.js","/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js","/_astro/addon-fit.jgKqzwky.js","/_astro/addon-web-links.C9lyQRxI.js","/_astro/addon-webgl.Bd5ox92E.js","/_astro/client.BDkzSRUN.js","/_astro/client.Bbg9OBwT.js","/_astro/client.CLSsMr2g.js","/_astro/xterm.B-l5AIf6.js","/_astro/App.B7RjqN_I.css","/_astro/jetbrains-mono.CFJaiWaY.woff2","/_astro/symbols-nerd.CEdkKAK8.woff2"],"buildFormat":"directory","checkOrigin":true,"actionBodySizeLimit":1048576,"serverIslandBodySizeLimit":1048576,"allowedDomains":[],"key":"aQouSOIGM72di/hasieRslH1TKt1tgL+44wIUAIYgjQ=","sessionConfig":{"driver":"unstorage/drivers/fs-lite","options":{"base":"/home/runner/work/webr/webr/node_modules/.astro/sessions"}},"image":{},"devToolbar":{"enabled":false,"debugInfoOutput":""},"logLevel":"info","shouldInjectCspMetaTags":false});
|
|
2446
2446
|
var manifestRoutes = _manifest.routes;
|
|
2447
2447
|
var manifest = Object.assign(_manifest, {
|
|
2448
2448
|
renderers,
|
package/package.json
CHANGED
package/server/cli.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { parseArgs } from 'node:util';
|
|
|
2
2
|
import { renderUnicode } from 'uqr';
|
|
3
3
|
import { runServer } from './run';
|
|
4
4
|
import { explicitPort, knownPort } from './port';
|
|
5
|
-
import { defaultDeps, installPlugin,
|
|
5
|
+
import { defaultDeps, installPlugin, uninstallWebrPlugin, updatePlugin } from './plugin';
|
|
6
6
|
import { checkHerdr } from './herdr-check';
|
|
7
7
|
import { modeLines, pluginMode } from './plugin/mode';
|
|
8
8
|
import { openWebr, statusLines } from './where';
|
|
@@ -16,9 +16,8 @@ const HELP = `Webr — control your Herdr agents from anywhere.
|
|
|
16
16
|
Usage
|
|
17
17
|
webr Show status and this help
|
|
18
18
|
webr start [options] Run the server in this terminal
|
|
19
|
-
webr
|
|
20
|
-
webr
|
|
21
|
-
webr plugin status Show whether the plugin is installed and Webr is running
|
|
19
|
+
webr install [options] Start Webr whenever the Herdr server starts, and open it
|
|
20
|
+
webr uninstall Remove Webr from Herdr
|
|
22
21
|
webr invite [--port <port>] Print a one-time code and QR to connect a device
|
|
23
22
|
webr status Show whether Webr is running and where
|
|
24
23
|
webr open Open Webr in your browser
|
|
@@ -27,7 +26,7 @@ Usage
|
|
|
27
26
|
Options
|
|
28
27
|
--port <port> Port to listen on (default: first free port from 4444, then remembered)
|
|
29
28
|
--host <address> Listen on a specific address (default 0.0.0.0, every interface)
|
|
30
|
-
--no-open Don't open the browser after "
|
|
29
|
+
--no-open Don't open the browser after "install"
|
|
31
30
|
--origin <url> Public URL when served through a proxy, e.g. https://mac.tailnet.ts.net
|
|
32
31
|
-v, --version Print the version
|
|
33
32
|
-h, --help Print this help
|
|
@@ -76,11 +75,13 @@ const pluginSettings = (values: ReturnType<typeof parseCommand>['values']) => ({
|
|
|
76
75
|
...(values.origin ? { origin: values.origin } : {}),
|
|
77
76
|
});
|
|
78
77
|
|
|
79
|
-
async function
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
async function install(values: ReturnType<typeof parseCommand>['values']) {
|
|
79
|
+
for (const line of (await installPlugin(pluginSettings(values), defaultDeps())).filter(Boolean)) console.log(line);
|
|
80
|
+
if (!values['no-open']) await openWhenUp(knownPort(values.port ? ['--port', values.port] : []));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function uninstall() {
|
|
84
|
+
for (const line of (await uninstallWebrPlugin(defaultDeps())).filter(Boolean)) console.log(line);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
async function openWhenUp(port: number) {
|
|
@@ -101,7 +102,7 @@ async function printStatusAndHelp(values: ReturnType<typeof parseCommand>['value
|
|
|
101
102
|
|
|
102
103
|
export async function main(argv: string[]) {
|
|
103
104
|
const { values, positionals } = parseCommand(argv);
|
|
104
|
-
const [command
|
|
105
|
+
const [command] = positionals;
|
|
105
106
|
if (values.help || command === 'help') return void console.log(HELP);
|
|
106
107
|
if (values.version) { console.log(packageInfo().version); return printUpdateHint(); }
|
|
107
108
|
if (!command) return printStatusAndHelp(values);
|
|
@@ -111,6 +112,7 @@ export async function main(argv: string[]) {
|
|
|
111
112
|
if (command === 'status') return printStatus(values);
|
|
112
113
|
if (command === 'open') return void (await openWebr(knownPort(values.port ? ['--port', values.port] : []))).forEach((line) => console.log(line));
|
|
113
114
|
if (command === 'invite') return invite(knownPort(values.port ? ['--port', values.port] : []));
|
|
114
|
-
if (command === '
|
|
115
|
+
if (command === 'install') return install(values);
|
|
116
|
+
if (command === 'uninstall') return uninstall();
|
|
115
117
|
throw new Error(`Unknown command: ${positionals.join(' ')}\n\n${HELP}`);
|
|
116
118
|
}
|
package/server/plugin/dev.ts
CHANGED
|
@@ -39,6 +39,6 @@ export function enterPluginDevMode(checkout: string, run: RunCommand = realRun,
|
|
|
39
39
|
return () => {
|
|
40
40
|
rmSync(join(stateDir, DEV_FILE), { force: true });
|
|
41
41
|
restorePrevious(previous, run);
|
|
42
|
-
if (restartProduction) try { startProduction(run, stateDir); } catch { console.error('Could not start production Webr. Run "webr
|
|
42
|
+
if (restartProduction) try { startProduction(run, stateDir); } catch { console.error('Could not start production Webr. Run "webr install".'); }
|
|
43
43
|
};
|
|
44
44
|
}
|
package/server/plugin/index.ts
CHANGED
|
@@ -61,22 +61,7 @@ export async function updatePlugin(deps: PluginDeps) {
|
|
|
61
61
|
if (!deps.run('herdr', ['--version']).ok) return undefined;
|
|
62
62
|
if (!installedPlugin(deps.run)) return undefined;
|
|
63
63
|
const address = probeAddress(readPluginConfig(pluginConfigDir(deps.run)));
|
|
64
|
-
if ((await isPortOpen(address)) && !(await stopPluginWebr(deps.stateDir, address))) return [`Webr is running on port ${address.port} but the plugin did not start it. Stop it and run "webr
|
|
65
|
-
const refreshed = deps.run('webr', ['
|
|
66
|
-
return refreshed.ok ? quiet(refreshed.output) : [`The new Webr could not refresh the plugin. Run "webr
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export async function pluginStatus(deps: PluginDeps) {
|
|
70
|
-
requireHerdr(deps.run);
|
|
71
|
-
const plugin = installedPlugin(deps.run);
|
|
72
|
-
if (!plugin) return ['The Webr plugin is not installed. Install it with "webr plugin install".'];
|
|
73
|
-
const config = readPluginConfig(pluginConfigDir(deps.run));
|
|
74
|
-
const address = probeAddress(config);
|
|
75
|
-
return [
|
|
76
|
-
`Installed (${plugin.kind === 'github' ? 'from GitHub' : `linked to ${plugin.root}`}).`,
|
|
77
|
-
`Webr is ${await isPortOpen(address) ? 'running' : 'not running'} on port ${address.port}.`,
|
|
78
|
-
...modeLines(pluginMode(deps.run, deps.stateDir)),
|
|
79
|
-
`Settings: ${JSON.stringify(config)}`,
|
|
80
|
-
`Logs and state: ${deps.stateDir}`,
|
|
81
|
-
];
|
|
64
|
+
if ((await isPortOpen(address)) && !(await stopPluginWebr(deps.stateDir, address))) return [`Webr is running on port ${address.port} but the plugin did not start it. Stop it and run "webr install" to use the new version.`];
|
|
65
|
+
const refreshed = deps.run('webr', ['install', '--no-open']);
|
|
66
|
+
return refreshed.ok ? quiet(refreshed.output) : [`The new Webr could not refresh the plugin. Run "webr install". ${quiet(refreshed.output).join(' ')}`];
|
|
82
67
|
}
|
package/server/plugin/mode.ts
CHANGED
|
@@ -35,6 +35,6 @@ export function pluginMode(run: RunCommand, stateDir: string): PluginMode {
|
|
|
35
35
|
export function modeLines(mode: PluginMode) {
|
|
36
36
|
if (mode.kind === 'production') return ['Mode: production (started by the Herdr plugin).'];
|
|
37
37
|
if (mode.kind === 'dev') return [`Mode: dev, running from ${mode.checkout}. Stopping "pnpm dev" brings production back.`];
|
|
38
|
-
if (mode.kind === 'stuck') return [`Mode: the plugin still points at ${mode.where} but dev is not running. Run "webr
|
|
38
|
+
if (mode.kind === 'stuck') return [`Mode: the plugin still points at ${mode.where} but dev is not running. Run "webr install" to restore production.`];
|
|
39
39
|
return [];
|
|
40
40
|
}
|
package/server/where.ts
CHANGED
|
@@ -6,7 +6,7 @@ const launcher = (platform = process.platform) => platform === 'darwin' ? ['open
|
|
|
6
6
|
|
|
7
7
|
export async function statusLines(port: number, mode: string[] = []) {
|
|
8
8
|
if (await isPortOpen({ host: '127.0.0.1', port })) return [`Webr is running at ${localUrl(port)}`, ...mode];
|
|
9
|
-
return [`Webr is not running. Its address is ${localUrl(port)}.`, ...mode, 'It starts with the Herdr server once the plugin is installed ("webr
|
|
9
|
+
return [`Webr is not running. Its address is ${localUrl(port)}.`, ...mode, 'It starts with the Herdr server once the plugin is installed ("webr install"), or run "webr start".'];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export async function openWebr(port: number, open = openInBrowser) {
|