feat: steam url fix
This commit is contained in:
parent
13fedeca8b
commit
52f59bcfde
1 changed files with 4 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ import { AuthService } from '@gitroom/helpers/auth/auth.service';
|
|||
import { pricing } from '@gitroom/nestjs-libraries/database/prisma/subscriptions/pricing';
|
||||
import { Readable, pipeline } from 'stream';
|
||||
import { promisify } from 'util';
|
||||
import { OnlyURL } from '@gitroom/nestjs-libraries/dtos/webhooks/webhooks.dto';
|
||||
|
||||
const pump = promisify(pipeline);
|
||||
|
||||
|
|
@ -183,10 +184,11 @@ export class PublicController {
|
|||
|
||||
@Get('/stream')
|
||||
async streamFile(
|
||||
@Query('url') url: string,
|
||||
@Query() query: OnlyURL,
|
||||
@Res() res: Response,
|
||||
@Req() req: Request
|
||||
) {
|
||||
const { url } = query;
|
||||
if (!url.endsWith('mp4')) {
|
||||
return res.status(400).send('Invalid video URL');
|
||||
}
|
||||
|
|
@ -219,7 +221,6 @@ export class PublicController {
|
|||
|
||||
try {
|
||||
await pump(Readable.fromWeb(r.body as any), res);
|
||||
} catch (err) {
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue