71 lines
2.5 KiB
JavaScript
71 lines
2.5 KiB
JavaScript
/**
|
|
* Module settings registration.
|
|
*
|
|
* Note on `sharedSecret`: Foundry stores world-scope settings in a place
|
|
* readable by all connected clients, not just GMs. A player with browser
|
|
* console access can read the value. This is acceptable here because the
|
|
* secret only authorizes pushing dnd5e actor data — which players already
|
|
* have access to through normal play — and the Frappe side enforces all
|
|
* other authorization. Rotate the secret if you stop trusting a player.
|
|
*/
|
|
|
|
import { MODULE_ID } from "./constants.js";
|
|
|
|
export function registerSettings() {
|
|
game.settings.register(MODULE_ID, "frappeBaseUrl", {
|
|
name: "Frappe Base URL",
|
|
hint: "Base URL of your Seitime Frappe site, e.g. https://seitimegames.com (no trailing slash).",
|
|
scope: "world",
|
|
config: true,
|
|
type: String,
|
|
default: "https://seitimegames.com",
|
|
});
|
|
|
|
game.settings.register(MODULE_ID, "sharedSecret", {
|
|
name: "Shared Secret",
|
|
hint: "Bridge secret — must match Foundry Settings → Shared Secret on the Frappe side. Readable by any connected client; rotate if compromised.",
|
|
scope: "world",
|
|
config: true,
|
|
type: String,
|
|
default: "",
|
|
secret: true,
|
|
});
|
|
|
|
game.settings.register(MODULE_ID, "worldId", {
|
|
name: "World ID",
|
|
hint: "Identifier sent in the X-Bridge-World header. If you've configured Allowed World IDs on the Frappe side, this must be one of them. Leave blank to use the current Foundry world's id.",
|
|
scope: "world",
|
|
config: true,
|
|
type: String,
|
|
default: "",
|
|
});
|
|
|
|
game.settings.register(MODULE_ID, "manifestSyncIntervalMinutes", {
|
|
name: "Manifest Sync Interval (minutes)",
|
|
hint: "How often to push the actor manifest while the world is open. 0 disables periodic sync; on/create/delete pushes still fire.",
|
|
scope: "world",
|
|
config: true,
|
|
type: Number,
|
|
default: 15,
|
|
range: { min: 0, max: 120, step: 1 },
|
|
});
|
|
|
|
game.settings.register(MODULE_ID, "snapshotDebounceSeconds", {
|
|
name: "Snapshot Debounce (seconds)",
|
|
hint: "How long to wait after the last actor edit before pushing a snapshot. Combat causes frequent edits, so a few seconds is usually right.",
|
|
scope: "world",
|
|
config: true,
|
|
type: Number,
|
|
default: 5,
|
|
range: { min: 1, max: 60, step: 1 },
|
|
});
|
|
|
|
game.settings.register(MODULE_ID, "snapshotAutoSync", {
|
|
name: "Auto-Sync on Actor Edits",
|
|
hint: "When enabled, the primary GM pushes a snapshot every time a PC is edited (debounced). Disable to push only via macro/console.",
|
|
scope: "world",
|
|
config: true,
|
|
type: Boolean,
|
|
default: true,
|
|
});
|
|
}
|