refactor: remove meteor from githubenterprise auth (#34992)

Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
pull/35153/head^2
Martin Schoeler 11 months ago committed by GitHub
parent 083fc49cf7
commit baa79d3eee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 22
      apps/meteor/app/github-enterprise/client/hooks/useGitHubEnterpriseAuth.ts
  2. 1
      apps/meteor/app/github-enterprise/client/index.ts
  3. 1
      apps/meteor/client/importPackages.ts
  4. 3
      apps/meteor/client/views/root/AppLayout.tsx

@ -1,9 +1,8 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../custom-oauth/client/CustomOAuth';
import { settings } from '../../settings/client';
import { CustomOAuth } from '../../../custom-oauth/client/CustomOAuth';
// GitHub Enterprise Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/github_enterprise
// In RocketChat -> Administration the URL needs to be http(s)://{github.enterprise.server}/
@ -20,11 +19,14 @@ const config: OauthConfig = {
};
const GitHubEnterprise = new CustomOAuth('github_enterprise', config);
Meteor.startup(() => {
Tracker.autorun(() => {
if (settings.get('API_GitHub_Enterprise_URL')) {
config.serverURL = settings.get('API_GitHub_Enterprise_URL');
export const useGitHubEnterpriseAuth = () => {
const githubApiUrl = useSetting('API_GitHub_Enterprise_URL') as string;
useEffect(() => {
if (githubApiUrl) {
config.serverURL = githubApiUrl;
GitHubEnterprise.configure(config);
}
});
});
}, [githubApiUrl]);
};

@ -10,7 +10,6 @@ import '../app/emoji/client';
import '../app/emoji-emojione/client';
import '../app/emoji-custom/client';
import '../app/file-upload/client';
import '../app/github-enterprise/client';
import '../app/gitlab/client';
import '../app/iframe-login/client';
import '../app/license/client';

@ -7,6 +7,7 @@ import { useGoogleTagManager } from './hooks/useGoogleTagManager';
import { useMessageLinkClicks } from './hooks/useMessageLinkClicks';
import { useSettingsOnLoadSiteUrl } from './hooks/useSettingsOnLoadSiteUrl';
import { useAnalytics } from '../../../app/analytics/client/loadScript';
import { useGitHubEnterpriseAuth } from '../../../app/github-enterprise/client/hooks/useGitHubEnterpriseAuth';
import { useGitLabAuth } from '../../../app/gitlab/client/hooks/useGitLabAuth';
import { useLivechatEnterprise } from '../../../app/livechat-enterprise/hooks/useLivechatEnterprise';
import { useNextcloud } from '../../../app/nextcloud/client/useNextcloud';
@ -36,8 +37,8 @@ const AppLayout = () => {
useSettingsOnLoadSiteUrl();
useLivechatEnterprise();
useNextcloud();
useGitLabAuth();
useGitHubEnterpriseAuth();
const layout = useSyncExternalStore(appLayout.subscribe, appLayout.getSnapshot);

Loading…
Cancel
Save