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
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
157 lines
4.9 KiB
TypeScript
157 lines
4.9 KiB
TypeScript
import crypto from 'node:crypto';
|
|
|
|
import { settings, settingsRegistry } from '../../settings';
|
|
|
|
export const addMatrixBridgeFederationSettings = async (): Promise<void> => {
|
|
await settingsRegistry.add('Federation_Matrix_enabled', false, {
|
|
readonly: true,
|
|
type: 'boolean',
|
|
i18nLabel: 'Federation_Matrix_enabled',
|
|
i18nDescription: 'Federation_Matrix_enabled_desc',
|
|
alert: 'Old_Federation_Alert',
|
|
public: true,
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_serve_well_known', true, {
|
|
readonly: true,
|
|
type: 'boolean',
|
|
i18nLabel: 'Federation_Matrix_serve_well_known',
|
|
alert: 'Federation_Matrix_serve_well_known_Alert',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_enable_ephemeral_events', false, {
|
|
readonly: true,
|
|
type: 'boolean',
|
|
i18nLabel: 'Federation_Matrix_enable_ephemeral_events',
|
|
i18nDescription: 'Federation_Matrix_enable_ephemeral_events_desc',
|
|
alert: 'Federation_Matrix_enable_ephemeral_events_Alert',
|
|
public: true,
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
const uniqueId = settings.get('uniqueID') || crypto.randomUUID().slice(0, 15).replaceAll('-', '_');
|
|
const homeserverToken = crypto.createHash('sha256').update(`hs_${uniqueId}`).digest('hex');
|
|
const applicationServiceToken = crypto.createHash('sha256').update(`as_${uniqueId}`).digest('hex');
|
|
|
|
const siteUrl = settings.get<string>('Site_Url');
|
|
|
|
await settingsRegistry.add('Federation_Matrix_id', `rocketchat_${uniqueId}`, {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_id',
|
|
i18nDescription: 'Federation_Matrix_id_desc',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_hs_token', homeserverToken, {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_hs_token',
|
|
i18nDescription: 'Federation_Matrix_hs_token_desc',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_as_token', applicationServiceToken, {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_as_token',
|
|
i18nDescription: 'Federation_Matrix_as_token_desc',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_homeserver_url', 'http://localhost:8008', {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_homeserver_url',
|
|
i18nDescription: 'Federation_Matrix_homeserver_url_desc',
|
|
alert: 'Federation_Matrix_homeserver_url_alert',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_homeserver_domain', siteUrl, {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_homeserver_domain',
|
|
i18nDescription: 'Federation_Matrix_homeserver_domain_desc',
|
|
alert: 'Federation_Matrix_homeserver_domain_alert',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_bridge_url', 'http://localhost:3300', {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_bridge_url',
|
|
i18nDescription: 'Federation_Matrix_bridge_url_desc',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_bridge_localpart', 'rocket.cat', {
|
|
readonly: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_bridge_localpart',
|
|
i18nDescription: 'Federation_Matrix_bridge_localpart_desc',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_registration_file', '', {
|
|
readonly: true,
|
|
type: 'code',
|
|
i18nLabel: 'Federation_Matrix_registration_file',
|
|
i18nDescription: 'Federation_Matrix_registration_file_desc',
|
|
alert: 'Federation_Matrix_registration_file_Alert',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_max_size_of_public_rooms_users', 100, {
|
|
readonly: true,
|
|
type: 'int',
|
|
i18nLabel: 'Federation_Matrix_max_size_of_public_rooms_users',
|
|
i18nDescription: 'Federation_Matrix_max_size_of_public_rooms_users_desc',
|
|
alert: 'Federation_Matrix_max_size_of_public_rooms_users_Alert',
|
|
modules: ['federation'],
|
|
public: true,
|
|
enterprise: true,
|
|
invalidValue: false,
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_configuration_status', 'Invalid', {
|
|
readonly: true,
|
|
hidden: true,
|
|
type: 'string',
|
|
i18nLabel: 'Federation_Matrix_configuration_status',
|
|
i18nDescription: 'Federation_Matrix_configuration_status_desc',
|
|
public: false,
|
|
enterprise: false,
|
|
invalidValue: '',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
|
|
await settingsRegistry.add('Federation_Matrix_check_configuration_button', 'checkFederationConfiguration', {
|
|
readonly: true,
|
|
hidden: true,
|
|
type: 'action',
|
|
actionText: 'Federation_Matrix_check_configuration',
|
|
public: false,
|
|
enterprise: false,
|
|
invalidValue: '',
|
|
group: 'Federation',
|
|
section: 'Matrix Bridge',
|
|
});
|
|
};
|