Also replace base url of pre signed s3 url
This commit is contained in:
parent
c37e305342
commit
ff75ba7160
1 changed files with 9 additions and 4 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue