-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: Tag private apps as migrated (exempt from CE limitations) whe…
…n moving to the next major (#33420) * feat: Add migration to grandfather enabled private apps
- Loading branch information
1 parent
06a1214
commit c92cfe5
Showing
6 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,5 +39,6 @@ import './v303'; | |
import './v304'; | ||
import './v305'; | ||
import './v306'; | ||
import './v307'; | ||
|
||
export * from './xrun'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Apps } from '@rocket.chat/apps'; | ||
import type { AppSignatureManager } from '@rocket.chat/apps-engine/server/managers/AppSignatureManager'; | ||
import type { IAppStorageItem } from '@rocket.chat/apps-engine/server/storage'; | ||
import { License } from '@rocket.chat/license'; | ||
|
||
import type { AppRealStorage } from '../../../ee/server/apps/storage'; | ||
import { addMigration } from '../../lib/migrations'; | ||
|
||
addMigration({ | ||
version: 307, | ||
name: "Mark all installed private apps as 'migrated'", | ||
async up() { | ||
const isEE = License.hasValidLicense(); | ||
if (isEE) { | ||
return; | ||
} | ||
|
||
if (!Apps.self) { | ||
throw new Error('Apps Orchestrator not registered.'); | ||
} | ||
|
||
Apps.initialize(); | ||
|
||
const sigMan = Apps.getManager()?.getSignatureManager() as AppSignatureManager; | ||
const appsStorage = Apps.getStorage() as AppRealStorage; | ||
const apps = await appsStorage.retrieveAllPrivate(); | ||
|
||
for await (const app of apps.values()) { | ||
const updatedApp = { | ||
...app, | ||
migrated: true, | ||
} as IAppStorageItem; | ||
|
||
await appsStorage.update({ | ||
...updatedApp, | ||
signature: await sigMan.signApp(updatedApp), | ||
}); | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters