diff --git a/models.cpp b/models.cpp index f2ba2c9..7ef6f42 100644 --- a/models.cpp +++ b/models.cpp @@ -50,6 +50,11 @@ void from_json(const json& j, Account& account) { throw std::runtime_error("failed to find host in url: "s + url); } 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) { diff --git a/routes/css.cpp b/routes/css.cpp index d061dc9..6efce36 100644 --- a/routes/css.cpp +++ b/routes/css.cpp @@ -22,6 +22,21 @@ static const constexpr char css[] = R"EOF( margin: 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 { background-color: var(--bg-color); color: var(--fg-color); @@ -30,13 +45,6 @@ html { padding: 10px; overflow-wrap: break-word; } -p, details { - margin-top: 1em; - margin-bottom: 1em; -} -details[open] { - margin-bottom: 0; -} img { object-fit: cover; diff --git a/routes/status.cpp b/routes/status.cpp index 3bd70c3..77eeafb 100644 --- a/routes/status.cpp +++ b/routes/status.cpp @@ -57,7 +57,7 @@ static inline std::string make_title(const Post& post) { size_t content_len; const char* content = reinterpret_cast(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) { title.append(content, content_len > 50 ? 50 : content_len); if (content_len > 50) { diff --git a/routes/user.cpp b/routes/user.cpp index 1ebb4a9..7d2f73e 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.acct(), ")", view_on_original, Element("br"), Element("br"), Element("b", {"Joined: "}), short_time(account.created_at), Element("br"),