Fix miscellaneous stuff

This commit is contained in:
blankie 2023-11-24 14:57:12 +11:00
parent c5b2d5dcf1
commit 4124e84e25
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
4 changed files with 22 additions and 9 deletions

View File

@ -50,6 +50,11 @@ void from_json(const json& j, Account& account) {
throw std::runtime_error("failed to find host in url: "s + url); throw std::runtime_error("failed to find host in url: "s + url);
} }
account.server = sm.str(1); account.server = sm.str(1);
if (account.display_name.empty()) {
// https://mastodonapp.uk/@probertd8
account.display_name = account.username;
}
} }
void from_json(const json& j, Media& media) { void from_json(const json& j, Media& media) {

View File

@ -22,6 +22,21 @@ static const constexpr char css[] = R"EOF(
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
p, details {
margin-top: 1em;
margin-bottom: 1em;
}
ul {
margin: revert;
padding: revert;
}
details[open] {
margin-bottom: 0;
}
summary:hover {
text-decoration: underline;
}
html { html {
background-color: var(--bg-color); background-color: var(--bg-color);
color: var(--fg-color); color: var(--fg-color);
@ -30,13 +45,6 @@ html {
padding: 10px; padding: 10px;
overflow-wrap: break-word; overflow-wrap: break-word;
} }
p, details {
margin-top: 1em;
margin-bottom: 1em;
}
details[open] {
margin-bottom: 0;
}
img { img {
object-fit: cover; object-fit: cover;

View File

@ -57,7 +57,7 @@ static inline std::string make_title(const Post& post) {
size_t content_len; size_t content_len;
const char* content = reinterpret_cast<const char*>(lxb_dom_node_text_content(document.body(), &content_len)); const char* content = reinterpret_cast<const char*>(lxb_dom_node_text_content(document.body(), &content_len));
std::string title = post.account.display_name + " (" + post.account.acct() + "): "; std::string title = post.account.display_name + " (@" + post.account.acct() + "): ";
if (content_len) { if (content_len) {
title.append(content, content_len > 50 ? 50 : content_len); title.append(content, content_len > 50 ? 50 : content_len);
if (content_len > 50) { if (content_len > 50) {

View File

@ -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("img", {{"class", "user_page-profile"}, {"alt", "User profile picture"}, {"src", account.avatar}}, {}),
}), }),
Element("span", { 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.acct(), ")", view_on_original,
Element("br"), Element("br"),
Element("br"), Element("b", {"Joined: "}), short_time(account.created_at), Element("br"), Element("b", {"Joined: "}), short_time(account.created_at),
Element("br"), Element("br"),