limit cookie domains, #22 (#38)

This commit is contained in:
Simon 2024-05-11 22:02:46 +07:00 committed by GitHub
parent c82e493628
commit 0d58ddaaa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,6 +208,7 @@ function buildCookieLine(cookie) {
async function sendCookies() { async function sendCookies() {
console.log('function sendCookies'); console.log('function sendCookies');
const acceptableDomains = ['.youtube.com', 'youtube.com', 'www.youtube.com'];
let cookieStores = await browserType.cookies.getAllCookieStores(); let cookieStores = await browserType.cookies.getAllCookieStores();
let cookieLines = [ let cookieLines = [
@ -223,9 +224,11 @@ async function sendCookies() {
}); });
for (let j = 0; j < allCookiesStore.length; j++) { for (let j = 0; j < allCookiesStore.length; j++) {
const cookie = allCookiesStore[j]; const cookie = allCookiesStore[j];
if (acceptableDomains.includes(cookie.domain)) {
cookieLines.push(buildCookieLine(cookie)); cookieLines.push(buildCookieLine(cookie));
} }
} }
}
let response = cookieStr(cookieLines); let response = cookieStr(cookieLines);