1
0
Fork 0

Also replace base url of pre signed s3 url

This commit is contained in:
Chocobozzz 2023-06-06 11:59:00 +02:00
parent c37e305342
commit ff75ba7160
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -4,8 +4,9 @@ import { CONFIG } from '@server/initializers/config'
import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys'
import { buildKey, getClient } from './shared' import { buildKey, getClient } from './shared'
import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from './urls'
export function generateWebVideoPresignedUrl (options: { export async function generateWebVideoPresignedUrl (options: {
file: MVideoFile file: MVideoFile
downloadFilename: string downloadFilename: string
}) { }) {
@ -19,10 +20,12 @@ export function generateWebVideoPresignedUrl (options: {
ResponseContentDisposition: `attachment; filename=${downloadFilename}` ResponseContentDisposition: `attachment; filename=${downloadFilename}`
}) })
return getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
return getWebTorrentPublicFileUrl(url)
} }
export function generateHLSFilePresignedUrl (options: { export async function generateHLSFilePresignedUrl (options: {
streamingPlaylist: MStreamingPlaylistVideo streamingPlaylist: MStreamingPlaylistVideo
file: MVideoFile file: MVideoFile
downloadFilename: string downloadFilename: string
@ -37,5 +40,7 @@ export function generateHLSFilePresignedUrl (options: {
ResponseContentDisposition: `attachment; filename=${downloadFilename}` ResponseContentDisposition: `attachment; filename=${downloadFilename}`
}) })
return getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
return getHLSPublicFileUrl(url)
} }