diff options
Diffstat (limited to 'server/tools/peertube-auth.ts')
-rw-r--r-- | server/tools/peertube-auth.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts index 1a4fae4ce..7673b92cd 100644 --- a/server/tools/peertube-auth.ts +++ b/server/tools/peertube-auth.ts | |||
@@ -80,8 +80,19 @@ program | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | }, async (_, result) => { | 82 | }, 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 | |||
83 | // Check credentials | 90 | // Check credentials |
84 | try { | 91 | try { |
92 | // Strip out everything after the domain:port. | ||
93 | // @see https://github.com/Chocobozzz/PeerTube/issues/3520 | ||
94 | result.url = stripExtraneousFromPeerTubeUrl(result.url) | ||
95 | |||
85 | await getAccessToken(result.url, result.username, result.password) | 96 | await getAccessToken(result.url, result.username, result.password) |
86 | } catch (err) { | 97 | } catch (err) { |
87 | console.error(err.message) | 98 | console.error(err.message) |