aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-auth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools/peertube-auth.ts')
-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 {