diff --git a/src/js/client.js b/src/js/client.js
index 1bdc50031..3ddba64c4 100644
--- a/src/js/client.js
+++ b/src/js/client.js
@@ -481,6 +481,20 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
}).error(defaultErrorHandler(callback));
};
+ Client.prototype.setDynamicDnsConfig = function (enabled, callback) {
+ post('/api/v1/settings/dynamic_dns', { enabled: enabled }).success(function(data, status) {
+ if (status !== 200) return callback(new ClientError(status, data));
+ callback(null);
+ }).error(defaultErrorHandler(callback));
+ };
+
+ Client.prototype.getDynamicDnsConfig = function (callback) {
+ get('/api/v1/settings/dynamic_dns').success(function(data, status) {
+ if (status !== 200) return callback(new ClientError(status, data));
+ callback(null, data.enabled);
+ }).error(defaultErrorHandler(callback));
+ };
+
Client.prototype.getUpdateInfo = function (callback) {
get('/api/v1/cloudron/update').success(function(data, status) {
if (status !== 200) return callback(new ClientError(status, data));
diff --git a/src/views/settings.html b/src/views/settings.html
index ed7b6df3c..4a9613101 100644
--- a/src/views/settings.html
+++ b/src/views/settings.html
@@ -324,4 +324,33 @@
+
+
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 }}
+
+ Use Dynamic DNS
+
+
+
+
+
+
+ Saved
+
+
+
+ Save
+
+
+
+
diff --git a/src/views/settings.js b/src/views/settings.js
index e1df8f90e..9796292e5 100644
--- a/src/views/settings.js
+++ b/src/views/settings.js
@@ -287,6 +287,37 @@ 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);
@@ -418,6 +449,8 @@ 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;