File tree Expand file tree Collapse file tree 5 files changed +33
-31
lines changed
Expand file tree Collapse file tree 5 files changed +33
-31
lines changed Original file line number Diff line number Diff line change 1+ import { useSetting } from '@rocket.chat/ui-contexts' ;
2+ import { useEffect } from 'react' ;
3+
4+ import { CustomOAuth } from '../../../custom-oauth/client/CustomOAuth' ;
5+
6+ const config = {
7+ serverURL : '' ,
8+ authorizePath : '/m/oauth2/auth/' ,
9+ tokenPath : '/m/oauth2/token/' ,
10+ identityPath : '/m/oauth2/api/me/' ,
11+ scope : 'basic' ,
12+ addAutopublishFields : {
13+ forLoggedInUser : [ 'services.dolphin' ] ,
14+ forOtherUsers : [ 'services.dolphin.name' ] ,
15+ } ,
16+ accessTokenParam : 'access_token' ,
17+ } ;
18+
19+ const Dolphin = new CustomOAuth ( 'dolphin' , config ) ;
20+
21+ export const useDolphin = ( ) => {
22+ const enabled = useSetting ( 'Accounts_OAuth_Dolphin' ) ;
23+ const url = useSetting ( 'Accounts_OAuth_Dolphin_URL' ) as string ;
24+
25+ useEffect ( ( ) => {
26+ if ( enabled ) {
27+ config . serverURL = url ;
28+ Dolphin . configure ( config ) ;
29+ }
30+ } , [ enabled , url ] ) ;
31+ } ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import '../app/authorization/client';
44import '../app/autotranslate/client' ;
55import '../app/canned-responses/client' ;
66import '../app/custom-sounds/client' ;
7- import '../app/dolphin/client' ;
87import '../app/emoji/client' ;
98import '../app/emoji-emojione/client' ;
109import '../app/emoji-custom/client' ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { useGoogleTagManager } from './hooks/useGoogleTagManager';
77import { useMessageLinkClicks } from './hooks/useMessageLinkClicks' ;
88import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl' ;
99import { useAnalytics } from '../../../app/analytics/client/loadScript' ;
10+ import { useDolphin } from '../../../app/dolphin/client/hooks/useDolphin' ;
1011import { useDrupal } from '../../../app/drupal/client/hooks/useDrupal' ;
1112import { useGitHubEnterpriseAuth } from '../../../app/github-enterprise/client/hooks/useGitHubEnterpriseAuth' ;
1213import { useGitLabAuth } from '../../../app/gitlab/client/hooks/useGitLabAuth' ;
@@ -41,6 +42,7 @@ const AppLayout = () => {
4142 useGitLabAuth ( ) ;
4243 useGitHubEnterpriseAuth ( ) ;
4344 useDrupal ( ) ;
45+ useDolphin ( ) ;
4446
4547 const layout = useSyncExternalStore ( appLayout . subscribe , appLayout . getSnapshot ) ;
4648
You can’t perform that action at this time.
0 commit comments