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:
authorwood <wood@trueai.org>2020-06-27 12:54:12 +0300
committerwood <wood@trueai.org>2020-06-27 12:54:12 +0300
commitcc9080e533925fb93a5e0469e5c1153505bad38a (patch)
treefc132f9d94d4010cc0d125769bc081dd1253da2a /Duplicati/Server
parentb8e1f8f4de4514dcd24c544cadb6f184714c4302 (diff)
add tencent cos
Diffstat (limited to 'Duplicati/Server')
-rw-r--r--Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js52
-rw-r--r--Duplicati/Server/webroot/ngax/templates/backends/cos.html35
2 files changed, 87 insertions, 0 deletions
diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
index 217ff8a7a..5fc999fc0 100644
--- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
+++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
@@ -31,6 +31,7 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
EditUriBackendConfig.templates['sia'] = 'templates/backends/sia.html';
EditUriBackendConfig.templates['tardigrade'] = 'templates/backends/tardigrade.html';
EditUriBackendConfig.templates['rclone'] = 'templates/backends/rclone.html';
+ EditUriBackendConfig.templates['cos'] = 'templates/backends/cos.html';
EditUriBackendConfig.testers['s3'] = function(scope, callback) {
@@ -503,6 +504,25 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
};
+ EditUriBackendConfig.parsers['cos'] = function (scope, module, server, port, path, options) {
+ if (options['--cos-app-id'])
+ scope.cos_app_id = options['--cos-app-id'];
+ if (options['--cos-region'])
+ scope.cos_region = options['--cos-region'];
+ if (options['--cos-secret-id'])
+ scope.cos_secret_id = options['--cos-secret-id'];
+ if (options['--cos-secret-key'])
+ scope.cos_secret_key = options['--cos-secret-key'];
+ if (options['--cos-bucket'])
+ scope.cos_bucket = options['--cos-bucket'];
+
+ var nukeopts = ['--cos-app-id', '--cos-region', '--cos-secret-id', '--cos-secret-key', '--cos-bucket'];
+ for (var x in nukeopts)
+ delete options[nukeopts[x]];
+
+ EditUriBackendConfig.mergeServerAndPath(scope);
+ }
+
// Builders take the scope and produce the uri output
EditUriBackendConfig.builders['s3'] = function (scope) {
var opts = {
@@ -785,6 +805,27 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
return url;
};
+
+ EditUriBackendConfig.builders['cos'] = function (scope) {
+ var opts = {
+ 'cos-app-id': scope.cos_app_id,
+ 'cos-region': scope.cos_region,
+ 'cos-secret-id': scope.cos_secret_id,
+ 'cos-secret-key': scope.cos_secret_key,
+ 'cos-bucket': scope.cos_bucket
+ };
+
+ EditUriBackendConfig.merge_in_advanced_options(scope, opts);
+
+ var url = AppUtils.format('{0}://{1}{2}',
+ scope.Backend.Key,
+ scope.Path || '',
+ AppUtils.encodeDictAsUrl(opts)
+ );
+
+ return url;
+ }
+
EditUriBackendConfig.validaters['file'] = function (scope, continuation) {
if (EditUriBackendConfig.require_path(scope))
continuation();
@@ -1079,4 +1120,15 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
continuation();
};
+ EditUriBackendConfig.validaters['cos'] = function (scope, continuation) {
+ var res =
+ EditUriBackendConfig.require_field(scope, 'cos_app_id', gettextCatalog.getString('cos_app_id')) &&
+ EditUriBackendConfig.require_field(scope, 'cos_secret_id', gettextCatalog.getString('cos_secret_id')) &&
+ EditUriBackendConfig.require_field(scope, 'cos_secret_key', gettextCatalog.getString('cos_secret_key')) &&
+ EditUriBackendConfig.require_field(scope, 'cos_region', gettextCatalog.getString('cos_region')) &&
+ EditUriBackendConfig.require_field(scope, 'cos_bucket', gettextCatalog.getString('cos_bucket'));
+
+ if (res)
+ continuation();
+ };
});
diff --git a/Duplicati/Server/webroot/ngax/templates/backends/cos.html b/Duplicati/Server/webroot/ngax/templates/backends/cos.html
new file mode 100644
index 000000000..feae7f551
--- /dev/null
+++ b/Duplicati/Server/webroot/ngax/templates/backends/cos.html
@@ -0,0 +1,35 @@
+<div class="input text">
+ <label for="cos_app_id" translate>COS App Id</label>
+ <input type="text" name="cos_app_id" id="cos_app_id" ng-model="$parent.cos_app_id"
+ placeholder="{{'Tencent Cloud Account APPID' | translate}}"/>
+</div>
+
+<div class="input text">
+ <label for="cos_secret_id" translate>COS Secret Id</label>
+ <input type="text" name="cos_secret_id" id="cos_secret_id" ng-model="$parent.cos_secret_id"
+ placeholder="{{'Cloud API Secret Id' | translate}}"/>
+</div>
+
+<div class="input password">
+ <label for="cos_secret_key" translate>COS Secret Key</label>
+ <input type="password" name="cos_secret_key" id="cos_secret_key" ng-model="$parent.cos_secret_key"
+ placeholder="{{'Cloud API Secret Key' | translate}}"/>
+</div>
+
+<div class="input text">
+ <label for="cos_region" translate>Region</label>
+ <input type="text" name="cos_region" id="cos_region" ng-model="$parent.cos_region" placeholder="{{'Bucket region ap-guangzhou' | translate}}" />
+</div>
+
+<div class="input text">
+ <label for="cos_bucket" translate>Bucket name</label>
+ <input type="text" name="cos_bucket" id="cos_bucket" ng-model="$parent.cos_bucket" placeholder="{{'Bucket, format: BucketName-APPID' | translate}}"/>
+</div>
+
+<div class="input text">
+ <label for="cos_path" translate>Folder path</label>
+ <input type="text" name="cos_path" id="cos_path" ng-model="$parent.Path"
+ placeholder="{{'COS Path or subfolder in the bucket' | translate}}"/>
+</div>
+
+<div><a target="_blank" href="https://cloud.tencent.com/product/cos/document">Tencent Cloud COS documents and resources</a></div>