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
+50
-1
@@ -1163,6 +1163,19 @@ sync_configs() {
|
||||
# Validate the generated configs
|
||||
validate_configs "$NITRO_SRC_DIR"
|
||||
|
||||
# Pre-flight: warn if NITRO_IMAGE_LIBRARY_URL looks wrong before applying configs
|
||||
if [ -n "$NITRO_IMAGE_LIBRARY_URL" ]; then
|
||||
case "$NITRO_IMAGE_LIBRARY_URL" in
|
||||
*://*/nitro-client*|*://*/nitro-client/)
|
||||
fail "NITRO_IMAGE_LIBRARY_URL points to the Nitro client path instead of /gamedata/c_images/ — images will 404"
|
||||
;;
|
||||
esac
|
||||
case "$NITRO_IMAGE_LIBRARY_URL" in
|
||||
*/c_images/) ;;
|
||||
*://*) warn "NITRO_IMAGE_LIBRARY_URL does not contain /c_images/ — verify it points to the c_images directory" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
info "Applying critical config URLs..."
|
||||
NITRO_SRC_DIR="$NITRO_SRC_DIR" NITRO_DIST_CONFIG_DIR="$dcd" \
|
||||
NITRO_IMAGE_LIBRARY_URL="$NITRO_IMAGE_LIBRARY_URL" NITRO_HOF_FURNITURE_URL="$NITRO_HOF_FURNITURE_URL" \
|
||||
@@ -1481,7 +1494,23 @@ cmd_health() {
|
||||
echo -e "\n ${C_BOLD}$(_t "Config URLs:")${C_RESET}"
|
||||
for key in NITRO_SITE_URL NITRO_API_URL NITRO_SOCKET_URL NITRO_GAMEDATA_URL NITRO_IMAGE_LIBRARY_URL; do
|
||||
local val="${!key}"
|
||||
[ -n "$val" ] && ok "$key" || warn "$key"
|
||||
if [ -z "$val" ]; then
|
||||
warn "$key"
|
||||
else
|
||||
case "$key" in
|
||||
NITRO_IMAGE_LIBRARY_URL)
|
||||
case "$val" in
|
||||
*/c_images/) ok "$key" ;;
|
||||
*) warn "$key missing /c_images/ in path: $val" ;;
|
||||
esac ;;
|
||||
NITRO_SITE_URL)
|
||||
case "$val" in
|
||||
*/nitro-client*|*/nitro-client) warn "$key should be the site URL, not the Nitro client path" ;;
|
||||
*) ok "$key" ;;
|
||||
esac ;;
|
||||
*) ok "$key" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
echo -e "\n ${C_BOLD}$(_t "Directories:")${C_RESET}"
|
||||
checkw "Emulator" test -d "$EMULATOR_DIR/Emulator"; checkw "Nitro-V3" test -d "$NITRO_CLIENT"; checkw "Renderer" test -d "$NITRO_RENDERER"
|
||||
@@ -1954,6 +1983,26 @@ main() {
|
||||
NITRO_ASSET_URL="${NITRO_ASSET_URL:-${NITRO_SITE_URL:-}/gamedata/bundled}"
|
||||
NITRO_FURNI_ASSET_ICON_URL="${NITRO_FURNI_ASSET_ICON_URL:-${NITRO_SITE_URL:-}/gamedata/icons/%libname%%param%_icon.png}"
|
||||
|
||||
# Validate computed URLs for common misconfigurations.
|
||||
_nitro_url_warn() {
|
||||
local _key="$1" _val="$2" _hint="$3"
|
||||
case "$_val" in
|
||||
"") warn "$_key not set ($_hint)" ;;
|
||||
*/nitro-client/*|*/nitro-client) fail "$_key points at the Nitro client path. It must point to the gamedata/c_images directory." ;;
|
||||
*://*/nitro-client/) fail "$_key points at the Nitro client URL. Set NITRO_IMAGE_LIBRARY_URL=/gamedata/c_images/ or correct NITRO_SITE_URL." ;;
|
||||
esac
|
||||
case "$_key" in
|
||||
NITRO_IMAGE_LIBRARY_URL)
|
||||
case "$_val" in
|
||||
*/c_images/) ok "$_key correctly includes /c_images/" ;;
|
||||
*://*) warn "$_key does not end with /c_images/ — current: $_val" ;;
|
||||
esac ;;
|
||||
esac
|
||||
}
|
||||
_nitro_url_warn "NITRO_SITE_URL" "$NITRO_SITE_URL" "site URL"
|
||||
_nitro_url_warn "NITRO_IMAGE_LIBRARY_URL" "$NITRO_IMAGE_LIBRARY_URL" "image library URL"
|
||||
_nitro_url_warn "NITRO_GAMEDATA_URL" "$NITRO_GAMEDATA_URL" "gamedata URL"
|
||||
|
||||
exec > >(tee -a "$LOG_FILE") 2>&1
|
||||
|
||||
case "$cmd" in
|
||||
|
||||
Reference in new issue
Block a user