mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix: 🐛 Fix all TypeScript issues
This commit is contained in:
parent
29aa43f4ce
commit
2b5b82b465
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -182,3 +182,4 @@ glitch-dev
|
||||||
*.pem
|
*.pem
|
||||||
oclif.manifest.json
|
oclif.manifest.json
|
||||||
.direnv/
|
.direnv/
|
||||||
|
tsconfig.tsbuildinfo
|
||||||
|
|
@ -36,7 +36,8 @@
|
||||||
"cloc": "cloc . --exclude-dir node_modules,dist,.output,.nuxt,meta,logs,glitch,glitch-dev --exclude-ext sql,log,pem",
|
"cloc": "cloc . --exclude-dir node_modules,dist,.output,.nuxt,meta,logs,glitch,glitch-dev --exclude-ext sql,log,pem",
|
||||||
"wc": "find server database *.ts docs packages types utils drizzle tests -type f -print0 | wc -m --files0-from=-",
|
"wc": "find server database *.ts docs packages types utils drizzle tests -type f -print0 | wc -m --files0-from=-",
|
||||||
"cli": "bun run cli/index.ts",
|
"cli": "bun run cli/index.ts",
|
||||||
"prune": "ts-prune | grep -v server/ | grep -v dist/ | grep -v '(used in module)'"
|
"prune": "ts-prune | grep -v server/ | grep -v dist/ | grep -v '(used in module)'",
|
||||||
|
"check": "bunx tsc -p ."
|
||||||
},
|
},
|
||||||
"trustedDependencies": [
|
"trustedDependencies": [
|
||||||
"@biomejs/biome",
|
"@biomejs/biome",
|
||||||
|
|
@ -87,7 +88,7 @@
|
||||||
"drizzle-kit": "^0.21.1",
|
"drizzle-kit": "^0.21.1",
|
||||||
"oclif": "^4.10.4",
|
"oclif": "^4.10.4",
|
||||||
"ts-prune": "^0.10.3",
|
"ts-prune": "^0.10.3",
|
||||||
"typescript": "latest"
|
"typescript": "^5.4.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.3.2"
|
"typescript": "^5.3.2"
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ export const configValidator = z.object({
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.default([]),
|
.default([]),
|
||||||
jwt_key: z.string().min(3).includes(";").default("").optional(),
|
jwt_key: z.string().min(3).includes(";").default(""),
|
||||||
}),
|
}),
|
||||||
http: z.object({
|
http: z.object({
|
||||||
base_url: z.string().min(1).default("http://lysand.social"),
|
base_url: z.string().min(1).default("http://lysand.social"),
|
||||||
|
|
@ -217,7 +217,14 @@ export const configValidator = z.object({
|
||||||
bucket_name: z.string().min(1).default("lysand"),
|
bucket_name: z.string().min(1).default("lysand"),
|
||||||
public_url: z.string().min(1).url(),
|
public_url: z.string().min(1).url(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.default({
|
||||||
|
endpoint: "",
|
||||||
|
access_key: "",
|
||||||
|
secret_access_key: "",
|
||||||
|
region: undefined,
|
||||||
|
bucket_name: "lysand",
|
||||||
|
public_url: "",
|
||||||
|
}),
|
||||||
validation: z
|
validation: z
|
||||||
.object({
|
.object({
|
||||||
max_displayname_size: z.number().int().default(50),
|
max_displayname_size: z.number().int().default(50),
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export default (app: Hono) =>
|
||||||
let lastModified = new Date(2024, 0, 0);
|
let lastModified = new Date(2024, 0, 0);
|
||||||
|
|
||||||
const extended_description_file = Bun.file(
|
const extended_description_file = Bun.file(
|
||||||
config.instance.extended_description_path,
|
config.instance.extended_description_path || "",
|
||||||
);
|
);
|
||||||
|
|
||||||
if (await extended_description_file.exists()) {
|
if (await extended_description_file.exists()) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export const getBestContentType = (
|
||||||
};
|
};
|
||||||
|
|
||||||
export const urlToContentFormat = (
|
export const urlToContentFormat = (
|
||||||
url: string,
|
url?: string,
|
||||||
): typeof EntityValidator.$ContentFormat | null => {
|
): typeof EntityValidator.$ContentFormat | null => {
|
||||||
if (!url) return null;
|
if (!url) return null;
|
||||||
if (url.startsWith("https://api.dicebear.com/")) {
|
if (url.startsWith("https://api.dicebear.com/")) {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export const redirect = (url: string | URL, status = 302) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const proxyUrl = (url: string | null) => {
|
export const proxyUrl = (url: string | null = null) => {
|
||||||
const urlAsBase64Url = Buffer.from(url || "").toString("base64url");
|
const urlAsBase64Url = Buffer.from(url || "").toString("base64url");
|
||||||
return url
|
return url
|
||||||
? new URL(
|
? new URL(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue