Skip to content

Commit aadbcbc

Browse files
refactor: remove meteor startup & autorun from dolphin auth (#34990)
Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
1 parent eba8e36 commit aadbcbc

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
};

apps/meteor/app/dolphin/client/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/meteor/app/dolphin/client/lib.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

apps/meteor/client/importPackages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import '../app/authorization/client';
44
import '../app/autotranslate/client';
55
import '../app/canned-responses/client';
66
import '../app/custom-sounds/client';
7-
import '../app/dolphin/client';
87
import '../app/emoji/client';
98
import '../app/emoji-emojione/client';
109
import '../app/emoji-custom/client';

apps/meteor/client/views/root/AppLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useGoogleTagManager } from './hooks/useGoogleTagManager';
77
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
88
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
99
import { useAnalytics } from '../../../app/analytics/client/loadScript';
10+
import { useDolphin } from '../../../app/dolphin/client/hooks/useDolphin';
1011
import { useDrupal } from '../../../app/drupal/client/hooks/useDrupal';
1112
import { useGitHubEnterpriseAuth } from '../../../app/github-enterprise/client/hooks/useGitHubEnterpriseAuth';
1213
import { 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

0 commit comments

Comments
 (0)