Browse Source

Fix #13

pull/46/head 0.99
coomdev 2 years ago
parent
commit
ac9c90ac28
  1. 22
      build.js
  2. 26
      extheader.js
  3. 4
      main.d.ts
  4. 2
      main.meta.js
  5. 6
      main.user.js
  6. 4
      src/thirdeye.ts

22
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;

26
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==
`;

4
main.d.ts

@ -1,3 +1,7 @@
declare module '*.css' {
export default string;
}
declare module '*.png' {
export default Uint8Array;
}

2
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/*

6
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

4
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;
Loading…
Cancel
Save