Commit Graph

29 Commits

Author SHA1 Message Date
medievalshell 4e96355a94 perf(boot): non pre-fetchare le URL gamedata directory
preloadUrl salta le URL che finiscono con '/' (le gamedata split sono
directory): prima 404avano e sprecavano connessioni all'avvio.
2026-05-30 00:15:07 +02:00
duckietm 690a196d42 🆙 Fix texts 2026-05-21 08:59:26 +02:00
medievalshell 450b0fface security: don't dump the SSO ticket in the prepare() diagnostic log
The `[App] prepare() start` console.warn was including the full SSO
ticket from `window.location.search`. SSO tickets are one-shot bearer
credentials — any leak (copied logs in a bug report, screen share,
malicious browser extension reading console output) grants
single-use access to the user's session. Replace the actual ticket
with a boolean.
2026-05-21 02:23:56 +02:00
medievalshell 9e38de6160 feat(auth): capture remember-token from URL and persist for reconnect
The CMS Inertia /client page now passes `&token=<uuid>&token_exp=<unix>`
on the iframe src so Nitro can persist the token to localStorage on first
boot. `App.tsx::prepare()` reads them from `window.location.search` and
calls `SetRememberLogin({ token, expiresAt })` when no remember-login is
already stored.

This wires up the existing reconnect flow: when the WS drops, the loop
in `tryRememberLogin()` (already in this file) POSTs the saved token to
`login.remember.endpoint` (defaults to `${api.url}/api/auth/remember`)
and uses the returned fresh SSO ticket to reconnect. Without this step
the localStorage stayed empty and the reconnect always fell through to
"Session expired" after a few retries because Arcturus clears
`auth_ticket` on first consume.

Server side: the CMS counterpart is in medievalshell/InertiaCMS
commit on djoohotel — adds the /api/auth/remember endpoint backed by
`users_remember_families` (UUID family + 30-day expiry + revoked flag).
2026-05-21 01:01:06 +02:00
medievalshell c685c997a3 feat(loading): redesigned loader with progress bar, task labels, configurable assets
Loading screen overhaul:
- LoadingView: Nitro V3 logo flush top-left, loading.gif at viewport
  centre, large progress bar (max 900px / 90vw, h-8, gradient + glow)
  anchored bottom-centre with the percentage rendered inside the bar in
  Poppins, plus a friendly stage label underneath. Logo + background +
  progress bar colour overridable via renderer-config keys
  (loading.logo.url, loading.background, loading.progress.color).
- App.tsx: wired a real loadingProgress (0->100) + loadingTask driven by
  the boot pipeline: config init (10), renderer (20), per-warmup-task
  bumps for AssetManager/Localization/AvatarRender/SoundManager (25->70),
  session managers (78/85/92), Communication (98), ready (100). Each bump
  carries a task label looked up via a new taskLabel(key, fallback)
  helper so the Italian baseline ("Sto caricando il guardaroba",
  "Connessione al server", ...) can be translated by editing
  renderer-config; fallback keeps current strings if the key is missing.
- AvatarEffectsView: replace raw fetch(url).json() with
  loadGamedata(url) so the effectmap root manifest (JSON5 with
  // comments) parses correctly and supports the core/custom/seasonal
  tier merge.
- fallbackToLogin: respect login.screen.enabled=false. When login is
  disabled (SSO-only deployments), init failures now route to
  showSessionExpired() (home + diagnostic) instead of rendering an empty
  LoginView placeholder.
- scripts/write-asset-loader.mjs: the pre-React shell rendered into
  #root before the JS bundle takes over was a light-blue login skeleton
  (linear gradient + two grey rectangles) producing a visible flash
  before the real loader appeared. Replaced with the same
  radial-gradient the LoadingView paints — the handoff is now invisible.
- renderer-config.example: document the 13 loader keys so operators can
  copy & translate.
2026-05-21 00:22:17 +02:00
simoleo89 779a98cae1 merge: sync upstream duckietm/Dev (b2318b9) into feat/react19-modernization
Absorbs 10 upstream commits (JSON5 config support, user-settings reset
password/email/username, wear-badge popup fix, login screen fix, About
update, offer selection logic, client path fix).

Conflicts resolved by keeping the modernized React 19 / Zustand / Form
Actions structure and porting upstream intent surgically:

- bootstrap.ts: kept GetConfiguration().init() pre-init + useEffectEvent,
  added JSON5 import (already wired into the parse fallback)
- LoginView.tsx: kept Form Actions (useActionState/useFormStatus); the
  upstream persistAccessTokenFromPayload(payload) fix was already
  integrated in the modernized SSO branch
- App.tsx: kept useEffectEvent import + StrictMode/ErrorBoundary umbrella
- vite.config.mjs: kept sirv plugin + react-compiler babel; absorbed
  upstream's base: process.env.VITE_BASE || './'
- package.json: kept superset (sirv, Vitest, Zustand, react-colorful,
  React Compiler) + added json5
- User-settings views: accepted upstream (duplicate of local cherry-pick
  2053c8e); notification badge bubble: accepted upstream fix

Verification: yarn typecheck clean, 193/193 Vitest, yarn build green.
2026-05-18 20:14:58 +02:00
duckietm 0199437a82 🆙 Small fix login screen 2026-05-15 13:15:30 +02:00
duckietm 2053c8e015 🆕 Added Reset password / Email and chenge username in user settings 2026-05-13 21:13:31 +02:00
simoleo89 cd8951e536 dev: serve game assets via sirv plugin and pre-init configuration
Restoring `yarn start` from "takes forever" back to seconds.

A previous session had symlinked `public/nitro-assets` and `public/swf`
to a sibling `Nitro-Files/` tree (~177k files) so Vite could serve them
through `publicDir`. The cost was massive: chokidar tried to install a
watcher on every file at startup and the dev server hung for minutes
on Windows. Upstream `duckietm/Nitro-V3` never does this — assets live
on a separate HTTP server referenced by URL in the JSON configs.

Changes:

- Remove the two symlinks under `public/` and add a .gitignore entry
  with a note explaining why they must not come back.
- Add a small Vite plugin (`nitroAssetsServer`) that mounts `sirv` on
  `/nitro-assets/*` and `/swf/*`, reading from
  `../Nitro-Files/{nitro-assets,swf}`. sirv is a connect-style
  middleware that bypasses chokidar entirely, so 177k files no longer
  cost anything at startup. The plugin also wires the same handler
  into `configurePreviewServer` so `yarn preview` keeps working.
- Drop the matching `/nitro-assets` and `/swf` entries from
  `server.proxy` — they had been pointed at the auth proxy on :2096
  which does not expose those paths.
- Disable `login.turnstile.enabled` in `renderer-config.json`. The
  configured sitekey is Cloudflare's "always-passes" test key but the
  widget still requires user interaction and blocks the login flow
  in local dev.

Login flow fixes that fell out of debugging:

- `prepare()` in App.tsx ran twice under React Strict Mode (mount →
  cleanup → mount). The first pass set `setShowLogin(true)`, the
  second raced ahead and fell through to `onSessionExpired()`,
  clobbering the login UI. Guard the effect with
  `lastPrepareTriggerRef` so duplicate runs at the same trigger value
  are skipped while intentional re-runs (after a successful login,
  which bumps `prepareTrigger`) still go through.
- Call `GetConfiguration().init()` from `bootstrap.ts` before
  importing `./index`. The renderer's ConfigurationManager logs
  "Missing configuration key" the first time any key is read against
  an uninitialised store, and components mounted in the first paint
  (login screen, hooks, the renderer warmup) were all hitting that
  path before prepare()'s deferred init landed. Pre-loading the
  config means the store is already populated when React mounts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 20:57:01 +02:00
simoleo89 d382635597 Phase A: clear all react-hooks/exhaustive-deps warnings via useEffectEvent or hoisting
Eliminate the four remaining missing-dependency warnings reported by
react-hooks v7. Each one was a real stale-closure or re-trigger hazard;
the fix matches the intent rather than just silencing the linter.

- src/App.tsx (line 448): wrap showSessionExpired with useEffectEvent
  (onSessionExpired) so the prepare effect doesn't re-run on every
  showSessionExpired identity change but still calls the latest
  callback. Replace the two in-effect call sites.
- src/components/furni-editor/views/FurniEditorSearchView.tsx: wrap
  the on-mount onSearch('', '', 1) call with useEffectEvent so the
  callback prop isn't a missing dependency.
- src/components/notification-center/views/bubble-layouts/
  NotificationBadgeReceivedBubbleView.tsx: wrap the
  "fetch badges only if empty on mount" check with useEffectEvent
  so badgeCodes.length isn't required as a dep (and won't re-fetch
  every count change).
- src/components/navigator/views/room-settings/
  NavigatorRoomSettingsRightsTabView.tsx: switch deps from
  roomData?.roomId to roomData (the body uses roomData.roomId after
  an early return; the linter wanted the whole object).
- src/api/ui-settings/UiSettingsContext.tsx: hoist ALL_CSS_VARS
  outside the component (it's a static constant).

After this, yarn eslint reports zero exhaustive-deps warnings across
the whole src/.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
2026-05-11 16:31:51 +00:00
simoleo89 25d51aff3f Enable <StrictMode> + make App.tsx renderer init idempotent
App.tsx's prepare() useEffect ran four .init() calls
(SessionDataManager, RoomSessionManager, RoomEngine, Communication)
without any guard, plus an immediate heartbeat ping and a legacy
authentication track. Under StrictMode dev double-invoke, those
fire twice — risking duplicate session/communication state.

- Gate the four .init() chain behind gameInitPromiseRef: both the
  first and the simulated second invocation await the same promise.
- Gate the legacy track + immediate heartbeat behind bootstrapDoneRef.
- Heartbeat and remember-rotate intervals were already idempotent
  (clearInterval before setInterval); ticker registration was already
  guarded by tickersStartedRef; renderer/warmup were already gated by
  rendererPromiseRef/warmupPromiseRef. No change needed there.

Wrap <App /> in <StrictMode> in src/index.tsx now that the renderer
init path is double-invoke safe.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
2026-05-11 16:31:50 +00:00
simoleo89 535fa71020 ESLint --fix: auto-fix brace-style, indent, semi, no-trailing-spaces
Run eslint --fix across src/ to clear ~1900 mechanical lint errors
surfaced by the @typescript-eslint v8 + react-hooks v7 + react-compiler
upgrade in the React 19 modernization PR.

Issues fixed automatically:
- brace-style (Allman): try/catch one-liners reformatted to multi-line
- indent: tab-vs-space and depth corrections
- semi: missing trailing semicolons
- no-trailing-spaces

No semantic changes. Remaining 701 errors are real-code issues
(set-state-in-effect, rules-of-hooks, no-unsafe-* type checks) that
need manual per-file review.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
2026-05-11 16:31:50 +00:00
duckietm cdf8d929e1 🆕 Added Reset password / Email and chenge username in user settings 2026-05-11 18:07:54 +02:00
Lorenzune 57b83c1097 Refine mobile avatar widgets and login flow 2026-05-07 21:19:15 +02:00
Lorenzune b4fab3f6b9 Merge duckie main into live merge branch 2026-04-25 13:52:11 +02:00
duckietm bf99f97122 🆙 Updated Tokens to use JWT rotational tokens 2026-04-24 11:16:15 +02:00
Lorenzune 541d3045f1 Update secure login flow and login view 2026-04-23 16:26:32 +02:00
duckietm 969f4a07d2 🆕 Token login added
Backend (AuthHttpHandler):
- New users_remember_tokens table stores sha256 hex of the raw token
  so the DB never holds a usable credential. Seed file adds the table
  and a login.remember.duration.days setting (default 30).
- /api/auth/login accepts "remember": true. On success, issues a fresh
  32-byte base64url token, stores the hash, returns the raw token.
- New POST /api/auth/remember: accepts the raw token, looks up by hash,
  on a valid hit mints a fresh SSO ticket, rotates the token (deletes
  the consumed one and issues a new one), returns both to the client.
  No Turnstile - it's an automated trusted-device flow.
- /api/auth/logout also accepts rememberToken and deletes that single
  row so other devices keep their tokens.

Frontend:
- LoginView: "Remember me" checkbox (key login.remember_me already in
  ExternalTexts). Enabling it persists the returned rememberToken in
  localStorage.nitro.remember.token.
- App.tsx: before deciding to show the login screen, try a silent POST
  to /api/auth/remember with the stored token. On 200, inject the
  returned ssoTicket into window.NitroConfig and proceed to the
  authenticated flow; on 401, forget the token and show login.
- PurseView logout: sends the stored rememberToken in the body so the
  server can delete it, and clears localStorage before reload.
2026-04-23 10:16:32 +02:00
duckietm 2ff37c22d2 🆙 Added the use of ExternalTexts / UITexts 2026-04-23 08:33:04 +02:00
Lorenzune 237c523f9a checkpoint: secure assets and login flow baseline 2026-04-23 07:01:09 +02:00
duckietm 2de52235eb 🆕 UI Login page / no CMS required anymore 2026-04-20 14:22:53 +02:00
Lorenzune 36c0221a54 chore: checkpoint current work 2026-04-03 05:22:26 +02:00
duckietm 0ee4455d8d 🆙 SSO failure detection 2026-03-26 13:31:12 +01:00
duckietm 19fd0e0809 Revert "Merge pull request #45 from simoleo89/interface-color-pr"
This reverts commit d911196ccb, reversing
changes made to 8dccc509c4.
2026-03-23 13:31:15 +01:00
Life 9c2dccaad6 feat: UI color theming system with live preview, presets and server sync
- RGBA color picker with live preview (debounce 50ms)
- 30 preset colors + 12 theme presets (Ocean, Forest, Sunset, Royal, etc.)
- Header image selection from configurable image library
- Export/Import theme as JSON via clipboard
- CSS variable theming across all UI elements: NitroCard headers/tabs,
  context menus, buttons (primary/dark/gray), InfoStand, toolbar,
  room tools, purse, progress bars, sliders
- All elements use var(--name, fallback) for zero visual change when default
- Smooth 0.3s CSS transitions on theme change
- Server-side persistence via WebSocket (packets 10047/10048)
- Integrated Color/Image tabs into BackgroundsView panel
- All strings use LocalizeText() for i18n support
- Settings persisted in localStorage + server sync with 1s debounce
- Added react-colorful dependency
2026-03-22 21:48:07 +01:00
duckietm 4f2299e492 🆕 Disconnection handler, when you got disconnected you automatic go back to the room 2026-03-19 15:05:41 +01:00
duckietm 194e8cf3a8 Revert "Merge pull request #16 from simoleo89/feature/ui-customization"
This reverts commit d1a5996268, reversing
changes made to ae4ecc42f0.
2026-03-19 10:39:56 +01:00
medievalshell ea35f19940 Add UI Customization Panel with full color theming
- New "Interfaccia" panel with color picker (HSV + hex/RGB/alpha + 30 presets)
- Profile background customization tab
- Accent color propagates via CSS variables to: card headers/tabs,
  context menus, Button dark/primary/gray variants, InfoStand panels,
  toolbar, room tools, purse, .btn-primary/.btn-dark CSS classes
- All elements use var(--name, fallback) for zero visual change when default
- Settings persisted in localStorage
- Added react-colorful dependency
- Added ui-config.json with header images config keys
2026-03-18 20:12:00 +01:00
DuckieTM 7feb10ab15 🆙 Init V3 2026-01-31 09:10:52 +01:00