Fix issue #17: Foundry Module: Show pairing status

This commit is contained in:
Gitea OpenCode Agent
2026-10-14 12:59:26 +00:00
parent 67ca4b0210
commit ed0b9af00b
6 changed files with 359 additions and 2 deletions

View File

@@ -225,6 +225,7 @@ router.post('/link/complete', linkRateLimit, async (req, res) => {
res.set('Cache-Control', 'no-store');
res.json({
status: 'ok',
campaign: { id: campaign.id, name: campaign.name },
world: { id: world.worldId, title: world.worldTitle, system: world.system },
syncToken,
bridgeConfig: bridgeUrl && pushToken ? { url: bridgeUrl, pushToken } : null
@@ -236,6 +237,26 @@ router.post('/link/complete', linkRateLimit, async (req, res) => {
}
});
// The Foundry module shows this in its settings: the sync token alone only proves
// a link was made once, so the module asks which campaign it belongs to and hears
// back nothing but `unauthorized` once that campaign unlinks the world again.
router.get('/sync/status', async (req, res) => {
try {
const campaign = await syncCampaign(req, res);
if (!campaign) return;
res.set('Cache-Control', 'no-store');
res.json({
status: 'ok',
campaign: { id: campaign.id, name: campaign.name },
worldId: campaign.foundryWorldId
});
} catch (err) {
console.error(err);
res.json({ status: 'error', msg: 'errors.internal' });
}
});
router.post('/sync/snapshot', async (req, res) => {
try {
const campaign = await syncCampaign(req, res);