mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Add hook which allows to overwrite frontend settings
This commit is contained in:
parent
f1680386ca
commit
23dbdbc169
|
@ -121,7 +121,7 @@ class App {
|
||||||
push: Push.Push;
|
push: Push.Push;
|
||||||
versions: IPackageVersions | undefined;
|
versions: IPackageVersions | undefined;
|
||||||
restEndpoint: string;
|
restEndpoint: string;
|
||||||
|
frontendSettings: IN8nUISettings;
|
||||||
protocol: string;
|
protocol: string;
|
||||||
sslKey: string;
|
sslKey: string;
|
||||||
sslCert: string;
|
sslCert: string;
|
||||||
|
@ -155,6 +155,25 @@ class App {
|
||||||
|
|
||||||
this.presetCredentialsLoaded = false;
|
this.presetCredentialsLoaded = false;
|
||||||
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
|
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
|
||||||
|
|
||||||
|
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
|
||||||
|
|
||||||
|
this.frontendSettings = {
|
||||||
|
endpointWebhook: this.endpointWebhook,
|
||||||
|
endpointWebhookTest: this.endpointWebhookTest,
|
||||||
|
saveDataErrorExecution: this.saveDataErrorExecution,
|
||||||
|
saveDataSuccessExecution: this.saveDataSuccessExecution,
|
||||||
|
saveManualExecutions: this.saveManualExecutions,
|
||||||
|
executionTimeout: this.executionTimeout,
|
||||||
|
maxExecutionTimeout: this.maxExecutionTimeout,
|
||||||
|
timezone: this.timezone,
|
||||||
|
urlBaseWebhook,
|
||||||
|
versionCli: '',
|
||||||
|
oauthCallbackUrls: {
|
||||||
|
'oauth1': urlBaseWebhook + `${this.restEndpoint}/oauth1-credential/callback`,
|
||||||
|
'oauth2': urlBaseWebhook + `${this.restEndpoint}/oauth2-credential/callback`,
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +191,9 @@ class App {
|
||||||
async config(): Promise<void> {
|
async config(): Promise<void> {
|
||||||
|
|
||||||
this.versions = await GenericHelpers.getVersions();
|
this.versions = await GenericHelpers.getVersions();
|
||||||
|
this.frontendSettings.versionCli = this.versions.cli;
|
||||||
|
|
||||||
|
await this.externalHooks.run('frontend.settings', [this.frontendSettings]);
|
||||||
|
|
||||||
const excludeEndpoints = config.get('security.excludeEndpoints') as string;
|
const excludeEndpoints = config.get('security.excludeEndpoints') as string;
|
||||||
|
|
||||||
|
@ -1617,24 +1639,7 @@ class App {
|
||||||
|
|
||||||
// Returns the settings which are needed in the UI
|
// Returns the settings which are needed in the UI
|
||||||
this.app.get(`/${this.restEndpoint}/settings`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IN8nUISettings> => {
|
this.app.get(`/${this.restEndpoint}/settings`, ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IN8nUISettings> => {
|
||||||
const urlBaseWebhook = WebhookHelpers.getWebhookBaseUrl();
|
return this.frontendSettings;
|
||||||
|
|
||||||
const settings: IN8nUISettings = {
|
|
||||||
endpointWebhook: this.endpointWebhook,
|
|
||||||
endpointWebhookTest: this.endpointWebhookTest,
|
|
||||||
saveDataErrorExecution: this.saveDataErrorExecution,
|
|
||||||
saveDataSuccessExecution: this.saveDataSuccessExecution,
|
|
||||||
saveManualExecutions: this.saveManualExecutions,
|
|
||||||
executionTimeout: this.executionTimeout,
|
|
||||||
maxExecutionTimeout: this.maxExecutionTimeout,
|
|
||||||
timezone: this.timezone,
|
|
||||||
urlBaseWebhook,
|
|
||||||
versionCli: this.versions!.cli,
|
|
||||||
oauthCallbackUrls: {
|
|
||||||
'oauth1': urlBaseWebhook + `${this.restEndpoint}/oauth1-credential/callback`,
|
|
||||||
'oauth2': urlBaseWebhook + `${this.restEndpoint}/oauth2-credential/callback`,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue