diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2015-12-06 17:35:59 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2015-12-06 17:36:33 +0300 |
commit | a0115cb741d279f7e153e5029b0c6fdf2ca79e57 (patch) | |
tree | 3f48d84d04f454b9eb3fcf5a06548ed74e1914bb /Duplicati/Server/webroot/ngax/scripts/services | |
parent | 6f33f8dc5348f4706c782267089a189d88e2475b (diff) |
Added Mega.co.nz backend as requested in issue #806
Diffstat (limited to 'Duplicati/Server/webroot/ngax/scripts/services')
-rw-r--r-- | Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js | 31 | ||||
-rw-r--r-- | Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js | 3 |
2 files changed, 32 insertions, 2 deletions
diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js index 127dd2219..3726b470f 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js @@ -22,6 +22,7 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, EditUriBackendConfig.templates['azure'] = 'templates/backends/azure.html'; EditUriBackendConfig.templates['gcs'] = 'templates/backends/gcs.html'; EditUriBackendConfig.templates['b2'] = 'templates/backends/b2.html'; + EditUriBackendConfig.templates['mega'] = 'templates/backends/mega.html'; // Loaders are a way for backends to request extra data from the server EditUriBackendConfig.loaders['s3'] = function(scope) { @@ -256,6 +257,10 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, delete options[nukeopts[x]]; }; + EditUriBackendConfig.parsers['mega'] = function(scope, module, server, port, path, options) { + EditUriBackendConfig.mergeServerAndPath(scope); + }; + // Builders take the scope and produce the uri output EditUriBackendConfig.builders['s3'] = function(scope) { var opts = { @@ -380,6 +385,23 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, return url; }; + EditUriBackendConfig.builders['mega'] = function(scope) { + var opts = { }; + + EditUriBackendConfig.merge_in_advanced_options(scope, opts); + + // Slightly better error message + scope.Folder = scope.Path; + + var url = AppUtils.format('{0}://{1}{2}', + 'mega', + scope.Path, + AppUtils.encodeDictAsUrl(opts) + ); + + return url; + }; + EditUriBackendConfig.validaters['file'] = function(scope) { return EditUriBackendConfig.require_path(scope); }; @@ -489,5 +511,14 @@ backupApp.service('EditUriBuiltins', function(AppService, AppUtils, SystemInfo, return res; }; + EditUriBackendConfig.validaters['mega'] = function(scope) { + scope.Path = scope.Path || ''; + var res = + EditUriBackendConfig.require_field(scope, 'Username', 'Username') && + EditUriBackendConfig.require_field(scope, 'Password', 'Password'); + + return res; + }; + });
\ No newline at end of file diff --git a/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js b/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js index f441c38e8..32e82d831 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js @@ -6,7 +6,7 @@ backupApp.service('SystemInfo', function($rootScope, $timeout, AppService, AppUt var backendgroups = { std: {'ftp': null, 'ssh': null, 'webdav': null, 'openstack': 'OpenStack Object Storage / Swift', 's3': 'S3 Compatible'}, local: {'file': null}, - prop: { 's3': null, 'azure': null, 'googledrive': null, 'onedrive': null, 'cloudfiles': null, 'gcs': null, 'openstack': null, 'hubic': null, 'amzcd': null, 'b2': null } + prop: { 's3': null, 'azure': null, 'googledrive': null, 'onedrive': null, 'cloudfiles': null, 'gcs': null, 'openstack': null, 'hubic': null, 'amzcd': null, 'b2': null, 'mega': null } } this.backendgroups = backendgroups; @@ -59,7 +59,6 @@ backupApp.service('SystemInfo', function($rootScope, $timeout, AppService, AppUt push_with_type(m, 'Others', 3); } - $rootScope.$broadcast('systeminfochanged'); }, AppUtils.connectionError) |