WIndows works perfectly

This commit is contained in:
Cris Stringfellow 2024-08-29 16:00:23 +00:00
parent d91a1856b7
commit dac4145195
No known key found for this signature in database
1 changed files with 32 additions and 21 deletions

View File

@ -177,6 +177,7 @@
]); ]);
const NEVER_CACHE = new Set([ const NEVER_CACHE = new Set([
`${GO_SECURE ? 'https://localhost' : 'http://127.0.0.1'}:${args.server_port}`, `${GO_SECURE ? 'https://localhost' : 'http://127.0.0.1'}:${args.server_port}`,
`http://localhost:${args.server_port}`,
`http://localhost:${args.chrome_port}`, `http://localhost:${args.chrome_port}`,
`http://127.0.0.1:${args.chrome_port}`, `http://127.0.0.1:${args.chrome_port}`,
`https://127.0.0.1:${args.chrome_port}`, `https://127.0.0.1:${args.chrome_port}`,
@ -776,9 +777,9 @@
} }
async function saveResponseData(key, url, response) { async function saveResponseData(key, url, response) {
try {
const origin = (new URL(url).origin); const origin = (new URL(url).origin);
let originDir = State.Cache.get(origin); let originDir = State.Cache.get(origin);
originDir = originDir.replace(TBL, '_');
if ( ! originDir ) { if ( ! originDir ) {
originDir = Path.resolve(library_path(), origin.replace(TBL, '_')); originDir = Path.resolve(library_path(), origin.replace(TBL, '_'));
try { try {
@ -787,6 +788,12 @@
console.warn(`Issue with origin directory ${originDir}`, e); console.warn(`Issue with origin directory ${originDir}`, e);
} }
State.Cache.set(origin, originDir); State.Cache.set(origin, originDir);
} else {
if ( originDir.includes(':\\\\') ) {
originDir = originDir.split(/:\\\\/, 2);
originDir[1] = originDir[1]?.replace?.(TBL, '_');
originDir = originDir.join(':\\\\');
}
} }
const fileName = `${await sha1(key)}.json`; const fileName = `${await sha1(key)}.json`;
@ -799,6 +806,10 @@
} }
return responsePath; return responsePath;
} catch(e) {
console.warn(`Could not save response data`, e);
return '';
}
} }
async function sha1(key) { async function sha1(key) {