Fix miscellaneous stuff
This commit is contained in:
		
							parent
							
								
									c5b2d5dcf1
								
							
						
					
					
						commit
						4124e84e25
					
				|  | @ -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) { | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ static inline std::string make_title(const Post& post) { | |||
|     size_t 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) { | ||||
|         title.append(content, content_len > 50 ? 50 : content_len); | ||||
|         if (content_len > 50) { | ||||
|  |  | |||
|  | @ -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"), | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue