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 2s
147 lines
3.9 KiB
TypeScript
147 lines
3.9 KiB
TypeScript
import type { ISettingStatistics, ISettingStatisticsObject } from '@rocket.chat/core-typings';
|
|
|
|
import { settings } from '../../settings';
|
|
|
|
const setSettingsStatistics = async (settings: ISettingStatistics): Promise<ISettingStatisticsObject> => {
|
|
const {
|
|
account2fa,
|
|
cannedResponsesEnabled,
|
|
e2e,
|
|
e2eDefaultDirectRoom,
|
|
e2eDefaultPrivateRoom,
|
|
smtpHost,
|
|
smtpPort,
|
|
fromEmail,
|
|
fileUploadEnable,
|
|
frameworkDevMode,
|
|
frameworkEnable,
|
|
surveyEnabled,
|
|
updateChecker,
|
|
liveStream,
|
|
broadcasting,
|
|
allowEditing,
|
|
allowDeleting,
|
|
allowUnrecognizedSlashCommand,
|
|
allowBadWordsFilter,
|
|
readReceiptEnabled,
|
|
readReceiptStoreUsers,
|
|
globalSearchEnabled,
|
|
pushEnable,
|
|
threadsEnabled,
|
|
webRTCEnableChannel,
|
|
webRTCEnablePrivate,
|
|
webRTCEnableDirect,
|
|
} = settings;
|
|
|
|
// If Canned Response does not exist add blank object to the statistic
|
|
const cannedRes = cannedResponsesEnabled !== undefined ? { cannedResponses: { cannedResponsesEnabled } } : {};
|
|
|
|
const statisticObject = {
|
|
accounts: {
|
|
account2fa,
|
|
},
|
|
...cannedRes,
|
|
e2ee: {
|
|
e2e,
|
|
e2eDefaultDirectRoom,
|
|
e2eDefaultPrivateRoom,
|
|
},
|
|
email: {
|
|
smtp: {
|
|
smtpHost,
|
|
smtpPort,
|
|
fromEmail,
|
|
},
|
|
},
|
|
fileUpload: {
|
|
fileUploadEnable,
|
|
},
|
|
general: {
|
|
apps: {
|
|
frameworkDevMode,
|
|
frameworkEnable,
|
|
},
|
|
nps: {
|
|
surveyEnabled,
|
|
},
|
|
update: {
|
|
updateChecker,
|
|
},
|
|
},
|
|
liveStreamAndBroadcasting: {
|
|
liveStream,
|
|
broadcasting,
|
|
},
|
|
message: {
|
|
allowEditing,
|
|
allowDeleting,
|
|
allowUnrecognizedSlashCommand,
|
|
allowBadWordsFilter,
|
|
readReceiptEnabled,
|
|
readReceiptStoreUsers,
|
|
},
|
|
push: {
|
|
pushEnable,
|
|
},
|
|
search: {
|
|
defaultProvider: {
|
|
globalSearchEnabled,
|
|
},
|
|
},
|
|
threads: {
|
|
threadsEnabled,
|
|
},
|
|
webRTC: {
|
|
webRTCEnableChannel,
|
|
webRTCEnablePrivate,
|
|
webRTCEnableDirect,
|
|
},
|
|
};
|
|
return statisticObject;
|
|
};
|
|
export const getSettingsStatistics = async (): Promise<ISettingStatisticsObject> => {
|
|
try {
|
|
const settingsBase = [
|
|
{ key: 'Accounts_TwoFactorAuthentication_Enabled', alias: 'account2fa' },
|
|
{ key: 'E2E_Enable', alias: 'e2e' },
|
|
{ key: 'E2E_Enabled_Default_DirectRooms', alias: 'e2eDefaultDirectRoom' },
|
|
{ key: 'E2E_Enabled_Default_PrivateRooms', alias: 'e2eDefaultPrivateRoom' },
|
|
{ key: 'SMTP_Host', alias: 'smtpHost' },
|
|
{ key: 'SMTP_Port', alias: 'smtpPort' },
|
|
{ key: 'From_Email', alias: 'fromEmail' },
|
|
{ key: 'FileUpload_Enabled', alias: 'fileUploadEnable' },
|
|
{ key: 'NPS_survey_enabled', alias: 'surveyEnabled' },
|
|
{ key: 'Update_EnableChecker', alias: 'updateChecker' },
|
|
{ key: 'Livestream_enabled', alias: 'liveStream' },
|
|
{ key: 'Broadcasting_enabled', alias: 'broadcasting' },
|
|
{ key: 'Message_AllowEditing', alias: 'allowEditing' },
|
|
{ key: 'Message_AllowDeleting', alias: 'allowDeleting' },
|
|
{ key: 'Message_AllowUnrecognizedSlashCommand', alias: 'allowUnrecognizedSlashCommand' },
|
|
{ key: 'Message_AllowBadWordsFilter', alias: 'allowBadWordsFilter' },
|
|
{ key: 'Message_Read_Receipt_Enabled', alias: 'readReceiptEnabled' },
|
|
{ key: 'Message_Read_Receipt_Store_Users', alias: 'readReceiptStoreUsers' },
|
|
{ key: 'Search.defaultProvider.GlobalSearchEnabled', alias: 'globalSearchEnabled' },
|
|
{ key: 'Push_enable', alias: 'pushEnable' },
|
|
{ key: 'Threads_enabled', alias: 'threadsEnabled' },
|
|
{ key: 'WebRTC_Enable_Channel', alias: 'webRTCEnableChannel' },
|
|
{ key: 'WebRTC_Enable_Private', alias: 'webRTCEnablePrivate' },
|
|
{ key: 'WebRTC_Enable_Direct', alias: 'webRTCEnableDirect' },
|
|
{ key: 'Canned_Responses_Enable', alias: 'cannedResponsesEnabled' },
|
|
] as const;
|
|
|
|
const settingsStatistics = settingsBase.reduce<ISettingStatistics>((acc, { key, alias }) => {
|
|
if (!settings.has(key)) return acc;
|
|
|
|
acc[alias] = settings.get(key);
|
|
|
|
return acc;
|
|
}, {});
|
|
|
|
const staticticObject = await setSettingsStatistics(settingsStatistics);
|
|
|
|
return staticticObject;
|
|
} catch (error: any) {
|
|
return error;
|
|
}
|
|
};
|