diff --git a/dashboard/src/models/AppsModel.js b/dashboard/src/models/AppsModel.js index 59b70406e..d0dcebfc3 100644 --- a/dashboard/src/models/AppsModel.js +++ b/dashboard/src/models/AppsModel.js @@ -127,8 +127,7 @@ function create() { } } - if (app.manifest.postInstallMessage) { - let text = app.manifest.postInstallMessage; + function expandTemplateVars(text) { // we chose - because underscore has special meaning in markdown text = text.replace(/\$CLOUDRON-APP-LOCATION/g, app.subdomain); text = text.replace(/\$CLOUDRON-APP-DOMAIN/g, app.domain); @@ -139,6 +138,12 @@ function create() { text = text.replace(/\$CLOUDRON-USERNAME/g, profile.username); text = text.replace(/\$CLOUDRON-APP-ID/g, app.id); + return text; + } + + if (app.manifest.postInstallMessage) { + let text = expandTemplateVars(app.manifest.postInstallMessage); + // [^] matches even newlines. '?' makes it non-greedy if (app.sso) text = text.replace(/[^]*?<\/nosso>/g, ''); else text = text.replace(/[^]*?<\/sso>/g, ''); @@ -146,6 +151,10 @@ function create() { app.manifest.postInstallMessage = text.trim(); } + for (const key of Object.keys(app.checklist)) { + app.checklist[key].message = expandTemplateVars(app.checklist[key].message); + } + return app; }