From daec37ce500beefe0a8e60157b1556bc7fdc1098 Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Mon, 4 Apr 2022 18:23:07 +0000 Subject: [PATCH] One-click software FossilOrigin-Name: 8b33dfcad1b752e7aec7bd1bd8e36fe70fd4ab7d02760a63f5ee893631bb6147 --- Makefile | 3 ++- dist/svg/star-repeat.svg | 1 + dist/treebird20.css | 19 +++++++++++++++++-- src/account.c | 22 ++++++++++++++++++++++ src/account.h | 2 ++ src/status.c | 15 +++++++++++---- static/account.html | 4 +--- static/account_info.html | 3 +++ static/status.html | 11 ++++++++++- 9 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 dist/svg/star-repeat.svg create mode 100644 static/account_info.html diff --git a/Makefile b/Makefile index a2e6a2f..e905080 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,8 @@ $(PAGES_DIR)/config_appearance.chtml: $(PAGES_DIR)/config_appearance.html ./filec $< data_config_appearance_html > $@ $(PAGES_DIR)/in_reply_to.chtml: $(PAGES_DIR)/in_reply_to.html ./filec $< data_in_reply_to_html > $@ - +$(PAGES_DIR)/account_info.chtml: $(PAGES_DIR)/account_info.html + ./filec $< data_account_info_html > $@ $(MASTODONT_DIR): git clone $(MASTODONT_URL) || true diff --git a/dist/svg/star-repeat.svg b/dist/svg/star-repeat.svg new file mode 100644 index 0000000..4efa5af --- /dev/null +++ b/dist/svg/star-repeat.svg @@ -0,0 +1 @@ + diff --git a/dist/treebird20.css b/dist/treebird20.css index 67001da..72dee31 100644 --- a/dist/treebird20.css +++ b/dist/treebird20.css @@ -655,12 +655,19 @@ svg.in-reply-to-icon position: relative; } +.account-note +{ + word-break: break-all; +} + .account-info { background: linear-gradient(#e4e4e4, #efefef); color: #000; - padding: 2px 50px; + padding: 15px 50px; border-bottom: 1px solid #cacaca; + max-height: 200px; + overflow: auto; } .acct-pfp @@ -726,7 +733,7 @@ svg.in-reply-to-icon padding: 5px 20px; border-radius: 24px; background: inherit; - box-shadow: inset 0px 2px 5px rgba(0, 0, 0, 0.2); + box-shadow: inset 0px 0px 2px rgba(0, 0, 0, 0.2); } .follow-btnm.active @@ -779,6 +786,14 @@ svg.in-reply-to-icon stroke: #fcd202; } +.status-interact svg.like:hover, +.status-interact svg.like:active, +.status-interact svg.like:focus +{ + stroke: #08d3a5; + pointer: select; +} + .status-interact svg.like:hover, .status-interact svg.like:active, .statis-interact svg.like:focus diff --git a/src/account.c b/src/account.c index c829235..3dd1fbd 100644 --- a/src/account.c +++ b/src/account.c @@ -27,6 +27,20 @@ // Files #include "../static/index.chtml" #include "../static/account.chtml" +#include "../static/account_info.chtml" + +char* construct_account_info(struct mstdnt_account* acct, + size_t* size) +{ + char* acct_info_html; + size_t s; + + s = easprintf(&acct_info_html, data_account_info_html, + acct->note); + + if (size) *size = s; + return acct_info_html; +} char* construct_account_page(mastodont_t* api, struct mstdnt_account* acct, @@ -37,6 +51,7 @@ char* construct_account_page(mastodont_t* api, int cleanup = 0; int result_size; char* statuses_html; + char* info_html = NULL; char* result; // Load statuses html @@ -45,6 +60,11 @@ char* construct_account_page(mastodont_t* api, statuses_html = "Error in malloc!"; else cleanup = 1; + + if (acct->note) + { + info_html = construct_account_info(acct, NULL); + } result_size = easprintf(&result, data_account_html, acct->header, @@ -57,6 +77,7 @@ char* construct_account_page(mastodont_t* api, "Followers", acct->followers_count, acct->avatar, + info_html ? info_html : "", statuses_html); if (result_size == -1) @@ -64,6 +85,7 @@ char* construct_account_page(mastodont_t* api, if (res_size) *res_size = result_size; if (cleanup) free(statuses_html); + if (info_html) free(info_html); return result; } diff --git a/src/account.h b/src/account.h index 23ba46f..137754b 100644 --- a/src/account.h +++ b/src/account.h @@ -22,6 +22,8 @@ #include #include "session.h" +char* construct_account_info(struct mstdnt_account* acct, + size_t* size); char* construct_account_page(mastodont_t* api, struct mstdnt_account* acct, struct mstdnt_status* statuses, diff --git a/src/status.c b/src/status.c index 0779b9e..955b480 100644 --- a/src/status.c +++ b/src/status.c @@ -91,9 +91,12 @@ int try_interact_status(struct session* ssn, mastodont_t* api, char* id) if (!(ssn->post.itype && id)) return 1; // Pretty up the type - if (strcmp(ssn->post.itype, "like") == 0) + if (strcmp(ssn->post.itype, "like") == 0 || + strcmp(ssn->post.itype, "likeboost") == 0) mastodont_favourite_status(api, id, &storage, NULL); - else if (strcmp(ssn->post.itype, "repeat") == 0) + // Not else if because possibly a like-boost + if (strcmp(ssn->post.itype, "repeat") == 0 || + strcmp(ssn->post.itype, "likeboost") == 0) mastodont_reblog_status(api, id, &storage, NULL); else if (strcmp(ssn->post.itype, "bookmark") == 0) mastodont_bookmark_status(api, id, &storage, NULL); @@ -219,6 +222,7 @@ char* construct_status(mastodont_t* api, emoji_reactions ? emoji_reactions : "", config_url_prefix, status->id, + status->id, reply_count ? reply_count : "", config_url_prefix, status->id, @@ -232,6 +236,8 @@ char* construct_status(mastodont_t* api, favourites_count ? favourites_count : "", config_url_prefix, status->id, + config_url_prefix, + status->id, status->id); if (size) *size = s; @@ -269,10 +275,11 @@ void status_interact(struct session* ssn, mastodont_t* api, char** data) try_interact_status(ssn, api, data[0]); printf("Status: 303 See Other\r\n" - "Location: %s\r\n" + "Location: %s#id-%s\r\n" "Content-Length: 14\r\n\r\n" "Redirecting...", - referer ? referer : "/"); + referer ? referer : "/", + data[0]); } void status_view(struct session* ssn, mastodont_t* api, char** data) diff --git a/static/account.html b/static/account.html index 5fb2c39..23682ca 100644 --- a/static/account.html +++ b/static/account.html @@ -27,9 +27,7 @@ - +%s