From b3db37da892af76056d82057ce9412c0992c77af Mon Sep 17 00:00:00 2001 From: coomdev Date: Tue, 19 Apr 2022 15:09:17 +0200 Subject: [PATCH] Handle edge case where the booru doesn't generate previews --- main.meta.js | 2 +- main.user.js | 6 ++++-- src/thirdeye.ts | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main.meta.js b/main.meta.js index a6c8edc..ea14764 100644 --- a/main.meta.js +++ b/main.meta.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.191 +// @version 0.192 // @description uhh // @author You // @match https://boards.4channel.org/* diff --git a/main.user.js b/main.user.js index 52b21e9..204dede 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name PNGExtraEmbed // @namespace https://coom.tech/ -// @version 0.191 +// @version 0.192 // @description uhh // @author You // @match https://boards.4channel.org/* @@ -81,7 +81,7 @@ var define_BUILD_VERSION_default; var init_define_BUILD_VERSION = __esm({ ""() { - define_BUILD_VERSION_default = [0, 191]; + define_BUILD_VERSION_default = [0, 192]; } }); @@ -16500,6 +16500,8 @@ break; } if (result && result.length != 0 && phashEn && prevlink) { + if (!result[0].preview_url) + return true; const getHash = async (l) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer(); diff --git a/src/thirdeye.ts b/src/thirdeye.ts index e55d073..732650a 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -215,6 +215,8 @@ const has_embed = async (b: Buffer, fn?: string, prevlink?: string) => { } if ((result && result.length != 0) && phashEn && prevlink) { + if (!result[0].preview_url) + return true; const getHash = async (l: string) => { const ogreq = await ifetch(l); const origPreview = await ogreq.arrayBuffer();