Fix issue #79: Implement documentation
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Connecting a service
|
||||
|
||||
Dragonroll talks to three services: [Discord](/docs/discord), [Foundry VTT](/docs/foundry) and
|
||||
[Obsidian](/docs/obsidian). They all connect the same way, and none of them is given your Dragonroll
|
||||
password.
|
||||
|
||||
## How a connection works
|
||||
|
||||
A service asks Dragonroll for a **sign-up link** and shows it to you. You open that link in your
|
||||
browser, sign in if you are not signed in already, and pick which of your campaigns the service may
|
||||
use. Only then does the service get its own credential, which lets it read and change that one
|
||||
campaign and nothing else.
|
||||
|
||||
| You see | What it means |
|
||||
| --- | --- |
|
||||
| A link in Discord, in the Foundry module or in the Obsidian plugin | The service is waiting for you to pick a campaign |
|
||||
| A campaign picker in your browser | Sign in and choose the campaign, and the service is connected |
|
||||
| "Connected" in the service | It picked up its credential and can start working |
|
||||
|
||||
The link is short-lived — it expires after ten minutes — and can only be used once. If you close it
|
||||
without choosing, ask the service for a new one. If a service loses the credential it was given, it
|
||||
asks for a new link too: nothing is kept that would let it back in.
|
||||
|
||||
## What a connection allows
|
||||
|
||||
What a service may do is decided by the campaign you pick, so check the name before you confirm. The
|
||||
screen tells you which service is asking, and what it wants:
|
||||
|
||||
- a **Discord server** reads the campaign's characters, so whoever is in that server can read them,
|
||||
- a **Foundry world** keeps its actors and items in step with the campaign, which means it writes into
|
||||
it, and Dragonroll writes into it,
|
||||
- **Obsidian** reads the campaign's notes and pushes the ones you tell it to.
|
||||
|
||||
A campaign holds one link per service: linking a second Foundry world, or a second Discord server,
|
||||
replaces the one it had. Authorizing a service with a different Dragonroll account replaces who the
|
||||
service answers to.
|
||||
|
||||
## Seeing and undoing a connection
|
||||
|
||||
Open the campaign and look at **Settings → Integrations**. It lists the three services and, for each
|
||||
one, whether it is connected, what is connected to it, and which Dragonroll account authorized it.
|
||||
|
||||
**Unlink** ends it. The service loses access the next time it asks — nothing it already wrote into the
|
||||
campaign is deleted, and nothing about your campaign changes. To use the service again, start a new
|
||||
link from its own side.
|
||||
|
||||
## Next
|
||||
|
||||
- [Discord](/docs/discord) — read characters and campaigns from a server.
|
||||
- [Foundry VTT](/docs/foundry) — keep a world and a campaign in step.
|
||||
- [Obsidian](/docs/obsidian) — write campaign notes in your vault.
|
||||
62
frontend/app/content/docs/03-integrations/02-discord.md
Normal file
62
frontend/app/content/docs/03-integrations/02-discord.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Discord
|
||||
|
||||
The Dragonroll Discord bot lets a server read the characters of a campaign without anyone leaving
|
||||
Discord: the roster, a character's sheet with its portrait, and who plays whom. It is a read-only bot —
|
||||
it never changes your campaign.
|
||||
|
||||
## Connecting a server
|
||||
|
||||
1. Invite the bot to the server with the `bot` and `applications.commands` scopes.
|
||||
2. A Discord **administrator** runs `/dragonroll connect`. The bot answers with a *Sign in to
|
||||
Dragonroll* button.
|
||||
3. Whoever opens it signs in to the Dragonroll account that owns the campaign and picks that campaign.
|
||||
The server is now linked to it, and the bot says so.
|
||||
4. From then on anybody in the server can look the campaign's characters up.
|
||||
|
||||
The authorization link lasts ten minutes and works once. A campaign is linked to one Discord server at
|
||||
a time, and a server to one campaign; authorizing the server with a different Dragonroll account takes
|
||||
over the connection.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Who | What it does |
|
||||
| --- | --- | --- |
|
||||
| `/characters [type]` | everybody | Lists the characters of the campaign this server is linked to. `type` narrows the list to **Characters**, **NPCs** or **Creatures**. Every character a player has claimed shows up next to that player. |
|
||||
| `/character name [public]` | everybody | Shows one actor's sheet: its portrait, description, race, class and level, background, armor class and speed, ability scores, proficiencies, traits, spells and inventory. Start typing a name and Discord offers the campaign's roster. Set `public` to `true` to show the sheet to the whole channel instead of only to you. |
|
||||
| `/dragonroll connect` | administrators | Asks Dragonroll for the sign-up link that connects this server, and confirms here once somebody has authorized it. |
|
||||
| `/dragonroll link campaign:` | administrators | Moves this server to another campaign of the connected Dragonroll account. Type part of a name to filter the choices. |
|
||||
| `/dragonroll unlink` | administrators | Removes this server's campaign link. The campaign is untouched; the commands simply have nothing to read until one is linked again. |
|
||||
| `/dragonroll status` | everybody | Shows which campaign this server reads, and which character your Discord account holds on it. |
|
||||
| `/dragonroll refresh` | everybody | Asks Dragonroll again where the connection stands, and shows what it answered. |
|
||||
| `/dragonroll assign character:` | everybody | Links a character of the campaign to your Discord account, so the bot knows it is yours and `/characters` says so. You can take a character nobody holds; a character somebody else holds can only be moved by an administrator. |
|
||||
| `/dragonroll unassign [character]` | everybody | Drops a character link. Without the option you give up your own character; naming somebody else's takes it off them, which only an administrator can do. |
|
||||
|
||||
Replies are private: only you see them, so a player can look up their character in a busy channel. The
|
||||
one exception is `/character` with `public:true`, which posts the sheet where everyone can read it — for
|
||||
the villain the party is talking to, or the magic item they just found.
|
||||
|
||||
## Characters and their players
|
||||
|
||||
`/dragonroll assign` is how a player says *this one is mine*:
|
||||
|
||||
- each account holds one character, so claiming a second one frees the first,
|
||||
- a free character can be taken by anybody,
|
||||
- a character somebody holds can only be taken or freed by a server administrator,
|
||||
- the pairing shows up in `/characters` and in `/dragonroll status`, which is what lets the table see
|
||||
who is playing whom.
|
||||
|
||||
Assigning a character does not hide anything: the bot is read-only and every member of the server can
|
||||
already read the campaign's characters with `/character`.
|
||||
|
||||
## When something goes wrong
|
||||
|
||||
| The bot says | What is going on |
|
||||
| --- | --- |
|
||||
| "Connect a Dragonroll account first with /dragonroll connect." | Nobody has authorized this server yet, or the authorization expired before anyone opened it. |
|
||||
| "Only Discord server administrators can connect Dragonroll or change this campaign link." | The command changes the server's connection, so it needs the Discord Administrator permission. |
|
||||
| "The bot API secret is missing or does not match the backend." | Whoever runs the bot has to set the same `DRAGONROLL_DISCORD_BOT_SECRET` in the bot and in the Dragonroll backend. |
|
||||
| "This server does not have a linked campaign." | The link was removed; an administrator has to pick a campaign with `/dragonroll link`. |
|
||||
|
||||
Character portraits are read from Dragonroll's public upload folder, so the bot needs to be able to
|
||||
reach the server Dragonroll runs on. Whoever hosts the bot finds its setup in `discord-bot/README.md`
|
||||
in the source repository.
|
||||
114
frontend/app/content/docs/03-integrations/03-foundry.md
Normal file
114
frontend/app/content/docs/03-integrations/03-foundry.md
Normal file
@@ -0,0 +1,114 @@
|
||||
# Foundry VTT
|
||||
|
||||
The Foundry integration keeps a Dragonroll campaign and a Foundry world in step: the world's
|
||||
characters and item directory arrive in the campaign, and what you change in Dragonroll goes back to
|
||||
the world.
|
||||
|
||||
There are two separate parts, and you only need the first of them:
|
||||
|
||||
| Part | What it is |
|
||||
| --- | --- |
|
||||
| The **Dragonroll Foundry API** module | Installed in the world. Links it to a campaign and keeps its actors and items synced. Runs in the game client. |
|
||||
| The optional **snapshot bridge** | A small process on the Foundry host that publishes a read-only snapshot of the world for Dragonroll to browse. Only for reading world data over the API. |
|
||||
|
||||
Character and item sync works without the bridge.
|
||||
|
||||
## Installing the module
|
||||
|
||||
Foundry VTT v12 to v14. Copy the `dragonroll-foundry` folder into
|
||||
`{Foundry user data}/Data/modules/dragonroll-foundry/`, restart Foundry, and enable **Dragonroll
|
||||
Foundry API** in the world's module settings.
|
||||
|
||||
The module's own settings hold two things you set: the **Dragonroll Endpoint** — the address of your
|
||||
Dragonroll server, `https://dragonroll.aranroig.com` by default — and **Dragonroll Auto-sync**, which
|
||||
is on.
|
||||
|
||||
## Linking a world
|
||||
|
||||
Open the world with a GM account. The module asks Dragonroll for a sign-up link and prints it in a
|
||||
notification: open it, sign in, and pick the campaign this world belongs to. **Dragonroll Pairing
|
||||
Status** in the module settings always says where things stand — waiting for a link, connected to a
|
||||
named campaign, or why a link could not be used.
|
||||
|
||||
Worth knowing:
|
||||
|
||||
- The link expires after ten minutes and works once. If it goes unused, reload the world to get a new
|
||||
one.
|
||||
- A world links to one campaign, and a campaign to one Foundry world: linking a second world replaces
|
||||
the first.
|
||||
- The link, the sync token it hands back and the pairing status are all **client** settings: the
|
||||
browser that completed the link is the one that syncs. Another browser on the same world reads as not
|
||||
paired until it links too.
|
||||
- **Dragonroll Pairing Status** is written by the module. It is not a field to fill in.
|
||||
- The campaign shows the linked world's title and system under **Settings → Integrations**, where
|
||||
**Unlink** ends the pairing.
|
||||
|
||||
## What syncs
|
||||
|
||||
| In Foundry | In the campaign |
|
||||
| --- | --- |
|
||||
| Character, NPC and creature actors | Actors with the same sheet: abilities, combat stats, proficiencies, traits, spells, carried gear, portrait |
|
||||
| The world's **item directory** (the items tab) | The campaign's item list, with category, rarity, quantity, weight, properties and description |
|
||||
| The folders grouping that item directory | Item folders with the same names and nesting |
|
||||
| A folder's colour | The campaign's folder colour — and the other way round, what you colour in Dragonroll lands on the world's folder |
|
||||
|
||||
The item list is the world's item directory and nothing else. The gear a character carries is that
|
||||
character's inventory: it travels with the character and stays on its sheet, so a sword a fighter owns
|
||||
does not turn up in the campaign's item list. Spells, classes, subclasses, backgrounds, feats and
|
||||
species are not gear and are not imported.
|
||||
|
||||
An actor or item keeps the Dragonroll id it was given in a `dragonroll-foundry.actorId` /
|
||||
`dragonroll-foundry.itemId` flag, and that is what makes the two sides recognise each other. A world
|
||||
item that carries no flag is matched by name, so a hand-written item in Dragonroll is adopted instead of
|
||||
doubled, and renaming it in either place does not resurrect a duplicate.
|
||||
|
||||
Changes flow both ways as they happen, and Dragonroll's own edits are applied back in Foundry within a
|
||||
few seconds. A **full** snapshot — the one taken when the world links, or forced from the actor
|
||||
directory — is the only thing that prunes: it is the only moment either side can see the whole list and
|
||||
notice what is gone. Live edits never delete anything.
|
||||
|
||||
## Auto-sync, and sending one actor on purpose
|
||||
|
||||
**Dragonroll Auto-sync** is what keeps the two in step: actors and world items you create, change or
|
||||
delete are sent to the campaign, and both sides reconcile every few seconds. Turning it off stops all
|
||||
of it — nothing is sent, and Dragonroll stops rewriting your Foundry documents, so the campaign keeps
|
||||
whatever it already holds. Turn it back on and both sides reconcile again, including the edits queued
|
||||
while it was off.
|
||||
|
||||
To send one character across right now, or to cross over while autosync is off, right-click the actor
|
||||
(or several) in the Foundry actor directory and pick **Dragonroll: Force Sync**. Those actors, with the
|
||||
gear inside them, are pushed immediately. It only upserts: it never prunes the campaign's other actors.
|
||||
Actors Dragonroll does not import — anything that is not a character, NPC or creature — are refused with
|
||||
a notification saying so.
|
||||
|
||||
## Foundry's icons in Dragonroll
|
||||
|
||||
With a world linked, Dragonroll's item icon browser can page through the icon library that world ships
|
||||
with, one folder at a time. If it says the world has no address, set it under **Settings → Integrations
|
||||
→ Foundry VTT URL** in the campaign.
|
||||
|
||||
## The optional snapshot bridge
|
||||
|
||||
The bridge is a small Node.js (18 or newer) process that runs beside Foundry. A GM client publishes the
|
||||
world's actor and item snapshot to it, and Dragonroll reads that snapshot back through its own API, so
|
||||
a server can ask what a world holds without touching the game. It is read-only, it keeps nothing across
|
||||
restarts, and character sync does not depend on it.
|
||||
|
||||
It needs its own tokens — separate ones for publishing and for reading — and an origin allow-list for
|
||||
the Foundry client:
|
||||
|
||||
| Variable | What it is |
|
||||
| --- | --- |
|
||||
| `DRAGONROLL_FOUNDRY_PUSH_TOKEN` | The token the Foundry client publishes with; the backend's `FOUNDRY_API_PUSH_TOKEN` must match it |
|
||||
| `DRAGONROLL_FOUNDRY_READ_TOKEN` | The token reads with; the backend's `FOUNDRY_API_TOKEN` must match it |
|
||||
| `DRAGONROLL_FOUNDRY_ALLOWED_ORIGINS` | The browser origins allowed to publish, comma separated |
|
||||
| `DRAGONROLL_FOUNDRY_HOST` / `DRAGONROLL_FOUNDRY_PORT` | Where the bridge listens; `0.0.0.0:8787` by default |
|
||||
| `DRAGONROLL_FOUNDRY_DATA_PATH` | The Foundry Data directory, which lets the bridge list the core `icons/` library |
|
||||
|
||||
The backend points at it with `FOUNDRY_API_URL` (and `FOUNDRY_API_CLIENT_URL` when the Foundry clients
|
||||
reach it under a different address than the backend does). Once it is set up, Dragonroll answers
|
||||
`GET /api/foundry/world`, `/actors`, `/characters`, `/items`, one of each by id, an actor's embedded
|
||||
items, and `/icons` — all for a signed-in Dragonroll user, and all read-only.
|
||||
|
||||
`dragonroll-foundry/README.md` in the source repository documents the bridge, its routes and its
|
||||
heartbeat in full.
|
||||
77
frontend/app/content/docs/03-integrations/04-obsidian.md
Normal file
77
frontend/app/content/docs/03-integrations/04-obsidian.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Obsidian
|
||||
|
||||
The **Dragonroll Sync** plugin moves campaign notes between a Dragonroll campaign and an Obsidian
|
||||
vault: import the campaign so you can read and write it with your own notes, and push the note you are
|
||||
working on back to the campaign.
|
||||
|
||||
It is an explicit, you-ask-for-it workflow. Nothing happens in the background, and the plugin never
|
||||
deletes a note.
|
||||
|
||||
## Installing
|
||||
|
||||
Copy `main.js` and `manifest.json` into your vault:
|
||||
|
||||
```text
|
||||
<vault>/.obsidian/plugins/dragonroll-sync/
|
||||
```
|
||||
|
||||
Then enable **Dragonroll Sync** under Settings → Community plugins. It is plain JavaScript, so there is
|
||||
nothing to build, and it runs on desktop and mobile alike.
|
||||
|
||||
## Connecting
|
||||
|
||||
Under **Settings → Community plugins → Dragonroll Sync**:
|
||||
|
||||
1. Set the **Dragonroll API URL** — `https://dragonroll.aranroig.com/api` by default, or your own
|
||||
server, such as `http://localhost:5000/api`.
|
||||
2. **Sign in** with your Dragonroll username or email and your password. The password is used once to
|
||||
sign in and is not saved; what the plugin keeps is the session token, in this vault, and it expires
|
||||
after 48 hours like any other Dragonroll session.
|
||||
3. Pick the **campaign**. Every import and push works against that campaign.
|
||||
|
||||
## Commands
|
||||
|
||||
Both are in Obsidian's command palette:
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| **Import or refresh campaign notes** | Brings every note of the campaign into `Dragonroll/<Campaign>/`, folders and nesting included, and updates the ones already there. Imported notes keep their place in the campaign's folder tree. |
|
||||
| **Push active note to Dragonroll** | Sends the note you are in to the campaign: a new root note if it is not linked yet, or an update of the note it is linked to. |
|
||||
|
||||
## How a note knows where it belongs
|
||||
|
||||
An imported note carries three properties in its frontmatter:
|
||||
|
||||
```yaml
|
||||
---
|
||||
dragonrollId: 665f1c…
|
||||
dragonrollCampaign: 665f0a…
|
||||
dragonrollTitle: The Salt Gull
|
||||
---
|
||||
```
|
||||
|
||||
They are what ties the file to its note in the campaign: they survive renames, and they are stripped
|
||||
from the markdown the plugin sends back, so they never show up in Dragonroll. Pushing a brand new local
|
||||
note adds them too, which is how the next push updates the same note instead of creating a copy.
|
||||
|
||||
Renaming the note's title in Dragonroll renames the imported file on the next import; renaming the file
|
||||
in Obsidian renames the note in Dragonroll on the next push.
|
||||
|
||||
## Your edits are not overwritten
|
||||
|
||||
The plugin remembers how a note looked the last time it was imported or pushed, and uses that as the
|
||||
baseline:
|
||||
|
||||
| Since the last sync | What the import does |
|
||||
| --- | --- |
|
||||
| Only the campaign's copy changed | The local file is updated |
|
||||
| Only your local file changed | Your file is kept as it is, and reported for you to look at |
|
||||
| Both changed | Your file is kept as it is, and reported for you to look at |
|
||||
| Neither changed | Nothing is touched |
|
||||
|
||||
So a note you were rewriting in Obsidian is never quietly replaced: the plugin leaves it alone and tells
|
||||
you it is waiting. Pushing is the deliberate direction — it writes the active note's current title and
|
||||
content into Dragonroll.
|
||||
|
||||
A note that is linked to a different campaign cannot be pushed while another campaign is selected:
|
||||
switch the campaign in the plugin settings first.
|
||||
Reference in New Issue
Block a user