Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Skovhede <kenneth@hexad.dk>2015-12-06 17:35:59 +0300
committerKenneth Skovhede <kenneth@hexad.dk>2015-12-06 17:36:33 +0300
commita0115cb741d279f7e153e5029b0c6fdf2ca79e57 (patch)
tree3f48d84d04f454b9eb3fcf5a06548ed74e1914bb /Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
parent6f33f8dc5348f4706c782267089a189d88e2475b (diff)
Added Mega.co.nz backend as requested in issue #806
Diffstat (limited to 'Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js')
-rw-r--r--Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js31
1 files changed, 31 insertions, 0 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