lbry-desktop/lbrytv/src/routes.js

19 lines
515 B
JavaScript
Raw Normal View History

2019-11-07 20:39:22 +01:00
const { getHtml } = require('./html');
const { generateStreamUrl } = require('../../ui/util/lbrytv');
const Router = require('@koa/router');
const send = require('koa-send');
const router = new Router();
router.get(`/embed/:claimName/:claimId`, async ctx => {
const { claimName, claimId } = ctx.params;
const streamUrl = generateStreamUrl(claimName, claimName);
ctx.redirect = streamUrl;
});
router.get('*', async ctx => {
const html = await getHtml(ctx);
ctx.body = html;
});
module.exports = router;