aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-12 16:09:02 +0200
committerChocobozzz <chocobozzz@cpy.re>2022-10-24 14:48:24 +0200
commit3545e72c686ff1725bbdfd8d16d693e2f4aa75a3 (patch)
treee7f1d12ef5dae1e1142c3a8d0b681c1dbbb0de10 /shared/core-utils
parent38a3ccc7f8ad0ea94362b58c732af7c387ab46be (diff)
downloadPeerTube-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.ts12
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 @@
1import { Video, VideoPlaylist } from '../../models' 1import { Video, VideoPlaylist } from '../../models'
2import { secondsToTime } from './date' 2import { secondsToTime } from './date'
3 3
4function 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
4function buildPlaylistLink (playlist: Pick<VideoPlaylist, 'shortUUID'>, base?: string) { 14function 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
105export { 115export {
116 addQueryParams,
117
106 buildPlaylistLink, 118 buildPlaylistLink,
107 buildVideoLink, 119 buildVideoLink,
108 120