Skip to content
Snippets Groups Projects
Unverified Commit ec99e151 authored by Douglas Gubert's avatar Douglas Gubert Committed by GitHub
Browse files

Regression: Re-add app signature migration to fix the faulty previous one (#28107)

parent d74b32e5
No related branches found
No related tags found
No related merge requests found
......@@ -25,4 +25,5 @@ import './v288';
import './v289';
import './v290';
import './v291';
import './v292';
import './xrun';
import { Settings } from '@rocket.chat/models';
import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage';
import type { AppSignatureManager } from '@rocket.chat/apps-engine/server/managers/AppSignatureManager';
import type { AppRealStorage } from '../../../ee/server/apps/storage';
import { addMigration } from '../../lib/migrations';
......@@ -8,7 +7,7 @@ import { Apps } from '../../../ee/server/apps';
addMigration({
version: 291,
name: "Mark all installed apps as 'migrated', add 'installationSource' and 'signature'",
name: "Mark all installed apps as 'migrated', add 'installationSource'",
async up() {
// remove non-used settings
await Settings.removeById('Apps_Framework_Development_Mode');
......@@ -16,7 +15,6 @@ addMigration({
Apps.initialize();
const sigMan = Apps.getManager()?.getSignatureManager() as AppSignatureManager;
const appsStorage = Apps.getStorage() as AppRealStorage;
const apps = await appsStorage.retrieveAll();
......@@ -29,7 +27,6 @@ addMigration({
...app,
migrated: true,
installationSource: 'marketplaceInfo' in app ? 'marketplace' : 'private',
signature: await sigMan.signApp(app),
} as IAppStorageItem),
),
);
......
import type { AppSignatureManager } from '@rocket.chat/apps-engine/server/managers/AppSignatureManager';
import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage';
import { Apps } from '../../../ee/server/apps';
import type { AppRealStorage } from '../../../ee/server/apps/storage';
import { addMigration } from '../../lib/migrations';
addMigration({
version: 292,
name: 'Add checksum signature to existing apps',
async up() {
Apps.initialize();
const sigMan = Apps.getManager()?.getSignatureManager() as AppSignatureManager;
const appsStorage = Apps.getStorage() as AppRealStorage;
const apps = await appsStorage.retrieveAll();
const promises: Array<ReturnType<AppRealStorage['update']>> = [];
apps.forEach(async (app) =>
promises.push(
appsStorage.update({
...app,
signature: await sigMan.signApp(app),
} as IAppStorageItem),
),
);
await Promise.all(promises);
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment