-
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.
[IMPROVE] Setup Wizard Flow for airgapped environment (#28018)
- Loading branch information
1 parent
2e99a20
commit 1e1ad84
Showing
11 changed files
with
137 additions
and
81 deletions.
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
33 changes: 33 additions & 0 deletions
33
apps/meteor/app/cloud/server/functions/registerPreIntentWorkspaceWizard.ts
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,33 @@ | ||
import { HTTP } from 'meteor/http'; | ||
import type { IUser } from '@rocket.chat/core-typings'; | ||
|
||
import { settings } from '../../../settings/server'; | ||
import { buildWorkspaceRegistrationData } from './buildRegistrationData'; | ||
import { SystemLogger } from '../../../../server/lib/logger/system'; | ||
import { Users } from '../../../models/server'; | ||
|
||
export async function registerPreIntentWorkspaceWizard(): Promise<boolean> { | ||
const firstUser = Users.getOldest({ name: 1, emails: 1 }) as IUser | undefined; | ||
const email = firstUser?.emails?.find((address) => address)?.address || ''; | ||
|
||
const regInfo = await buildWorkspaceRegistrationData(email); | ||
const cloudUrl = settings.get('Cloud_Url'); | ||
|
||
try { | ||
HTTP.post(`${cloudUrl}/api/v2/register/workspace/pre-intent`, { | ||
data: regInfo, | ||
timeout: 10 * 1000, | ||
}); | ||
|
||
return true; | ||
} catch (err: any) { | ||
SystemLogger.error({ | ||
msg: 'Failed to register workspace pre-intent with Rocket.Chat Cloud', | ||
url: '/api/v2/register/workspace/pre-intent', | ||
...(err.response?.data && { cloudError: err.response.data }), | ||
err, | ||
}); | ||
|
||
return false; | ||
} | ||
} |
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
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
Oops, something went wrong.