Add some $variables to the post install message

This way the post install messages can be better.

Removed it as a filter because I cannot figure how to pass args to it
This commit is contained in:
Girish Ramakrishnan
2020-08-08 18:07:06 -07:00
parent 91d4d95cb4
commit d82dde4b7f
4 changed files with 21 additions and 15 deletions
+17
View File
@@ -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>[^]*?<\/nosso>/g, '');
else text = text.replace(/<sso>[^]*?<\/sso>/g, '');
app.manifest.postInstallMessage = text;
}
return app;
};
-11
View File
@@ -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>[^]*?<\/nosso>/g, '');
else return text.replace(/<sso>[^]*?<\/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)
+2 -2
View File
@@ -22,7 +22,7 @@
</h5>
</div>
<div class="modal-body">
<div ng-bind-html="app.manifest.postInstallMessage | postInstallMessage:app | markdown2html"></div>
<div ng-bind-html="app.manifest.postInstallMessage | markdown2html"></div>
<div ng-show="app.manifest.documentationUrl">
Please see the <a target="_blank" ng-href="{{ app.manifest.documentationUrl }}">documentation</a> for more information.
</div>
@@ -281,7 +281,7 @@
<h4>First Time Setup</h4>
</div>
<div class="modal-body">
<div ng-bind-html="app.manifest.postInstallMessage | postInstallMessage:app | markdown2html"></div>
<div ng-bind-html="app.manifest.postInstallMessage | markdown2html"></div>
</div>
<div class="modal-footer">
<div class="form-group pull-left" ng-show="postInstallMessage.openApp">
+2 -2
View File
@@ -17,7 +17,7 @@
<p ng-show="appPostInstallConfirm.app.manifest.addons.email">This app is set up to allow all users with a mailbox on this Cloudron. Login with the email and Cloudron password to access the mailbox.</p>
<p ng-show="!appPostInstallConfirm.customAuth && !appPostInstallConfirm.app.manifest.addons.email"> This app is set up to authenticate with the Cloudron User Directory. Cloudron users can login and use {{ appPostInstallConfirm.app.manifest.title }}.</p>
<div ng-bind-html="appPostInstallConfirm.app.manifest.postInstallMessage | postInstallMessage:appPostInstallConfirm.app | markdown2html"></div>
<div ng-bind-html="appPostInstallConfirm.app.manifest.postInstallMessage | markdown2html"></div>
<div ng-show="appPostInstallConfirm.app.manifest.documentationUrl">
Please see the <a target="_blank" ng-href="{{appPostInstallConfirm.app.manifest.documentationUrl}}">documentation</a> for more information.
</div>
@@ -69,7 +69,7 @@
<div id="appinfoPostinstallMessage" class="panel-collapse collapse">
<br/>
<div ng-bind-html="appInfo.app.manifest.postInstallMessage | postInstallMessage:appInfo.app | markdown2html"></div>
<div ng-bind-html="appInfo.app.manifest.postInstallMessage | markdown2html"></div>
</div>
</div>