# Home navigation and hosted Vim follow-up ## Application assets and editor routes Templates load CSS and JavaScript from `/static/`. The legacy `/o/path:/system/static/` namespace remains a read-only compatibility alias to the confined static file server. It is not a UUID/Object address and must not be sent through document authorization. Other `/o/` addresses remain protected. `/e/docs` and `/e/-/docs` both edit `/docs`; `/e/`, `/e/-`, and `/e/-/` edit `/`. The authorization target and editor use the same path decoder. Database resolution errors must not be mistaken for a missing page. ## Bookmark sections The Domain-scoped `home_bookmarks` JSON array stays backward compatible: ```json [ {"kind":"section","label":"Reference","href":"","children":false}, {"kind":"url","label":"Example","href":"https://example.com/"}, {"kind":"section","label":"Documents","href":"/docs","children":true} ] ``` A section starts a card and owns subsequent links until the next section. Legacy links before any section form a default card. `children=true` replaces that section's displayed links with the immediate children of its parent Path; manually configured links remain stored for when the toggle is turned off. Virtual folders are included, but `/u`, `/_`, and `/-` are excluded at the root. Management is available through a small settings icon on every home layout to Domain/Campus admins. A native modal dialog provides focus containment, Escape and close-button dismissal, while retaining unsaved edits if closed. The same section-card editor is used at `/-/sys/config?panel=bookmarks`. Section moves and deletion operate on the entire group; links can be moved to another section using a selector. Page content is never deleted by bookmark deletion. Saves use the existing server validation and request JSON acknowledgement; errors remain in the form instead of navigating away. On success the home reloads its cards. A navigation warning protects unsaved edits. Classic and directory layouts show cards; the search-only layout retains its search focus while allowing management. Limits: 64 rows total, including at most 16 section rows. Labels and URLs are validated server-side; invalid submissions leave previous settings untouched. Path URLs escape literal percent signs, fragments, spaces and Unicode. `GET /v/bookmarks?section=&after=` loads children as JSON. It resolves the section within the active Domain, checks the parent and each child against current read permissions, and returns at most 80 scanned children per request with a continuation cursor. No revision bodies, metadata stats, thumbnails or full-Domain listing are loaded. Queries use the Path prefix index and request cancellation. Browser loading is lazy and limited to two concurrent requests. Responses are `no-store`, avoiding stale permission results. Empty filtered pages may still contain a continuation cursor. Follow-up: batch authorization and materialized immediate-child indexes for extremely large subtrees; optimistic concurrency for multiple administrators editing the same configuration (currently last successful save wins). ## vim.wasm configuration and plugins The pinned runtime writes injected files using `wx+`: an existing bundled `/.vim/vimrc` is skipped, despite the package README suggesting overwrite. Use a new `/pageswiki.vimrc` MEMFS file and explicit `-u /pageswiki.vimrc`. This is verified inside the real Wasm binary, not merely by HTTP success. The Gateway image bundles the existing licensed Hack Nerd Font locally. `document.fonts.load('16px PagesWikiHack')` completes before startup so canvas cell widths use the final font. `guifont=PagesWikiHack:h16` controls actual Vim rendering; CSS alone does not. Font, Worker and Wasm retain same-origin isolation. `assets/vimwasm/app/vimrc` sets line numbers, cursor line, status line, search, indentation and dark colors. `pageswiki.vim` is a bundled pure-Vimscript plugin in `/.vim/plugin`, with an explicit runtimepath. Available operations: - `:Files` / Space+f: `:find` with Tab completion beneath `/work`. - Space+b: buffer listing and selection. - `[b` / `]b`: previous/next buffer; `:next` still traverses arguments. - Space+w: write; Space+/: clear search highlight. The existing BufWritePost export and scoped Gateway write-back remain in use. The base settings are image-managed. Domain administrators can customize them at `/-/sys/config?panel=adapter-vim.wasm`, separately from connection settings. ### Domain customization contract `POST /-/sys/config/vim` stores one `vim_wasm_settings` JSON config value per Domain: `enabled`, `font_size` (10–32), `vimrc`, `colorscheme`, `color_name`. The settings panel uploads UTF-8 files into editable text fields, supports download, custom-colorscheme removal, and reset to defaults. Each script is limited to 64 KiB; NUL bytes, invalid UTF-8 and path-bearing filenames are rejected server-side. One custom colorscheme is managed initially; uploading another replaces that slot. Nothing is written into the host filesystem. Only active builtin Domain/Campus administrators can save; readonly accounts cannot mutate executable configuration even if they retain group membership. A supplied Origin must match the request Host. Vimscript is executable trusted configuration and may invoke browser integration features; it is not a safe format for untrusted uploads. This is explicitly disclosed in the UI. No server shell, terminal, package manager or arbitrary process execution is exposed. An authorized `vim.wasm` workspace response includes the session Domain's `vim_settings`. The Gateway retains that snapshot in its server-side session and supplies it with `GET /vim/api/session` (`no-store`). Other adapter types do not receive these settings. Changes apply on a newly opened session. MEMFS initialization order: bundled defaults, configured font size, source `/pageswiki-user.vimrc`, then a fixed-path custom colorscheme under `/pageswiki-config/colors/pageswiki_custom.vim`. A conventional uploaded name matching `[A-Za-z0-9_-]+.vim` is also registered as a local alias before the user vimrc is sourced, so `colorscheme uploaded` works for `uploaded.vim`. Other uploaded filenames remain display metadata; no uploaded name is inserted into a command. Disabled customization retains source text but does not execute it. `?safe=1` on the Vim frontend URL skips all Domain customizations, including the font size, so a broken startup script cannot prevent recovery through the defaults and settings panel. Follow-up: versioned per-user settings, multiple named scheme slots, and an isolated test-startup window. A restricted terminal is not needed for the current configuration workflow. Any future terminal bridge needs a separate capability, runtime sandbox, resource limits and explicit authority design. Third-party plugin policy: vendor pinned, licensed pure-Vimscript files into MEMFS and test against this old pinned Vim feature set. Candidate classes are surround/text-object/comment helpers without native or network dependencies; no unreviewed third-party plugin is added by this change. Runtime vim-plug installation is unsupported. Vendoring `fzf.vim` alone is insufficient because fzf requires a native executable; shell/system()-dependent plugins belong in code-server or need a separately designed Wasm/JavaScript bridge. ## Verification `go test ./...` includes asset routing, matching editor/authorization paths, section persistence, invalid input, admin restrictions and child access tests. Opt-in browser tests: ```sh PAGESWIKI_BROWSER_TEST=1 go test ./internal/server -run 'TestEditorHomeChromiumSmoke|TestConfigChromiumSmoke|TestVimWasmChromiumSmoke|TestBookmarkAndVimSettingsChromium' -count=1 ``` The Vim test uses CDP real-time waiting (virtual time can finish before Worker compilation), two isolated files and a fake save endpoint. It asserts the actual guifont, loaded `:Files` command, argument count and absence of startup errors. It also edits a buffer with `:write` and verifies that BufWritePost exports the changed bytes to the fake Gateway save endpoint. Both custom settings and safe mode are exercised. UI tests open and close the settings dialog, save a section with automatic children, and upload/save vimrc and colorscheme files.