Merge branch 'master' into ai/issue-17
This commit is contained in:
30
AGENTS.md
30
AGENTS.md
@@ -28,6 +28,7 @@ CI (`.gitea/workflows/deploy.yml`) builds two Docker images on every push to `ma
|
||||
dragonroll/
|
||||
├── backend/ Express API (CommonJS, entry: src/index.js)
|
||||
├── frontend/ Nuxt 4 app (entry: app/app.vue)
|
||||
├── obsidian-plugin/ Plain JavaScript Obsidian plugin for campaign note import/push
|
||||
├── docker-compose.yml nginx :3000 -> frontend :3000, /api -> backend :5000
|
||||
├── nginx.conf reverse proxy rules for the compose stack
|
||||
├── ecosystem.config.js PM2 config (stale: runs `npm start`, which does not exist — see §9)
|
||||
@@ -189,7 +190,8 @@ Fetch the file from `/api/public/<filename>`.
|
||||
`GET /api/campaign/list` → `{status:'ok',campaigns}`
|
||||
`GET /api/campaign/retrieve/:id` → `{status:'ok',campaign}` (401 when no `req.user.id`)
|
||||
|
||||
`GET /api/note/list?campaign=` → `{status:'ok', folders, notes}` — notes with `folder: null` (roots)
|
||||
`GET /api/note/list?campaign=` → `{status:'ok', folders, notes}` — notes with `folder: null` (roots);
|
||||
folder entries include `parentFolder` so clients can rebuild nested folder paths
|
||||
`GET /api/note/subfolder/list?campaign=&folder=` → `{status:'ok', subfolders, notes}`
|
||||
`POST /api/note/create` — `{title*,content,campaign*,folder?}` (folder validated against campaign)
|
||||
`POST /api/note/update` — `{id*, title?, content?, folder?, color?}` — partial, ownership checked
|
||||
@@ -290,7 +292,7 @@ frontend/
|
||||
│ │ VersionRender
|
||||
│ ├── layouts/ IconButton, Dropdown, Tabs, ColorPicker (reusable UI atoms)
|
||||
│ └── viewer/ TopBar, statusbar/{StatusBar,FetchStatus}, topbar/{TopSearchBar,SearchResult},
|
||||
│ content/{Content,NoteContainer,Note}, widgets/{TableWidget,TestWidget,
|
||||
│ content/{Content,NoteContainer,Note}, map/MapViewerPane, widgets/{TableWidget,TestWidget,
|
||||
│ inline/RollWidgetInline,display/RollWidgetDisplay}
|
||||
├── composables/ useTheme.ts (theme+accent singletons, localStorage, data-* attrs),
|
||||
│ useEmitter.ts (BROKEN, see §9)
|
||||
@@ -304,7 +306,10 @@ There is no `app/pages/`. `app/app.vue` renders a fixed shell of managers. "Scre
|
||||
|
||||
- **Windows** — floating, draggable/resizable overlays (login, main menu, settings…), or
|
||||
- **Content** — the campaign workspace (`TopBar` + `ContentSidebar` + note column + `StatusBar`),
|
||||
shown when `Campaign` state is non-null.
|
||||
shown when `Campaign` state is non-null. The note column shows the open notes, or the map anchored
|
||||
on it (`AnchorMap` / `ActivePane` in `services/Content.js`); the sidebar's notes and maps buttons
|
||||
switch between the two while both keep their state, and `viewer/map/MapViewerPane.vue` renders the
|
||||
map there and inside the `map_viewer` window (a detached anchored map).
|
||||
|
||||
Boot sequence (`app.vue` → `start()`):
|
||||
|
||||
@@ -367,7 +372,7 @@ Plain modules with module-scope `ref()`s imported directly. No DI, no Pinia. Sin
|
||||
| `Server.js` | axios instance (fallback baseURL `http://localhost:5000/api`), `initApi(baseURL)` called by `plugins/api.ts`, request interceptor adding `Authorization: Bearer <localStorage.token>`, `getBaseUrl()`. Default export is a factory: call `Server()` then `.get/.post`. |
|
||||
| `User.js` | `UserStatus` ref, `GetUser()` (decodes JWT, auto-logout on `exp`), `SetUser(token)`, `LoadUser`, `LogoutUser`, `IsAdmin`, `HasAdmin()`, `GetUserSetting(key)` / `SetUserSetting(key,value)` (server-backed, in `User.settings`) |
|
||||
| `Campaign.js` | `useCampaignService()` → `Campaign` (`useState('campaign')`), `SetCampaign(data)` (also writes `localStorage.selectedCampaignId`), `RestoreCampaign()` |
|
||||
| `Content.js` | `ShowContent` ref (drives the campaign workspace). `SetShowContent` is exported but unused — `ContentManager.vue` sets it from a `watch(Campaign)` and never turns it back off |
|
||||
| `Content.js` | `ShowContent` ref (drives the campaign workspace: `ContentManager.vue` turns it on from a `watch(Campaign)`, `TopBar` off when leaving a campaign) and the anchored map: `ActivePane` (`'notes'`\|`'map'`), `AnchoredMap`, `SetActivePane`, `AnchorMap`, `ClearAnchoredMap` |
|
||||
| `Emitter.js` | `export const emitter = mitt()` — the app-wide event bus |
|
||||
| `Toaster.js` | `DisplayToast(color, text, duration)` → emits `toast`; `ToastManager.vue` renders it |
|
||||
| `Tooltip.js` | `SetupTooltip()`, `AddTooltip(el, text, {max_width})` (stores on `el._dr_tooltip`), polled visibility via `elementsFromPoint` |
|
||||
@@ -477,6 +482,23 @@ script; `WindowDefinitions` stores raw keys (`title: 'windows.login'`) and `Wind
|
||||
configured (`nuxt.config.ts`, `langDir: 'locales/'`, `vueI18n: './i18n.config.ts'`) but its locale files
|
||||
(`locales/en.json` etc.) are empty `{}` — the custom plugin is what components actually consume.
|
||||
|
||||
### 5.9 Obsidian plugin
|
||||
|
||||
`obsidian-plugin/` is a plain JavaScript community plugin; copy `main.js` and `manifest.json` into
|
||||
`<vault>/.obsidian/plugins/dragonroll-sync/` (details in its README). It signs in through
|
||||
`POST /api/user/login`, saves the 48-hour JWT token in plugin data, and does not save the password.
|
||||
The user selects a campaign from `GET /api/campaign/list`.
|
||||
|
||||
- **Import or refresh campaign notes** reads `/api/note/list` plus `/api/note/subfolder/list` and
|
||||
creates/updates Markdown files under `Dragonroll/<Campaign>/`, preserving Dragonroll's folder tree.
|
||||
- **Push active note to Dragonroll** creates a root campaign note or updates the note linked in its
|
||||
frontmatter.
|
||||
- `dragonrollId`, `dragonrollCampaign`, and `dragonrollTitle` frontmatter properties link imported
|
||||
notes. They are omitted from content sent to Dragonroll. Per-note signatures detect local edits;
|
||||
imports preserve modified local files, and push is explicit.
|
||||
|
||||
The plugin uses Obsidian's `requestUrl` helper, so the request path does not depend on browser CORS.
|
||||
|
||||
## 6. Conventions
|
||||
|
||||
- **Backend**: CommonJS `require`/`module.exports`; files in `services/` are shared infra, `routes/`
|
||||
|
||||
Reference in New Issue
Block a user