refactor: improve code structure and add better logging
All checks were successful
Code quality checks / biome (push) Successful in 10s
All checks were successful
Code quality checks / biome (push) Successful in 10s
- Replace custom logger with @atums/echo library - Restructure imports using # path aliases - Add request performance tracking and better request logging - Improve type definitions and error handling - Add custom file serving capability - Update biome configuration with stricter linting rules - Add comprehensive API documentation (DOCS.md)
This commit is contained in:
parent
82c9d72619
commit
5f0bdb885b
24 changed files with 666 additions and 392 deletions
87
config/constants.ts
Normal file
87
config/constants.ts
Normal file
|
@ -0,0 +1,87 @@
|
|||
// cSpell:disable
|
||||
|
||||
const reqLoggerIgnores = {
|
||||
ignoredStartsWith: ["/public"],
|
||||
ignoredPaths: ["/favicon.ico"],
|
||||
};
|
||||
|
||||
import type { IBooruConfigMap, IBooruDefaults } from "#types/config";
|
||||
|
||||
const booruDefaults: IBooruDefaults = {
|
||||
search: "index.php?page=dapi&s=post&q=index&json=1",
|
||||
random: "s",
|
||||
id: "index.php?page=dapi&s=post&q=index&json=1&id=",
|
||||
};
|
||||
|
||||
const booruConfig: IBooruConfigMap = {
|
||||
"rule34.xxx": {
|
||||
enabled: true,
|
||||
name: "rule34.xxx",
|
||||
aliases: ["rule34", "r34", "rule34xxx"],
|
||||
endpoint: "api.rule34.xxx",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "ac.rule34.xxx/autocomplete.php?q=",
|
||||
},
|
||||
"realbooru.com": {
|
||||
enabled: false,
|
||||
name: "realbooru.com",
|
||||
aliases: ["realbooru", "rb", "real34", "realb"],
|
||||
endpoint: "realbooru.com",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "realbooru.com/index.php?page=autocomplete&term=",
|
||||
},
|
||||
"safebooru.org": {
|
||||
enabled: true,
|
||||
name: "safebooru.org",
|
||||
aliases: ["safebooru", "sb", "s34"],
|
||||
endpoint: "safebooru.org",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "safebooru.org/autocomplete.php?q=",
|
||||
},
|
||||
"tbib.org": {
|
||||
enabled: true,
|
||||
name: "tbib.org",
|
||||
aliases: ["tbib", "tb", "tbiborg"],
|
||||
endpoint: "tbib.org",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "tbib.org/autocomplete.php?q=",
|
||||
},
|
||||
"hypnohub.net": {
|
||||
enabled: true,
|
||||
name: "hypnohub.net",
|
||||
aliases: ["hypnohub", "hh", "hypnohubnet"],
|
||||
endpoint: "hypnohub.net",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "hypnohub.net/autocomplete.php?q=",
|
||||
},
|
||||
"xbooru.com": {
|
||||
enabled: true,
|
||||
name: "xbooru.com",
|
||||
aliases: ["xbooru", "xb", "xboorucom"],
|
||||
endpoint: "xbooru.com",
|
||||
functions: booruDefaults,
|
||||
autocomplete: "xbooru.com/autocomplete.php?q=",
|
||||
},
|
||||
"e621.net": {
|
||||
enabled: true,
|
||||
name: "e621.net",
|
||||
aliases: ["e621", "e6", "e621net"],
|
||||
endpoint: "e621.net",
|
||||
autocomplete: "e621.net/tags/autocomplete.json?search[name_matches]=",
|
||||
functions: {
|
||||
search: "posts.json",
|
||||
random: "defaultRandom",
|
||||
id: ["posts/", ".json"],
|
||||
},
|
||||
},
|
||||
"gelbooru.com": {
|
||||
enabled: true,
|
||||
name: "gelbooru.com",
|
||||
aliases: ["gelbooru", "gb", "gelboorucom"],
|
||||
endpoint: "gelbooru.com",
|
||||
autocomplete: "gelbooru.com/index.php?page=autocomplete&term=",
|
||||
functions: booruDefaults,
|
||||
},
|
||||
};
|
||||
|
||||
export { reqLoggerIgnores, booruConfig, booruDefaults };
|
Loading…
Add table
Add a link
Reference in a new issue