Improvements: remove dead config, fix ESM, add URL validation, unify types, add missing logging
- Remove .prettierrc (dead config, Biome replaces Prettier) - Rename lighthouserc.json to lighthouserc.cjs with module.exports for ESM compat - Add logger.warn to empty catch blocks in auth, register, site-settings, prisma-cache, redis, security, rate-limit - Unify ActionResult type: action-helper.ts uses 'ok' consistent with safe-action-shared.ts - Add noUnusedLocals + noUnusedParameters to tsconfig + fix 25 pre-existing unused vars - Replace barrel export src/types/index.ts with direct @/types/common imports - Make trustHost conditional (development only) in auth.ts - Add pre-flight URL validation to update-Nitrov3.sh to catch image.library.url misconfigurations - Improve NITRO_IMAGE_LIBRARY_URL content validation in pre-flight & post-compute checks
This commit is contained in:
1 parent
b922f6d49f
commit
17847545dd
292 files changed
+69195
-67915
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import "server-only";
|
||||
|
||||
import { FALLBACK_HOTEL_NAME } from "@/lib/brand";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { redis } from "@/lib/redis";
|
||||
|
||||
@@ -25,6 +26,7 @@ class SiteSettings {
|
||||
});
|
||||
return new Map(rows.map((r) => [r.key, r.value]));
|
||||
} catch {
|
||||
logger.warn("Failed to load site settings from database, using defaults");
|
||||
return new Map(Object.entries(DEFAULTS));
|
||||
}
|
||||
}
|
||||
@@ -38,7 +40,7 @@ class SiteSettings {
|
||||
return new Map(Object.entries(parsed));
|
||||
}
|
||||
} catch {
|
||||
// Redis unavailable — fall through
|
||||
logger.warn("Redis cache read failed for site settings");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +58,7 @@ class SiteSettings {
|
||||
JSON.stringify(obj),
|
||||
);
|
||||
} catch {
|
||||
// non-critical
|
||||
logger.warn("Failed to write site settings to Redis cache");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,13 +80,12 @@ class SiteSettings {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
async getMany(
|
||||
keys: string[],
|
||||
): Promise<Record<string, string | null>> {
|
||||
async getMany(keys: string[]): Promise<Record<string, string | null>> {
|
||||
const map = await this.load();
|
||||
const result: Record<string, string | null> = {};
|
||||
for (const key of keys) {
|
||||
result[key] = map.get(key) ?? (key in DEFAULTS ? DEFAULTS[key] as string : null);
|
||||
result[key] =
|
||||
map.get(key) ?? (key in DEFAULTS ? (DEFAULTS[key] as string) : null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -111,7 +112,7 @@ class SiteSettings {
|
||||
try {
|
||||
await redis.del(REDIS_CACHE_KEY);
|
||||
} catch {
|
||||
// non-critical
|
||||
logger.warn("Failed to invalidate Redis cache for site settings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user