move to biomejs, add workflow move auth to header check readme
All checks were successful
Code quality checks / biome (push) Successful in 13s
All checks were successful
Code quality checks / biome (push) Successful in 13s
This commit is contained in:
parent
73ab535df6
commit
9cb178aea4
18 changed files with 368 additions and 340 deletions
|
@ -1,7 +1,5 @@
|
|||
// cSpell:disable
|
||||
|
||||
import { gelBooruAUTH, getE621Auth } from "@config/environment";
|
||||
|
||||
const booruDefaults: IBooruDefaults = {
|
||||
search: "index.php?page=dapi&s=post&q=index&json=1",
|
||||
random: "s",
|
||||
|
@ -68,7 +66,6 @@ export const booruConfig: IBooruConfigMap = {
|
|||
random: "defaultRandom",
|
||||
id: ["posts/", ".json"],
|
||||
},
|
||||
auth: getE621Auth(),
|
||||
},
|
||||
"gelbooru.com": {
|
||||
enabled: true,
|
||||
|
@ -77,6 +74,5 @@ export const booruConfig: IBooruConfigMap = {
|
|||
endpoint: "gelbooru.com",
|
||||
autocomplete: "gelbooru.com/index.php?page=autocomplete&term=",
|
||||
functions: booruDefaults,
|
||||
auth: gelBooruAUTH(),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,47 +1,6 @@
|
|||
import { logger } from "@/helpers/logger";
|
||||
|
||||
export const environment: Environment = {
|
||||
port: parseInt(process.env.PORT || "6600", 10),
|
||||
port: Number.parseInt(process.env.PORT || "6600", 10),
|
||||
host: process.env.HOST || "0.0.0.0",
|
||||
development:
|
||||
process.env.NODE_ENV === "development" ||
|
||||
process.argv.includes("--dev"),
|
||||
process.env.NODE_ENV === "development" || process.argv.includes("--dev"),
|
||||
};
|
||||
|
||||
if (
|
||||
!process.env.E621_USER_AGENT ||
|
||||
!process.env.E621_USERNAME ||
|
||||
!process.env.E621_API_KEY
|
||||
) {
|
||||
logger.error("Missing e621 credentials in .env file");
|
||||
} else {
|
||||
if (
|
||||
process.env.E621_USERNAME === "username" ||
|
||||
process.env.E621_API_KEY === "apikey"
|
||||
) {
|
||||
logger.error("Please update your e621 credentials in the .env file");
|
||||
}
|
||||
}
|
||||
|
||||
export function getE621Auth(): Record<string, string> {
|
||||
const e621UserAgent: string | undefined = process.env.E621_USER_AGENT;
|
||||
const e621Username: string | undefined = process.env.E621_USERNAME;
|
||||
const e621ApiKey: string | undefined = process.env.E621_API_KEY;
|
||||
|
||||
return {
|
||||
"User-Agent": e621UserAgent || "",
|
||||
Authorization:
|
||||
"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 || "",
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue