mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Change "client key" to "client id" (#3130)
In #3118 @ryneeverett mentioned that "key" suggests that this is a secret, when in truth it's just a user identifier. So "ID" is a better word for it than "key".
This commit is contained in:
parent
8097e28318
commit
7f68441916
32 changed files with 387 additions and 388 deletions
|
@ -279,7 +279,7 @@ std::string configurationDefaults =
|
|||
"# WARNING: Please read the documentation (man task-sync) before setting up\n"
|
||||
"# Taskwarrior for Taskserver synchronization.\n"
|
||||
"\n"
|
||||
"#sync.server.client_key # Client key for sync to a server\n"
|
||||
"#sync.server.client_id # Client ID for sync to a server\n"
|
||||
"#sync.server.encryption_secret # Encryption secret for sync to a server\n"
|
||||
"#sync.server.origin # Origin of the sync server\n"
|
||||
"#sync.local.server_dir # Directory for local sync\n"
|
||||
|
|
|
@ -193,7 +193,7 @@ int CmdShow::execute (std::string& output)
|
|||
" sugar"
|
||||
" summary.all.projects"
|
||||
" sync.local.server_dir"
|
||||
" sync.server.client_key"
|
||||
" sync.server.client_id"
|
||||
" sync.server.encryption_secret"
|
||||
" sync.server.origin"
|
||||
" tag.indicator"
|
||||
|
|
|
@ -63,14 +63,14 @@ int CmdSync::execute (std::string& output)
|
|||
|
||||
// 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 client_id = Context::getContext ().config.get ("sync.server.client_id");
|
||||
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);
|
||||
} else if (origin != "" && client_id != "" && encryption_secret != "") {
|
||||
server = tc::Server (origin, client_id, encryption_secret);
|
||||
server_ident = origin;
|
||||
} else {
|
||||
throw std::string ("Neither sync.server nor sync.local are configured.");
|
||||
|
|
|
@ -49,23 +49,23 @@ tc::Server::Server (const std::string &server_dir)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
tc::Server::Server (const std::string &origin, const std::string &client_key, const std::string &encryption_secret)
|
||||
tc::Server::Server (const std::string &origin, const std::string &client_id, const std::string &encryption_secret)
|
||||
{
|
||||
TCString tc_origin = tc_string_borrow (origin.c_str ());
|
||||
|
||||
TCString tc_client_key_str = tc_string_borrow (client_key.c_str ());
|
||||
TCString tc_client_id = tc_string_borrow (client_id.c_str ());
|
||||
|
||||
TCString tc_encryption_secret = tc_string_borrow (encryption_secret.c_str ());
|
||||
|
||||
TCUuid tc_client_key;
|
||||
if (tc_uuid_from_str(tc_client_key_str, &tc_client_key) != TC_RESULT_OK) {
|
||||
TCUuid tc_client_uuid;
|
||||
if (tc_uuid_from_str(tc_client_id, &tc_client_uuid) != TC_RESULT_OK) {
|
||||
tc_string_free(&tc_origin);
|
||||
tc_string_free(&tc_encryption_secret);
|
||||
throw "client_key must be a valid UUID";
|
||||
throw "client_id must be a valid UUID";
|
||||
}
|
||||
|
||||
TCString error;
|
||||
auto tcserver = tc_server_new_remote (tc_origin, tc_client_key, tc_encryption_secret, &error);
|
||||
auto tcserver = tc_server_new_remote (tc_origin, tc_client_uuid, tc_encryption_secret, &error);
|
||||
if (!tcserver) {
|
||||
auto errmsg = format ("Could not configure connection to server at {1}: {2}",
|
||||
origin, tc_string_content (&error));
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace tc {
|
|||
Server (const std::string& server_dir);
|
||||
|
||||
// Construct a remote server (tc_server_new_remote).
|
||||
Server (const std::string &origin, const std::string &client_key, const std::string &encryption_secret);
|
||||
Server (const std::string &origin, const std::string &client_id, const std::string &encryption_secret);
|
||||
|
||||
// This object "owns" inner, so copy is not allowed.
|
||||
Server (const Server &) = delete;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue