@eduwork/dsh-remote-access 0.1.5 → 0.1.7

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.
@@ -1 +1 @@
1
- "use strict";(()=>{var a=parent.remoteTunnel,s=new URL(document.baseURI);function l(n){let{name:e,code:t,message:r,details:o}=n,d=e==="TunnelStreamError";return Object.assign(new Error(r??"remote stream failed"),{dshRemoteStreamFailure:d?{kind:"remote",code:t,details:structuredClone(o)}:{kind:"carrier"}})}function c(n){let e=n.target?.closest?.("a[download]");if(n.defaultPrevented||!(e instanceof HTMLAnchorElement))return;let t=new URL(e.href);t.origin!==s.origin||!t.pathname.startsWith(s.pathname)||(n.preventDefault(),u(t,e.download).catch(r=>console.error("remote download failed",r)))}var i=HTMLAnchorElement.prototype.click;async function u(n,e){let t=await fetch(n);if(!t.ok)throw new Error(`HTTP ${t.status} for ${n.pathname}`);let r=document.createElement("a");r.href=URL.createObjectURL(await t.blob()),r.download=e||m(t.headers.get("content-disposition")??"")||n.pathname.split("/").at(-1),i.call(r),setTimeout(()=>URL.revokeObjectURL(r.href),6e4)}function m(n){let e=/filename\*=UTF-8''([^;]+)/i.exec(n)?.[1];return e===void 0?/filename="?([^";]+)/i.exec(n)?.[1]:decodeURIComponent(e)}a!==void 0&&(document.documentElement.setAttribute("data-eduwork-remote",""),Object.assign(globalThis,{__DSH_TRANSPORT__:{async fetch(n,e){let t=new URL(n,s),r={method:e.method??"GET",url:`/${t.pathname.slice(s.pathname.length)}${t.search}`,headers:[...new Headers(e.headers)],...e.body!=null&&{body:await new Response(e.body).arrayBuffer()}},o=await a.fetch(r,e.signal);if("error"in o)throw new TypeError(o.error);return new Response(o.body.byteLength===0?null:o.body,{status:o.status,headers:o.headers})},async*openStream(n,e,t,r){try{for await(let o of a.openStream(n,e,t,r))yield structuredClone(o)}catch(o){throw t.aborted?t.reason:l(o)}}}}),addEventListener("click",c,!0),HTMLAnchorElement.prototype.click=function(){this.isConnected||this.addEventListener("click",c,{once:!0}),i.call(this)});})();
1
+ "use strict";(()=>{Promise.withResolvers??=()=>{let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}};AbortSignal.any??=t=>{let e=[...t],n=new AbortController,r=e.find(s=>s.aborted);if(r!==void 0)return n.abort(r.reason),n.signal;let o=s=>{for(let d of e)d.removeEventListener("abort",o);n.abort(s.target.reason)};for(let s of e)s.addEventListener("abort",o);return n.signal};URL.canParse??=(t,e)=>{try{return new URL(t,e),!0}catch{return!1}};var i=parent.remoteTunnel,a=new URL(document.baseURI);function u(t){let{name:e,code:n,message:r,details:o}=t,s=e==="TunnelStreamError";return Object.assign(new Error(r??"remote stream failed"),{dshRemoteStreamFailure:s?{kind:"remote",code:n,details:structuredClone(o)}:{kind:"carrier"}})}function c(t){let e=t.target?.closest?.("a[download]");if(t.defaultPrevented||!(e instanceof HTMLAnchorElement))return;let n=new URL(e.href);n.origin!==a.origin||!n.pathname.startsWith(a.pathname)||(t.preventDefault(),m(n,e.download).catch(r=>console.error("remote download failed",r)))}var l=HTMLAnchorElement.prototype.click;async function m(t,e){let n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status} for ${t.pathname}`);let r=document.createElement("a");r.href=URL.createObjectURL(await n.blob()),r.download=e||f(n.headers.get("content-disposition")??"")||t.pathname.split("/").at(-1),l.call(r),setTimeout(()=>URL.revokeObjectURL(r.href),6e4)}function f(t){let e=/filename\*=UTF-8''([^;]+)/i.exec(t)?.[1];return e===void 0?/filename="?([^";]+)/i.exec(t)?.[1]:decodeURIComponent(e)}i!==void 0&&(document.documentElement.setAttribute("data-eduwork-remote",""),Object.assign(globalThis,{__DSH_TRANSPORT__:{async fetch(t,e){let n=new URL(t,a),r={method:e.method??"GET",url:`/${n.pathname.slice(a.pathname.length)}${n.search}`,headers:[...new Headers(e.headers)],...e.body!=null&&{body:await new Response(e.body).arrayBuffer()}},o=await i.fetch(r,e.signal);if("error"in o)throw new TypeError(o.error);return new Response(o.body.byteLength===0?null:o.body,{status:o.status,headers:o.headers})},async*openStream(t,e,n,r){try{for await(let o of i.openStream(t,e,n,r))yield structuredClone(o)}catch(o){throw n.aborted?n.reason:u(o)}}}}),addEventListener("click",c,!0),HTMLAnchorElement.prototype.click=function(){this.isConnected||this.addEventListener("click",c,{once:!0}),l.call(this)});})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduwork/dsh-remote-access",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "End-to-end encrypted remote access to a DSH host through a self-hosted relay",
5
5
  "type": "module",
6
6
  "license": "MulanPSL-2.0 AND MIT",
@@ -92,10 +92,10 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@deepseek-ai/cordis": "4.0.5",
96
- "@deepseek-ai/dsh-home-paths": "0.2.1-rc.2",
97
- "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
98
- "@deepseek-ai/schemastery": "3.18.5",
95
+ "@deepseek-ai/cordis": "4.1.0",
96
+ "@deepseek-ai/dsh-home-paths": "0.2.2-rc.2",
97
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.2",
98
+ "@deepseek-ai/schemastery": "3.19.0",
99
99
  "@types/node": "24.19.2",
100
100
  "@types/react": "18.3.31",
101
101
  "@types/ws": "8.18.2",
@@ -107,7 +107,7 @@
107
107
  "typescript": "7.0.2",
108
108
  "uqr": "0.1.3",
109
109
  "ws": "8.22.0",
110
- "zod": "4.4.3"
110
+ "zod": "4.6.6"
111
111
  },
112
112
  "engines": {
113
113
  "node": ">=24.22.1"