diff --git a/main.meta.js b/main.meta.js index b5e0cb8..6b806c5 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.145 +// @version 0.146 // @description uhh // @author You // @match https://boards.4channel.org/* diff --git a/main.user.js b/main.user.js index 244883e..65f9ea1 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.145 +// @version 0.146 // @description uhh // @author You // @match https://boards.4channel.org/* @@ -12067,13 +12067,13 @@ settings.subscribe((b) => { csettings3 = b; }); - var gelquirk = (prefix) => (a) => (a.post || a).map((e) => ({ + var gelquirk = (prefix) => (a) => (a.post || a.data || a).map((e) => ({ full_url: e.file_url, preview_url: e.preview_url || e.preview_url, source: e.source, ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf(".") + 1), page: `${prefix}${e.id}`, - tags: (e.tag_string || e.tags || "").split(" ") + tags: (e.tag_string || e.tags && (typeof Array.isArray(e.tags) && typeof e.tags[0] == "string" ? e.tags.join(" ") : e.tags.map((e2) => e2.name_en).join(" ")) || "").split(" ") })) || []; var experimentalApi = false; settings.subscribe((s) => { @@ -12153,7 +12153,7 @@ skip: true, extract: extract4, has_embed: has_embed4, - match: (fn) => !!fn.match(/^[0-9a-fA-F]{32}\.....?/) + match: (fn) => !!fn.match(/^[0-9a-f]{32}\.....?/) }; // src/pomf.ts diff --git a/src/thirdeye.ts b/src/thirdeye.ts index 90e6bf1..f72c9ec 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -37,14 +37,14 @@ function firstThatFor(promises: Promise[], pred: (v: T) => boolean) { } const gelquirk: (s: string) => tran = prefix => (a => - (a.post || a).map((e: any) => ({ + (a.post || a.data || a).map((e: any) => ({ full_url: e.file_url, preview_url: e.preview_url || e.preview_url, source: e.source, ext: e.file_ext || e.file_url.substr(e.file_url.lastIndexOf('.') + 1), page: `${prefix}${e.id}`, - tags: (e.tag_string || e.tags || '').split(' ') + tags: (e.tag_string || (e.tags && (typeof Array.isArray(e.tags) && typeof e.tags[0] == "string" ? e.tags.join(' ') : e.tags.map((e: any) => e.name_en).join(' '))) || '').split(' ') } as BooruMatch)) || []); let experimentalApi = false; @@ -116,12 +116,12 @@ const shoujoFind = async (hex: string): Promise => { const findFileFrom = async (b: Booru, hex: string, abort?: EventTarget) => { try { -/* if (experimentalApi) { - const res = await shoujoFind(hex); - if (!res) - debugger; - return hex in res ? (res[hex][b.domain] || []) : []; - }*/ + /* if (experimentalApi) { + const res = await shoujoFind(hex); + if (!res) + debugger; + return hex in res ? (res[hex][b.domain] || []) : []; + }*/ if (b.domain in cache && hex in cache[b.domain]) return cache[b.domain][hex] as BooruMatch[]; const res = await GM_fetch(`https://${b.domain}${b.endpoint}${hex}`); @@ -190,5 +190,5 @@ export default { skip: true, extract, has_embed, - match: fn => !!fn.match(/^[0-9a-fA-F]{32}\.....?/) + match: fn => !!fn.match(/^[0-9a-f]{32}\.....?/) } as ImageProcessor; \ No newline at end of file