Sync against taskchampion-sync-server (#3118)

This removes use of gnutls and the TLS implementation, which is no
longer needed (task synchronization is handled via Taskchampion, which
uses `reqwest`, which handles TLS via other Rust dependencies). This
incidentally removes the following config options:
 * `debug.tls`
 * `taskd.ca`
 * `taskd.certificate`
 * `taskd.ciphers`
 * `taskd.credentials`
 * `taskd.key`
 * `taskd.server`
 * `taskd.trust`
This commit is contained in:
Dustin J. Mitchell
2023-07-08 10:27:33 -04:00
committed by GitHub
parent 771977aa69
commit 31105c2ba3
57 changed files with 403 additions and 1615 deletions

View File

@@ -35,6 +35,7 @@
#include <shared.h>
#include <format.h>
#include <util.h>
#include "tc/Server.h"
////////////////////////////////////////////////////////////////////////////////
CmdSync::CmdSync ()
@@ -53,10 +54,37 @@ CmdSync::CmdSync ()
}
////////////////////////////////////////////////////////////////////////////////
int CmdSync::execute (std::string&)
int CmdSync::execute (std::string& output)
{
throw std::string ("Sync support is disabled during transition to TaskChampion.");
return 0;
int status = 0;
tc::Server server;
std::string server_ident;
// If no server is set up, quit.
std::string origin = Context::getContext ().config.get ("sync.server.origin");
std::string client_key = Context::getContext ().config.get ("sync.server.client_key");
std::string encryption_secret = Context::getContext ().config.get ("sync.server.encryption_secret");
std::string server_dir = Context::getContext ().config.get ("sync.local.server_dir");
if (server_dir != "") {
server = tc::Server (server_dir);
server_ident = server_dir;
} else if (origin != "" && client_key != "" && encryption_secret != "") {
server = tc::Server (origin, client_key, encryption_secret);
server_ident = origin;
} else {
throw std::string ("Neither sync.server nor sync.local are configured.");
}
std::stringstream out;
if (Context::getContext ().verbose ("sync"))
out << format ("Syncing with {1}", server_ident)
<< '\n';
Context::getContext ().tdb2.sync(std::move(server), false);
output = out.str ();
return status;
}
////////////////////////////////////////////////////////////////////////////////