HEL-892: document Krea2 API named inputs without inferred identities
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Batch164 local GET-only:230 saved/5 Notes/85 exact/2 VHS gaps/13 unknown/4 hosts.
|
||||
import fs from 'node:fs';
|
||||
import assert from 'node:assert/strict';
|
||||
import crypto from 'node:crypto';
|
||||
const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright');
|
||||
const out='.local-evidence/krea-api-document/browser';fs.mkdirSync(out,{recursive:true});
|
||||
const checks=[],requests=[],errors=[],blockedFonts=[],assertionGroups={},interceptions=[];let group='aggregate';
|
||||
const textRenderings=[];
|
||||
function check(condition,label){assert.ok(condition,label);checks.push(label);assertionGroups[group]=(assertionGroups[group]||0)+1;console.log('PASS '+label);}
|
||||
function assertLocalUrl(raw){
|
||||
const u=new URL(String(raw));assert.ok(u.protocol==='http:'&&['127.0.0.1','localhost'].includes(u.hostname)&&['8247','5173'].includes(u.port)&&!u.username&&!u.password,'Refused before request: '+u);return u;
|
||||
}
|
||||
function localFetch(raw){assertLocalUrl(raw);return fetch(raw);}
|
||||
for(const raw of ['http://6.0.0.1:8247/api/workflows','http://127.0.0.1:9999/','https://example.invalid/','http://127.0.0.1:8247@evil.invalid/']){assert.throws(()=>assertLocalUrl(raw));check(true,'URL预检拒绝且未发送 '+raw);}
|
||||
for(const raw of ['http://127.0.0.1:8247/api/workflows','http://127.0.0.1:5173/connections'])assertLocalUrl(raw);
|
||||
const browser=await chromium.launch({headless:true,executablePath:process.env.BROWSER_EXECUTABLE});
|
||||
try {
|
||||
const page=await browser.newPage({viewport:{width:1440,height:1000}});
|
||||
await page.routeWebSocket('**/*',ws=>{ws.close();}); // No HMR socket transport is needed for read-only checks.
|
||||
await page.route('**/*',route=>{
|
||||
const u=new URL(route.request().url());
|
||||
if(u.hostname==='fonts.googleapis.com'){blockedFonts.push(String(u));return route.fulfill({contentType:'text/css',body:''});}
|
||||
try{assertLocalUrl(u);}catch(e){errors.push(String(e));return route.abort();}
|
||||
if(route.request().method()!=='GET'||u.pathname==='/api/view'||(/\.(mp4|png|wav|mp3|webm)$/i.test(u.pathname)&&u.pathname!=='/favicon.png')){errors.push('Forbidden request '+u);return route.abort();}
|
||||
return route.continue();
|
||||
});
|
||||
page.on('request',r=>{if(r.url().includes('/api/'))requests.push({method:r.method(),url:r.url()});});
|
||||
page.on('pageerror',e=>errors.push(e.message));
|
||||
requests.push({method:'GET',url:'http://127.0.0.1:8247/api/workflows'});
|
||||
const records=await(await localFetch('http://127.0.0.1:8247/api/workflows')).json();
|
||||
Reference in New Issue
Block a user