diff --git a/src/views/domains.html b/src/views/domains.html index 339aac663..dae2cd382 100644 --- a/src/views/domains.html +++ b/src/views/domains.html @@ -295,4 +295,33 @@ + +
+

Dynamic DNS

+
+ +
+
+
+

+ Enable this option to keep all your DNS records in sync with a changing IP address. + This is useful when Cloudron runs in a network with a frequently changing public IP address like a home connection. +

+


{{ dyndnsConfigure.error }}

+ +
+
+ +
+
+ Saved +
+ +
+ +
+
+
diff --git a/src/views/domains.js b/src/views/domains.js index 5111b2865..81d1dd964 100644 --- a/src/views/domains.js +++ b/src/views/domains.js @@ -441,12 +441,47 @@ angular.module('Application').controller('DomainsController', ['$scope', '$locat } }; + $scope.dyndnsConfigure = { + busy: false, + success: false, + error: '', + currentState: false, + enabled: false, + + refresh: function () { + Client.getDynamicDnsConfig(function (error, enabled) { + if (error) return console.error(error); + + $scope.dyndnsConfigure.currentState = enabled; + $scope.dyndnsConfigure.enabled = enabled; + }); + }, + + submit: function () { + $scope.dyndnsConfigure.busy = true; + $scope.dyndnsConfigure.success = false; + $scope.dyndnsConfigure.error = ''; + + Client.setDynamicDnsConfig($scope.dyndnsConfigure.enabled, function (error) { + if (error) $scope.dyndnsConfigure.error = error.message; + else $scope.dyndnsConfigure.currentState = $scope.dyndnsConfigure.enabled; + + $scope.dyndnsConfigure.busy = false; + $scope.dyndnsConfigure.success = true; + }); + } + }; + Client.onReady(function () { getDomains(function (error, result) { if (error) return console.error(error); $scope.domains = result; $scope.ready = true; + + if (!$scope.config.managed) { + $scope.dyndnsConfigure.refresh(); + } }); }); diff --git a/src/views/settings.html b/src/views/settings.html index c4db0fcf4..f21c0aa9b 100644 --- a/src/views/settings.html +++ b/src/views/settings.html @@ -323,34 +323,4 @@ - -
-

Dynamic DNS

-
- -
-
-
-

- This feature will keep all your DNS records in sync with a changing IP address. - It is useful when Cloudron runs in a network with a frequently changing public IP address like a home connection. -

-


{{ dyndnsConfigure.error }}

- -
-
- -
-
- Saved -
- -
- -
-
-
- diff --git a/src/views/settings.js b/src/views/settings.js index 9796292e5..e1df8f90e 100644 --- a/src/views/settings.js +++ b/src/views/settings.js @@ -287,37 +287,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca } }; - $scope.dyndnsConfigure = { - busy: false, - success: false, - error: '', - currentState: false, - enabled: false, - - refresh: function () { - Client.getDynamicDnsConfig(function (error, enabled) { - if (error) return console.error(error); - - $scope.dyndnsConfigure.currentState = enabled; - $scope.dyndnsConfigure.enabled = enabled; - }); - }, - - submit: function () { - $scope.dyndnsConfigure.busy = true; - $scope.dyndnsConfigure.success = false; - $scope.dyndnsConfigure.error = ''; - - Client.setDynamicDnsConfig($scope.dyndnsConfigure.enabled, function (error) { - if (error) $scope.dyndnsConfigure.error = error.message; - else $scope.dyndnsConfigure.currentState = $scope.dyndnsConfigure.enabled; - - $scope.dyndnsConfigure.busy = false; - $scope.dyndnsConfigure.success = true; - }); - } - }; - function getAutoupdatePattern() { Client.getAppAutoupdatePattern(function (error, result) { if (error) return console.error(error); @@ -449,8 +418,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca $scope.currency = caasConfig.currency === 'eur' ? '€' : '$'; }); } else if (!$scope.config.managed) { - $scope.dyndnsConfigure.refresh(); - Client.getAppstoreConfig(function (error, appstoreConfig) { if (error) return console.error(error); if (!appstoreConfig.token) return;