diff --git a/src/cookie.c b/src/cookie.c index 7ef1128..7aa8509 100644 --- a/src/cookie.c +++ b/src/cookie.c @@ -55,6 +55,7 @@ char* read_cookies_env(struct cookie_values* cookies) { "lang", &(cookies->lang), key_int }, { "instance_url", &(cookies->instance_url), key_string }, { "background_url", &(cookies->background_url), key_string }, + { "interact_img", &(cookies->interact_img), key_int }, { "client_id", &(cookies->client_id), key_string }, { "client_secret", &(cookies->client_secret), key_string }, { "themeclr", &(cookies->themeclr), key_int }, diff --git a/src/cookie.h b/src/cookie.h index cd912d7..5e4dfc3 100644 --- a/src/cookie.h +++ b/src/cookie.h @@ -36,6 +36,7 @@ struct cookie_values struct key jsreply; struct key jslive; struct key js; + struct key interact_img; struct key stat_attachments; struct key stat_greentexts; struct key stat_dope; diff --git a/src/local_config.h b/src/local_config.h index a6a4080..9efb231 100644 --- a/src/local_config.h +++ b/src/local_config.h @@ -31,6 +31,7 @@ struct local_config int jsreply; int jslive; int js; + int interact_img; int stat_attachments; int stat_greentexts; int stat_dope; diff --git a/src/local_config_set.c b/src/local_config_set.c index aba8448..bfe8462 100644 --- a/src/local_config_set.c +++ b/src/local_config_set.c @@ -95,5 +95,6 @@ void load_config(struct session* ssn, mastodont_t* api) set_config_int(LOAD_CFG_SIM("instanceshowshoutbox", instance_show_shoutbox)); set_config_int(LOAD_CFG_SIM("instancepanel", instance_panel)); set_config_int(LOAD_CFG_SIM("notifembed", notif_embed)); + set_config_int(LOAD_CFG_SIM("interact_img", interact_img)); set_config_int(LOAD_CFG_SIM("lang", lang)); } diff --git a/src/main.c b/src/main.c index c7560de..fc5cc79 100644 --- a/src/main.c +++ b/src/main.c @@ -121,6 +121,7 @@ int main(void) .jsreply = 1, .jslive = 0, .js = 1, + .interact_img = 0, .stat_attachments = 1, .stat_greentexts = 1, .stat_dope = 1, diff --git a/src/query.c b/src/query.c index a8d32fb..501344c 100644 --- a/src/query.c +++ b/src/query.c @@ -108,6 +108,7 @@ char* read_post_data(struct post_values* post) { "emojoindex", &(post->emojoindex), key_int }, { "only_media", &(post->only_media), key_int }, { "replies_only", &(post->replies_only), key_int }, + { "interact_img", &(post->interact_img), key_int }, { "js", &(post->js), key_int }, { "statattachments", &(post->stat_attachments), key_int }, { "statgreentexts", &(post->stat_greentexts), key_int }, diff --git a/src/query.h b/src/query.h index bb706de..f0b67e3 100644 --- a/src/query.h +++ b/src/query.h @@ -39,6 +39,7 @@ struct post_values struct key jsreply; // Int struct key jslive; // Int struct key js; // Int + struct key interact_img; // Int struct key stat_attachments; // Int struct key stat_greentexts; // Int struct key stat_dope; // Int diff --git a/src/status.c b/src/status.c index f37080c..06b4eaa 100644 --- a/src/status.c +++ b/src/status.c @@ -50,6 +50,14 @@ #include "../static/reactions_btn.ctmpl" #include "../static/interaction_buttons.ctmpl" #include "../static/menu_item.ctmpl" +#include "../static/like_btn.ctmpl" +#include "../static/repeat_btn.ctmpl" +#include "../static/reply_btn.ctmpl" +#include "../static/expand_btn.ctmpl" +#include "../static/like_btn_img.ctmpl" +#include "../static/repeat_btn_img.ctmpl" +#include "../static/reply_btn_img.ctmpl" +#include "../static/expand_btn_img.ctmpl" #define ACCOUNT_INTERACTIONS_LIMIT 11 #define NUM_STR "%u" @@ -226,7 +234,10 @@ char* construct_interaction_buttons(struct session* ssn, size_t* size, uint8_t flags) { + int use_img = ssn->config.interact_img; char* interaction_html; + char* repeat_btn; + char* like_btn; char* likeboost_html = NULL; char* reply_count = NULL; char* repeat_count = NULL; @@ -269,16 +280,35 @@ char* construct_interaction_buttons(struct session* ssn, time_str = reltime_to_str(status->created_at); + // TODO cleanup? + if (use_img) + { + struct repeat_btn_img_template rpbdata = { .prefix = config_url_prefix, .repeat_active = status->reblogged ? "active" : "" }; + repeat_btn = tmpl_gen_repeat_btn_img(&rpbdata, NULL); + struct like_btn_img_template ldata = { .prefix = config_url_prefix, .favourite_active = status->favourited ? "active" : "" }; + like_btn = tmpl_gen_like_btn_img(&ldata, NULL); + } + else { + struct repeat_btn_template rpbdata = { .repeat_active = status->reblogged ? "active" : "" }; + repeat_btn = tmpl_gen_repeat_btn(&rpbdata, NULL); + struct like_btn_template ldata = { .favourite_active = status->favourited ? "active" : "" }; + like_btn = tmpl_gen_like_btn(&ldata, NULL); + } + struct interaction_buttons_template data = { + // Icons + .reply_btn = use_img ? data_reply_btn_img : data_reply_btn, + .expand_btn = use_img ? data_expand_btn_img : data_expand_btn, + .repeat_btn = repeat_btn, + .like_btn = like_btn, + // Interactions data .prefix = config_url_prefix, .status_id = status->id, .reply_count = reply_count, .unrepeat = status->reblogged ? "un" : "", - .repeat_active = status->reblogged ? "active" : "", .repeats_count = repeat_count, .repeat_text = "Repeat", .unfavourite = status->favourited ? "un" : "", - .favourite_active = status->favourited ? "active" : "", .favourites_count = favourites_count, .favourites_text = "Favorite", .likeboost_btn = (likeboost_html && @@ -298,6 +328,8 @@ char* construct_interaction_buttons(struct session* ssn, free(reactions_btn_html); free(likeboost_html); free(time_str); + free(like_btn); + free(repeat_btn); return interaction_html; } diff --git a/static/config_general.tmpl b/static/config_general.tmpl index b544b1b..50c8ffb 100644 --- a/static/config_general.tmpl +++ b/static/config_general.tmpl @@ -55,6 +55,10 @@ +