diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-07 00:48:55 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-07 00:48:55 +0200 |
| commit | a36080742287bad8f657f688d7fec0022dd696a1 (patch) | |
| tree | 3da5c9eedb9c0d2f22967ebf61bd777e32c7bb5e /packages/meshbay-hub/src/meshbay_hub/static/group-page.js | |
| parent | 6828e64a256caea3c4e51829ae1aa09dfa725324 (diff) | |
| download | meshbay-a36080742287bad8f657f688d7fec0022dd696a1.tar.gz | |
feat(client): HelloWorld, the reference application
Every other test of the plugin architecture reads source for the *absence* of
app names. That proves nobody wrote a special case for Videos; it cannot prove
a genuinely new application works, because there was no new application.
This is one. It stores directories, appears as a tab, has a settings pane and
lists files, and the node has never heard its name outside a single allow-list
entry. Two files and one registry line, which is the claim
`docs/refactor-groups.md` §4.1 makes.
It ships hidden behind `?dev=1` (`dev: true` in the registry, the same opt-in
shape as transport.js's `?trace=1`). Registering it normally would put a toy
app in every operator's group; not registering it would prove nothing, since
registration is exactly what is claimed to be sufficient.
**Adding it found two places where the claim was nearly true rather than true,
and both are fixed by making the code less app-specific:**
`group-settings.js` fell back to the whole registry when a group had no
`enabled_apps` yet — which would have turned a hidden app on for everyone. It
asks `availableApps()` now.
`group-page.js` wrote out `videoDirectories` / `musicDirectories` /
`photoDirectories` by hand, so a fifth app would have needed that file edited.
It derives `<key>Directories` from the registry.
Neither was found by reading; both were found by adding the app, which is the
whole reason it exists.
Verified in a real Electron window as well as by the tests: hidden by default,
present with the flag, offered its own settings section, and listing exactly
the files under its configured folder and its subfolders — not the ones beside
it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011pvMdvLBG92jyhvD5pD6us
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/group-page.js | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js index 0a43724..6f41426 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js @@ -9,7 +9,7 @@ import { HUB, session, cacheGroupIndex, hubFetch, ensureFreshToken, _loadBundleKey, _loadRecoveryKey, _storeBundleKey, } from './hub-client.js'; -import { visibleApps } from './apps.js'; +import { APPS, visibleApps } from './apps.js'; import { GroupName } from './group-name.js'; import { FilePreview } from './files-app.js'; import { VideoPlayer } from './video-player.js'; @@ -654,10 +654,19 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, // `group-settings.js` untouched — that page renders the panes without // knowing what any of them is for, which is what makes adding an app a // registry entry rather than an edit to the page. + // `<key>Directories` for every registered app, derived from the registry + // rather than written out. Naming them here would mean adding an app + // required editing this file, which is the one thing the plugin + // architecture is supposed to have removed — and the reference app + // (docs/refactor-groups.md §4.1) is what made the difference visible. + const perAppDirectories = useMemo(() => { + const out = {}; + for (const app of APPS) out[`${app.key}Directories`] = appDirs(app.key); + return out; + }, [appDirs]); + const appSettings = useMemo(() => ({ - videoDirectories: appDirs('video'), - musicDirectories: appDirs('music'), - photoDirectories: appDirs('photo'), + ...perAppDirectories, chatDirectory, chatLinkPreview, tmdbEnabled: tmdbConfig ? tmdbConfig.enabled !== false : true, @@ -665,7 +674,8 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, tmdbTokenCustomized: Boolean(tmdbConfig && tmdbConfig.tokenCustomized), musicbrainzEnabled: musicbrainzConfig ? musicbrainzConfig.enabled !== false : true, - }), [appDirs, chatDirectory, chatLinkPreview, tmdbConfig, musicbrainzConfig]); + }), [perAppDirectories, chatDirectory, chatLinkPreview, tmdbConfig, + musicbrainzConfig]); const commonProps = { groupId, transportRef, gekRef, status, username, @@ -676,9 +686,7 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, // Plural everywhere: Videos and Music read a list now, and Photos always // did. The scalar `videoRoot`/`audioRoot` shapes survive only on the wire, // for a node that speaks MNP 1.0 — nothing in the client carries them. - videoDirectories: appDirs('video'), - musicDirectories: appDirs('music'), - photoDirectories: appDirs('photo'), + ...perAppDirectories, tmdbConfig, musicbrainzConfig, onPlayQueue, }; |