diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-04 11:41:03 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-04 11:41:29 +0100 |
commit | 2570fd9c1c879d1a543fb0dff1e7cfb036234d11 (patch) | |
tree | f33fb7cc5ca25aa6052c15d44bebd384a56a8276 /shared/core-utils | |
parent | 60b880acdfa85eab5c9ec09ba1283f82ae58ec85 (diff) | |
download | PeerTube-2570fd9c1c879d1a543fb0dff1e7cfb036234d11.tar.gz PeerTube-2570fd9c1c879d1a543fb0dff1e7cfb036234d11.tar.zst PeerTube-2570fd9c1c879d1a543fb0dff1e7cfb036234d11.zip |
Redirect to default login url on 401
Can be an external URL
Diffstat (limited to 'shared/core-utils')
-rw-r--r-- | shared/core-utils/plugins/hooks.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/shared/core-utils/plugins/hooks.ts b/shared/core-utils/plugins/hooks.ts index 3784969b5..96bcc945e 100644 --- a/shared/core-utils/plugins/hooks.ts +++ b/shared/core-utils/plugins/hooks.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { RegisteredExternalAuthConfig } from '@shared/models' | ||
1 | import { HookType } from '../../models/plugins/hook-type.enum' | 2 | import { HookType } from '../../models/plugins/hook-type.enum' |
2 | import { isCatchable, isPromise } from '../common/promises' | 3 | import { isCatchable, isPromise } from '../common/promises' |
3 | 4 | ||
@@ -49,7 +50,12 @@ async function internalRunHook <T> (options: { | |||
49 | return result | 50 | return result |
50 | } | 51 | } |
51 | 52 | ||
53 | function getExternalAuthHref (apiUrl: string, auth: RegisteredExternalAuthConfig) { | ||
54 | return apiUrl + `/plugins/${auth.name}/${auth.version}/auth/${auth.authName}` | ||
55 | } | ||
56 | |||
52 | export { | 57 | export { |
53 | getHookType, | 58 | getHookType, |
54 | internalRunHook | 59 | internalRunHook, |
60 | getExternalAuthHref | ||
55 | } | 61 | } |