# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 9
# self = https://watcher.sour.is/conv/qazcfgq
The code for the desktop client is now public here: https://github.com/stig-atle/YarnDesktopClient , I will create tickets for the known things I need to fix and such later today.
If anyone of you pulls the code and compiles it - then please let me know :)
Nice work, @stigatle! Didn't try to compile it because I don't run yarnd (and I avoid GTK like the plague), but looked at the code. First and foremost, I very strongly suggest you choose your favorite code formatter and apply it. :-) Especially the space placement is inconsistent. Secondly, if someone's password contains a quote, they're having a bad day. ;-)

Thirdly, are you sure about disabling TLS certificate checking? And one last remark: personally, I like early returns, it makes the code more readable in my opinion than deeply nested control structures. Especially, when the code gets longer, questions like "here's an else, what if did it belong to a few pages up?" are greatly reduced. Some people even say that grouping stuff into functions avoids long functions altogether.

Enjoy your pizza! I'll have some tomorrow. Dough is proving overnight.
@lyse valid points and noted. 😀
It will improve shortly. I had not thought about quotes in password, so that was a nice catch that needs to be fixed.
@lyse Also - I agree with the rest of what you say. I just have a habit of making stuff work, then improve, but what you mention is somethig I need to be better at doing from the start, so I'm glad you mention these things. Also - the TLS check - it refused to connect if I have it enabled, and from what I saw online you need a copy of the servers cert locally to have that enabled, that's at least what I found when I looked into it, but it's worth a second look for sure. Pizza was great today, i'm stuffed! :)
@stigatle Happy hacking, mate! :-) Assuming that the server sends a proper certificate chain, you need just the root CA that signed the intermediate or server certificate locally in your key store.
@lyse @prologic it seems like the ssl verification works now, I enabled it - but also added another option as well that I now saw in the docs, and now it did not fail on my end (which it did before). I will add a 'enable ssl verification' checkbox (checked by default) so that those who do not need or want it for testing and such can disable it if they want.
Great, @stigatle! Is this a double free in https://github.com/stig-atle/YarnDesktopClient/blob/main/YarnDesktopClient.cpp#L126? curl_easy_cleanup is called twice (lines 126 and 128) in case of an error. Similarly in other code blocks.

And you're leaking memory: https://curl.se/libcurl/c/curl_slist_append.html You gotta have to call curl_slist_free_all. Maybe use a cURL C++ wrapper library or write your own wrapper around the C library to make your life a bit easier.

Regarding escaping the JSON input for your HTTP requests, have a look there: https://rapidjson.org/md_doc_stream.html#StringBuffer This is probably the easiest.

Yeah, I know, small baby steps. :-)
@lyse thanks again! I'll get those things sorted.