mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 23:47:54 +08:00
add logic to detect and handle login invalid - will exit auto start chat and show cookie assistant. add the logic to store cookie and local storage while auto start chat running.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
export const setDomainLocalStorage = async (browser, url, kv) => {
|
||||
const page = await browser.newPage();
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', r => {
|
||||
r.respond({
|
||||
status: 200,
|
||||
contentType: 'text/plain',
|
||||
body: ':)',
|
||||
});
|
||||
});
|
||||
await page.goto(url);
|
||||
await page.evaluate(kv => {
|
||||
Object.keys(kv).forEach(k => {
|
||||
localStorage.setItem(k, kv[k]);
|
||||
})
|
||||
}, kv);
|
||||
await page.close();
|
||||
};
|
||||
Reference in New Issue
Block a user