5.7 KiB
5.7 KiB
Blossom Server Sidenav Section
Overview
Add a Blossom Servers section to the sidenav on all pages, mirroring the existing relay section pattern. This replaces the current server management UI that lives only in the blobs.html sidenav body with a compact, fixed-position section visible across the entire app.
Current Architecture
Relay Section Pattern (to mirror)
The relay section follows this architecture across all 20 pages:
- HTML — A
#divRelaySectiondiv sits between#divSideNavBodyand#divVersionBarin the sidenav - CSS — Global styles in
www/css/client.cssdefine#divRelaySection,#divRelaySectionTitle,#divRelayList - Module —
www/js/relay-ui.mjsexportsinitSidenavRelaySection()andupdateSidenavRelaySection() - Per-page wiring — Each page imports from
relay-ui.mjs, callsinitSidenavRelaySection()at startup, andupdateSidenavRelaySection()in its periodicUpdateFooter()loop
Current Blossom Server Management (blobs.html only)
- Server list stored in
USER_SERVER_LISTarray with health status - Server list fetched via Nostr kind 10063 subscription
- Full management UI (add/remove/test/publish) rendered in
loadSideNav()into#divSideNavBody - Health checking via
checkServerHealth()function
Proposed Architecture
graph TD
A[www/js/blossom-ui.mjs] --> B[initBlossomSection]
A --> C[updateBlossomSection]
A --> D[getBlossomServers]
B --> E[Creates HamburgerMorphing indicators]
C --> F[Updates health status indicators]
D --> G[Subscribes to kind 10063 events]
D --> H[Checks server health]
I[www/css/client.css] --> J[#divBlossomSection]
I --> K[#divBlossomSectionTitle]
I --> L[#divBlossomList]
M[Every HTML page] --> N[HTML: divBlossomSection in sidenav]
M --> O[JS: import and call blossom-ui.mjs]
Sidenav Layout Order
#divSideNav
├── #divSideNavHeader
├── #divSideNavBody (flex: 1, scrollable)
├── #divRelaySection (fixed, max-height: 200px)
├── #divBlossomSection (fixed, max-height: 200px) ← NEW
└── #divVersionBar (fixed height)
Implementation Steps
1. Create www/js/blossom-ui.mjs
A new module mirroring relay-ui.mjs with these exports:
initBlossomSection()— Called once at page init. Sets up the section, subscribes to kind 10063 events viasubscribe()frominit-ndk.mjsupdateBlossomSection()— Called periodically fromUpdateFooter(). Refreshes server health indicatorsgetBlossomServers()— Returns the current server list array (for use byblobs.htmland other pages that need server data)
The module will:
- Subscribe to kind 10063 events to get the user's blossom server list
- Parse server tags from the event
- Perform health checks on each server
- Render a compact list in
#divBlossomListshowing:- Server domain name
- Health status indicator (HamburgerMorphing shape: circle=unchecked, plus=healthy, x=unhealthy)
- Upload/mirror capability indicators
2. Add CSS to www/css/client.css
Add styles for #divBlossomSection, #divBlossomSectionTitle, #divBlossomList — identical structure to the relay section styles:
#divBlossomSection {
flex-shrink: 0;
max-height: 200px;
overflow-y: auto;
background-color: var(--secondary-color);
border-top: 3px solid var(--primary-color);
padding: 10px;
}
#divBlossomSectionTitle {
font-family: pageKanji;
font-size: 100%;
font-weight: bold;
margin-bottom: 10px;
padding-bottom: 5px;
border-bottom: 1px solid var(--muted-color);
}
#divBlossomList {
font-size: 70%;
font-family: var(--font-family);
}
3. Add HTML to all 20 pages
Insert between #divRelaySection and #divVersionBar:
<div id="divBlossomSection">
<div id="divBlossomSectionTitle">ブロッサム</div>
<div id="divBlossomList">Loading servers...</div>
</div>
4. Update all 20 pages JavaScript
Add import and initialization calls:
// Import
import { initBlossomSection, updateBlossomSection } from './js/blossom-ui.mjs';
// In main init
initBlossomSection();
// In UpdateFooter
await updateBlossomSection();
5. Refactor blobs.html
- Remove the server management UI from
loadSideNav()(the サーバー管理 section) - Import
getBlossomServersfromblossom-ui.mjsinstead of maintaining its ownUSER_SERVER_LIST - Keep blob-specific functionality (upload, delete, sync, grid/list view) but source server data from the shared module
- The sidenav body can be repurposed for blob-specific controls or left minimal
Pages to Update (20 total)
www/ai.htmlwww/blobs.htmlwww/cal.htmlwww/cashu.htmlwww/db.htmlwww/didactyl.htmlwww/event.htmlwww/index.htmlwww/links.htmlwww/msg.htmlwww/music.htmlwww/note.htmlwww/npub.htmlwww/post.htmlwww/profile.htmlwww/relays.htmlwww/skills-demo.htmlwww/strudel.htmlwww/template.htmlwww/todo.htmlwww/tools.html
Key Design Decisions
- Japanese title: ブロッサム (Burossamu = Blossom) to match リレー pattern
- Health indicators: Use HamburgerMorphing shapes consistent with relay indicators
- Shared state: The module manages its own server list state, exposed via
getBlossomServers()for pages likeblobs.htmlthat need to interact with servers - Subscription: Each page subscribes to kind 10063 independently through the shared NDK worker — the module handles deduplication
- Health check frequency: Health checks run on init and then periodically (every 60 seconds) to avoid excessive network requests