Commit Graph
131 Commits
Author SHA1 Message Date
openhands 7b249a7222 P1-P3 admin cleanup: rank guard, SSRF guard, count caching, dead code removal, pagination rewrite
- P1: new src/lib/admin/rank-guard.ts with tryGuardRank/guardRank + RankGuardTarget/Result; extracted from users.ts; applied to admin-bans (create/lift + rank redirect) and admin-badges (caps + rank guard + error surfacing); import-url-safety.ts SSRF guard wired into clone save+icon fetch; logAudit await in help-tickets; antiddos mutations SETTINGS_EDIT; markAllAlertsRead NOTIFICATIONS_EDIT; rankError/saveError in all 25 message files; tests rew/new for bans/badges/rank-guard/import-url-safety

- P2: ticket-inbox merged pagination reworked to single UNION ALL SQL with LIMIT/OFFSET (avoids O(offset) materialization); getCachedAdminCount with cacheFiltered option applied to devops/errors/photos/items/guilds/help-tickets/moderation pages; admin-theme catches→?error=1+banner+25 locales; logger in silent catches (rare-values/writeable-boxes); catalog-items-loader CAST→plain equality; count caching helper extended with opt-in cacheFiltered

- P3: removed dead modules is-staff/notice/recent-furni-resync/log-filters plus load-user-sanctions/user-sanction-timeline; removed orphaned CATALOG_PAGE_COLUMNS re-export; removed getFurniIconUrl from studio-furni-icons

Build: lint 0, typecheck 0, 3480 tests pass, i18n:check exit 0, colors exit 0. Circular chunk warning (9452/10535/66463) is webpack code-splitting artifact; build succeeds.
2026-10-12 17:42:19 +02:00
openhands 179484642f feat: per-account login lockout, mail index, resend captcha, i18n scoping
Closes the four HIGH/MEDIUM items left open after the previous pass.

Login lockout
- The only login limits were keyed on the client IP, so a distributed attempt
  could grind on one account indefinitely. Added a per-account lockout with a
  budget of 8 failures per 15 minutes.
- The bucket is keyed on the RESOLVED account id, not on the submitted string:
  users may sign in with either username or e-mail and neither the lookup nor
  the input normaliser folds case, so an input-keyed bucket would hand out a
  fresh budget per spelling of the same account.
- precheckLogin and NextAuth's authorize share the bucket, so the pre-check
  cannot be used to buy extra attempts and a client that skips it entirely is
  still bounded. Both check the lockout BEFORE verifying the password: the
  success path clears the counter, which would otherwise walk a locked account
  straight back in on the right password.
- A successful login clears the failures, which needs two new primitives in
  rate-limit.ts: peekRateLimit (read-only, does not consume a unit) and
  clearRateLimit.
- Fixed a latent inconsistency while doing so: the in-process bucket capped its
  counter at the limit while Redis' INCR kept climbing, so the two backends
  disagreed about how far over the limit a key was. Both now track the true
  count.

Mail lookup index
- Added an index on users.mail (0035). Password reset, e-mail verification and
  the resend cooldown all resolve a single account from a submitted address and
  were full table scans of `users`. Deliberately non-unique: legacy rows can
  hold the same address more than once, so a unique index would fail to apply.

Resend captcha
- /verify's resend form triggers real outbound mail and was reachable with only
  a cooldown. It now runs the configured captcha before the account lookup and
  before any send.

Client message payload
- The root layout serialised the whole catalogue into every page. pages.admin
  and admin are ~177 KB of the ~235 KB and are unreachable from the public route
  group, so that layout now installs its own provider with the staff namespaces
  removed. Nested providers replace rather than merge, which is why this has to
  live in the segment layout. /admin, /mod, /client and /admin-next keep the
  full set; a guard test fails if a public page ever references a staff
  namespace.
2026-10-09 17:12:50 +02:00
openhands 6cc45d7413 feat: harden atoms-nexst against review findings (37 items)
Second review pass covering security, performance, admin tooling and the
public/room flows. All HIGH and MEDIUM findings from the audit are resolved;
nothing in this commit changes the visible feature set.

Authentication & session security
- CSP is now set on the request headers in the proxy, which is what Next.js
  uses to derive the render nonce, so the nonce is effective.
- 2FA: an already-enabled user cannot re-enroll, the setup endpoint is
  rate-limited per account, and confirmed codes are persisted so the second
  secret no longer silently never applies.
- Password reset revokes the ticket, authTicket and all personal access
  tokens, and bumps the token version so existing sessions die. The same
  revocation is now wired into the staff-side password reset.
- /reset and /verify return a stable error code instead of raw text; the
  mail lookups are ordered by id so duplicates cannot vary between runs.
- Resending the verification mail gets a per-address cooldown on top of the
  per-user limit.
- Issue API tokens with the narrower radio/ticket ability set instead of "*".

Authorization & input handling
- Mid-rank staff can no longer keep dynamically granted non-view admin.*
  permissions: existing grants are revoked by migration and the grant lookup
  is restricted to "%.view". Rank guards use the dynamic super-admin check.
- Alerting a user is permission-checked and audited like the other tools.
- Material mutations (giveCredits/giveDuckets/giveDiamonds, the admin user
  actions route, bulk user actions) are capped and rank-guarded, and bulk
  ids are bounded.
- updateRoom / updateRoomItem write through a field allowlist, and items
  may only be edited through their own room.
- Classnames reaching the filesystem are validated before use so a crafted
  value cannot escape the asset directories.
- The word filter now also covers offline mails, guild forum threads and
  replies, and user mottos.
- Media uploads are validated by magic bytes, /api/media requires the page
  edit permission, APP_URL must be configured once mail is enabled, and the
  diagnostics error route checks the fetch site header.

Admin tooling
- Secret settings render masked and cannot be overwritten with a blank or
  an arbitrary raw key; radio credentials are new password inputs.
- Commandocentrum balance changes are audited.
- Admin list pagination reads the caller's per-page instead of the max, and
  the log exporter caps offset and search length.

Performance
- Catalog translations are cached per module, with a cheap revision hash;
  the public online count uses a stale window instead of hammering the DB.
- The cache warmup now primes the payload the home route actually reads.
- TopHeader batches its queries into one round trip, and LCP avatars load
  eagerly.
- motion/react and sonner are no longer part of the root layout; the nav
  dropdown and mobile nav panels are lazy client chunks. Anonymous visitors
  again get the navigation chrome, and public pages get an edge cacheable
  response.

Accessibility
- Nested <main> elements in phase pages became <section>; the page entrance
  and route progress animations are pure CSS that respect reduced motion.
2026-10-09 16:19:48 +02:00
openhands 3933214953 feat(auth): implement all 16 homepage/login/register review items
- add countArticles() (published-only, mirrors news-list) and warm total_articles
- localize homepage metadata; bind articleCount to both stats; unique photo alts
- drop duplicate news date and the mascot preload priorities
- extract shared AuthPageFrame/AuthUsersCards used by /login and /register
- login: localized noindex metadata, session redirect via safeRedirectPath,
  ?from passthrough from proxy, unified auth roster cache keys, registered notice
- register: localized metadata, session redirect to /me, unified cache keys
- add resend-verification flow on /verify with rate-limited non-enumerable action
- add safeRedirectPath() with unit tests
- register form: live requirements checklist + password mismatch guard
- login form: unverified state with resend-link CTA
- honour prefers-reduced-motion in TypewriterText
- add 6 translations across all 25 locales
2026-10-08 18:49:27 +02:00
openhands 6bffc53779 refactor(auth): merge the duplicate login form and localize the auth screens
`home-login-form.tsx` and `login-form.tsx` were two ~240-line near-identical
components. Delete the former and give `LoginForm` a `variant` prop:

- `variant="page"`   sr-only labels plus the register/forgot footer (/login)
- `variant="compact"` visible labels, no footer (homepage sidebar)

Field ids now come from `useId()`, so the two usages can never collide, and the
hardcoded "Show"/"Hide"/"Loading" strings are translated.

Localization of the login and register screens:

- `home-login-form.tsx` was entirely hardcoded English.
- `passwordStrength()` returned hardcoded "Weak"/"Fair"/"Good"/"Strong".
- `register.ts` returned only English strings. It now returns a
  locale-independent `code` next to the message, and the form renders
  `t(code)` with the English string as a fallback.
- Backfilled the new keys across all 25 locales, plus the login/register
  strings that were still English in most of them. `ar`, `fi` and `ja` had
  their entire login/register namespace in English and are now filled in.
  Locale parity stays at 0 missing keys, as `i18n:check` requires.

Copy that did not match the enforced rules: the UI advertised "min 8 chars"
(EN) / "min 6 tekens" (NL) while registration requires 12 characters plus an
uppercase, a lowercase, a digit and a special character. Corrected in every
locale. `password-reset.ts` enforced only 6 characters and is raised to 12 to
match registration.

Accessibility: `login-form.tsx` had no `<label>`, no `id` and no `required` on
any field. All three are now present, and error banners are announced with
`role="alert"`.

Adds `src/i18n/auth-messages.test.ts`, which asserts every `RegisterErrorCode`
resolves to a non-empty message in all 25 locales; verified it fails when a key
is removed. The existing register tests now also assert the error `code`.
2026-10-04 18:50:23 +02:00
openhands bc00ecf08c feat(i18n): complete message parity across all 25 locales
The admin.studio.nitroCleanup section (102 keys) only existed in en and
nl, so 23 locales fell back to English for the entire Nitro Cleanup
panel. The referrals and dailyRewards keys were missing from the same
23 locales, and en itself was missing 6 keys that nl had.

Add the missing keys to every locale with translations, so all 25
locales now carry the same 6063 keys.
2026-09-27 18:38:58 +02:00
openhands c3ff497050 feat(referrals): add referral attribution and daily login rewards
- Track referral attribution at registration via ?ref code with
  same-IP and duplicate-pair guards
- Add daily login rewards with streak tracking, claim flow and
  sendCurrency payout backed by RCON with DB fallback
- Add admin pages for referral settings and the daily reward schedule
- Add migration 0033 with tables, seed schedule, settings and ACL grants
- Add admin.referrals.* and admin.dailyrewards.* permission slugs
- Localize new copy in en, nl and it
2026-09-20 12:29:01 +02:00
openhands 91e649398c feat(i18n): make admin and catalog components fully translatable 2026-09-18 16:02:08 +02:00
openhands d6111387e4 feat(auth): align login and register with themed intro, translated social cards 2026-09-18 13:35:22 +02:00
openhands 469f69ddd7 feat(home): two-column hero with live status panel, explore nav, featured news 2026-09-18 13:27:08 +02:00
openhands d0db352f36 feat(home): make index clearer with decluttered hero and live stats panel 2026-09-18 13:06:26 +02:00
openhands d131124515 feat(theme): animate public background with aurora and particles, polish landing pages
Add background_effect (aurora/particles), background_overlay tint and
opacity to the theme manager, rendered site-wide by ThemeVars on every
public page. Polish the home and register pages (hero mascot, live stat
pulse, date pills, photo strip, CTA band, theme-aware register intro,
i18n for home/register section).
2026-09-18 12:44:39 +02:00
openhands 5b4b275b2a feat(housekeeping): add per-hotel theme manager with import/export and background
Theme Manager under /admin-next/hotel/theme-manager lets the owner save, apply, rename, delete, import, and export custom themes, plus set a custom site background by URL or upload. Themes are stored in WebsiteSetting/custom_themes JSON so they survive CMS updates.
2026-09-16 19:45:57 +02:00
openhands 438277a17a feat(studio): expand nitro cleanup with repair, auto-clean, and orphaned assets
Scan distinguishes fake, broken, and orphaned SWF/icon assets with age
metadata, deletes per asset kind, re-downloads broken nitro bundles from
configured sources, auto-cleans old fake leftovers, and exports a JSON
manifest. Adds rebuild and auto-clean API endpoints with audit coverage
and a housekeeping preview route under the hotel domain.

Verified: full vitest suite (2213 tests), typecheck, and biome all pass.
2026-09-15 21:59:21 +02:00
openhands 0f01ebf48b Organize imports: persist undo across sessions, translate UI to 23 languages 2026-09-14 19:07:56 +02:00
openhands 3a4089a5fa Organize imports: drag & drop, virtualization, dupes, undo, days select, localStorage
- Native HTML5 drag & drop between categories with drop-target highlight
- Virtualized item lists via @tanstack/react-virtual (fixed 34px rows)
- Auto-batching of large groups (500 items / 50 groups per run)
- Duplicate detection against the destination page with badge + summary
- Per-category layout preview grid
- Undo history for item moves (single + batch, tracks source groups)
- Days-range selector to load older imports (30/60/90/180)
- LocalStorage persistence of user settings (mode, destination, price, days)
- Added translation keys across all 25 locales
2026-09-14 18:40:50 +02:00
openhands 644d53ca16 Rebuild organize imports: move furniture between categories, 500-item cap 2026-09-14 18:24:48 +02:00
simoleo89 c5c9941768 feat(hk): explain background updates with protected content links and retry details 2026-09-13 19:41:25 +02:00
simoleo89 f7b9b55700 fix(news): preserve recoverable reads and verify publication against real services 2026-09-13 19:31:32 +02:00
simoleo89 8abfe352ef fix(security): authorize site uploads and harden tokens, media and request identity 2026-09-13 19:24:43 +02:00
simoleo89 52f6d1491f fix(news): persist publication requests and retry cache delivery 2026-09-13 18:33:45 +02:00
simoleo89 13665e0c3c feat(catalog): persist idempotent bulk operations and retryable deliveries 2026-09-13 18:05:03 +02:00
simoleo89 1eee6661f9 feat(notifications): add account-scoped inbox and persistent preferences 2026-09-13 17:59:22 +02:00
simoleo89 8f55ff2d17 feat(docker): guide clone installation and validate paired update artifacts 2026-09-13 17:57:14 +02:00
openhands 0af8d8a398 fix(lint): resolve biome formatting and unused variables across codebase 2026-09-12 19:45:29 +02:00
openhands 91008d84fe feat(i18n): synchronize all translation keys across all supported locales (25 languages) 2026-09-12 19:30:16 +02:00
simoleo89 c5a2b44807 feat(catalog): undo bulk offer edits with guarded history restoration 2026-09-11 10:47:46 +02:00
simoleo89 13bd3695cb feat(studio): recover matching Nitro sources and persist import phases 2026-09-11 10:22:06 +02:00
simoleo89 00e33623f7 feat(devops): diagnose slow HK requests and dependency timings 2026-09-11 09:48:19 +02:00
simoleo89 88790d1a0d feat(cms): recover drafts and failed imports with verified UI workflows 2026-09-11 08:58:10 +02:00
simoleo89 db4acbb46e feat(editorial): validate publications and preserve partial event updates 2026-09-11 00:36:55 +02:00
simoleo89 96d3e3f602 feat(events): add weekly browsing and personal registrations 2026-09-11 00:27:41 +02:00
simoleo89 a537c55793 feat(me): show actionable personal tasks with unavailable states 2026-09-11 00:15:46 +02:00
simoleo89 1ef405be0a feat(cms): add recovery history and operational reliability tools 2026-09-09 21:57:56 +02:00
simoleo89 89526af344 feat(hk): expand search and add operational user overview 2026-09-09 21:14:10 +02:00
simoleo89 047cd9f3dd feat(catalog): add saved packages, preview and bulk price editing 2026-09-09 20:04:10 +02:00
simoleo89 c389c3893d feat(cms): improve catalog, editorial recovery and operations 2026-09-09 19:36:15 +02:00
simoleo89 35d0f3ee01 fix(catalog): make access controls visible and compact 2026-09-06 21:08:52 +02:00
simoleo89 93a7e9a7c2 feat(catalog): improve visual manager search and offer discovery 2026-09-06 20:58:53 +02:00
simoleo89 55a47949f1 feat(catalog): add reviewed bulk edits and complete category duplication 2026-09-06 20:25:19 +02:00
simoleo89 193b6686a9 refactor(catalog): unify commands and embed guarded catalog workspace 2026-09-06 19:40:52 +02:00
simoleo89 9b0ea2fb16 fix(news): restore publication flow and deduplicate dashboard friends 2026-09-06 18:32:43 +02:00
simoleo89 ef94646d60 fix(i18n): persist CMS translations and validate message catalogs 2026-09-06 17:55:11 +02:00
simoleo89 96234075f8 refactor(admin): remove sidebar favorites 2026-09-06 17:25:04 +02:00
simoleo89 a070004e7b feat(admin): reorganize housekeeping and strengthen shared workflows 2026-09-06 17:17:30 +02:00
simoleo89 b5dcadb67b feat(staff): present members in responsive profile cards 2026-09-06 11:53:05 +02:00
simoleo89 85a6df162b feat(me): organize personal dashboard and localize user actions 2026-09-06 11:30:24 +02:00
simoleo89 31691c1c7d feat(profile): organize profile sections and use native currency icons 2026-09-06 10:56:20 +02:00
simoleo89 b12e405b34 fix(i18n): complete command center texts and merge client fallbacks 2026-09-05 20:24:41 +02:00
simoleo89 51d1284950 feat(admin): organize command center controls and diagnostics 2026-09-05 20:15:35 +02:00