Fix flags

FossilOrigin-Name: baab10c67fd7300e8462c125a28ab5b606f5d11e22612565c9fc7ccf22fe3de0
This commit is contained in:
me@ow.nekobit.net 2022-03-28 16:14:49 +00:00
parent 7cb80631a1
commit 3985afe5f8
3 changed files with 17 additions and 3 deletions

View file

@ -8,6 +8,7 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <mastodont.h>
#define FALSE 0
#define TRUE 1
@ -32,6 +33,19 @@ static char* const config_canonical_name = "treebird";
*/
static char* const config_instance_url = "https://my-instace.social/";
/* [[ IF YOU DON'T UNDERSTAND THIS, LEAVE IT ALONE ]]
* Flag: library_flags
*
* The flags to pass into the mastodont library. If this value is zero, it is not
* set. To set multiple flags, use the `|` operator, like `FLAG_1 | FLAG_2`
*
* Note: Since Treebird is a HTTP frontend, MSTDNT_FLAG_NO_URI_SANITIZE is already
* set by default, setting it here is redundant.
*
* Example: MSTDNT_FLAG_SSL_UNVERIFIED
*/
static uint16_t config_library_flags = 0;
/*
* String: url_prefix
*

View file

@ -47,7 +47,7 @@ int main(void)
{
mastodont_t api;
api.url = config_instance_url;
mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE);
mastodont_init(&api, MSTDNT_FLAG_NO_URI_SANITIZE | config_library_flags);
// Load cookies
char* cookies_str = read_cookies_env();

View file

@ -86,10 +86,10 @@ int try_interact_status(mastodont_t* api, char* id)
// Pretty up the type
if (strcmp(post.itype, "like") == 0)
{
mastodont_favourite_status(api, id, &storage);
mastodont_favourite_status(api, id, &storage, NULL);
}
else if (strcmp(post.itype, "repeat") == 0) {
mastodont_reblog_status(api, id, &storage);
mastodont_reblog_status(api, id, &storage, NULL);
}
mastodont_storage_cleanup(&storage);