codexunlimit 0.1.0-web.10 → 0.1.0-web.11
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/app.mjs +4 -1
- package/package.json +1 -1
- package/product.mjs +1 -1
package/app.mjs
CHANGED
|
@@ -49,7 +49,10 @@ export function createLocalApp(state,{license,request=fetch,account=()=>readCode
|
|
|
49
49
|
const json=(status,data,extra={})=>{res.writeHead(status,{...headers,'content-type':'application/json; charset=utf-8',...extra});res.end(JSON.stringify(data));};
|
|
50
50
|
try{
|
|
51
51
|
const origin='http://'+req.headers.host;
|
|
52
|
-
|
|
52
|
+
// External links may navigate to the public shell; APIs still require same-origin access.
|
|
53
|
+
const entryNavigation=req.method==='GET'&&(url.pathname==='/app'||url.pathname==='/app/')&&
|
|
54
|
+
req.headers['sec-fetch-mode']==='navigate'&&req.headers['sec-fetch-dest']==='document';
|
|
55
|
+
if((req.headers.origin&&req.headers.origin!==origin)||(req.headers['sec-fetch-site']==='cross-site'&&!entryNavigation))throw fail('local_request_denied',403);
|
|
53
56
|
if(req.method==='GET'&&url.pathname==='/app'){res.writeHead(302,{...headers,location:'/app/'});res.end();return true;}
|
|
54
57
|
if(req.method==='GET'&&assets[url.pathname]){
|
|
55
58
|
const file=assets[url.pathname],type=file.endsWith('.html')?'text/html':file.endsWith('.css')?'text/css':file.endsWith('.svg')?'image/svg+xml':file.endsWith('.png')?'image/png':file.endsWith('.ico')?'image/x-icon':file.endsWith('.woff2')?'font/woff2':file.endsWith('.txt')?'text/plain':'text/javascript';
|
package/package.json
CHANGED
package/product.mjs
CHANGED