diff --git a/build-chrome.js b/build-chrome.js
index b85c6a5..7b111d6 100644
--- a/build-chrome.js
+++ b/build-chrome.js
@@ -33,7 +33,8 @@ const domains = [
"https://fireden.net/*",
"https://thebarchive.com/*",
"https://archiveofsins.com/*",
- "https://kohlchan.net/*"
+ "https://kohlchan.net/*",
+ "https://*.kohlchan.net/*"
];
const manif3 = {
diff --git a/src/main.ts b/src/main.ts
index c59d610..a0e04f9 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,4 +1,4 @@
-///
+///
///
import { Buffer } from "buffer";
@@ -22,8 +22,8 @@ import EyeButton from './Components/EyeButton.svelte';
import NotificationsHandler from './Components/NotificationsHandler.svelte';
import { fireNotification, getEmbedsFromCache, getSelectedFile } from "./utils";
-import { getQueryProcessor, QueryProcessor } from "./websites";
-import { ifetch, Platform, sendCmd, lqueue, supportedAltDomain, supportedMainDomain, genPort, initMainIPC } from "./platform";
+import { getQueryProcessor, QueryProcessor, supportedAltDomain, supportedMainDomain } from "./websites";
+import { ifetch, Platform, sendCmd, lqueue, genPort, initMainIPC } from "./platform";
import TextEmbeddingsSvelte from "./Components/TextEmbeddings.svelte";
import { HydrusClient } from "./hydrus";
import { registerPlugin, createTokenClass } from 'linkifyjs';
@@ -93,60 +93,6 @@ type EmbeddedFileWithoutPreview = {
export type EmbeddedFile = EmbeddedFileWithPreview | EmbeddedFileWithoutPreview;
-/*
-const processImage = async (srcs: AsyncGenerator, fn: string, hex: string, prevurl: string) => {
- const ret = await Promise.all(processors.filter(e => e.match(fn)).map(async proc => {
- if (proc.skip) {
- // skip file downloading, file is referenced from the filename
- // basically does things like filtering out blacklisted tags
- const md5 = Buffer.from(hex, 'base64');
- if (await proc.has_embed(md5, fn, prevurl) === true) {
- return [await proc.extract(md5, fn), true] as [EmbeddedFile[], boolean];
- }
- return;
- }
- let succ = false;
- let cumul: Buffer;
- do {
- try {
- const n = await srcs.next();
- if (n.done)
- return; // no more links to try
- const iter = streamRemote(n.value);
- if (!iter)
- return;
- cumul = Buffer.alloc(0);
- let found: boolean | undefined;
- let chunk: ReadableStreamDefaultReadResult = { done: true };
- do {
- const { value, done } = await iter.next(typeof found === "boolean");
- if (done) {
- chunk = { done: true } as ReadableStreamDefaultReadDoneResult;
- } else {
- chunk = { done: false, value } as ReadableStreamDefaultReadValueResult;
- cumul = Buffer.concat([cumul, value!]);
- const v = await proc.has_embed(cumul);
- if (typeof v == "string") {
- return [await proc.extract(cumul, v), false] as [EmbeddedFile[], boolean];
- }
- found = v;
- }
- } while (found !== false && !chunk.done);
- succ = true;
- await iter.next(true);
- if (found !== true) {
- //console.log(`Gave up on ${src} after downloading ${cumul.byteLength} bytes...`);
- return;
- }
- return [await proc.extract(cumul), false] as [EmbeddedFile[], boolean];
- } catch {
- // ignore error and retry with another link
- }
- } while (!succ);
- }));
- return ret.filter(e => e).map(e => e!);
-};*/
-
const textToElement = (s: string) =>
document.createRange().createContextualFragment(s).children[0] as any as T;
@@ -822,7 +768,7 @@ const startup = async (is4chanX = true) => {
}
};
const obs = new MutationObserver(somethingChanged);
- if (location.host.includes("kohlchan.net")) {
+ if (['kohlchan.net', 'nocsp.kohlchan.net'].includes(location.host)) {
// vanilla kohl, behaves a bit like a mix of the two
target = e.detail as HTMLDivElement;
a.style.display = "inline-block";
diff --git a/src/platform.ts b/src/platform.ts
index 32b6dc1..4874792 100644
--- a/src/platform.ts
+++ b/src/platform.ts
@@ -112,29 +112,6 @@ const Bridged = (ctor: any) => {
ctor[k] = bridge(k, ctor[k]);
};
-const altdomains = [
- "desuarchive.org",
- "archived.moe",
- "archive.nyafuu.org",
- "arch.b4k.co",
- "archive.4plebs.org",
- "archive.wakarimasen.moe",
- "b4k.co",
- "fireden.net",
- "thebarchive.com",
- "archiveofsins.com",
- "kohlchan.net",
- "nocsp.kohlchan.net",
-];
-
-export function supportedAltDomain(s: string) {
- return altdomains.includes(s);
-}
-
-export function supportedMainDomain(s: string) {
- return ['boards.4channel.org', 'boards.4chan.org'].includes(s);
-}
-
let popupport: browser.runtime.Port;
const pendingcmds: Record void> = {};
diff --git a/src/websites/index.ts b/src/websites/index.ts
index c6b13c5..4e080cb 100644
--- a/src/websites/index.ts
+++ b/src/websites/index.ts
@@ -23,7 +23,7 @@ export const V4chan: QueryProcessor = {
postsWithFiles: (h) => [...(h || document).querySelectorAll('.file')].map(e => e.closest('.postContainer')) as any,
settingsHost: () => document.getElementById("navtopright") as any,
catalogControlHost: () => document.getElementById("settings") as HTMLDivElement,
- getImageLink: async function* (post: HTMLElement) {
+ getImageLink: async function*(post: HTMLElement) {
yield post.querySelector('a[target="_blank"]')?.getAttribute('href') || '';
},
@@ -49,7 +49,7 @@ export const X4chan: QueryProcessor = {
postsWithFiles: (h) => [...(h || document).querySelectorAll('.postContainer:not([class*="noFile"])')] as HTMLElement[],
settingsHost: () => document.getElementById("shortcuts") as any,
catalogControlHost: () => document.getElementById("index-options") as HTMLDivElement,
- getImageLink: async function* (post: HTMLElement) {
+ getImageLink: async function*(post: HTMLElement) {
yield post.querySelector('a[target="_blank"]')?.getAttribute('href') || '';
},
getFilename: (post: HTMLElement) => {
@@ -72,7 +72,7 @@ export const FoolFuuka: QueryProcessor = {
postsWithFiles: (h) => [...(h || document).querySelectorAll('article[class*="thread"], article[class*="has_image"]')] as HTMLElement[],
settingsHost: () => document.querySelector(".letters") as any,
catalogControlHost: () => document.getElementById("index-options") as HTMLDivElement,
- getImageLink: async function* (post: HTMLElement) {
+ getImageLink: async function*(post: HTMLElement) {
if (location.host == "arch.b4k.co") { //get hecked
return;
}
@@ -103,7 +103,7 @@ export const KChan: QueryProcessor = {
postsWithFiles: (h) => ([...(h || document).querySelectorAll('.postCell')] as HTMLElement[]).filter(p => p.querySelector('figure')),
settingsHost: () => document.getElementById("navOptionsSpanThread") as any,
catalogControlHost: () => document.getElementById("divTools") as HTMLDivElement,
- getImageLink: async function* (post: HTMLElement) {
+ getImageLink: async function*(post: HTMLElement) {
yield (post.querySelector('a.imgLink[target="_blank"]') as HTMLAnchorElement)?.href || '';
},
@@ -126,9 +126,32 @@ export const KChan: QueryProcessor = {
export const getQueryProcessor = (is4chanX: boolean) => {
if (['boards.4chan.org', 'boards.4channel.org'].includes(location.host))
return is4chanX ? X4chan : V4chan;
- if (location.host.includes("kohlchan.net")) {
+ if (['kohlchan.net', 'nocsp.kohlchan.net'].includes(location.host)) {
return KChan;
}
if (document.querySelector('meta[name="generator"]')?.getAttribute("content")?.startsWith("FoolFuuka"))
return FoolFuuka;
};
+
+const altdomains = [
+ "desuarchive.org",
+ "archived.moe",
+ "archive.nyafuu.org",
+ "arch.b4k.co",
+ "archive.4plebs.org",
+ "archive.wakarimasen.moe",
+ "b4k.co",
+ "fireden.net",
+ "thebarchive.com",
+ "archiveofsins.com",
+ "kohlchan.net",
+ "nocsp.kohlchan.net",
+];
+
+export function supportedAltDomain(s: string) {
+ return altdomains.includes(s);
+}
+
+export function supportedMainDomain(s: string) {
+ return ['boards.4channel.org', 'boards.4chan.org'].includes(s);
+}