use local download url that redirects to api server
This commit is contained in:
parent
b50f1b0d8b
commit
5944e471c7
3 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
const { getHtml } = require('./html');
|
||||
const { generateStreamUrl } = require('../../ui/util/lbrytv');
|
||||
const { generateStreamUrl, generateDownloadUrl } = require('../../ui/util/lbrytv');
|
||||
const { LBRY_TV_API } = require('../../config');
|
||||
const Router = require('@koa/router');
|
||||
const send = require('koa-send');
|
||||
|
@ -12,6 +12,12 @@ router.get(`/$/embed/:claimName/:claimId`, async ctx => {
|
|||
ctx.redirect(streamUrl);
|
||||
});
|
||||
|
||||
router.get(`/$/download/:claimName/:claimId`, async ctx => {
|
||||
const { claimName, claimId } = ctx.params;
|
||||
const downloadUrl = generateDownloadUrl(claimName, claimId, LBRY_TV_API);
|
||||
ctx.redirect(downloadUrl);
|
||||
});
|
||||
|
||||
router.get('*', async ctx => {
|
||||
const html = await getHtml(ctx);
|
||||
ctx.body = html;
|
||||
|
|
|
@ -909,5 +909,6 @@
|
|||
"Get %range% LBC": "Get %range% LBC",
|
||||
"Did something go wrong? Have a look in your log file, or send it to %support_link%.": "Did something go wrong? Have a look in your log file, or send it to %support_link%.",
|
||||
"%amount% LBC": "%amount% LBC",
|
||||
"%amount% fee": "%amount% fee"
|
||||
}
|
||||
"%amount% fee": "%amount% fee",
|
||||
"1 file hidden due to your %content_viewing_preferences_link%": "1 file hidden due to your %content_viewing_preferences_link%"
|
||||
}
|
|
@ -4,7 +4,6 @@ import * as MODALS from 'constants/modal_types';
|
|||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import ToolTip from 'component/common/tooltip';
|
||||
import { generateDownloadUrl } from 'util/lbrytv';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
|
@ -39,7 +38,7 @@ function FileDownloadLink(props: Props) {
|
|||
const isPaidContent = cost > 0;
|
||||
const { name, claim_id: claimId, value } = claim;
|
||||
const fileName = value && value.source && value.source.name;
|
||||
const downloadUrl = generateDownloadUrl(name, claimId, undefined, true);
|
||||
const downloadUrl = `/$/download/${name}/${claimId}`;
|
||||
|
||||
function handleDownload() {
|
||||
// @if TARGET='app'
|
||||
|
|
Loading…
Add table
Reference in a new issue