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
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:
37
apps/meteor/server/lib/utils/functions/getBaseUserFields.ts
Normal file
37
apps/meteor/server/lib/utils/functions/getBaseUserFields.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
type UserFields = {
|
||||
[k: string]: number;
|
||||
};
|
||||
|
||||
export const getBaseUserFields = (allowServiceKeys = false): UserFields => ({
|
||||
'name': 1,
|
||||
'username': 1,
|
||||
'nickname': 1,
|
||||
'emails': 1,
|
||||
'status': 1,
|
||||
'statusDefault': 1,
|
||||
'statusText': 1,
|
||||
'statusSource': 1,
|
||||
'statusExpiresAt': 1,
|
||||
'statusConnection': 1,
|
||||
'bio': 1,
|
||||
'avatarOrigin': 1,
|
||||
'utcOffset': 1,
|
||||
'language': 1,
|
||||
'settings': 1,
|
||||
'enableAutoAway': 1,
|
||||
'idleTimeLimit': 1,
|
||||
'roles': 1,
|
||||
'active': 1,
|
||||
'defaultRoom': 1,
|
||||
'customFields': 1,
|
||||
'requirePasswordChange': 1,
|
||||
'requirePasswordChangeReason': 1,
|
||||
'statusLivechat': 1,
|
||||
'banners': 1,
|
||||
'oauth.authorizedClients': 1,
|
||||
'_updatedAt': 1,
|
||||
'avatarETag': 1,
|
||||
'openBusinessHours': 1,
|
||||
'abacAttributes': 1,
|
||||
...(allowServiceKeys && { 'services.totp.enabled': 1, 'services.email2fa.enabled': 1 }),
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import { getBaseUserFields } from './getBaseUserFields';
|
||||
|
||||
type UserFields = {
|
||||
[k: string]: number;
|
||||
};
|
||||
|
||||
export const getDefaultUserFields = (): UserFields => ({
|
||||
...getBaseUserFields(true),
|
||||
'services.github': 1,
|
||||
'services.gitlab': 1,
|
||||
'services.password.bcrypt': 1,
|
||||
});
|
||||
61
apps/meteor/server/lib/utils/functions/getMongoInfo.ts
Normal file
61
apps/meteor/server/lib/utils/functions/getMongoInfo.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { MongoInternals, type MongoConnection } from 'meteor/mongo';
|
||||
|
||||
function getOplogInfo(): { mongo: MongoConnection } {
|
||||
const { mongo } = MongoInternals.defaultRemoteCollectionDriver();
|
||||
|
||||
return { mongo };
|
||||
}
|
||||
|
||||
async function fallbackMongoInfo(): Promise<{
|
||||
mongoVersion: string;
|
||||
mongoStorageEngine?: string;
|
||||
mongo: MongoConnection;
|
||||
}> {
|
||||
let mongoVersion;
|
||||
let mongoStorageEngine;
|
||||
|
||||
const { mongo } = getOplogInfo();
|
||||
|
||||
try {
|
||||
const { version } = await mongo.db.command({ buildinfo: 1 });
|
||||
mongoVersion = version;
|
||||
mongoStorageEngine = 'unknown';
|
||||
} catch (e) {
|
||||
console.error('=== Error getting MongoDB info ===');
|
||||
console.error(e?.toString());
|
||||
console.error('----------------------------------');
|
||||
console.error("Without mongodb version we can't ensure you are running a compatible version.");
|
||||
console.error('If you are running your mongodb with auth enabled and an user different from admin');
|
||||
console.error('you may need to grant permissions for this user to check cluster data.');
|
||||
console.error('You can do it via mongo shell running the following command replacing');
|
||||
console.error("the string YOUR_USER by the correct user's name:");
|
||||
console.error('');
|
||||
console.error(' db.runCommand({ grantRolesToUser: "YOUR_USER" , roles: [{role: "clusterMonitor", db: "admin"}]})');
|
||||
console.error('');
|
||||
console.error('==================================');
|
||||
}
|
||||
|
||||
return { mongoVersion, mongoStorageEngine, mongo };
|
||||
}
|
||||
|
||||
export async function getMongoInfo(): Promise<{
|
||||
mongoVersion: string;
|
||||
mongoStorageEngine?: string;
|
||||
mongo: MongoConnection;
|
||||
}> {
|
||||
let mongoVersion;
|
||||
let mongoStorageEngine;
|
||||
|
||||
const { mongo } = getOplogInfo();
|
||||
|
||||
try {
|
||||
const { version, storageEngine } = await mongo.db.command({ serverStatus: 1 });
|
||||
|
||||
mongoVersion = version;
|
||||
mongoStorageEngine = storageEngine.name;
|
||||
} catch (e) {
|
||||
return fallbackMongoInfo();
|
||||
}
|
||||
|
||||
return { mongoVersion, mongoStorageEngine, mongo };
|
||||
}
|
||||
31
apps/meteor/server/lib/utils/functions/isDocker.ts
Normal file
31
apps/meteor/server/lib/utils/functions/isDocker.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import fs from 'node:fs';
|
||||
|
||||
function hasDockerEnv(): boolean {
|
||||
try {
|
||||
fs.statSync('/.dockerenv');
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function hasDockerCGroup(): boolean {
|
||||
try {
|
||||
return fs.readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker') !== -1;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function check(): boolean {
|
||||
return hasDockerEnv() || hasDockerCGroup();
|
||||
}
|
||||
|
||||
let _isDocker: boolean;
|
||||
export const isDocker = function (): boolean {
|
||||
if (_isDocker === undefined) {
|
||||
_isDocker = check();
|
||||
}
|
||||
|
||||
return _isDocker;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
import { settings } from '../../../settings';
|
||||
|
||||
export const isSMTPConfigured = (): boolean => {
|
||||
const isMailURLSet = !(process.env.MAIL_URL === 'undefined' || process.env.MAIL_URL === undefined);
|
||||
return Boolean(settings.get('SMTP_Host')) || isMailURLSet;
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { IMessage } from '@rocket.chat/core-typings';
|
||||
import { Uploads } from '@rocket.chat/models';
|
||||
|
||||
import { FileUpload } from '../../media/file-upload';
|
||||
import { getURL } from '../getURL';
|
||||
|
||||
export const normalizeMessageFileUpload = async (message: Omit<IMessage, '_updatedAt'>): Promise<Omit<IMessage, '_updatedAt'>> => {
|
||||
if (message.file && !message.fileUpload) {
|
||||
const jwt = FileUpload.generateJWTToFileUrls({
|
||||
rid: message.rid,
|
||||
userId: message.u._id,
|
||||
fileId: message.file._id,
|
||||
});
|
||||
const file = await Uploads.findOne({ _id: message.file._id });
|
||||
if (!file) {
|
||||
return message;
|
||||
}
|
||||
message.fileUpload = {
|
||||
publicFilePath: file.name
|
||||
? getURL(`${FileUpload.getPath(`${file._id}/${encodeURI(file.name)}`).substring(1)}${jwt ? `?token=${jwt}` : ''}`, {
|
||||
cdn: false,
|
||||
full: true,
|
||||
})
|
||||
: '',
|
||||
type: file.type,
|
||||
size: file.size,
|
||||
};
|
||||
}
|
||||
return message;
|
||||
};
|
||||
Reference in New Issue
Block a user