Browse Source

Remove fun code, haha

pull/46/head
coomdev 2 years ago
parent
commit
ccf644678e
  1. 5
      chrome/dist/background.js
  2. 2
      chrome/dist/main.js
  3. 2
      chrome/manifest.json
  4. 44
      src/background.ts
  5. 36
      src/platform.ts

5
chrome/dist/background.js

@ -1969,7 +1969,6 @@
};
}
}, filts, ["blocking", "responseHeaders", ...true ? ["extraHeaders"] : []]);
var snooze = (n) => new Promise((_) => setTimeout(_, n));
async function bravedeserialize(src) {
if (typeof src != "object")
return src;
@ -1984,16 +1983,12 @@
return ret;
}
case "File": {
if ("brave" in navigator)
await snooze(1e3);
return new File([src.value], src.name, {
lastModified: src.lastModified,
type: src.type
});
}
case "Blob": {
if ("brave" in navigator)
await snooze(1e3);
return new Blob([src.value], {
type: src.type
});

2
chrome/dist/main.js

@ -51,7 +51,7 @@
var define_BUILD_VERSION_default;
var init_define_BUILD_VERSION = __esm({
"<define:BUILD_VERSION>"() {
define_BUILD_VERSION_default = [0, 259];
define_BUILD_VERSION_default = [0, 260];
}
});

2
chrome/manifest.json

@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "PngExtraEmbedder",
"description": "Discover embedded files on 4chan and archives!",
"version": "0.259",
"version": "0.260",
"icons": {
"64": "1449696017588.png"
},

44
src/background.ts

@ -54,46 +54,6 @@ if (manifest == 2)
}
}, filts, ['blocking', 'responseHeaders', ...(execution_mode == "chrome_api" ? ['extraHeaders' as 'blocking'] : [])]);
const snooze = (n: number) => new Promise<void>((_) => setTimeout(_, n));
async function deserialize(src: any): Promise<any> {
if (typeof src != "object")
return src;
switch (src.cls) {
case 'FormData': {
const ret = new FormData();
for (const [key, items] of src.value) {
for (const item of items) {
ret.append(key, await deserialize(item));
}
}
return ret;
}
case 'File': {
if ('brave' in navigator)
await snooze(1000);
return new File([await (await fetch(src.value)).blob()], src.name, {
lastModified: src.lastModified,
type: src.type
});
}
case 'Blob': {
if ('brave' in navigator)
await snooze(1000);
return new Blob([await (await fetch(src.value)).blob()], {
type: src.type
});
}
case 'Object': {
const ret = {} as any;
for (const prop in src.value) {
ret[prop] = await deserialize(src.value[prop]);
}
return ret;
}
}
}
async function bravedeserialize(src: any): Promise<any> {
if (typeof src != "object")
return src;
@ -108,16 +68,12 @@ async function bravedeserialize(src: any): Promise<any> {
return ret;
}
case 'File': {
if ('brave' in navigator)
await snooze(1000);
return new File([src.value], src.name, {
lastModified: src.lastModified,
type: src.type
});
}
case 'Blob': {
if ('brave' in navigator)
await snooze(1000);
return new Blob([src.value], {
type: src.type
});

36
src/platform.ts

@ -148,42 +148,6 @@ export function request(domain: string): void {
}
}
async function serialize(src: any): Promise<any> {
if (src instanceof FormData) {
const value = [];
for (const kv of src)
value.push([kv[0], await Promise.all(src.getAll(kv[0]).map(serialize))]);
return {
cls: 'FormData', value,
};
}
if (src instanceof File) {
const { name, type, lastModified } = src;
const value = URL.createObjectURL(src);
return {
cls: 'File',
name, type, lastModified, value,
};
}
if (src instanceof Blob) {
const { type } = src;
const value = URL.createObjectURL(src);
return {
cls: 'Blob', type, value,
};
}
if (src === null || src === undefined || typeof src != "object")
return src;
const ret = {
cls: 'Object',
value: {}
} as any;
for (const prop in src) {
ret.value[prop] = await serialize(src[prop]);
}
return ret;
}
async function braveserialize(root: any): Promise<any> {
const transfer: Transferable[] = [];
const ser = async (src: any): Promise<any> => {

Loading…
Cancel
Save