This commit is contained in:
@@ -135,6 +135,9 @@ export DRAGONROLL_FOUNDRY_PUSH_TOKEN='replace-with-a-different-long-random-publi
|
||||
export DRAGONROLL_FOUNDRY_ALLOWED_ORIGINS='https://vtt.example.com'
|
||||
export DRAGONROLL_FOUNDRY_HOST='0.0.0.0'
|
||||
export DRAGONROLL_FOUNDRY_PORT='8787'
|
||||
# Optional: the Foundry Data directory. With it the bridge can list the core
|
||||
# `icons/` library Dragonroll's item icon browser shows.
|
||||
export DRAGONROLL_FOUNDRY_DATA_PATH='/home/foundry/Foundry Data'
|
||||
npm start --prefix foundry/bridge
|
||||
```
|
||||
|
||||
@@ -170,6 +173,7 @@ The backend exposes these JWT-protected routes when the optional snapshot bridge
|
||||
| `GET /api/foundry/actors/:id/items` | Items embedded in an actor |
|
||||
| `GET /api/foundry/items` | World-level items |
|
||||
| `GET /api/foundry/items/:id` | One world-level item |
|
||||
| `GET /api/foundry/icons?campaign=&dir=&offset=` | One folder of Foundry's core icon library |
|
||||
|
||||
The bridge exposes the matching routes under `/api/*`, plus `GET /health`. Data routes require
|
||||
`Authorization: Bearer <read-token>`. Responses contain `{ status: "ok", data, world, syncedAt,
|
||||
@@ -177,6 +181,13 @@ ageSeconds, stale }`. The snapshot stays in memory; `stale` becomes true when th
|
||||
received a GM heartbeat for more than two minutes. The bridge returns `503 foundry.not-ready` until a
|
||||
configured GM client has published its first snapshot.
|
||||
|
||||
The icon library is the one route that reads the disk instead of the snapshot: with
|
||||
`DRAGONROLL_FOUNDRY_DATA_PATH` set, `GET /api/icons?dir=icons/svg&offset=120&limit=120` answers one
|
||||
folder at a time — `{ status: "ok", dir, directories, files, offset, next }` of paths relative to the
|
||||
data directory — and never reads outside `icons/`. `next` is the offset of the next page of icons, or
|
||||
null once the folder is listed, which is how the campaign's icon browser keeps a library of thousands
|
||||
lazy to load. Without that variable the route answers `503 foundry.errors.icons-unavailable`.
|
||||
|
||||
World-level items come from Foundry's `game.items`; actor inventories come from each actor's embedded
|
||||
items collection. The API returns plain document data snapshots. This is a read-only integration: it
|
||||
does not create or update Foundry documents, and it does not persist the bridge cache across restarts.
|
||||
|
||||
Reference in New Issue
Block a user