kill snapshot.ts (untested)

This commit is contained in:
velzie 2024-08-25 14:55:20 -04:00
parent 9a39435c7d
commit 7f398cda17
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
7 changed files with 33 additions and 18 deletions

View file

@ -8,7 +8,8 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
if (args[0].startsWith("blob:") || args[0].startsWith("data:")) {
if (args[0].startsWith("blob:")) {
args[0] =
"data:application/javascript;base64," + btoa(syncfetch(args[0]));
"data:application/javascript;base64," +
btoa(syncfetch(client, args[0]));
}
args[0] = "/scramjet/worker?data=" + args[0];
@ -30,9 +31,12 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
});
}
function syncfetch(url: string) {
function syncfetch(client: ScramjetClient, url: string) {
const xhr = new XMLHttpRequest();
xhr.open("GET", url, false);
const realOpen = client.natives["XMLHttpRequest.prototype.open"].bind(xhr);
realOpen("GET", url, false);
xhr.send();
return xhr.responseText;