fix: 🐛 Fix all TypeScript issues

This commit is contained in:
Jesse Wierzbinski 2024-05-15 17:07:34 -10:00
parent 29aa43f4ce
commit 2b5b82b465
No known key found for this signature in database
7 changed files with 16 additions and 7 deletions

1
.gitignore vendored
View file

@ -182,3 +182,4 @@ glitch-dev
*.pem *.pem
oclif.manifest.json oclif.manifest.json
.direnv/ .direnv/
tsconfig.tsbuildinfo

BIN
bun.lockb

Binary file not shown.

View file

@ -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"

View file

@ -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),

View file

@ -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()) {

View file

@ -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/")) {

View file

@ -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(