@pablopunk/webr 0.3.9 → 0.3.10
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/client/_astro/{App.BtZuijDn.js → App.bmHm9djw.js} +1 -1
- package/dist/server/chunks/{App_C1bSzRXS.mjs → App_BbzCRPiT.mjs} +2 -1
- package/dist/server/chunks/{_id__PkkT8hXq.mjs → _id___SMAFJxg.mjs} +1 -1
- package/dist/server/chunks/{_tab__OowoBszk.mjs → _tab__O2UOM0DH.mjs} +1 -1
- package/dist/server/chunks/{new_DC57I9zU.mjs → new_n3R-7e9Z.mjs} +1 -1
- package/dist/server/chunks/{settings_BIpDm2u1.mjs → settings_CP_J5pGZ.mjs} +1 -1
- package/dist/server/entry.mjs +5 -5
- package/package.json +1 -1
- package/src/server/host.ts +5 -4
- package/src/server/runtime/target.ts +2 -1
- package/src/server/transport/herdr-target.ts +4 -1
- package/src/server/transport/remote-upload.ts +40 -0
- package/src/server/uploads.ts +9 -9
|
@@ -830,7 +830,8 @@ var uploadErrors = {
|
|
|
830
830
|
file_too_large: "This file is larger than 5 MB.",
|
|
831
831
|
empty_file: "This file is empty.",
|
|
832
832
|
unsupported_image: "Only PNG, JPEG, GIF and WebP images can be attached.",
|
|
833
|
-
uploads_unsupported_target: "
|
|
833
|
+
uploads_unsupported_target: "Files cannot be attached on this machine yet.",
|
|
834
|
+
upload_failed: "The file could not be sent to the machine.",
|
|
834
835
|
machine_disconnected: "The machine is not connected."
|
|
835
836
|
};
|
|
836
837
|
var isAttachableImage = (file) => attachableTypes.includes(file.type);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as createAstro, V as __exportAll, i as renderComponent, u as renderTemplate } from "./server_dfdLOyV2.mjs";
|
|
2
2
|
import { t as createComponent } from "./compiler_BnrQvXXD.mjs";
|
|
3
|
-
import { n as $$Base, t as App } from "./
|
|
3
|
+
import { n as $$Base, t as App } from "./App_BbzCRPiT.mjs";
|
|
4
4
|
//#region src/pages/threads/[id].astro
|
|
5
5
|
var _id__exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
default: () => $$Id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as createAstro, V as __exportAll, i as renderComponent, u as renderTemplate } from "./server_dfdLOyV2.mjs";
|
|
2
2
|
import { t as createComponent } from "./compiler_BnrQvXXD.mjs";
|
|
3
|
-
import { n as $$Base, t as App } from "./
|
|
3
|
+
import { n as $$Base, t as App } from "./App_BbzCRPiT.mjs";
|
|
4
4
|
//#region src/pages/sessions/[session]/tabs/[tab].astro
|
|
5
5
|
var _tab__exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
default: () => $$Tab,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as createAstro, V as __exportAll, i as renderComponent, u as renderTemplate } from "./server_dfdLOyV2.mjs";
|
|
2
2
|
import { t as createComponent } from "./compiler_BnrQvXXD.mjs";
|
|
3
|
-
import { n as $$Base, t as App } from "./
|
|
3
|
+
import { n as $$Base, t as App } from "./App_BbzCRPiT.mjs";
|
|
4
4
|
//#region src/pages/new.astro
|
|
5
5
|
var new_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
default: () => $$New,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as createAstro, V as __exportAll, i as renderComponent, u as renderTemplate } from "./server_dfdLOyV2.mjs";
|
|
2
2
|
import { t as createComponent } from "./compiler_BnrQvXXD.mjs";
|
|
3
|
-
import { n as $$Base, t as App } from "./
|
|
3
|
+
import { n as $$Base, t as App } from "./App_BbzCRPiT.mjs";
|
|
4
4
|
//#region src/pages/settings.astro
|
|
5
5
|
var settings_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
default: () => $$Settings,
|
package/dist/server/entry.mjs
CHANGED
|
@@ -2426,10 +2426,10 @@ var renderers = [Object.assign({
|
|
|
2426
2426
|
//#endregion
|
|
2427
2427
|
//#region \0virtual:astro:pages
|
|
2428
2428
|
var _page0 = () => import("./chunks/node_C8FqXy_n.mjs").then((n) => n.t);
|
|
2429
|
-
var _page1 = () => import("./chunks/
|
|
2430
|
-
var _page2 = () => import("./chunks/
|
|
2431
|
-
var _page3 = () => import("./chunks/
|
|
2432
|
-
var _page4 = () => import("./chunks/
|
|
2429
|
+
var _page1 = () => import("./chunks/new_n3R-7e9Z.mjs");
|
|
2430
|
+
var _page2 = () => import("./chunks/_tab__O2UOM0DH.mjs");
|
|
2431
|
+
var _page3 = () => import("./chunks/settings_CP_J5pGZ.mjs");
|
|
2432
|
+
var _page4 = () => import("./chunks/_id___SMAFJxg.mjs");
|
|
2433
2433
|
var _page5 = () => import("./chunks/index_Bvv1gpI0.mjs");
|
|
2434
2434
|
var pageMap = /* @__PURE__ */ new Map([
|
|
2435
2435
|
["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", _page0],
|
|
@@ -2441,7 +2441,7 @@ var pageMap = /* @__PURE__ */ new Map([
|
|
|
2441
2441
|
]);
|
|
2442
2442
|
//#endregion
|
|
2443
2443
|
//#region \0virtual:astro:manifest
|
|
2444
|
-
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.CJakfIju.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.CJakfIju.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.CJakfIju.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.CJakfIju.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/
|
|
2444
|
+
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.CJakfIju.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.CJakfIju.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.CJakfIju.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.CJakfIju.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___SMAFJxg.mjs","\u0000virtual:astro:page:src/pages/sessions/[session]/tabs/[tab]@_@astro":"chunks/_tab__O2UOM0DH.mjs","\u0000virtual:astro:page:src/pages/index@_@astro":"chunks/index_Bvv1gpI0.mjs","\u0000virtual:astro:page:src/pages/new@_@astro":"chunks/new_n3R-7e9Z.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_C8FqXy_n.mjs","\u0000virtual:astro:page:src/pages/settings@_@astro":"chunks/settings_CP_J5pGZ.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_8J8zk4Wd.mjs","/home/runner/work/webr/webr/src/components/App.tsx":"_astro/App.bmHm9djw.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.bmHm9djw.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.CJakfIju.css","/_astro/jetbrains-mono.CFJaiWaY.woff2","/_astro/symbols-nerd.CEdkKAK8.woff2"],"buildFormat":"directory","checkOrigin":true,"actionBodySizeLimit":1048576,"serverIslandBodySizeLimit":1048576,"allowedDomains":[],"key":"wMBFmhe+pn2DnaCSXSWVokwTbr5rGkrH+IRu6kzYs+A=","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});
|
|
2445
2445
|
var manifestRoutes = _manifest.routes;
|
|
2446
2446
|
var manifest = Object.assign(_manifest, {
|
|
2447
2447
|
renderers,
|
package/package.json
CHANGED
package/src/server/host.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { isTrustedHost } from './auth/access';
|
|
|
14
14
|
import { registerDevHmrProxy } from './dev-hmr-proxy';
|
|
15
15
|
import { registerVoiceRoutes } from './voice/routes';
|
|
16
16
|
import type { Transcriber } from './voice/transcriber';
|
|
17
|
-
import { MAX_IMAGE_BYTES, UploadStore,
|
|
17
|
+
import { MAX_IMAGE_BYTES, UploadStore, uploadContentTypes, uploadFileName } from './uploads';
|
|
18
18
|
|
|
19
19
|
const localOwner = 'local';
|
|
20
20
|
type SsrHandler = (request: FastifyRequest['raw'], response: import('node:http').ServerResponse, next: (error?: unknown) => void, locals: Record<string, unknown>) => void;
|
|
@@ -41,6 +41,7 @@ export async function createHost(manager: RuntimeManager, origin: string, ssr?:
|
|
|
41
41
|
if (status === 413) return reply.code(413).send({ error: 'image_too_large' });
|
|
42
42
|
if (message === 'file_too_large') return reply.code(413).send({ error: message });
|
|
43
43
|
if (message === 'empty_file') return reply.code(400).send({ error: message });
|
|
44
|
+
if (message === 'upload_failed') return reply.code(502).send({ error: message });
|
|
44
45
|
if (status === 415 || message === 'unsupported_image') return reply.code(415).send({ error: 'unsupported_image' });
|
|
45
46
|
if (status && status >= 400 && status < 500) return reply.code(status).send({ error: 'invalid_request' });
|
|
46
47
|
if (message === 'thread_not_found') return reply.code(404).send({ error: message });
|
|
@@ -64,10 +65,10 @@ export async function createHost(manager: RuntimeManager, origin: string, ssr?:
|
|
|
64
65
|
const { machineId, name } = z.object({ machineId: opaqueId, name: z.string().max(255).optional() }).strict().parse(request.query);
|
|
65
66
|
const supervisor = manager.supervisors.get(machineId);
|
|
66
67
|
if (!supervisor?.connected) return reply.code(409).send({ error: 'machine_disconnected' });
|
|
67
|
-
if (!supervisor.target.
|
|
68
|
+
if (!supervisor.target.acceptsUploads) return reply.code(409).send({ error: 'uploads_unsupported_target' });
|
|
68
69
|
if (!Buffer.isBuffer(request.body)) return reply.code(415).send({ error: 'unsupported_image' });
|
|
69
|
-
const
|
|
70
|
-
return { path:
|
|
70
|
+
const fileName = uploadFileName(request.headers['content-type'], name, request.body);
|
|
71
|
+
return { path: supervisor.target.storeUpload ? await supervisor.target.storeUpload(fileName, request.body) : await uploads.saveAs(fileName, request.body) };
|
|
71
72
|
});
|
|
72
73
|
app.get('/api/directories', async (request, reply) => {
|
|
73
74
|
const { machineId, prefix } = z.object({ machineId: opaqueId, prefix: z.string().max(1000).refine((path) => !/[\x00-\x1f]/.test(path)) }).strict().parse(request.query);
|
|
@@ -15,7 +15,8 @@ export type TargetAdapter = {
|
|
|
15
15
|
locations: LaunchLocation[];
|
|
16
16
|
writable: boolean;
|
|
17
17
|
os?: MachineOs;
|
|
18
|
-
|
|
18
|
+
acceptsUploads?: boolean;
|
|
19
|
+
storeUpload?(fileName: string, bytes: Buffer): Promise<string>;
|
|
19
20
|
subscribe(onEvent: () => void, onClose: (reason: string) => void, paneIds?: string[]): Promise<() => void>;
|
|
20
21
|
snapshot(): Promise<NativeSnapshot>;
|
|
21
22
|
catalog(projectId?: string): Promise<Machine>;
|
|
@@ -5,6 +5,7 @@ import { SocketApi } from '../protocol/socket';
|
|
|
5
5
|
import { nativeSnapshot, nativeWorkspace, nativeTab, nativePane } from '../protocol/native';
|
|
6
6
|
import { openCliStream } from '../terminal/cli';
|
|
7
7
|
import { boundedProcess } from './process';
|
|
8
|
+
import { uploadOverSsh } from './remote-upload';
|
|
8
9
|
import { SshForward, sshOptions, remoteCommand, quoteShell } from './ssh';
|
|
9
10
|
import type { LaunchInput } from '../../shared/runtime';
|
|
10
11
|
import type { Machine, MachineOs } from '../../lib/machines';
|
|
@@ -31,7 +32,8 @@ export class HerdrTarget implements TargetAdapter {
|
|
|
31
32
|
get enabled() { return this.profile.enabled; }
|
|
32
33
|
get writable() { return this.compatible; }
|
|
33
34
|
get os() { return this.profile.transport === 'local' ? osFromPlatform(process.platform) : this.remoteOs; }
|
|
34
|
-
get
|
|
35
|
+
get acceptsUploads() { return this.profile.transport === 'local' || this.remoteOs !== 'windows'; }
|
|
36
|
+
storeUpload?: (fileName: string, bytes: Buffer) => Promise<string>;
|
|
35
37
|
private api?: SocketApi;
|
|
36
38
|
private forwarding?: SshForward;
|
|
37
39
|
private compatible = false;
|
|
@@ -40,6 +42,7 @@ export class HerdrTarget implements TargetAdapter {
|
|
|
40
42
|
private streams = new Set<ReturnType<typeof openCliStream>>();
|
|
41
43
|
private icons = new Map<string, { expires: number; value: Promise<Icon | undefined> }>();
|
|
42
44
|
constructor(private profile: TargetProfile, private dependencies: Dependencies = { process: boundedProcess, cli: openCliStream }) {
|
|
45
|
+
if (profile.transport === 'ssh') this.storeUpload = (fileName, bytes) => uploadOverSsh(profile.host!, fileName, bytes);
|
|
43
46
|
this.id = profile.id; this.name = profile.name; this.session = profile.session;
|
|
44
47
|
this.fingerprint = targetFingerprint(profile);
|
|
45
48
|
this.locations = profile.locations.map((location) => ({ ...location, localId: location.projectId, logicalId: location.logicalId ?? location.projectId, projectId: scopedProjectId(profile.id, location.projectId) }));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { quoteShell, sshOptions } from './ssh';
|
|
3
|
+
|
|
4
|
+
const UPLOAD_TIMEOUT_MS = 60_000;
|
|
5
|
+
const EXPIRY_DAYS = 7;
|
|
6
|
+
const OUTPUT_LIMIT = 4096;
|
|
7
|
+
const hostPattern = /^[A-Za-z0-9_][A-Za-z0-9_.@-]{0,200}$/;
|
|
8
|
+
const fileNamePattern = /^(image|file)-[0-9a-f-]{36}(\.[a-z0-9]{1,10})?$/;
|
|
9
|
+
const absolutePath = /^\/[^\0\r\n]+$/;
|
|
10
|
+
|
|
11
|
+
export const remoteUploadScript = (fileName: string) => {
|
|
12
|
+
if (!fileNamePattern.test(fileName)) throw new Error('invalid_upload_name');
|
|
13
|
+
return [
|
|
14
|
+
'set -e', 'umask 077',
|
|
15
|
+
'dir="${XDG_CACHE_HOME:-$HOME/.cache}/webr-uploads"', 'mkdir -p "$dir"',
|
|
16
|
+
`target="$dir/${fileName}"`,
|
|
17
|
+
'cat > "$target.part"', 'mv "$target.part" "$target"',
|
|
18
|
+
`find "$dir" -type f \\( -name 'image-*' -o -name 'file-*' \\) -mtime +${EXPIRY_DAYS} -exec rm -f {} + >/dev/null 2>&1 || true`,
|
|
19
|
+
'printf \'%s\\n\' "$target"',
|
|
20
|
+
].join('\n');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function uploadOverSsh(host: string, fileName: string, bytes: Buffer, spawnProcess: typeof spawn = spawn, timeoutMs = UPLOAD_TIMEOUT_MS): Promise<string> {
|
|
24
|
+
if (!hostPattern.test(host)) throw new Error('invalid_ssh_target');
|
|
25
|
+
const command = 'sh -c ' + quoteShell(remoteUploadScript(fileName));
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const child = spawnProcess('ssh', [...sshOptions, host, command], { stdio: ['pipe', 'pipe', 'ignore'] });
|
|
28
|
+
let output = ''; let settled = false;
|
|
29
|
+
const settle = (error?: Error, path?: string) => {
|
|
30
|
+
if (settled) return; settled = true; clearTimeout(timer);
|
|
31
|
+
if (error) { child.kill('SIGTERM'); reject(error); } else resolve(path!);
|
|
32
|
+
};
|
|
33
|
+
const timer = setTimeout(() => settle(new Error('upload_failed')), timeoutMs);
|
|
34
|
+
child.stdout!.on('data', (chunk: Buffer) => { output += chunk; if (output.length > OUTPUT_LIMIT) settle(new Error('upload_failed')); });
|
|
35
|
+
child.stdin!.on('error', () => {});
|
|
36
|
+
child.on('error', () => settle(new Error('upload_failed')));
|
|
37
|
+
child.on('close', (code) => { const path = output.trim().split('\n').at(-1) ?? ''; if (code === 0 && absolutePath.test(path)) settle(undefined, path); else settle(new Error('upload_failed')); });
|
|
38
|
+
child.stdin!.end(bytes);
|
|
39
|
+
});
|
|
40
|
+
}
|
package/src/server/uploads.ts
CHANGED
|
@@ -24,17 +24,17 @@ export function imageExtension(contentType: string | undefined, bytes: Buffer) {
|
|
|
24
24
|
return type.extension;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export function uploadFileName(contentType: string | undefined, name: string | undefined, bytes: Buffer) {
|
|
28
|
+
if (!isFileUpload(contentType)) return `image-${randomUUID()}.${imageExtension(contentType, bytes)}`;
|
|
29
|
+
if (!bytes.length) throw new Error('empty_file');
|
|
30
|
+
if (bytes.length > MAX_FILE_BYTES) throw new Error('file_too_large');
|
|
31
|
+
return `file-${randomUUID()}${extensionOf(name)}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
export class UploadStore {
|
|
28
35
|
constructor(readonly directory = resolve(process.env.WEBR_UPLOADS ?? '.data/uploads'), private lifetimeMs = UPLOAD_LIFETIME_MS) {}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
async saveFile(name: string | undefined, bytes: Buffer) {
|
|
33
|
-
if (!bytes.length) throw new Error('empty_file');
|
|
34
|
-
if (bytes.length > MAX_FILE_BYTES) throw new Error('file_too_large');
|
|
35
|
-
return this.write(`file-${randomUUID()}${extensionOf(name)}`, bytes);
|
|
36
|
-
}
|
|
37
|
-
private async write(fileName: string, bytes: Buffer) {
|
|
36
|
+
save(contentType: string | undefined, bytes: Buffer, name?: string) { return this.saveAs(uploadFileName(contentType, name, bytes), bytes); }
|
|
37
|
+
async saveAs(fileName: string, bytes: Buffer) {
|
|
38
38
|
await mkdir(this.directory, { recursive: true, mode: 0o700 });
|
|
39
39
|
const path = join(this.directory, fileName);
|
|
40
40
|
await writeFile(path, bytes, { mode: 0o600, flag: 'wx' });
|