diff --git a/build.js b/build.js index a81c74b..e55f55b 100644 --- a/build.js +++ b/build.js @@ -6,30 +6,10 @@ import { writeFileSync, readFileSync } from 'fs' import esbuild from "esbuild"; import esbuildSvelte from "esbuild-svelte"; import sveltePreprocess from "svelte-preprocess"; +import { extheader } from './extheader.js'; let res = spawnSync("git", ["rev-list", "--count", "HEAD"]); let rev = +res.stdout; -const extheader = `// ==UserScript== -// @name PNGExtraEmbed -// @namespace https://coom.tech/ -// @version 0.${rev} -// @description uhh -// @author You -// @match https://boards.4channel.org/* -// @match https://boards.4chan.org/* -// @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js -// @grant GM_xmlhttpRequest -// @grant GM.xmlHttpRequest -// @grant GM_openInTab -// @grant GM.openInTab -// @run-at document-start -// @connect 4chan.org -// @connect 4channel.org -// @connect i.4cdn.org -// @connect * -// @icon https://coom.tech/resources/assets/1449696017588.png -// ==/UserScript== -`; (async () => { let res; diff --git a/extheader.js b/extheader.js new file mode 100644 index 0000000..6668068 --- /dev/null +++ b/extheader.js @@ -0,0 +1,26 @@ +import { spawnSync } from 'child_process'; + +let res = spawnSync("git", ["rev-list", "--count", "HEAD"]); +let rev = +res.stdout; + +export const extheader = `// ==UserScript== +// @name PNGExtraEmbed +// @namespace https://coom.tech/ +// @version 0.${rev} +// @description uhh +// @author You +// @match https://boards.4channel.org/* +// @match https://boards.4chan.org/* +// @require https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js +// @grant GM_xmlhttpRequest +// @grant GM.xmlHttpRequest +// @grant GM_openInTab +// @grant GM.openInTab +// @run-at document-start +// @connect 4chan.org +// @connect 4channel.org +// @connect i.4cdn.org +// @connect * +// @icon https://coom.tech/resources/assets/1449696017588.png +// ==/UserScript== +`; \ No newline at end of file diff --git a/main.d.ts b/main.d.ts index a0d82a9..0dbc7b7 100644 --- a/main.d.ts +++ b/main.d.ts @@ -1,3 +1,7 @@ declare module '*.css' { export default string; +} + +declare module '*.png' { + export default Uint8Array; } \ No newline at end of file diff --git a/main.meta.js b/main.meta.js index 174882f..bbe5850 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.97 +// @version 0.98 // @description uhh // @author You // @match https://boards.4channel.org/* diff --git a/main.user.js b/main.user.js index addfbcd..94a84bc 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.97 +// @version 0.98 // @description uhh // @author You // @match https://boards.4channel.org/* @@ -11435,7 +11435,7 @@ sources = new Set(s.sources); }); var cache = {}; - var findFileFrom = async (b, hex) => { + var findFileFrom = async (b, hex, abort) => { try { if (b.domain in cache && hex in cache[b.domain]) return cache[b.domain][hex]; @@ -11495,7 +11495,7 @@ skip: true, extract: extract4, has_embed: has_embed4, - match: (fn) => !!fn.match(/^[0-9a-fA-F]{32}\.....?$/) + match: (fn) => !!fn.match(/^[0-9a-fA-F]{32}\.....?/) }; // src/App.svelte diff --git a/src/thirdeye.ts b/src/thirdeye.ts index 9070eff..cdef92f 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -122,7 +122,7 @@ settings.subscribe(s => { const cache: any = {}; -const findFileFrom = async (b: Booru, hex: string) => { +const findFileFrom = async (b: Booru, hex: string, abort?: EventTarget) => { try { if (b.domain in cache && hex in cache[b.domain]) return cache[b.domain][hex] as BooruMatch[]; @@ -191,5 +191,5 @@ export default { skip: true, extract, has_embed, - match: fn => !!fn.match(/^[0-9a-fA-F]{32}\.....?$/) + match: fn => !!fn.match(/^[0-9a-fA-F]{32}\.....?/) } as ImageProcessor; \ No newline at end of file