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:
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