30 Commits

Author SHA1 Message Date
Lorenzune dd1b8b7613 Fix release bundle chunk loading 2026-06-15 02:20:54 +02:00
simoleo89 d73656bbfe chore: update react player and frontend deps 2026-06-04 22:15:12 +02:00
medievalshell 0c7814fe04 perf(build): granular code-split + preconnect hint for cold-load speed
The vendor chunk was a single ~1MB blob (react + tanstack-query +
framer-motion + jodit + emoji-mart + react-icons + howler + zustand +
json5 all merged), forcing every cold load to wait on the slowest of
those modules before the page could interactivate. Split it into
domain-specific chunks so HTTP/2 multiplexing can pull them in
parallel and CF can cache each independently:

- vendor-pixi  (pixi.js + pixi-filters — when rollup actually splits;
                currently inlined into the umbrella renderer chunk
                because nitro-renderer is its sole importer)
- vendor-audio (howler)
- vendor-emoji (@emoji-mart — heaviest at ~430KB, only used in chat
                so a longer-term win is making it lazy)
- vendor-editor (jodit + @react-page — admin-only news editor)
- vendor-react (react / react-dom / scheduler / error-boundary)
- vendor-motion / vendor-query / vendor-icons / vendor-state /
  vendor-json5
- nitro-renderer-{avatar,communication,room,assets} — heaviest
  renderer packages get their own chunks when imported directly
  (the umbrella @nitrots/nitro-renderer still hosts the rest)

Also add a `<link rel=preconnect>` for challenges.cloudflare.com so
the Turnstile JS handshake doesn't pay an extra TLS round-trip on
the first paint.

Net effect: roughly the same total bytes shipped on a cold load, but
they fetch in parallel instead of sequentially, and a warm second
visitor only re-downloads the chunks whose code actually changed.
2026-05-21 02:03:38 +02:00
simoleo89 06f9b66073 merge: integrate duckietm/Dev (JSON mode selector, split-gamedata script, installer, IT→ENG)
# Conflicts:
#	vite.config.mjs
2026-05-19 17:04:58 +02:00
simoleo89 790ad2b279 fix(vite): alias @nitrots/nitro-renderer umbrella to source index.ts
Without an explicit alias for the umbrella package
@nitrots/nitro-renderer, vite's resolver follows the node_modules
symlink (@nitrots/nitro-renderer -> Nitro_Render_V3) and the
\`"main": "./index"\` field, which can land on a stale built
\`dist/index.js\` when one exists in the renderer working tree.

When that happens the bundle ships pre-snapshot-pattern stubs of
SessionDataManager / IgnoredUsersManager / etc. — and the new
useSessionInfo / useUserDataSnapshot code calling getUserDataSnapshot()
explodes at runtime with the Firefox error

  TypeError: (intermediate value)() is undefined

(which is Firefox's way of reporting a chain like
\`GetSessionDataManager().getUserDataSnapshot()\` where the second
method is undefined). The reported call site is ToolbarView line 46
because that's the first consumer of useSessionInfo that mounts.

Two fixes together:

1. This commit: explicit alias \`@nitrots/nitro-renderer\` ->
   \`<renderer>/index.ts\`. Subsequent transitive imports
   (export * from '@nitrots/api', '@nitrots/events', ...) still go
   through the existing per-package aliases, so all renderer code is
   guaranteed-source even when a stale dist exists.

2. Rebuild the renderer's dist (yarn build in Nitro_Render_V3) so that
   any other consumer that bypasses vite's alias resolution (e.g. an
   ad-hoc Node script) also sees the current state. Done separately.

No source code change to any consumer. The client production build
\`yarn build\` now produces a bundle containing getUserDataSnapshot,
getIgnoredUsersSnapshot, SESSION_DATA_UPDATED, IGNORED_USERS_UPDATED
and the other new symbols — verified via grep on dist/assets/*.js.
2026-05-18 22:00:52 +02:00
medievalshell 2fded7bc79 feat: interactive JSON / JSON5 mode selector at build time
Lets the operator pick between strict JSON (legacy) and JSON5 for every
configuration file consumed by Nitro and the renderer.

- scripts/configure-json.mjs: interactive prompt (JSON5 recommended),
  with --if-missing and --non-interactive flags for CI use
- package.json: yarn configure / prestart / prebuild hooks
- vite.config.mjs: reads .nitro-build.json (or NITRO_JSON_MODE env) and
  injects the compile-time constant __NITRO_JSON_MODE__ via define
- src/bootstrap.ts: routes client-mode.json parsing through the
  selected mode
- .gitignore: ignore the per-deployment .nitro-build.json
- README: full usage and override section
- public/configuration assets regenerated by the updated prebuild flow

The renderer side (@nitrots/utils JsonParser) is updated in the
companion Nitro_Render_V3 commit on the dev branch.
2026-05-18 20:38:26 +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 8b54a3ab92 🆙 Small fix when client is other paths like /client 2026-05-15 10:34:15 +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 45620cab15 vite: actually split the renderer into its own chunk
The existing manualChunks rule had a bug: every renderer-related check
sat INSIDE `if(id.includes('node_modules'))`, but the renderer source
is consumed via filesystem alias to ../Nitro_Render_V3/packages/*/src
— it is not under node_modules. So the `Nitro_Render_V3` branch never
fired, and the entire renderer (~1MB+) ended up merged into the main
app chunk instead of its own nitro-renderer-*.js.

Move the renderer-path check BEFORE the node_modules guard and base
it on either the literal "Nitro_Render_V3" segment or the resolved
rendererRoot (whichever is in use). The node_modules branch still
handles the unlikely case that someone publishes the renderer as a
real npm package later.

Result expected on yarn build:
- one nitro-renderer-*.js chunk for renderer + pixi (pixi is aliased
  to rendererRoot/node_modules/pixi.js, so its id will include
  rendererRoot too)
- one vendor-*.js chunk for third-party deps from node_modules
- one src-*.js (or similar) chunk for the app

This makes the first paint of the app faster (browser can parallel-
download chunks) and lets the CDN cache the renderer between deploys
where only the client code changed.

No behavior change at runtime — just a different on-disk layout.
2026-05-12 09:00:56 +00:00
simoleo89 35b8493696 vite: fail fast with a setup hint when the renderer SDK is missing
Today if you clone Nitro-V3 without cloning Nitro_Render_V3 next to it,
yarn start / yarn build fail deep inside Rolldown with:

    Failed to resolve import "@nitrots/nitro-renderer"
    from "/path/to/Nitro-V3/src/App.tsx"

which doesn't tell you what to do. Move the check up to
vite.config.mjs: when neither ../Nitro_Render_V3 nor ../renderer
exists, throw with the explicit clone-and-install steps and a pointer
to CLAUDE.md.

Also update CLAUDE.md "Commands" section:
- Add `yarn preview` (production build server, http://localhost:4173).
- Add a 4-step "Setup walkthrough" covering: clone the renderer
  sibling, yarn install on both, copy public/configuration/*.example
  to *.json, then run.

Net effect: a fresh checkout of this branch shows you exactly which
prerequisite is missing instead of a Rolldown stack trace.
2026-05-12 08:48:11 +00:00
simoleo89 a1bee1d825 React 19 modernization: forwardRef removal, Compiler, ErrorBoundary, Suspense, native <script>
Adopt React 19 idioms across the codebase. The runtime was already on
react@19.2.5 but no React 19 APIs were in use.

- forwardRef -> ref-as-prop in 7 layout/component files
  (NitroInput/Button/ItemCountBadge/Card×5/InfiniteGridItem,
  ToolbarItemView, AvatarEditorIcon)
- <Ctx.Provider> -> <Ctx> in 6 contexts (CatalogAdmin, FloorplanEditor,
  UiSettings, GridContext, NitroCardContext, NitroCardAccordionContext)
- Native <script> hoisting for Turnstile, ExternalPluginLoader, GoogleAdsView
  (React 19 dedupes by src; removes manual document.head.appendChild +
  module-level promise caches)
- React Compiler enabled at build time via babel-plugin-react-compiler
  in vite.config.mjs (target: '19'), plus eslint-plugin-react-compiler
  in lint mode
- Global <ErrorBoundary> + <Suspense> in src/index.tsx using
  react-error-boundary, with LoadingView as fallback
- BackgroundsView migrated to use(promise) as a demonstrator pattern
  for Suspense-driven config loading
- ESLint react setting bumped 18.3.1 -> 19.2; legacy
  @typescript-eslint/ban-types replaced with no-restricted-types
  (the old rule was removed in @typescript-eslint v8)
- Refresh public/configuration/{asset-loader,bootstrap}.js to match
  current write-asset-loader.mjs output

Phase 3 (login forms -> useActionState/useFormStatus) deferred:
LoginView is 1623 lines with lockout + Turnstile + heartbeat
interleaving; safer as its own PR.

https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
2026-05-11 16:31:50 +00:00
duckietm dbf5ae875c 🆙 Small update in building 2026-05-06 12:50:00 +02:00
Lorenzune 3c9a599505 Add secure configuration bootstrap flow 2026-04-25 13:29:48 +02:00
Lorenzune 21dd357397 Replace production domain references with examples 2026-04-24 15:59:55 +02:00
Lorenzune 541d3045f1 Update secure login flow and login view 2026-04-23 16:26:32 +02:00
Lorenzune 237c523f9a checkpoint: secure assets and login flow baseline 2026-04-23 07:01:09 +02:00
Lorenzune 726d1cc5c8 Merge latest duckie main with login UI 2026-04-21 11:53:30 +02:00
Lorenzune 964ffa6c1f Fix duckie merge vite layout alias 2026-04-21 11:23:40 +02:00
duckietm 2de52235eb 🆕 UI Login page / no CMS required anymore 2026-04-20 14:22:53 +02:00
duckietm 2ac7ed492f 🆙 Updated all css to be used for vite 8.0 2026-04-10 10:15:58 +02:00
Lorenzune 56a0be64d9 Polish wired editor UI and source selection flows 2026-03-25 03:26:27 +01:00
duckietm a0d0b5c4a4 Revert "Merge branch 'main' into furnisettingeditor-pr"
This reverts commit dfbfb1c2c1, reversing
changes made to 07702c44d0.
2026-03-23 11:49:05 +01:00
DuckieTM 735be2aff6 Merge branch 'main' into catalog-redesign 2026-03-23 08:49:20 +01:00
Life a5ea88010e feat: catalog style toggle (classic/new) with admin mode & favorites 2026-03-22 16:54:40 +01:00
Lorenzune 3e20f65f3a feat: update wired editor extras and selection handling 2026-03-22 16:48:51 +01:00
Medievalshell 7be552a523 Merge branch 'main' into improve-mod-tools-ui 2026-03-20 22:25:19 +01:00
duckietm 321dff2f6d 🆙 Now always generate a generic index.css when build 2026-03-17 11:46:02 +01:00
simoleo89 a11987e1e0 Add FurniEditor tool with Next.js API integration
- FurniEditor component with Search/Edit tabs (NitroCard UI)
- useFurniEditor hook connecting to Next.js API routes via Vite proxy
- Edit Furni button in room infostand (godMode) with sprite ID lookup
- Toolbar: 3-column flex layout (icons | chat | friends)
- Heroicons SVG for ID/Sprite display in infostand and edit view
- Vite config: proxy /api to Next.js, aliases for renderer3 packages
2026-03-15 00:27:09 +01:00
DuckieTM 7feb10ab15 🆙 Init V3 2026-01-31 09:10:52 +01:00