diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-06 11:59:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 10:19:07 +0200 |
commit | ff75ba7160abd28460425b0f13371f5d41501e77 (patch) | |
tree | 10603c722f2cee4f89e477428ed84f9369e9ac08 /server/lib/object-storage/pre-signed-urls.ts | |
parent | c37e305342c8655325f9606aa1f4b29abc471b39 (diff) | |
download | PeerTube-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.ts | 13 |
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' | |||
4 | import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' | 4 | import { MStreamingPlaylistVideo, MVideoFile } from '@server/types/models' |
5 | import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' | 5 | import { generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys' |
6 | import { buildKey, getClient } from './shared' | 6 | import { buildKey, getClient } from './shared' |
7 | import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from './urls' | ||
7 | 8 | ||
8 | export function generateWebVideoPresignedUrl (options: { | 9 | export 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 | ||
25 | export function generateHLSFilePresignedUrl (options: { | 28 | export 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 | } |