aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-30 11:26:24 +0100
committerChocobozzz <me@florianbigard.com>2020-12-30 11:26:24 +0100
commit24198e976f41bcc41b90c640f2c51931fc22b0a4 (patch)
tree2b9507a3bda8b868be783038b5aacd229bd363c2 /server
parent8e76aa1d75aebdadd0451d2e57c9bb65d1e75b9a (diff)
downloadPeerTube-24198e976f41bcc41b90c640f2c51931fc22b0a4.tar.gz
PeerTube-24198e976f41bcc41b90c640f2c51931fc22b0a4.tar.zst
PeerTube-24198e976f41bcc41b90c640f2c51931fc22b0a4.zip
Styling
Diffstat (limited to 'server')
-rw-r--r--server/tools/peertube-auth.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts
index 7673b92cd..6a0b89fe2 100644
--- a/server/tools/peertube-auth.ts
+++ b/server/tools/peertube-auth.ts
@@ -46,6 +46,15 @@ function isURLaPeerTubeInstance (url: string) {
46 return url.startsWith('http://') || url.startsWith('https://') 46 return url.startsWith('http://') || url.startsWith('https://')
47} 47}
48 48
49function stripExtraneousFromPeerTubeUrl (url: string) {
50 // Get everything before the 3rd /.
51 const urlLength = url.includes('/', 8)
52 ? url.indexOf('/', 8)
53 : url.length
54
55 return url.substr(0, urlLength)
56}
57
49program 58program
50 .name('auth') 59 .name('auth')
51 .usage('[command] [options]') 60 .usage('[command] [options]')
@@ -80,12 +89,6 @@ program
80 } 89 }
81 } 90 }
82 }, async (_, result) => { 91 }, async (_, result) => {
83 const stripExtraneousFromPeerTubeUrl = function (url: string) {
84 // Get everything before the 3rd /.
85 const urlLength: number = url.includes('/', 8) ? url.indexOf('/', 8) : url.length
86
87 return url.substr(0, urlLength)
88 }
89 92
90 // Check credentials 93 // Check credentials
91 try { 94 try {