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:
authorwarwickmm <warwickmm@users.noreply.github.com>2020-11-09 04:59:37 +0300
committerGitHub <noreply@github.com>2020-11-09 04:59:37 +0300
commitc7f9f8f5566b99d3189d9d32f24a888a8cdde231 (patch)
tree7a6128c2a2e3dcd8fb34e4c664020ec6905a99fa /Duplicati/Server
parent85139f86f243db02671b2fd527545e43a285c8e9 (diff)
parent812d698abab1cb8d1a663c23fd5aa7b50d89dde9 (diff)
Merge pull request #4324 from martikyan/feature/telegram_backend
Add support for Telegram channels as a backend destination.
Diffstat (limited to 'Duplicati/Server')
-rw-r--r--Duplicati/Server/Duplicati.Server.csproj4
-rw-r--r--Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js59
-rw-r--r--Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js1
-rw-r--r--Duplicati/Server/webroot/ngax/templates/backends/telegram.html24
4 files changed, 88 insertions, 0 deletions
diff --git a/Duplicati/Server/Duplicati.Server.csproj b/Duplicati/Server/Duplicati.Server.csproj
index 4a81dbdad..fe7c5b027 100644
--- a/Duplicati/Server/Duplicati.Server.csproj
+++ b/Duplicati/Server/Duplicati.Server.csproj
@@ -207,6 +207,10 @@
<Project>{ae035e01-c917-4f13-a35e-78f21c1a2f17}</Project>
<Name>Duplicati.Library.Backend.Tardigrade</Name>
</ProjectReference>
+ <ProjectReference Include="..\Library\Backend\Telegram\Duplicati.Library.Backend.Telegram.csproj">
+ <Project>{f61679a9-e5de-468a-b5a4-05f92d0143d2}</Project>
+ <Name>Duplicati.Library.Backend.Telegram</Name>
+ </ProjectReference>
<ProjectReference Include="..\Library\Backend\TencentCOS\Duplicati.Library.Backend.TencentCOS.csproj">
<Project>{545dd6d4-9476-42d6-b51c-a28e000c489e}</Project>
<Name>Duplicati.Library.Backend.TencentCOS</Name>
diff --git a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
index 5fc999fc0..5fd65207b 100644
--- a/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
+++ b/Duplicati/Server/webroot/ngax/scripts/services/EditUriBuiltins.js
@@ -30,6 +30,7 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
EditUriBackendConfig.templates['dropbox'] = 'templates/backends/oauth.html';
EditUriBackendConfig.templates['sia'] = 'templates/backends/sia.html';
EditUriBackendConfig.templates['tardigrade'] = 'templates/backends/tardigrade.html';
+ EditUriBackendConfig.templates['telegram'] = 'templates/backends/telegram.html';
EditUriBackendConfig.templates['rclone'] = 'templates/backends/rclone.html';
EditUriBackendConfig.templates['cos'] = 'templates/backends/cos.html';
@@ -503,6 +504,24 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
delete options[nukeopts[x]];
};
+ EditUriBackendConfig.parsers['telegram'] = function (scope, module, server, port, path, options) {
+ if (options['--api-id'])
+ scope.api_id = options['--api-id'];
+ if (options['--api-hash'])
+ scope.api_hash = options['--api-hash'];
+ if (options['--auth-code'])
+ scope.auth_code = options['--auth-code'];
+ if (options['--channel-name'])
+ scope.channel_name = options['--channel-name'];
+ if (options['--phone-number'])
+ scope.phone_number = options['--phone-number'];
+ if (options['--auth_password'])
+ scope.auth_password = options['--auth_password'];
+
+ var nukeopts = ['--api-id','--api-hash', '--auth-code', '--channel-name', '--phone-number', '--auth_password'];
+ for (var x in nukeopts)
+ delete options[nukeopts[x]];
+ };
EditUriBackendConfig.parsers['cos'] = function (scope, module, server, port, path, options) {
if (options['--cos-app-id'])
@@ -760,6 +779,26 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
return url;
};
+ EditUriBackendConfig.builders['telegram'] = function (scope) {
+ var opts = {
+ 'api-id': scope.api_id,
+ 'api-hash': scope.api_hash,
+ 'auth-code': scope.auth_code,
+ 'channel-name': scope.channel_name,
+ 'phone-number': scope.phone_number,
+ 'auth-password': scope.auth_password,
+ };
+
+ EditUriBackendConfig.merge_in_advanced_options(scope, opts);
+
+ var url = AppUtils.format('{0}://t.me/{1}',
+ scope.Backend.Key,
+ AppUtils.encodeDictAsUrl(opts)
+ );
+
+ return url;
+ };
+
EditUriBackendConfig.builders['rclone'] = function (scope) {
var opts = {
@@ -1110,6 +1149,26 @@ backupApp.service('EditUriBuiltins', function (AppService, AppUtils, SystemInfo,
continuation();
};
+ EditUriBackendConfig.validaters['telegram'] = function (scope, continuation) {
+ var opts = {
+ 'api-id': scope.api_id,
+ 'api-hash': scope.api_hash,
+ 'auth-code': scope.auth_code,
+ 'channel-name': scope.channel_name,
+ 'phone-number': scope.phone_number,
+ 'auth-password': scope.auth_password,
+ };
+
+ var res =
+ EditUriBackendConfig.require_field(scope, 'api_id', gettextCatalog.getString('api_id')) &&
+ EditUriBackendConfig.require_field(scope, 'api_hash', gettextCatalog.getString('api_hash')) &&
+ EditUriBackendConfig.require_field(scope, 'channel_name', gettextCatalog.getString('channel_name')) &&
+ EditUriBackendConfig.require_field(scope, 'phone_number', gettextCatalog.getString('phone_number'));
+
+ if (res)
+ continuation();
+ };
+
EditUriBackendConfig.validaters['rclone'] = function (scope, continuation) {
var res =
EditUriBackendConfig.require_field(scope, 'Server', gettextCatalog.getString('Remote Repository')) &&
diff --git a/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js b/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js
index c422020e5..5b117acf0 100644
--- a/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js
+++ b/Duplicati/Server/webroot/ngax/scripts/services/SystemInfo.js
@@ -72,6 +72,7 @@ backupApp.service('SystemInfo', function($rootScope, $timeout, $cookies, AppServ
'dropbox': null,
'sia': null,
'tardigrade': null,
+ 'telegram': null,
'jottacloud': null,
'rclone': null,
'cos': null
diff --git a/Duplicati/Server/webroot/ngax/templates/backends/telegram.html b/Duplicati/Server/webroot/ngax/templates/backends/telegram.html
new file mode 100644
index 000000000..f1987789d
--- /dev/null
+++ b/Duplicati/Server/webroot/ngax/templates/backends/telegram.html
@@ -0,0 +1,24 @@
+<div class="input text">
+ <label for="api_hash" translate>API Hash</label>
+ <input type="text" name="api_hash" id="api_hash" ng-model="$parent.api_hash" placeholder="{{' 0123456789abcdef... '}}" />
+</div>
+<div class="input text">
+ <label for="api_id" translate>API ID</label>
+ <input type="text" name="api_id" id="api_id" ng-model="$parent.api_id" placeholder="{{' 1234567 '}}" />
+</div>
+<div class="input text">
+ <label for="auth_code" translate>Authentication code</label>
+ <input type="text" name="auth_code" id="auth_code" ng-model="$parent.auth_code" placeholder="{{' 12345 '}}" />
+</div>
+<div class="input text">
+ <label for="channel_name" translate>The channel name</label>
+ <input type="text" name="channel_name" id="channel_name" ng-model="$parent.channel_name" placeholder="{{' My Backup '}}" />
+</div>
+<div class="input text">
+ <label for="phone_number" translate>The phone number</label>
+ <input type="text" name="phone_number" id="phone_number" ng-model="$parent.phone_number" placeholder="{{' +12223334455 '}}" />
+</div>
+<div class="input password">
+ <label for="auth_password" translate>The 2FA password</label>
+ <input type="password" name="auth_password" id="auth_password" ng-model="$parent.auth_password" />
+</div> \ No newline at end of file