Update reversi routing (#3937)
This commit is contained in:
committed by
syuilo
parent
7e646f109c
commit
81dbf64eb7
@ -219,6 +219,12 @@ router.get('/info', async ctx => {
|
||||
});
|
||||
});
|
||||
|
||||
const override = (source: string, target: string, depth: number = 0) =>
|
||||
[, ...target.split('/').filter(x => x), ...source.split('/').filter(x => x).splice(depth)].join('/');
|
||||
|
||||
router.get('/othello', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games/reversi', 1)));
|
||||
router.get('/reversi', async ctx => ctx.redirect(override(ctx.URL.pathname, 'games')));
|
||||
|
||||
// Render base html for all requests
|
||||
router.get('*', async ctx => {
|
||||
const meta = await fetchMeta();
|
||||
|
Reference in New Issue
Block a user