fix(assets): serve furniture icons from the gamedata tree, add stack-height SQL generator
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 30s
CI / tests-integration (push) Successful in 1m52s
CI / tests-unit (push) Successful in 2m3s
CI / tests-ui (push) Successful in 2m40s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 3m47s
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 30s
CI / tests-integration (push) Successful in 1m52s
CI / tests-unit (push) Successful in 2m3s
CI / tests-ui (push) Successful in 2m40s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 3m47s
Commit the two changes that were live in the working tree but never recorded. The nginx change adds a location for /swf/dcr/hof_furni/icons/ that reads /var/www/Gamedata/icons/ off disk and falls back to the CMS bundle for anything missing. The CMS built its icon URLs from that path, but the icons actually live in the gamedata tree: of the 16,263 classnames in items_base, 15,338 are present there under the safe name, against 11,267 under public/swf/dcr/hof_furni/icons. The swf tree also keeps colour variants behind a literal "*" in the filename, so every request using the safe name missed, and hof.furni.url already points the Nitro client at the gamedata tree. A miss is a no-store 404, never a cached one — same reasoning as @gamedata_missing, since add_header without "always" says nothing about a 404 and Cloudflare would otherwise apply the zone TTL. scripts/generate-stack-height-sql.ts emits a SQL file that repairs items_base dimensions and interaction columns from the logic inside each bundle, which is where they actually live rather than in furnidata. It writes a file and touches no database, so the result is reviewed before it is run.
This commit is contained in:
1 parent
43742e8d99
commit
2978483ea9
2 files changed
+489
No files matched your search
@@ -78,6 +78,23 @@ map "$cms_cc_class|$cms_skip_cache" $cms_public_cc {
|
||||
"~^3\|0" "public, max-age=300, s-maxage=300, stale-while-revalidate=600";
|
||||
}
|
||||
|
||||
# Bestandsnaam van een furni-icon, opgehaald uit de URL. De locatie voor
|
||||
# /swf/dcr/hof_furni/icons/ heeft die nodig om hetzelfde bestand bij de
|
||||
# gamedata-boom op te kunnen vragen. Leeg laten voor elke andere URL, zodat
|
||||
# niets anders deze waarde per ongeluk gebruikt.
|
||||
map $uri $furni_icon_file {
|
||||
~^/swf/dcr/hof_furni/icons/(?<icon_file>.+)$ $icon_file;
|
||||
default "";
|
||||
}
|
||||
|
||||
# Cache-Control per status voor het CMS-valrimpeltje. Een 404 mag nooit
|
||||
# gecacht worden (zie @gamedata_missing hieronder), dus die krijgt `no-store`
|
||||
# in plaats van de icon-TTL.
|
||||
map $upstream_status $furni_icon_cc {
|
||||
200 "public, max-age=604800, stale-while-revalidate=2592000";
|
||||
default "no-store";
|
||||
}
|
||||
|
||||
# ─── Mime fix ───
|
||||
types {
|
||||
application/json jsonc;
|
||||
@@ -376,6 +393,92 @@ server {
|
||||
return 404;
|
||||
}
|
||||
|
||||
# ─── Furni-icons: gamedata-boom eerst, CMS-boom als valrimpeltje ───
|
||||
#
|
||||
# De CMS bouwde zijn icon-URL's altijd vanaf /swf/dcr/hof_furni/icons/,
|
||||
# maar de catalogus komt uit /var/www/Gamedata/icons:
|
||||
# - van de 16.263 classnames in items_base staat er 15.338 hier onder de
|
||||
# "veilige" naam (`highscore_perteam_1_icon.png`), tegen 11.267 in
|
||||
# public/swf/dcr/hof_furni/icons;
|
||||
# - de swf-boom houdt kleurvarianten bovendien vast met een letterlijke
|
||||
# `*` in de bestandsnaam (`highscore_perteam*1_icon.png`), dus elke
|
||||
# aanvraag met de veilige naam mist;
|
||||
# - en `hof.furni.url` wijst de Nitro-client al naar deze boom.
|
||||
# Resultaat was een 404 voor `highscore_perteam_1_icon.png` en duizenden
|
||||
# andere, terwijl `/gamedata/icons/` ze wél heeft.
|
||||
#
|
||||
# Deze locatie leest de gamedata-boom rechtstreeks van schijf — nginx heeft
|
||||
# er leesrechten op en het is de boom die de client ook gebruikt. Wat daar
|
||||
# niet staat wordt doorgestuurd naar de CMS, die uit public/ serveert,
|
||||
# zodat niets wat nu al laadde stopt met laden.
|
||||
#
|
||||
# Een echte miss is een no-store 404, nooit een gecachte: `add_header`
|
||||
# zonder `always` zegt niets over een 404, en zonder de expliciete handler
|
||||
# hieronder neemt Cloudflare de zone-TTL (1 jaar) over. Zelfde les als bij
|
||||
# @gamedata_missing hierboven.
|
||||
location ^~ /swf/dcr/hof_furni/icons/ {
|
||||
alias /var/www/Gamedata/icons/;
|
||||
error_page 404 = @furni_icon_from_cms;
|
||||
# 403 = het pad valt op een map, dus `alias` eindigt op een directory.
|
||||
# Dat is geen icon, dus dezelfde route als een miss.
|
||||
error_page 403 = @furni_icon_missing;
|
||||
|
||||
# Geen limit_req: zelfde reden als /gamedata/icons/. Een kamerladen
|
||||
# vuurt honderden icons in één burst af.
|
||||
add_header Cache-Control "public, max-age=604800, stale-while-revalidate=2592000";
|
||||
add_header Cache-Tag "cms-furni-icons";
|
||||
access_log off;
|
||||
|
||||
add_header Access-Control-Allow-Origin $http_origin always;
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||
if ($cors_headers) {
|
||||
add_header Access-Control-Max-Age 1728000;
|
||||
add_header Content-Type "text/plain; charset=utf-8";
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# Niet in de gamedata-boom: val terug op public/swf/dcr/hof_furni/icons/,
|
||||
# waar de CMS naartoe importeert. Het pad wordt hier opnieuw opgebouwd
|
||||
# omdat een named location geen prefix van `$uri` afstropt.
|
||||
#
|
||||
# De Cache-Control komt uit `$furni_icon_cc` (status-afhankelijk) in plaats
|
||||
# van uit een tweede `error_page`: nginx negeert `error_page` die binnen
|
||||
# een named location staat die zelf via `error_page` bereikt is, dus een
|
||||
# geketende 404-handler bestaat hier niet.
|
||||
location @furni_icon_from_cms {
|
||||
internal;
|
||||
proxy_pass http://cms_app/swf/dcr/hof_furni/icons/$furni_icon_file;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Connection "";
|
||||
proxy_intercept_errors on;
|
||||
|
||||
# `=404` (geen URI) vervangt de body door nginx' eigen foutpagina. Next
|
||||
# stuurt voor een miss een volledige HTML-pagina van ~300 KB mee, en een
|
||||
# gebroken icon hoeft geen 300 KB aan markup op te halen. Dit is geen
|
||||
# interne redirect, dus de `add_header` hieronder blijven gelden.
|
||||
error_page 404 =404;
|
||||
|
||||
# `proxy_hide_header` haalt de Cache-Control van de CMS weg, anders
|
||||
# staan er twee in één antwoord (Next stuurt voor /swf/** een
|
||||
# `public, max-age=604800`, `location /` elders nog een
|
||||
# `private, no-cache`). Eén header per antwoord.
|
||||
proxy_hide_header Cache-Control;
|
||||
add_header Cache-Control $furni_icon_cc always;
|
||||
add_header Cache-Tag "cms-furni-icons";
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location @furni_icon_missing {
|
||||
add_header Cache-Control "no-store" always;
|
||||
add_header Cache-Tag "cms-furni-icons" always;
|
||||
add_header Access-Control-Allow-Origin $http_origin always;
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||
access_log off;
|
||||
return 404;
|
||||
}
|
||||
|
||||
location /camera/ {
|
||||
alias /var/www/Camera/;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
|
||||
Reference in new issue
Block a user