diff --git a/src/js/client.js b/src/js/client.js index 582c13ac6..8f9d50073 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1798,6 +1798,23 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout if (!app.manifest.title) app.manifest.title = 'Untitled'; + if (app.manifest.postInstallMessage) { + var text= app.manifest.postInstallMessage; + // we chose - because underscore has special meaning in markdown + text = text.replace('$CLOUDRON-APP-DOMAIN', app.fqdn); + text = text.replace('$CLOUDRON-APP-ORIGIN', 'https://' + app.fqdn); + text = text.replace('$CLOUDRON-API-DOMAIN', this._config.adminFqdn); + text = text.replace('$CLOUDRON-API-ORIGIN', 'https://' + this._config.adminFqdn); + text = text.replace('$CLOUDRON-USERNAME', this._userInfo.username); + text = text.replace('$CLOUDRON-APP-ID', app.id); + + // [^] matches even newlines. '?' makes it non-greedy + if (app.sso) text = text.replace(/[^]*?<\/nosso>/g, ''); + else text = text.replace(/[^]*?<\/sso>/g, ''); + + app.manifest.postInstallMessage = text; + } + return app; }; diff --git a/src/js/index.js b/src/js/index.js index 76052a173..827fb92bb 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -386,17 +386,6 @@ app.filter('prettyEmailAddresses', function () { }; }); -app.filter('postInstallMessage', function () { - return function (text, app) { - if (!text) return ''; - if (!app) return text; - - // [^] matches even newlines. '?' makes it non-greedy - if (app.sso) return text.replace(/[^]*?<\/nosso>/g, ''); - else return text.replace(/[^]*?<\/sso>/g, ''); - }; -}); - // custom directive for dynamic names in forms // See http://stackoverflow.com/questions/23616578/issue-registering-form-control-with-interpolated-name#answer-23617401 app.directive('laterName', function () { // (2) diff --git a/src/views/app.html b/src/views/app.html index 87759968a..cee273f72 100644 --- a/src/views/app.html +++ b/src/views/app.html @@ -22,7 +22,7 @@