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:
96
apps/meteor/ee/lib/misc/Utilities.ts
Normal file
96
apps/meteor/ee/lib/misc/Utilities.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
export class Utilities {
|
||||
static getI18nKeyForApp<TKey extends string, TAppId extends string>(key: TKey, appId: TAppId) {
|
||||
return `app-${appId}.${key}` as const;
|
||||
}
|
||||
|
||||
static curl(
|
||||
{
|
||||
method,
|
||||
params,
|
||||
auth,
|
||||
headers = {},
|
||||
url,
|
||||
query,
|
||||
content,
|
||||
}: {
|
||||
method: string;
|
||||
params?: Record<string, string>;
|
||||
auth?: string;
|
||||
headers?: Record<string, string>;
|
||||
url: string;
|
||||
query?: Record<string, string>;
|
||||
content?: unknown;
|
||||
},
|
||||
opts: {
|
||||
verbose?: boolean;
|
||||
headers?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
const newLine = '\\\n ';
|
||||
|
||||
const cmd = ['curl'];
|
||||
|
||||
// curl options
|
||||
if (opts.verbose) {
|
||||
cmd.push('-v');
|
||||
}
|
||||
if (opts.headers) {
|
||||
cmd.push('-i');
|
||||
}
|
||||
|
||||
// method
|
||||
cmd.push('-X');
|
||||
cmd.push((method || 'GET').toUpperCase());
|
||||
|
||||
// URL
|
||||
let u = url;
|
||||
|
||||
if (typeof params === 'object') {
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
u = u.replace(`:${key}`, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof query === 'object') {
|
||||
const queryString = Object.entries(query)
|
||||
.map(([key, value]) => `${key}=${value}`)
|
||||
.join('&');
|
||||
u += `?${queryString}`;
|
||||
}
|
||||
cmd.push(u);
|
||||
|
||||
// username
|
||||
if (auth) {
|
||||
cmd.push(newLine);
|
||||
cmd.push('-u');
|
||||
cmd.push(auth);
|
||||
}
|
||||
|
||||
// headers
|
||||
const headerKeys: string[] = [];
|
||||
Object.entries(headers).forEach(([key, val]) => {
|
||||
key = key.toLowerCase();
|
||||
headerKeys.push(key);
|
||||
cmd.push(newLine);
|
||||
cmd.push('-H');
|
||||
cmd.push(`"${key}${val ? ': ' : ';'}${val || ''}"`);
|
||||
});
|
||||
|
||||
if (content) {
|
||||
if (typeof content === 'object') {
|
||||
if (!headerKeys.includes('content-type')) {
|
||||
cmd.push(newLine);
|
||||
cmd.push('-H');
|
||||
cmd.push('"content-type: application/json"');
|
||||
}
|
||||
content = JSON.stringify(content);
|
||||
}
|
||||
|
||||
cmd.push(newLine);
|
||||
cmd.push('--data-binary');
|
||||
cmd.push(`'${content}'`);
|
||||
}
|
||||
|
||||
return cmd.join(' ');
|
||||
}
|
||||
}
|
||||
19
apps/meteor/ee/lib/misc/determineFileType.js
Normal file
19
apps/meteor/ee/lib/misc/determineFileType.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import fileType from 'file-type';
|
||||
|
||||
import { mime as MIME } from '../../../app/utils/lib/mimeTypes';
|
||||
|
||||
export function determineFileType(buffer, name) {
|
||||
const mime = MIME.lookup(name);
|
||||
|
||||
if (mime) {
|
||||
return Array.isArray(mime) ? mime[0] : mime;
|
||||
}
|
||||
|
||||
const detectedType = fileType(buffer);
|
||||
|
||||
if (detectedType) {
|
||||
return detectedType.mime;
|
||||
}
|
||||
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
24
apps/meteor/ee/lib/misc/fetchAppsStatusFromCluster.ts
Normal file
24
apps/meteor/ee/lib/misc/fetchAppsStatusFromCluster.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Apps } from '@rocket.chat/core-services';
|
||||
|
||||
import { isRunningMs } from '../../../server/lib/isRunningMs';
|
||||
import { Instance } from '../../server/sdk';
|
||||
|
||||
export async function fetchAppsStatusFromCluster() {
|
||||
const appsStatus = isRunningMs() ? await Apps.getAppsStatusInNodes() : await Instance.getAppsStatusInInstances();
|
||||
|
||||
Object.values(appsStatus).forEach((instances) =>
|
||||
instances.sort((a, b) => {
|
||||
if (a.instanceId > b.instanceId) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a.instanceId < b.instanceId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}),
|
||||
);
|
||||
|
||||
return appsStatus;
|
||||
}
|
||||
40
apps/meteor/ee/lib/misc/formatAppInstanceForRest.ts
Normal file
40
apps/meteor/ee/lib/misc/formatAppInstanceForRest.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { ProxiedApp } from '@rocket.chat/apps/dist/server/ProxiedApp';
|
||||
import type { AppLicenseValidationResult } from '@rocket.chat/apps/dist/server/marketplace/license/AppLicenseValidationResult';
|
||||
import type { IAppStorageItem } from '@rocket.chat/apps/dist/server/storage/IAppStorageItem';
|
||||
import type { AppStatus } from '@rocket.chat/apps-engine/definition/AppStatus';
|
||||
import type { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
|
||||
import type { AppStatusReport } from '@rocket.chat/core-services';
|
||||
import type { App } from '@rocket.chat/core-typings';
|
||||
|
||||
import { getInstallationSourceFromAppStorageItem } from '../../../lib/apps/getInstallationSourceFromAppStorageItem';
|
||||
|
||||
interface IAppInfoRest extends IAppInfo {
|
||||
status: AppStatus;
|
||||
languages: IAppStorageItem['languageContent'];
|
||||
licenseValidation?: AppLicenseValidationResult;
|
||||
private: boolean;
|
||||
migrated: boolean;
|
||||
clusterStatus?: App['clusterStatus'];
|
||||
}
|
||||
|
||||
export async function formatAppInstanceForRest(app: ProxiedApp, clusterStatus?: AppStatusReport): Promise<IAppInfoRest> {
|
||||
const appRest: IAppInfoRest = {
|
||||
...app.getInfo(),
|
||||
status: await app.getStatus(),
|
||||
languages: app.getStorageItem().languageContent,
|
||||
private: getInstallationSourceFromAppStorageItem(app.getStorageItem()) === 'private',
|
||||
migrated: !!app.getStorageItem().migrated,
|
||||
};
|
||||
|
||||
if (clusterStatus?.[app.getID()]) {
|
||||
appRest.clusterStatus = clusterStatus[app.getID()];
|
||||
}
|
||||
|
||||
const licenseValidation = app.getLatestLicenseValidationResult();
|
||||
|
||||
if (licenseValidation?.hasErrors || licenseValidation?.hasWarnings) {
|
||||
appRest.licenseValidation = licenseValidation;
|
||||
}
|
||||
|
||||
return appRest;
|
||||
}
|
||||
Reference in New Issue
Block a user