aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/object-storage/pre-signed-urls.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-06 11:59:00 +0200
committerChocobozzz <me@florianbigard.com>2023-06-29 10:19:07 +0200
commitff75ba7160abd28460425b0f13371f5d41501e77 (patch)
tree10603c722f2cee4f89e477428ed84f9369e9ac08 /server/lib/object-storage/pre-signed-urls.ts
parentc37e305342c8655325f9606aa1f4b29abc471b39 (diff)
downloadPeerTube-ff75ba7160abd28460425b0f13371f5d41501e77.tar.gz
PeerTube-ff75ba7160abd28460425b0f13371f5d41501e77.tar.zst
PeerTube-ff75ba7160abd28460425b0f13371f5d41501e77.zip
Also replace base url of pre signed s3 url
Diffstat (limited to 'server/lib/object-storage/pre-signed-urls.ts')
-rw-r--r--server/lib/object-storage/pre-signed-urls.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/object-storage/pre-signed-urls.ts b/server/lib/object-storage/pre-signed-urls.ts
index 46a0750a1..d8473d01e 100644
--- a/server/lib/object-storage/pre-signed-urls.ts
+++ b/server/lib/object-storage/pre-signed-urls.ts
@@ -4,8 +4,9 @@ import { CONFIG } from '@server/initializers/config'
4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' 4import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models'
5import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' 5import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys'
6import { buildKey, getClient } from './shared' 6import { buildKey, getClient } from './shared'
7import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from './urls'
7 8
8export function generateWebVideoPresignedUrl (options: { 9export async function generateWebVideoPresignedUrl (options: {
9 file: MVideoFile 10 file: MVideoFile
10 downloadFilename: string 11 downloadFilename: string
11}) { 12}) {
@@ -19,10 +20,12 @@ export function generateWebVideoPresignedUrl (options: {
19 ResponseContentDisposition: `attachment; filename=${downloadFilename}` 20 ResponseContentDisposition: `attachment; filename=${downloadFilename}`
20 }) 21 })
21 22
22 return getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) 23 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
24
25 return getWebTorrentPublicFileUrl(url)
23} 26}
24 27
25export function generateHLSFilePresignedUrl (options: { 28export async function generateHLSFilePresignedUrl (options: {
26 streamingPlaylist: MStreamingPlaylistVideo 29 streamingPlaylist: MStreamingPlaylistVideo
27 file: MVideoFile 30 file: MVideoFile
28 downloadFilename: string 31 downloadFilename: string
@@ -37,5 +40,7 @@ export function generateHLSFilePresignedUrl (options: {
37 ResponseContentDisposition: `attachment; filename=${downloadFilename}` 40 ResponseContentDisposition: `attachment; filename=${downloadFilename}`
38 }) 41 })
39 42
40 return getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 }) 43 const url = await getSignedUrl(getClient(), command, { expiresIn: 3600 * 24 })
44
45 return getHLSPublicFileUrl(url)
41} 46}