Update the browser, editor, settings, and installer

This commit is contained in:
Knotty Wyvern
2026-10-12 14:46:21 -07:00
parent 909894b9c8
commit f6eaa52949
163 changed files with 146260 additions and 534 deletions
+17
View File
@@ -0,0 +1,17 @@
export function cookieId(cookie) {
return JSON.stringify([cookie.name, cookie.domain, cookie.path, !!cookie.hostOnly, !!cookie.secure]);
}
export async function listCookies(session) {
return (await session.cookies.get({})).map(cookie => ({ id: cookieId(cookie), name: cookie.name,
domain: cookie.domain, path: cookie.path, secure: cookie.secure, httpOnly: cookie.httpOnly }));
}
export async function removeCookie(session, id) {
if (typeof id !== 'string' || id.length > 8192) throw new Error('Invalid cookie selection.');
const cookie = (await session.cookies.get({})).find(item => cookieId(item) === id);
if (!cookie) throw new Error('This cookie no longer exists. Refresh the list.');
// Expire the exact domain/path tuple. cookies.remove(url, name) can match other paths.
await session.cookies.set({ url: `${cookie.secure ? 'https' : 'http'}://${cookie.domain.replace(/^\./, '')}${cookie.path}`,
name: cookie.name, value: '', ...(cookie.hostOnly ? {} : { domain: cookie.domain }), path: cookie.path,
secure: cookie.secure, httpOnly: cookie.httpOnly, sameSite: cookie.sameSite, expirationDate: 1 });
await session.cookies.flushStore();
}