gelbooru should work, remove caching, fix random

This commit is contained in:
creations 2025-04-03 16:05:41 -04:00
parent e6acb47796
commit c34ddea659
Signed by: creations
GPG key ID: 8F553AA4320FC711
14 changed files with 480 additions and 401 deletions

View file

@ -1,6 +1,6 @@
// cSpell:disable
import { getE621Auth } from "./environment";
import { gelBooruAUTH, getE621Auth } from "@config/environment";
const booruDefaults: IBooruDefaults = {
search: "index.php?page=dapi&s=post&q=index&json=1",
@ -70,4 +70,13 @@ export const booruConfig: IBooruConfigMap = {
},
auth: getE621Auth(),
},
"gelbooru.com": {
enabled: true,
name: "gelbooru.com",
aliases: ["gelbooru", "gb", "gelboorucom"],
endpoint: "gelbooru.com",
autocomplete: "gelbooru.com/index.php?page=autocomplete&term=",
functions: booruDefaults,
auth: gelBooruAUTH(),
},
};

View file

@ -8,12 +8,6 @@ export const environment: Environment = {
process.argv.includes("--dev"),
};
export const redisConfig: RedisConfig = {
host: process.env.REDIS_HOST || "dragonfly-redis",
port: parseInt(process.env.REDIS_PORT || "6379", 10),
password: process.env.REDIS_PASSWORD || undefined,
};
if (
!process.env.E621_USER_AGENT ||
!process.env.E621_USERNAME ||
@ -40,3 +34,14 @@ export function getE621Auth(): Record<string, string> {
"Basic " + btoa(`${e621Username || ""}:${e621ApiKey || ""}`),
};
}
if (!process.env.GELBOORU_API_KEY || !process.env.GELBOORU_USER_ID) {
logger.error("Missing Gelbooru credentials in .env file");
}
export function gelBooruAUTH(): Record<string, string> {
return {
apiKey: process.env.GELBOORU_API_KEY || "",
userId: process.env.GELBOORU_USER_ID || "",
};
}