Skip to content

Commit a747fba

Browse files
committed
fix: redirects
1 parent 8e9eecb commit a747fba

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

meteor/server/api/peripheralDevice.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import KoaRouter from '@koa/router'
6969
import bodyParser from 'koa-bodyparser'
7070
import { assertConnectionHasOneOfPermissions } from '../security/auth'
7171
import { DBStudio } from '@sofie-automation/corelib/dist/dataModel/Studio'
72+
import { getRootSubpath } from '../lib'
7273

7374
const apmNamespace = 'peripheralDevice'
7475
export namespace ServerPeripheralDeviceAPI {
@@ -680,7 +681,7 @@ peripheralDeviceRouter.get('/:deviceId/oauthResponse', async (ctx) => {
680681
.catch(logger.error)
681682
}
682683

683-
ctx.redirect(`/settings/peripheralDevice/${deviceId}`)
684+
ctx.redirect(`${getRootSubpath()}/settings/peripheralDevice/${deviceId}`)
684685
} catch (e) {
685686
ctx.response.type = 'text/plain'
686687
ctx.response.status = 500

meteor/server/api/rest/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { peripheralDeviceRouter } from '../peripheralDevice'
1111
import { blueprintsRouter } from '../blueprints/http'
1212
import { createLegacyApiRouter } from './v0/index'
1313
import { heapSnapshotPrivateApiRouter } from '../heapSnapshot'
14+
import { getRootSubpath } from '../../lib'
1415

1516
const LATEST_REST_API = 'v1.0'
1617

@@ -34,7 +35,7 @@ apiRouter.use(
3435
)
3536

3637
async function redirectToLatest(ctx: koa.ParameterizedContext, _next: koa.Next): Promise<void> {
37-
ctx.redirect(`/api/${LATEST_REST_API}`)
38+
ctx.redirect(`${getRootSubpath()}/api/${LATEST_REST_API}`)
3839
ctx.status = 307
3940
}
4041

meteor/server/webmanifest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ async function webNrcsRundownRoute(ctx: Koa.ParameterizedContext, parsedUrl: URL
262262
// we couldn't find the External ID for Rundown/Rundown Playlist
263263
logger.debug(`NRCS URL: External ID not found "${externalId}"`)
264264
ctx.body = `Could not find requested object: "${externalId}", see the full list`
265-
ctx.redirect('/')
265+
ctx.redirect(`${getRootSubpath()}/`)
266266
ctx.response.status = 303
267267
return
268268
}
269269

270270
logger.debug(`NRCS URL: External ID found "${externalId}" in "${rundownPlaylist._id}"`)
271271
ctx.body = `Requested object found in Rundown Playlist "${rundownPlaylist._id}"`
272-
ctx.redirect(`/rundown/${rundownPlaylist._id}`)
272+
ctx.redirect(`${getRootSubpath()}/rundown/${rundownPlaylist._id}`)
273273
}
274274

275275
Meteor.startup(() => {

0 commit comments

Comments
 (0)