From 64edd2f4a14a5468a6c77d6bba26023abd94911f Mon Sep 17 00:00:00 2001 From: blankie Date: Fri, 24 Nov 2023 20:04:49 +1100 Subject: [PATCH] Add support for bot mark --- models.cpp | 1 + models.h | 1 + routes/user.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/models.cpp b/models.cpp index 4e86499..fd295f6 100644 --- a/models.cpp +++ b/models.cpp @@ -33,6 +33,7 @@ void from_json(const json& j, Account& account) { j.at("id").get_to(account.id); j.at("username").get_to(account.username); j.at("display_name").get_to(account.display_name); + j.at("bot").get_to(account.bot); account.created_at = parse_rfc3339(j.at("created_at").get_ref()); account.note_html = j.at("note").get(); j.at("avatar").get_to(account.avatar); diff --git a/models.h b/models.h index 04c5e82..0fa03ff 100644 --- a/models.h +++ b/models.h @@ -29,6 +29,7 @@ struct Account { std::string server; bool same_server; std::string display_name; + bool bot; time_t created_at; blankie::html::HTMLString note_html; std::string avatar; diff --git a/routes/user.cpp b/routes/user.cpp index 7d2f73e..b944d6f 100644 --- a/routes/user.cpp +++ b/routes/user.cpp @@ -106,7 +106,7 @@ static inline Element user_header(const httplib::Request& req, const std::string Element("img", {{"class", "user_page-profile"}, {"alt", "User profile picture"}, {"src", account.avatar}}, {}), }), Element("span", { - Element("b", {preprocess_html(req, account.emojis, account.display_name)}), " (@", account.acct(), ")", view_on_original, + Element("b", {preprocess_html(req, account.emojis, account.display_name)}), account.bot ? " (bot)" : "", " (@", account.acct(), ")", view_on_original, Element("br"), Element("br"), Element("b", {"Joined: "}), short_time(account.created_at), Element("br"),