diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-12 16:09:02 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-10-24 14:48:24 +0200 |
commit | 3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (patch) | |
tree | e7f1d12ef5dae1e1142c3a8d0b681c1dbbb0de10 /shared/core-utils | |
parent | 38a3ccc7f8ad0ea94362b58c732af7c387ab46be (diff) | |
download | PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.gz PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.tar.zst PeerTube-3545e72c686ff1725bbdfd8d16d693e2f4aa75a3.zip |
Put private videos under a specific subdirectory
Diffstat (limited to 'shared/core-utils')
-rw-r--r-- | shared/core-utils/common/url.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/shared/core-utils/common/url.ts b/shared/core-utils/common/url.ts index fd54e7594..d1c399f7b 100644 --- a/shared/core-utils/common/url.ts +++ b/shared/core-utils/common/url.ts | |||
@@ -1,6 +1,16 @@ | |||
1 | import { Video, VideoPlaylist } from '../../models' | 1 | import { Video, VideoPlaylist } from '../../models' |
2 | import { secondsToTime } from './date' | 2 | import { secondsToTime } from './date' |
3 | 3 | ||
4 | function addQueryParams (url: string, params: { [ id: string ]: string }) { | ||
5 | const objUrl = new URL(url) | ||
6 | |||
7 | for (const key of Object.keys(params)) { | ||
8 | objUrl.searchParams.append(key, params[key]) | ||
9 | } | ||
10 | |||
11 | return objUrl.toString() | ||
12 | } | ||
13 | |||
4 | function buildPlaylistLink (playlist: Pick<VideoPlaylist, 'shortUUID'>, base?: string) { | 14 | function buildPlaylistLink (playlist: Pick<VideoPlaylist, 'shortUUID'>, base?: string) { |
5 | return (base ?? window.location.origin) + buildPlaylistWatchPath(playlist) | 15 | return (base ?? window.location.origin) + buildPlaylistWatchPath(playlist) |
6 | } | 16 | } |
@@ -103,6 +113,8 @@ function decoratePlaylistLink (options: { | |||
103 | // --------------------------------------------------------------------------- | 113 | // --------------------------------------------------------------------------- |
104 | 114 | ||
105 | export { | 115 | export { |
116 | addQueryParams, | ||
117 | |||
106 | buildPlaylistLink, | 118 | buildPlaylistLink, |
107 | buildVideoLink, | 119 | buildVideoLink, |
108 | 120 | ||