Fix issue #17: Foundry Module: Show pairing status
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user