Support naked domains as external location
Let the user add an A record for naked domains Fixes #272
This commit is contained in:
9
webadmin/src/3rdparty/js/angular-tld.js
vendored
9
webadmin/src/3rdparty/js/angular-tld.js
vendored
@@ -1,6 +1,7 @@
|
||||
// !!!
|
||||
// This module is manually patched by us to not only report valid domains, but verify that subdomains are not accepted
|
||||
// !!!
|
||||
'use strict';
|
||||
|
||||
angular.module('ngTld', [])
|
||||
.factory('ngTld', ngTld)
|
||||
@@ -16,9 +17,14 @@ function ngTld() {
|
||||
return (path.slice(-1) !== '.') && !!tld.getDomain(path) && path !== tld.getDomain(path);
|
||||
}
|
||||
|
||||
function isNakedDomain(path) {
|
||||
return (path.slice(-1) !== '.') && !!tld.getDomain(path) && path === tld.getDomain(path);
|
||||
}
|
||||
|
||||
return {
|
||||
tldExists: tldExists,
|
||||
isSubdomain: isSubdomain
|
||||
isSubdomain: isSubdomain,
|
||||
isNakedDomain: isNakedDomain
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,4 +43,3 @@ function checkTld(ngTld) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-center" ng-show="appConfigure.usingAltDomain && appConfigure.location && appConfigure.isAltDomainValid()">
|
||||
<p class="text-center" ng-show="appConfigure.usingAltDomain && appConfigure.location && appConfigure.isAltDomainSubdomain()">
|
||||
Add a CNAME record for <b>{{ appConfigure.location }}</b> to <b>{{ appConfigure.app.cnameTarget || appConfigure.app.fqdn }}</b>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
<p class="text-center" ng-show="appConfigure.usingAltDomain && appConfigure.location && appConfigure.isAltDomainNaked()">
|
||||
Add an A record for <b>{{ appConfigure.location }}</b> to this Cloudron's public IP</b>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
<p class="text-center" ng-show="appConfigure.location && dnsConfig.provider === 'manual' && !dnsConfig.wildcard">
|
||||
<b>Do not forget, to add an A record for {{ appConfigure.location }}.{{ config.fqdn }}</b>
|
||||
<br>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
angular.module('Application').controller('AppsController', ['$scope', '$location', '$timeout', 'Client', 'AppStore', function ($scope, $location, $timeout, Client, AppStore) {
|
||||
angular.module('Application').controller('AppsController', ['$scope', '$location', '$timeout', 'Client', 'ngTld', 'AppStore', function ($scope, $location, $timeout, Client, ngTld, AppStore) {
|
||||
$scope.HOST_PORT_MIN = 1024;
|
||||
$scope.HOST_PORT_MAX = 65535;
|
||||
$scope.installedApps = Client.getInstalledApps();
|
||||
@@ -42,8 +42,15 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
},
|
||||
|
||||
isAltDomainValid: function () {
|
||||
if (!$scope.appConfigure.usingAltDomain) return true;
|
||||
return /.+\..+\..+/.test($scope.appConfigure.location); // 2 dots
|
||||
return ngTld.tldExists($scope.appConfigure.location);
|
||||
},
|
||||
|
||||
isAltDomainSubdomain: function () {
|
||||
return ngTld.isSubdomain($scope.appConfigure.location);
|
||||
},
|
||||
|
||||
isAltDomainNaked: function () {
|
||||
return ngTld.isNakedDomain($scope.appConfigure.location);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user