snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import { config } from '../../../../../app/apple/lib/config';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
/* const Apple =*/ CustomOAuth.configureOAuthService('apple', config);
export const useAppleOAuth = () => {
// Here we would expect to handle changes in settings, updating the configuration
// accordingly, but it was not implemented yet.
};

View File

@@ -0,0 +1,24 @@
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
import { loginServices } from '../../../../lib/loginServices';
export const useCustomOAuth = () => {
useEffect(
() =>
loginServices.onLoad((services) => {
for (const service of services) {
if (!('custom' in service && service.custom)) {
continue;
}
CustomOAuth.configureCustomOAuthService(service.service, {
serverURL: service.serverURL,
authorizePath: service.authorizePath,
scope: service.scope,
});
}
}),
[],
);
};

View File

@@ -0,0 +1,34 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
const config = {
serverURL: '',
authorizePath: '/m/oauth2/auth/',
tokenPath: '/m/oauth2/token/',
identityPath: '/m/oauth2/api/me/',
scope: 'basic',
addAutopublishFields: {
forLoggedInUser: ['services.dolphin'],
forOtherUsers: ['services.dolphin.name'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;
const Dolphin = CustomOAuth.configureOAuthService('dolphin', config);
export const useDolphinOAuth = () => {
const enabled = useSetting('Accounts_OAuth_Dolphin');
const url = useSetting('Accounts_OAuth_Dolphin_URL') as string;
useEffect(() => {
if (enabled) {
Dolphin.configure({
...config,
serverURL: url,
});
}
}, [enabled, url]);
};

View File

@@ -0,0 +1,39 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
// Drupal Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/drupal
// In RocketChat -> Administration the URL needs to be http(s)://{drupal.server}/
const config = {
serverURL: '',
identityPath: '/oauth2/UserInfo',
authorizePath: '/oauth2/authorize',
tokenPath: '/oauth2/token',
scope: 'openid email profile offline_access',
tokenSentVia: 'payload',
usernameField: 'preferred_username',
mergeUsers: true,
addAutopublishFields: {
forLoggedInUser: ['services.drupal'],
forOtherUsers: ['services.drupal.name'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;
const Drupal = CustomOAuth.configureOAuthService('drupal', config);
export const useDrupalOAuth = () => {
const drupalUrl = useSetting('API_Drupal_URL') as string;
useEffect(() => {
if (drupalUrl) {
Drupal.configure({
...config,
serverURL: drupalUrl,
});
}
}, [drupalUrl]);
};

View File

@@ -0,0 +1,34 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/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}/
const config = {
serverURL: '',
identityPath: '/api/v3/user',
authorizePath: '/login/oauth/authorize',
tokenPath: '/login/oauth/access_token',
addAutopublishFields: {
forLoggedInUser: ['services.github-enterprise'],
forOtherUsers: ['services.github-enterprise.username'],
},
} as const satisfies OauthConfig;
const GitHubEnterprise = CustomOAuth.configureOAuthService('github_enterprise', config);
export const useGitHubEnterpriseOAuth = () => {
const githubApiUrl = useSetting('API_GitHub_Enterprise_URL') as string;
useEffect(() => {
if (githubApiUrl) {
GitHubEnterprise.configure({
...config,
serverURL: githubApiUrl,
});
}
}, [githubApiUrl]);
};

View File

@@ -0,0 +1,34 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
const config = {
serverURL: 'https://gitlab.com',
identityPath: '/api/v4/user',
scope: 'read_user',
mergeUsers: false,
addAutopublishFields: {
forLoggedInUser: ['services.gitlab'],
forOtherUsers: ['services.gitlab.username'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;
const Gitlab = CustomOAuth.configureOAuthService('gitlab', config);
export const useGitLabOAuth = () => {
const gitlabApiUrl = useSetting('API_Gitlab_URL') as string;
const gitlabIdentiry = useSetting('Accounts_OAuth_Gitlab_identity_path') as string;
const gitlabMergeUsers = useSetting('Accounts_OAuth_Gitlab_merge_users', false);
useEffect(() => {
Gitlab.configure({
...config,
...(gitlabApiUrl && { serverURL: gitlabApiUrl.trim().replace(/\/*$/, '') }),
...(gitlabIdentiry && { identityPath: gitlabIdentiry.trim() || config.identityPath }),
...(gitlabMergeUsers && { mergeUsers: true }),
});
}, [gitlabApiUrl, gitlabIdentiry, gitlabMergeUsers]);
};

View File

@@ -0,0 +1,33 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
const config: OauthConfig = {
authorizePath: 'https://github.com/login/oauth/authorize',
serverURL: 'https://github.com',
identityPath: 'https://api.github.com/user',
tokenPath: 'https://github.com/login/oauth/access_token',
scope: 'user:email',
mergeUsers: false,
addAutopublishFields: {
forLoggedInUser: ['services.github'],
forOtherUsers: ['services.github.username'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;
const Github = CustomOAuth.configureOAuthService('github', config);
export const useGithubOAuth = () => {
const enabled = useSetting('Accounts_OAuth_Github');
useEffect(() => {
if (enabled) {
Github.configure({
...config,
});
}
}, [enabled]);
};

View File

@@ -0,0 +1,33 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
const config = {
serverURL: '',
tokenPath: '/index.php/apps/oauth2/api/v1/token',
tokenSentVia: 'header',
authorizePath: '/index.php/apps/oauth2/authorize',
identityPath: '/ocs/v2.php/cloud/user?format=json',
scope: 'openid',
addAutopublishFields: {
forLoggedInUser: ['services.nextcloud'],
forOtherUsers: ['services.nextcloud.name'],
},
} as const satisfies OauthConfig;
const Nextcloud = CustomOAuth.configureOAuthService('nextcloud', config);
export const useNextcloudOAuth = (): void => {
const nextcloudURL = useSetting('Accounts_OAuth_Nextcloud_URL') as string;
useEffect(() => {
if (nextcloudURL) {
Nextcloud.configure({
...config,
serverURL: nextcloudURL.trim().replace(/\/*$/, ''),
});
}
}, [nextcloudURL]);
};

View File

@@ -0,0 +1,72 @@
import type { OauthConfig } from '@rocket.chat/core-typings';
import { useSetting } from '@rocket.chat/ui-contexts';
import { useEffect } from 'react';
import { CustomOAuth } from '../../../../lib/customOAuth/CustomOAuth';
const configDefault = {
serverURL: '',
addAutopublishFields: {
forLoggedInUser: ['services.wordpress'],
forOtherUsers: ['services.wordpress.user_login'],
},
accessTokenParam: 'access_token',
} as const satisfies OauthConfig;
const WordPress = CustomOAuth.configureOAuthService('wordpress', configDefault);
const configureServerType = (
serverType: string,
identityPath?: string,
identityTokenSentVia?: string,
tokenPath?: string,
authorizePath?: string,
scope?: string,
): OauthConfig => {
switch (serverType) {
case 'custom': {
return {
...configDefault,
...(identityPath && { identityPath }),
...(identityTokenSentVia && { identityTokenSentVia }),
...(tokenPath && { tokenPath }),
...(authorizePath && { authorizePath }),
...(scope && { scope }),
};
}
case 'wordpress-com':
return {
...configDefault,
identityPath: 'https://public-api.wordpress.com/rest/v1/me',
identityTokenSentVia: 'header',
authorizePath: 'https://public-api.wordpress.com/oauth2/authorize',
tokenPath: 'https://public-api.wordpress.com/oauth2/token',
scope: 'auth',
};
default:
return {
...configDefault,
identityPath: '/oauth/me',
};
}
};
export const useWordPressOAuth = (): void => {
const wordpressURL = useSetting('API_Wordpress_URL') as string;
const serverType = useSetting('Accounts_OAuth_Wordpress_server_type') as string;
const identityPath = useSetting('Accounts_OAuth_Wordpress_identity_path') as string;
const identityTokenSentVia = useSetting('Accounts_OAuth_Wordpress_identity_token_sent_via') as string;
const tokenPath = useSetting('Accounts_OAuth_Wordpress_token_path') as string;
const authorizePath = useSetting('Accounts_OAuth_Wordpress_authorize_path') as string;
const scope = useSetting('Accounts_OAuth_Wordpress_scope') as string;
useEffect(() => {
WordPress.configure({
...configDefault,
...configureServerType(serverType, identityPath, identityTokenSentVia, tokenPath, authorizePath, scope),
serverURL: wordpressURL,
});
}, [authorizePath, identityPath, identityTokenSentVia, scope, serverType, tokenPath, wordpressURL]);
};