diff --git a/src/EyeButton.svelte b/src/EyeButton.svelte index 9ebcc49..378ba52 100644 --- a/src/EyeButton.svelte +++ b/src/EyeButton.svelte @@ -36,6 +36,12 @@ import { EmbeddedFile, EMBED_TYPES } from './main'; a.click(); window.URL.revokeObjectURL(url); } + + let black = new Set(); + settings.subscribe(s => { + black = new Set(s.blacklist); + }); + let blackHits = files.filter(file => file.tags?.some(e => black.has(e)) ?? false) ?? ['']; {#if $settings.eye} @@ -78,11 +84,25 @@ import { EmbeddedFile, EMBED_TYPES } from './main'; class:hasblack={file?.isBlacklisted === true} >{file.page.title} {/if} +{#if file.tags} + +
+ Tags + +
+{/if} {#if isNotChrome && isVideo} - { - inst.bepis(ev); - }} alt="By clicking this you agree to stay hydrated" + { inst.bepis(ev); }} + alt="By clicking this you agree to stay hydrated" class="clickable" class:hasembed={file?.embed_type === EMBED_TYPES.MEDIA_EMBED} class:hasext={file?.embed_type === EMBED_TYPES.THIRD_EYE} @@ -102,18 +122,30 @@ import { EmbeddedFile, EMBED_TYPES } from './main'; margin-right: 2px; } - .clickable:hover { - text-shadow: 0 0 4px palevioletred; - } - .clickable.hasembed { + .hasembed { color: deeppink; } - .clickable.hasext { + .hasext { color: goldenrod; } - .clickable.hasblack { + .hasblack { color: black; } + + /* + .hasembed-bg { + background-color: deeppink; + } + .hasext-bg { + background-color: goldenrod; + } + */ + .hasblack-bg { + background-color: black; + } + .clickable:hover { + text-shadow: 0 0 4px palevioletred; + } a.clickable.hasembed { color: deeppink !important; } @@ -123,4 +155,21 @@ import { EmbeddedFile, EMBED_TYPES } from './main'; a.clickable.hasblack { color: black !important; } + + details.tags { + display: inline-block; + } + .tags > ul { + position: absolute; + min-width: 35px; + + list-style: none; + margin-top: 2px; + padding: 0; + background-color: #00000044; + } + .tags > ul > li { + padding: 2px 2px; + margin-bottom: 2px; + } diff --git a/src/main.ts b/src/main.ts index 2334dad..d7fd1a0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,16 +16,6 @@ import SettingsButton from './SettingsButton.svelte'; import Embeddings from './Embeddings.svelte'; import EyeButton from './EyeButton.svelte'; -export enum EMBED_TYPES { - THIRD_EYE, - MEDIA_EMBED, -} -export enum EMBED_STATUS { - SUCCESS, - TE_BLACKLISTED, - PEE_UNDEFINED, - NONE, -} export interface ImageProcessor { skip?: true; match(fn: string): boolean; @@ -77,8 +67,19 @@ async function* streamRemote(url: string, chunkSize = 72 * 1024, fetchRestOnNonC //console.log("streaming ended, ", ptr, size); } +export enum EMBED_TYPES { + THIRD_EYE, + MEDIA_EMBED, +} +export enum EMBED_STATUS { + SUCCESS, + TE_BLACKLISTED, + PEE_UNDEFINED, + NONE, +} type EmbeddedFileWithPreview = { embed_type: EMBED_TYPES; + tags?: string[], isBlacklisted?: boolean; // third-eye only page?: { title: string, url: string }; // can be a booru page source?: string; // can be like a twitter post this was posted in originally @@ -90,6 +91,7 @@ type EmbeddedFileWithPreview = { type EmbeddedFileWithoutPreview = { embed_type: EMBED_TYPES; + tags?: string[], isBlacklisted: boolean; // third-eye only page: undefined; source: undefined; diff --git a/src/thirdeye.ts b/src/thirdeye.ts index 57a247c..60a66fd 100644 --- a/src/thirdeye.ts +++ b/src/thirdeye.ts @@ -82,12 +82,14 @@ const findFileFrom = async (b: Booru, hex: string, abort?: EventTarget) => { const extract = async (b: Buffer, fn?: string) => { let result!: BooruMatch[]; let booru!: string; + let tags: string[] = []; for (const e of Object.values(boorus)) { if (e.disabled) continue; result = await findFileFrom(e, fn!.substring(0, 32)); if (result.length) { booru = e.name; + tags = result.flatMap(e2 => e2.tags) break; } } @@ -97,6 +99,7 @@ const extract = async (b: Buffer, fn?: string) => { const prev = result[0].preview_url; const full = result[0].full_url; return { + tags: tags, source: result[0].source, page: { title: booru, url: result[0].page }, filename: fn!.substring(0, 33) + result[0].ext,