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.
Files changed (3) hide show
  1. package/app.mjs +4 -1
  2. package/package.json +1 -1
  3. 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
- if(req.headers.origin&&req.headers.origin!==origin||req.headers['sec-fetch-site']==='cross-site')throw fail('local_request_denied',403);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexunlimit",
3
- "version": "0.1.0-web.10",
3
+ "version": "0.1.0-web.11",
4
4
  "private": false,
5
5
  "description": "Codex Unlimit — trò chuyện và quản lý kết nối trên máy của bạn",
6
6
  "type": "module",
package/product.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION='0.1.0-web.10';
1
+ export const VERSION='0.1.0-web.11';
2
2
  export const PRODUCT='codexunlimit-connector';
3
3
  export const DEFAULT_PORT=18457;
4
4
  export const LICENSE_ORIGIN='https://codexunlimit.tudonghoa.me';