mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
annoying ass logging
This commit is contained in:
parent
58f6a4330a
commit
d7c6044602
2 changed files with 53 additions and 46 deletions
|
@ -25,13 +25,13 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
return "sp_t=00246e00653d39d1341bbe9d10f138c4; OptanonConsent=isGpcEnabled=0&datestamp=Sat+Jul+20+2024+16%3A11%3A26+GMT-0400+(Eastern+Daylight+Time)&version=202405.2.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=https%3A%2F%2Fopen.spotify.com%2F&groups=BG169%3A1%2Ct00%3A1%2Ci00%3A1%2CBG170%3A1%2Cs00%3A1%2Cf00%3A1%2Cm00%3A1%2Cf11%3A1";
|
return "sp_t=00246e00653d39d1341bbe9d10f138c4; OptanonConsent=isGpcEnabled=0&datestamp=Sat+Jul+20+2024+16%3A11%3A26+GMT-0400+(Eastern+Daylight+Time)&version=202405.2.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=https%3A%2F%2Fopen.spotify.com%2F&groups=BG169%3A1%2Ct00%3A1%2Ci00%3A1%2CBG170%3A1%2Cs00%3A1%2Cf00%3A1%2Cm00%3A1%2Cf11%3A1";
|
||||||
},
|
},
|
||||||
set(ctx, value: string) {
|
set(ctx, value: string) {
|
||||||
dbg.debug("setting cookie", value);
|
// dbg.debug("setting cookie", value);
|
||||||
const cookie = parse(value)[0];
|
const cookie = parse(value)[0];
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
let expires = cookie.expires;
|
let expires = cookie.expires;
|
||||||
|
|
||||||
dbg.error("expires", expires);
|
// dbg.error("expires", expires);
|
||||||
// if (expires instanceof Date) {
|
// if (expires instanceof Date) {
|
||||||
// if (isNaN(expires.getTime())) return;
|
// if (isNaN(expires.getTime())) return;
|
||||||
// if (expires.getTime() < date.getTime()) return;
|
// if (expires.getTime() < date.getTime()) return;
|
||||||
|
|
|
@ -8,49 +8,56 @@ export default function (client: ScramjetClient, self: Self) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// client.Proxy("navigator.serviceWorker.register", {
|
client.Proxy("navigator.serviceWorker.register", {
|
||||||
// apply(ctx) {
|
apply(ctx) {
|
||||||
// if (ctx.args[0] instanceof URL) ctx.args[0] = ctx.args[0].href;
|
if (ctx.args[0] instanceof URL) ctx.args[0] = ctx.args[0].href;
|
||||||
// let url = encodeUrl(ctx.args[0]) + "?dest=serviceworker";
|
let url = encodeUrl(ctx.args[0]) + "?dest=serviceworker";
|
||||||
// if (ctx.args[1] && ctx.args[1].type === "module") {
|
if (ctx.args[1] && ctx.args[1].type === "module") {
|
||||||
// url += "&type=module";
|
url += "&type=module";
|
||||||
// }
|
}
|
||||||
// let worker = new SharedWorker(url);
|
let worker = new SharedWorker(url);
|
||||||
//
|
|
||||||
// let handle = worker.port;
|
let handle = worker.port;
|
||||||
//
|
|
||||||
// navigator.serviceWorker.controller.postMessage({
|
navigator.serviceWorker.controller.postMessage(
|
||||||
// scramjet$type: "registerServiceWorker",
|
{
|
||||||
// port: handle,
|
scramjet$type: "registerServiceWorker",
|
||||||
// });
|
port: handle,
|
||||||
//
|
},
|
||||||
// const fakeRegistration = new Proxy(
|
[handle]
|
||||||
// {
|
);
|
||||||
// __proto__: ServiceWorkerRegistration.prototype,
|
|
||||||
// },
|
const fakeRegistration = new Proxy(
|
||||||
// {
|
{
|
||||||
// get(target, prop) {
|
__proto__: ServiceWorkerRegistration.prototype,
|
||||||
// if (prop === "installing") {
|
},
|
||||||
// return null;
|
{
|
||||||
// }
|
get(target, prop) {
|
||||||
// if (prop === "waiting") {
|
if (prop === "installing") {
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
// if (prop === "active") {
|
if (prop === "waiting") {
|
||||||
// return handle;
|
return null;
|
||||||
// }
|
}
|
||||||
// if (prop === "scope") {
|
if (prop === "active") {
|
||||||
// return ctx.args[0];
|
return handle;
|
||||||
// }
|
}
|
||||||
//
|
if (prop === "scope") {
|
||||||
// return Reflect.get(target, prop);
|
return ctx.args[0];
|
||||||
// },
|
}
|
||||||
// }
|
|
||||||
// );
|
if (prop === "addEventListener") {
|
||||||
//
|
return () => {};
|
||||||
// ctx.return(new Promise((resolve) => resolve(fakeRegistration)));
|
}
|
||||||
// },
|
|
||||||
// });
|
return Reflect.get(target, prop);
|
||||||
|
},
|
||||||
delete self.navigator.serviceWorker;
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.return(new Promise((resolve) => resolve(fakeRegistration)));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// delete self.navigator.serviceWorker;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue