diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml
index 83ca0f63..ab8c9bfa 100644
--- a/.gitea/workflows/deploy.yml
+++ b/.gitea/workflows/deploy.yml
@@ -46,6 +46,12 @@ jobs:
docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest ./backend
docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-backend:latest
+ - name: Build discord bot
+ run: |
+ docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-discord-bot:latest \
+ ./discord-bot
+ docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/dragonroll-discord-bot:latest
+
- name: Copy files
run: |
scp docker-compose.yml deploy@${{ secrets.DEPLOY_HOST}}:/var/www/app/
diff --git a/.gitignore b/.gitignore
index b512c09d..1dcef2d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-node_modules
\ No newline at end of file
+node_modules
+.env
\ No newline at end of file
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 00000000..8e548bf3
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,471 @@
+# AGENTS.md — Dragonroll
+
+Read this file before touching the code. It is a complete map of the project: layout, architecture,
+data model, API, conventions and known landmines. You should not need to explore the rest of the repo
+to make a correct change.
+
+## 1. What this is
+
+**Dragonroll** is a free/open-source helper for tabletop RPG campaigns (notes, campaigns, folders,
+dice widgets, shared markdown, sounds). It is a two-app monorepo:
+
+- `backend/` — Node + **Express 5** + **Mongoose 9** (MongoDB) REST API, JWT auth. CommonJS.
+- `frontend/` — **Nuxt 4 / Vue 3** client (Composition API, `
+
+
+
+
+
+
+```
+
+DOM id conventions that `Windows.js`, `WindowHandle.vue` and drag/resize depend on — do not rename:
+`window-wrapper-{id}`, `window-handle-{id}`, `window-resize-handle-{id}`, `context-menu`, `mouse-tooltip`.
+
+`WindowHandle.vue` reads `title` (translated at mount via `$t`), `close` and `back` off the window
+object, exposes `setupHandle()`, and plays `/sounds/close.wav` when closed.
+
+### 5.3 Services (`app/services/`) — the state layer
+
+Plain modules with module-scope `ref()`s imported directly. No DI, no Pinia. Singleton by import.
+
+| Service | Provides |
+|---|---|
+| `Server.js` | axios instance (fallback baseURL `http://localhost:5000/api`), `initApi(baseURL)` called by `plugins/api.ts`, request interceptor adding `Authorization: Bearer `, `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 |
+| `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` |
+| `ContextMenu.js` | `SetupContextMenu()`, `AddContextMenu(el, items, {dropdown:true})`, `ShowContextMenu(items)`, `HideContextMenu()`. Items: `{name, icon?, action?, divider?}` or `{name, context:[...]}` for a submenu; built imperatively into `#context-menu` with `motion` animations |
+| `Sound.js` | `AddSound(rootEl)` binds `/sounds/snap.wav` to every `.sound-click` inside `rootEl` |
+| `Marker.js` | marked `Marked` instance + custom extensions, `ParseMarkdown(src)`, `GetWidget(kind,name)` (§5.4) |
+| `ActionRegistry.js` | `register({id,label,description,execute,isActive?})`, `unregister`, `search(q)` (diacritic-insensitive, prefix-first sort), `execute(id,params)` — powers the command palette |
+| `Windows.js` / `WindowDefinitions.js` | §5.2 |
+| `widgets/DiceParser.js` | recursive-descent dice evaluator (§5.5) |
+
+### 5.4 Markdown → Vue widgets
+
+`Marker.js` registers three marked extensions:
+
+| Syntax | Level | Output |
+|---|---|---|
+| `@name\n\n@end` | block | `
` |
+| `@name[text]` | inline | `` |
+| `[[target]]` | inline | `` (renders the literal text `Link`) |
+
+`Note.vue` renders the HTML with `v-html`, then in a `setTimeout(...,0)` calls `mountComponents()`,
+which `querySelectorAll('.vue-component-display'|'.vue-component-inline')` and mounts each node with a
+**separate** `createApp(GetWidget(kind, el.dataset.component), { content: el.dataset.content })`.
+Widgets are therefore isolated mini-apps: they receive only `content` (a string) and must not rely on
+the parent app's provides/injection.
+
+Registering a widget = add an entry to `widget_map` in `Marker.js`:
+
+```js
+const widget_map = {
+ inline: { roll: () => import("~/components/viewer/widgets/inline/RollWidgetInline.vue") },
+ display: { roll: () => import("~/components/viewer/widgets/display/RollWidgetDisplay.vue") },
+};
+```
+
+`Note.vue` also: handles `Ctrl/Cmd+E` (toggle edit/preview, saves on exit) and `Ctrl/Cmd+S` (save via
+`POST /note/update`), tracks dirty state (white dot in the vertical title strip), and wires
+Obsidian-style collapsible callouts (`setupCallout()`/`toggleCallout()` + `callouts.scss`).
+
+### 5.5 Dice grammar (`DiceParser.js`)
+
+`parse(expr) -> { total, steps[] }`. Tokens: `\d*d\d+` with optional `adv|dis|kh|kl`, integers,
+`+ - * / ( )`, unary minus. `adv`/`dis` roll 2dN and keep max/min; `kh`/`kl` keep highest/lowest N.
+Division is `Math.floor`. Guards: count 1–1000, sides 2–10000. `steps` are `{type:'op'|'const'|'dice'}`
+and `RollWidgetDisplay.vue` turns them into the visual breakdown (kept/dropped/max/min classes).
+
+### 5.6 Event bus contract
+
+Every listener in the app (there are only these six `emitter.on` call sites):
+
+| Event | Payload | Listened by |
+|---|---|---|
+| `toast` | `{color,text,duration}` | `ToastManager.vue` |
+| `push-note` | `{key,title,text,date}` | `NoteContainer.vue` |
+| `delete-note` | note key (string) | `NoteContainer.vue` |
+| `title-updated` | `{key,title}` | `Note.vue`, `NoteContainer.vue` |
+| `status-bar-update` | `{text,icon}` | `FetchStatus.vue` |
+
+Emitters: `Toaster.js` (`toast`), `ContentSidebar` / `TopSearchBar` (`push-note`), `Note.vue` /
+`NestedNoteList.vue` (`delete-note`), `ContentSidebar` (`title-updated`), `FetchStatus` (self-test emit).
+
+**Orphan events** — emitted, never subscribed to anywhere (the matching handlers `handleNoteCreated` /
+`handleNoteRenamed` exist in `ContentSidebar.vue` but were never wired with `emitter.on`; see §9.17):
+
+| Event | Emitted by | Intended handler |
+|---|---|---|
+| `note-created` | `ContentSidebar.createNote`, `TopSearchBar` | `ContentSidebar.handleNoteCreated` (dead) |
+| `note-renamed` | `RenameNoteWindow.vue` | `ContentSidebar.handleNoteRenamed` (dead) |
+| `folder-saved` | `NewFolderWindow.vue` | none — sidebar refreshes only via `@reload-notes` from `NestedNoteList` |
+
+So "create note" currently works because the sidebar mutates its own list, and folder changes need an
+explicit `fetchCampaignNotes()`. If you rely on an event, check a listener exists.
+
+Note object shape in the UI layer is `{ key, title, text, date }` (mapped from the API's
+`{_id,title,content,date}`); convert at the boundary as `ContentSidebar.fetchCampaignNotes` does.
+
+### 5.7 Theming, fonts, icons, sounds
+
+- `useTheme.ts` owns `theme` (`'light'|'dark'`) and `accent` (`'katlum'`, type currently narrow) as
+ module singletons, persists to `localStorage`, and sets `data-theme` / `data-accent` on ``.
+ `app.vue` calls `setupTheme()` then forces `setTheme('dark')` on mount.
+- `colors.scss` holds Sass maps `dark`/`light` (and accents `katlum`/`solus`/`silang`) emitted as
+ **`--color-*` CSS variables**. Always style with `var(--color-...)` (`background`,
+ `window-background`, `button-hover`, `text`, `border`, `icon-invert`, …), never hardcode hex.
+- Icons are inverted via `filter: invert(var(--color-icon-invert))` — white SVGs + `.icon` class.
+ Reference either as public assets (`/icons/iconoir/regular/xmark.svg`, `/icons/ui/...`,
+ `/icons/Pixelarticons/white/close.svg`) or from the `pixelarticons` npm package
+ (`import SearchIcon from 'pixelarticons/svg/search.svg'`).
+- Fonts (`fonts.scss` + `public/fonts/5e`): `BookInsanityRemake` (body default), `MrEavesRemake`
+ (headings/window titles), `ScalySansRemake`, `NodestoCapsCondensed`, `SolberaImitationRemake`, etc.
+- Sounds in `public/sounds/`: `snap.wav` (the `.sound-click` default), `close.wav`, `click.wav`,
+ `dice.wav`, `roll1.wav`, `roll2.wav`, `notify.wav`, `drums.wav`, `lock.wav`, `doors/`.
+
+### 5.8 i18n
+
+Locales: `en` (default), `es`, `ca`. Files live at `frontend/i18n/locales//.json`, and
+`app/plugins/i18n.ts` globs them and nests each under its **filename** — so the key is
+`.`, e.g. `i18n/locales/en/main-menu.json` → `$t('main-menu.create-campaign')`.
+Namespaces in use: `general`, `login`, `register`, `main-menu`, `settings`, `windows`, `campaigns`
+(`campaigns` currently only exists for `en`). Call it as `$t(...)` in templates or via `useI18n()` in
+script; `WindowDefinitions` stores raw keys (`title: 'windows.login'`) and `WindowHandle` translates them.
+
+**Adding a string = add it to all three locales** (`en`, `es`, `ca`); the Nuxt i18n module is also
+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.
+
+## 6. Conventions
+
+- **Backend**: CommonJS `require`/`module.exports`; files in `services/` are shared infra, `routes/`
+ are thin Express routers, `models/` one Mongoose schema per file exporting `mongoose.model(...)`.
+ Every handler is `try/catch` → `{status:'error', msg:'errors.internal'}` + `console.error`.
+ Route logic helpers (like `userOwnsCampaign`) are duplicated per router file today — match that
+ style unless you refactor both at once.
+- **Frontend**: Vue 3 `
-
+
+
+
diff --git a/frontend/app/services/WindowDefinitions.js b/frontend/app/services/WindowDefinitions.js
index 2fe9e6e4..03f7371a 100644
--- a/frontend/app/services/WindowDefinitions.js
+++ b/frontend/app/services/WindowDefinitions.js
@@ -35,6 +35,12 @@ const defWindows = {
close: () => ClearWindow({type: 'create_campaign'}),
movable: true
},
+ campaign_settings: {
+ title: 'campaigns.settings.title',
+ component: () => import('~/components/windows/CampaignSettingsWindow.vue'),
+ close: () => ClearWindow({type: 'campaign_settings'}),
+ movable: true
+ },
rename_note: {
title: "Rename Note",
component: () => import('~/components/windows/RenameNoteWindow.vue'),
@@ -46,6 +52,24 @@ const defWindows = {
component: () => import('~/components/windows/NewFolderWindow.vue'),
close: () => ClearWindow({type: 'new_folder'}),
movable: true
+ },
+ new_note: {
+ title: "New Note",
+ component: () => import('~/components/windows/NewNoteWindow.vue'),
+ close: () => ClearWindow({type: 'new_note'}),
+ movable: true
+ },
+ create_campaign_entry: {
+ title: 'campaigns.create-entry',
+ component: () => import('~/components/windows/CreateCampaignEntryWindow.vue'),
+ close: () => ClearWindow({type: 'create_campaign_entry'}),
+ movable: true
+ },
+ character_sheet: {
+ title: 'campaigns.character-sheet.title',
+ component: () => import('~/components/windows/CharacterSheetWindow.vue'),
+ close: () => ClearWindow({type: 'character_sheet'}),
+ movable: true
}
}
diff --git a/frontend/i18n/locales/ca/campaigns.json b/frontend/i18n/locales/ca/campaigns.json
new file mode 100644
index 00000000..cad0dede
--- /dev/null
+++ b/frontend/i18n/locales/ca/campaigns.json
@@ -0,0 +1,69 @@
+{
+ "create": {
+ "name": "Nom", "description": "Descripció", "description-placeholder": "Escriu una breu descripció de la campanya...",
+ "enter": "Introdueix el nom de la campanya...", "color": "Color d'accent", "success": "Campanya creada correctament!"
+ },
+ "settings": {
+ "title": "Configuració de la campanya",
+ "tabs": { "basic": "Bàsic", "integrations": "Integracions" },
+ "name": "Nom de la campanya",
+ "color": "Color de la campanya",
+ "foundry-url": "URL de Foundry VTT",
+ "foundry-url-help": "Introdueix l'URL base de la instància de Foundry VTT que executa el mòdul Dragonroll Foundry.",
+ "no-foundry-world": "Aquesta campanya no té cap món de Foundry enllaçat.",
+ "start-foundry-link": "Crea un codi per a Foundry",
+ "start-foundry-link-help": "Copia aquest codi a l'opció Dragonroll Campaign Pairing Code del mòdul de Foundry. Dragonroll Endpoint utilitza https://dragonroll.aranroig.com de manera predeterminada. El codi caduca al cap de 10 minuts.",
+ "unlink-foundry": "Desenllaça",
+ "saved": "S'ha desat la configuració de la campanya.",
+ "linked": "S'ha enllaçat el món de Foundry amb aquesta campanya.",
+ "unlinked": "S'ha desenllaçat el món de Foundry d'aquesta campanya.",
+ "code-copied": "S'ha copiat el codi d'enllaç.",
+ "saving": "Desant...",
+ "errors": {
+ "name-required": "Introdueix un nom per a la campanya.",
+ "invalid-foundry-url": "Introdueix una URL vàlida de Foundry VTT amb http o https.",
+ "link-expired": "El codi d'enllaç ha caducat. Crea'n un de nou.",
+ "copy-code": "No s'ha pogut copiar el codi d'enllaç."
+ }
+ },
+ "sidebar-label": "Campanya",
+ "sections": { "notes": "Notes", "actors": "Actors i personatges", "items": "Objectes" },
+ "actions": {
+ "new-note": "Nota nova", "new-folder": "Carpeta nova", "refresh": "Actualitza",
+ "create": "Crea {section}", "submit": "Crea", "delete": "Suprimeix", "saving": "Desant...",
+ "collapse-sidebar": "Redueix la barra lateral", "expand-sidebar": "Expandeix la barra lateral"
+ },
+ "states": {
+ "loading": "Carregant...", "loading-notes": "Carregant notes...", "empty-notes": "Encara no hi ha notes en aquesta campanya.",
+ "empty-actors": "Encara no hi ha actors ni personatges.", "empty-items": "Encara no hi ha objectes en aquesta campanya."
+ },
+ "errors": { "load": "No s'han pogut carregar les entrades de la campanya." },
+ "create-entry": "Crea una entrada de campanya",
+ "fields": { "name": "Nom", "description": "Descripció" },
+ "actor": {
+ "new": "Actor o personatge nou", "type": "Tipus", "species": "Espècie", "class": "Classe",
+ "level": "Nivell", "level-short": "Nivell", "background": "Rerefons", "challenge-rating": "Grau de desafiament",
+ "challenge-rating-placeholder": "Per exemple, 1/4 o 3", "cr-short": "GD",
+ "types": { "character": "Personatge", "npc": "PNJ", "creature": "Criatura" }
+ },
+ "item": {
+ "new": "Objecte nou", "category": "Categoria", "rarity": "Raresa", "quantity": "Quantitat",
+ "quantity-short": "Quant.", "weight": "Pes (lb)", "properties": "Propietats", "properties-placeholder": "Per exemple, versàtil, subtil",
+ "categories": {
+ "weapon": "Arma", "armor": "Armadura", "shield": "Escut", "adventuring-gear": "Equip d'aventura",
+ "magic-item": "Objecte màgic", "consumable": "Consumible", "tool": "Eina", "treasure": "Tresor", "other": "Altre"
+ },
+ "rarities": { "common": "Comuna", "uncommon": "Poc comuna", "rare": "Rara", "very-rare": "Molt rara", "legendary": "Llegendària", "artifact": "Artefacte" }
+ },
+ "character-sheet": {
+ "title": "Fitxa de personatge", "name": "Nom del personatge", "class": "Classe", "subclass": "Subclasse", "unset-class": "Classe sense definir",
+ "level": "Nivell", "species": "Espècie", "unset-species": "Espècie sense definir", "edit": "Edita la fitxa", "cancel": "Cancel·la",
+ "saving": "Desant...", "save": "Desa la fitxa", "save-error": "No s'ha pogut desar aquesta fitxa de personatge.", "photo": "Foto", "upload-photo": "Pujar foto", "change-photo": "Canviar foto", "remove-photo": "Treure foto", "uploading-photo": "Pujant...", "photo-error": "No s'ha pogut pujar aquesta foto.", "ability-scores": "Característiques", "proficiency-bonus": "Bonificador de competència",
+ "combat": "Combat", "armor-class": "Classe d'armadura", "speed": "Velocitat", "proficiencies": "Competències",
+ "proficiencies-placeholder": "Afegeix salvacions, habilitats, armadures, armes, eines i idiomes...", "empty-proficiencies": "No hi ha competències afegides.",
+ "traits": "Trets", "traits-placeholder": "Afegeix trets, capacitats i altres detalls...", "empty-traits": "No hi ha trets afegits.",
+ "spells": "Conjurs", "spells-placeholder": "Escriu els conjurs, un per línia...", "empty-spells": "No hi ha conjurs afegits.",
+ "inventory": "Inventari", "add-item": "Afegeix un objecte", "carried-weight": "Pes transportat", "item-name": "Objecte",
+ "quantity": "Quant.", "weight-each": "Unitat (lb)", "total-weight": "Total (lb)", "actions": "Accions", "empty-inventory": "L'inventari és buit."
+ }
+}
diff --git a/frontend/i18n/locales/ca/discord.json b/frontend/i18n/locales/ca/discord.json
new file mode 100644
index 00000000..17052534
--- /dev/null
+++ b/frontend/i18n/locales/ca/discord.json
@@ -0,0 +1,18 @@
+{
+ "title": "Connectar Dragonroll amb Discord",
+ "checking": "Comprovant aquesta sol·licitud d'autorització…",
+ "summary": "Servidor de Discord: {guild}. Sol·licitat per {user}. Inicia sessió i confirma-ho només si confies en aquesta sol·licitud.",
+ "sign-in-lead": "Inicia sessió amb el compte de Dragonroll que és propietari de la campanya que vols que utilitzi aquest servidor.",
+ "signed-in-as": "Has iniciat sessió com a {user}.",
+ "approve": "Autoritzar aquest servidor de Discord",
+ "connected": "Dragonroll s'ha connectat a {guild}.",
+ "next-step": "Torna a Discord i executa /dragonroll link per triar una campanya.",
+ "replace-warning": "Autoritzar un altre compte de Dragonroll reemplaça la connexió actual i l'enllaç de campanya d'aquest servidor.",
+ "errors": {
+ "missing-code": "A aquest enllaç d'autorització li falta el codi. Executa /dragonroll connect a Discord de nou.",
+ "link-expired": "Aquest enllaç d'autorització no és vàlid o ha caducat. Executa /dragonroll connect a Discord de nou.",
+ "sign-in-failed": "No s'ha pogut iniciar sessió a Dragonroll. Revisa l'usuari i la contrasenya.",
+ "session-expired": "La teva sessió de Dragonroll ha caducat. Inicia sessió de nou per continuar.",
+ "internal": "No s'ha pogut carregar aquesta sol·licitud d'autorització."
+ }
+}
diff --git a/frontend/i18n/locales/ca/foundry.json b/frontend/i18n/locales/ca/foundry.json
new file mode 100644
index 00000000..961f5260
--- /dev/null
+++ b/frontend/i18n/locales/ca/foundry.json
@@ -0,0 +1,6 @@
+{
+ "errors": {
+ "link-expired": "El codi d'enllaç de Foundry no és vàlid, ha caducat o ja s'ha utilitzat.",
+ "world-already-linked": "Aquest món de Foundry ja està enllaçat amb una altra campanya."
+ }
+}
diff --git a/frontend/i18n/locales/ca/general.json b/frontend/i18n/locales/ca/general.json
index 9e26dfee..8058b1d1 100644
--- a/frontend/i18n/locales/ca/general.json
+++ b/frontend/i18n/locales/ca/general.json
@@ -1 +1,3 @@
-{}
\ No newline at end of file
+{
+ "save": "Desa"
+}
diff --git a/frontend/i18n/locales/ca/windows.json b/frontend/i18n/locales/ca/windows.json
index 3419e62d..3c392161 100644
--- a/frontend/i18n/locales/ca/windows.json
+++ b/frontend/i18n/locales/ca/windows.json
@@ -6,4 +6,4 @@
"edit-profile": "Editar perfil",
"settings": "Configuració",
"create-campaign": "Crear campanya"
-}
\ No newline at end of file
+}
diff --git a/frontend/i18n/locales/en/campaigns.json b/frontend/i18n/locales/en/campaigns.json
index ee2b9437..8979616c 100644
--- a/frontend/i18n/locales/en/campaigns.json
+++ b/frontend/i18n/locales/en/campaigns.json
@@ -6,5 +6,70 @@
"enter": "Enter campaign name here...",
"color": "Accent color",
"success": "Campaign created successfully!"
+ },
+ "settings": {
+ "title": "Campaign settings",
+ "tabs": { "basic": "Basic", "integrations": "Integrations" },
+ "name": "Campaign name",
+ "color": "Campaign color",
+ "foundry-url": "Foundry VTT URL",
+ "foundry-url-help": "Enter the base URL of the Foundry VTT instance running the Dragonroll Foundry module.",
+ "no-foundry-world": "No Foundry world is linked to this campaign.",
+ "start-foundry-link": "Create a code for Foundry",
+ "start-foundry-link-help": "Copy this code into the Dragonroll Campaign Pairing Code setting in the Foundry module. The Dragonroll Endpoint defaults to https://dragonroll.aranroig.com. The code expires after 10 minutes.",
+ "unlink-foundry": "Unlink",
+ "saved": "Campaign settings saved.",
+ "linked": "Foundry world linked to this campaign.",
+ "unlinked": "Foundry world unlinked from this campaign.",
+ "code-copied": "Pairing code copied.",
+ "saving": "Saving...",
+ "errors": {
+ "name-required": "Enter a campaign name.",
+ "invalid-foundry-url": "Enter a valid Foundry VTT URL using http or https.",
+ "link-expired": "This pairing code expired. Create a new one.",
+ "copy-code": "Unable to copy the pairing code."
+ }
+ },
+ "sidebar-label": "Campaign",
+ "sections": { "notes": "Notes", "actors": "Actors & Characters", "items": "Items" },
+ "actions": {
+ "new-note": "New note", "new-folder": "New folder", "refresh": "Refresh",
+ "create": "Create {section}", "submit": "Create", "delete": "Delete", "saving": "Saving...",
+ "collapse-sidebar": "Collapse sidebar", "expand-sidebar": "Expand sidebar"
+ },
+ "states": {
+ "loading": "Loading...", "loading-notes": "Loading notes...", "empty-notes": "No notes in this campaign yet.",
+ "empty-actors": "No actors or characters yet.", "empty-items": "No items in this campaign yet."
+ },
+ "errors": { "load": "Unable to load campaign entries." },
+ "create-entry": "Create campaign entry",
+ "fields": { "name": "Name", "description": "Description" },
+ "actor": {
+ "new": "New actor or character", "type": "Type", "species": "Species", "class": "Class",
+ "level": "Level", "level-short": "Level", "background": "Background", "challenge-rating": "Challenge rating",
+ "challenge-rating-placeholder": "For example, 1/4 or 3", "cr-short": "CR",
+ "types": { "character": "Character", "npc": "NPC", "creature": "Creature" }
+ },
+ "item": {
+ "new": "New item", "category": "Category", "rarity": "Rarity", "quantity": "Quantity",
+ "quantity-short": "Qty", "weight": "Weight (lb)", "properties": "Properties", "properties-placeholder": "For example, versatile, finesse",
+ "categories": {
+ "weapon": "Weapon", "armor": "Armor", "shield": "Shield", "adventuring-gear": "Adventuring gear",
+ "magic-item": "Magic item", "consumable": "Consumable", "tool": "Tool", "treasure": "Treasure", "other": "Other"
+ },
+ "rarities": { "common": "Common", "uncommon": "Uncommon", "rare": "Rare", "very-rare": "Very rare", "legendary": "Legendary", "artifact": "Artifact" }
+ },
+ "character-sheet": {
+ "title": "Character Sheet", "name": "Character name", "class": "Class", "subclass": "Subclass", "unset-class": "Class not set",
+ "level": "Level", "species": "Species", "unset-species": "Species not set", "edit": "Edit sheet", "cancel": "Cancel",
+ "saving": "Saving...", "save": "Save sheet", "save-error": "Unable to save this character sheet.",
+ "photo": "Photo", "upload-photo": "Upload photo", "change-photo": "Change photo", "remove-photo": "Remove photo",
+ "uploading-photo": "Uploading...", "photo-error": "Unable to upload this photo.", "ability-scores": "Ability Scores", "proficiency-bonus": "Proficiency Bonus",
+ "combat": "Combat", "armor-class": "Armor Class", "speed": "Speed", "proficiencies": "Proficiencies",
+ "proficiencies-placeholder": "Add saving throws, skills, armor, weapons, tools, and languages...", "empty-proficiencies": "No proficiencies added.",
+ "traits": "Traits", "traits-placeholder": "Add features, traits, and other character details...", "empty-traits": "No traits added.",
+ "spells": "Spells", "spells-placeholder": "List spells, one per line...", "empty-spells": "No spells added.",
+ "inventory": "Inventory", "add-item": "Add item", "carried-weight": "Carried weight", "item-name": "Item",
+ "quantity": "Qty", "weight-each": "Each (lb)", "total-weight": "Total (lb)", "actions": "Actions", "empty-inventory": "Inventory is empty."
}
-}
\ No newline at end of file
+}
diff --git a/frontend/i18n/locales/en/discord.json b/frontend/i18n/locales/en/discord.json
new file mode 100644
index 00000000..a4004fb7
--- /dev/null
+++ b/frontend/i18n/locales/en/discord.json
@@ -0,0 +1,18 @@
+{
+ "title": "Connect Dragonroll to Discord",
+ "checking": "Checking this authorization request…",
+ "summary": "Discord server: {guild}. Requested by {user}. Sign in and confirm only if you trust this request.",
+ "sign-in-lead": "Sign in to the Dragonroll account that owns the campaign you want this server to use.",
+ "signed-in-as": "Signed in as {user}.",
+ "approve": "Authorize this Discord server",
+ "connected": "Dragonroll is connected to {guild}.",
+ "next-step": "Return to Discord and run /dragonroll link to choose a campaign.",
+ "replace-warning": "Authorizing a different Dragonroll account replaces this server's current connection and campaign link.",
+ "errors": {
+ "missing-code": "This authorization link is missing its code. Run /dragonroll connect in Discord again.",
+ "link-expired": "This authorization link is invalid or expired. Run /dragonroll connect in Discord again.",
+ "sign-in-failed": "Dragonroll sign in failed. Check your username and password.",
+ "session-expired": "Your Dragonroll session has expired. Sign in again to continue.",
+ "internal": "Could not load this authorization request."
+ }
+}
diff --git a/frontend/i18n/locales/en/foundry.json b/frontend/i18n/locales/en/foundry.json
new file mode 100644
index 00000000..07c35343
--- /dev/null
+++ b/frontend/i18n/locales/en/foundry.json
@@ -0,0 +1,6 @@
+{
+ "errors": {
+ "link-expired": "This Foundry pairing code is invalid, expired, or already used.",
+ "world-already-linked": "This Foundry world is already linked to another campaign."
+ }
+}
diff --git a/frontend/i18n/locales/en/windows.json b/frontend/i18n/locales/en/windows.json
index b1474438..5d2d70f8 100644
--- a/frontend/i18n/locales/en/windows.json
+++ b/frontend/i18n/locales/en/windows.json
@@ -6,4 +6,4 @@
"edit-profile": "Edit Profile",
"settings": "Settings",
"create-campaign": "Create Campaign"
-}
\ No newline at end of file
+}
diff --git a/frontend/i18n/locales/es/campaigns.json b/frontend/i18n/locales/es/campaigns.json
new file mode 100644
index 00000000..5f8276fd
--- /dev/null
+++ b/frontend/i18n/locales/es/campaigns.json
@@ -0,0 +1,69 @@
+{
+ "create": {
+ "name": "Nombre", "description": "Descripción", "description-placeholder": "Escribe una breve descripción de la campaña...",
+ "enter": "Introduce el nombre de la campaña...", "color": "Color de acento", "success": "¡Campaña creada correctamente!"
+ },
+ "settings": {
+ "title": "Ajustes de la campaña",
+ "tabs": { "basic": "Básico", "integrations": "Integraciones" },
+ "name": "Nombre de la campaña",
+ "color": "Color de la campaña",
+ "foundry-url": "URL de Foundry VTT",
+ "foundry-url-help": "Introduce la URL base de la instancia de Foundry VTT que ejecuta el módulo Dragonroll Foundry.",
+ "no-foundry-world": "Esta campaña no tiene ningún mundo de Foundry vinculado.",
+ "start-foundry-link": "Crear un código para Foundry",
+ "start-foundry-link-help": "Copia este código en el ajuste Dragonroll Campaign Pairing Code del módulo de Foundry. Dragonroll Endpoint usa https://dragonroll.aranroig.com de forma predeterminada. El código caduca en 10 minutos.",
+ "unlink-foundry": "Desvincular",
+ "saved": "Se han guardado los ajustes de la campaña.",
+ "linked": "El mundo de Foundry se ha vinculado a esta campaña.",
+ "unlinked": "Se ha desvinculado el mundo de Foundry de esta campaña.",
+ "code-copied": "Código de vinculación copiado.",
+ "saving": "Guardando...",
+ "errors": {
+ "name-required": "Introduce un nombre para la campaña.",
+ "invalid-foundry-url": "Introduce una URL válida de Foundry VTT con http o https.",
+ "link-expired": "El código de vinculación ha caducado. Crea uno nuevo.",
+ "copy-code": "No se pudo copiar el código de vinculación."
+ }
+ },
+ "sidebar-label": "Campaña",
+ "sections": { "notes": "Notas", "actors": "Actores y personajes", "items": "Objetos" },
+ "actions": {
+ "new-note": "Nueva nota", "new-folder": "Nueva carpeta", "refresh": "Actualizar",
+ "create": "Crear {section}", "submit": "Crear", "delete": "Eliminar", "saving": "Guardando...",
+ "collapse-sidebar": "Contraer barra lateral", "expand-sidebar": "Expandir barra lateral"
+ },
+ "states": {
+ "loading": "Cargando...", "loading-notes": "Cargando notas...", "empty-notes": "Aún no hay notas en esta campaña.",
+ "empty-actors": "Aún no hay actores ni personajes.", "empty-items": "Aún no hay objetos en esta campaña."
+ },
+ "errors": { "load": "No se pudieron cargar las entradas de la campaña." },
+ "create-entry": "Crear entrada de campaña",
+ "fields": { "name": "Nombre", "description": "Descripción" },
+ "actor": {
+ "new": "Nuevo actor o personaje", "type": "Tipo", "species": "Especie", "class": "Clase",
+ "level": "Nivel", "level-short": "Nivel", "background": "Trasfondo", "challenge-rating": "Valor de desafío",
+ "challenge-rating-placeholder": "Por ejemplo, 1/4 o 3", "cr-short": "VD",
+ "types": { "character": "Personaje", "npc": "PNJ", "creature": "Criatura" }
+ },
+ "item": {
+ "new": "Nuevo objeto", "category": "Categoría", "rarity": "Rareza", "quantity": "Cantidad",
+ "quantity-short": "Cant.", "weight": "Peso (lb)", "properties": "Propiedades", "properties-placeholder": "Por ejemplo, versátil, sutil",
+ "categories": {
+ "weapon": "Arma", "armor": "Armadura", "shield": "Escudo", "adventuring-gear": "Equipo de aventura",
+ "magic-item": "Objeto mágico", "consumable": "Consumible", "tool": "Herramienta", "treasure": "Tesoro", "other": "Otro"
+ },
+ "rarities": { "common": "Común", "uncommon": "Poco común", "rare": "Raro", "very-rare": "Muy raro", "legendary": "Legendario", "artifact": "Artefacto" }
+ },
+ "character-sheet": {
+ "title": "Hoja de personaje", "name": "Nombre del personaje", "class": "Clase", "subclass": "Subclase", "unset-class": "Clase sin definir",
+ "level": "Nivel", "species": "Especie", "unset-species": "Especie sin definir", "edit": "Editar hoja", "cancel": "Cancelar",
+ "saving": "Guardando...", "save": "Guardar hoja", "save-error": "No se pudo guardar esta hoja de personaje.", "photo": "Foto", "upload-photo": "Subir foto", "change-photo": "Cambiar foto", "remove-photo": "Quitar foto", "uploading-photo": "Subiendo...", "photo-error": "No se pudo subir esta foto.", "ability-scores": "Características", "proficiency-bonus": "Bonificador por competencia",
+ "combat": "Combate", "armor-class": "Clase de armadura", "speed": "Velocidad", "proficiencies": "Competencias",
+ "proficiencies-placeholder": "Añade salvaciones, habilidades, armaduras, armas, herramientas e idiomas...", "empty-proficiencies": "No hay competencias añadidas.",
+ "traits": "Rasgos", "traits-placeholder": "Añade rasgos, capacidades y otros detalles...", "empty-traits": "No hay rasgos añadidos.",
+ "spells": "Conjuros", "spells-placeholder": "Escribe los conjuros, uno por línea...", "empty-spells": "No hay conjuros añadidos.",
+ "inventory": "Inventario", "add-item": "Añadir objeto", "carried-weight": "Peso transportado", "item-name": "Objeto",
+ "quantity": "Cant.", "weight-each": "Unidad (lb)", "total-weight": "Total (lb)", "actions": "Acciones", "empty-inventory": "El inventario está vacío."
+ }
+}
diff --git a/frontend/i18n/locales/es/discord.json b/frontend/i18n/locales/es/discord.json
new file mode 100644
index 00000000..a873fa04
--- /dev/null
+++ b/frontend/i18n/locales/es/discord.json
@@ -0,0 +1,18 @@
+{
+ "title": "Conectar Dragonroll con Discord",
+ "checking": "Comprobando esta solicitud de autorización…",
+ "summary": "Servidor de Discord: {guild}. Solicitado por {user}. Inicia sesión y confirma solo si confías en esta solicitud.",
+ "sign-in-lead": "Inicia sesión en la cuenta de Dragonroll que posee la campaña que quieres que use este servidor.",
+ "signed-in-as": "Has iniciado sesión como {user}.",
+ "approve": "Autorizar este servidor de Discord",
+ "connected": "Dragonroll se ha conectado a {guild}.",
+ "next-step": "Vuelve a Discord y ejecuta /dragonroll link para elegir una campaña.",
+ "replace-warning": "Autorizar otra cuenta de Dragonroll reemplaza la conexión actual y el vínculo de campaña de este servidor.",
+ "errors": {
+ "missing-code": "A este enlace de autorización le falta el código. Ejecuta /dragonroll connect en Discord de nuevo.",
+ "link-expired": "Este enlace de autorización no es válido o ha caducado. Ejecuta /dragonroll connect en Discord de nuevo.",
+ "sign-in-failed": "No se ha podido iniciar sesión en Dragonroll. Revisa el usuario y la contraseña.",
+ "session-expired": "Tu sesión de Dragonroll ha caducado. Inicia sesión de nuevo para continuar.",
+ "internal": "No se ha podido cargar esta solicitud de autorización."
+ }
+}
diff --git a/frontend/i18n/locales/es/foundry.json b/frontend/i18n/locales/es/foundry.json
new file mode 100644
index 00000000..4e318810
--- /dev/null
+++ b/frontend/i18n/locales/es/foundry.json
@@ -0,0 +1,6 @@
+{
+ "errors": {
+ "link-expired": "El código de vinculación de Foundry no es válido, ha caducado o ya se ha usado.",
+ "world-already-linked": "Este mundo de Foundry ya está vinculado a otra campaña."
+ }
+}
diff --git a/frontend/i18n/locales/es/general.json b/frontend/i18n/locales/es/general.json
index 9e26dfee..79f06818 100644
--- a/frontend/i18n/locales/es/general.json
+++ b/frontend/i18n/locales/es/general.json
@@ -1 +1,3 @@
-{}
\ No newline at end of file
+{
+ "save": "Guardar"
+}
diff --git a/frontend/i18n/locales/es/windows.json b/frontend/i18n/locales/es/windows.json
index f6050f8d..089a0c0e 100644
--- a/frontend/i18n/locales/es/windows.json
+++ b/frontend/i18n/locales/es/windows.json
@@ -6,4 +6,4 @@
"edit-profile": "Editar perfil",
"settings": "Configuración",
"create-campaign": "Crear campanya"
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index c6c4a44f..91e7b887 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,6 @@
"concurrently": "^9.2.1"
},
"scripts": {
- "dev": "concurrently -k -n BACKEND,FRONTEND -c blue,green \"DEBUG=* npm --prefix backend run dev\" \"npm --prefix frontend run dev\""
+ "dev": "concurrently -k -n BACKEND,FRONTEND,DISCORD-BOT,FOUNDRY -c blue,green,yellow,magenta \"DEBUG=* npm --prefix backend run dev\" \"npm --prefix frontend run dev\" \"npm --prefix discord-bot start\" \"node scripts/run-foundry.js\""
}
}
diff --git a/scripts/run-foundry.js b/scripts/run-foundry.js
new file mode 100644
index 00000000..845cfa90
--- /dev/null
+++ b/scripts/run-foundry.js
@@ -0,0 +1,31 @@
+// Runs the Foundry Virtual Tabletop start script defined by FOUNDRY_START_SCRIPT
+// in the root .env file. Used by `npm run dev` via concurrently.
+const { spawn } = require('node:child_process');
+const fs = require('node:fs');
+const path = require('node:path');
+
+try {
+ process.loadEnvFile(path.join(__dirname, '..', '.env'));
+} catch {
+ // No .env at the repo root: nothing to launch.
+}
+
+const script = process.env.FOUNDRY_START_SCRIPT;
+
+function idle(reason) {
+ console.log(`[foundry] ${reason} — Foundry server not started.`);
+ // Keep the process alive so concurrently (-k) does not kill the other dev servers.
+ setInterval(() => {}, 1 << 30);
+}
+
+if (!script) idle('FOUNDRY_START_SCRIPT is not set in .env');
+else if (!fs.existsSync(script)) idle(`start script not found: ${script}`);
+else {
+ console.log(`[foundry] Running ${script}`);
+ const child = spawn('sh', [script], { stdio: 'inherit', cwd: path.dirname(script) });
+ child.on('exit', (code, signal) => {
+ if (signal) process.exit(0); // killed together with `npm run dev`
+ idle(`exited with code ${code}`);
+ });
+ child.on('error', (err) => idle(`failed to start: ${err.message}`));
+}