Browse Source

Fix sankaku bug

pull/46/head
coomdev 2 years ago
parent
commit
1451b61344
  1. 2
      main.meta.js
  2. 8
      main.user.js
  3. 18
      src/thirdeye.ts

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

8
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

18
src/thirdeye.ts

@ -37,14 +37,14 @@ function firstThatFor<T>(promises: Promise<T>[], 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<ApiResult> => {
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;
Loading…
Cancel
Save