diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 26 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 6 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 92f9309..5281325 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -5121,6 +5121,14 @@ namespace QuickMedia { return move_room; } + static void add_body_item_unique_title(BodyItems &body_items, const std::string &title) { + for(auto &body_item : body_items) { + if(body_item->get_title() == title) + return; + } + body_items.push_back(BodyItem::create(title)); + } + void Program::after_matrix_login_page() { if(!window.isOpen()) exit(exit_code); @@ -5138,8 +5146,22 @@ namespace QuickMedia { auto matrix_invites_page = std::make_unique<MatrixInvitesPage>(this, matrix, invites_body.get(), matrix_invites_page_search_bar.get()); auto room_directory_body = create_body(); - room_directory_body->items.push_back(BodyItem::create(matrix->get_homeserver_domain())); - room_directory_body->items.push_back(BodyItem::create("matrix.org")); + add_body_item_unique_title(room_directory_body->items, matrix->get_homeserver_domain()); + add_body_item_unique_title(room_directory_body->items, "midov.pl"); + add_body_item_unique_title(room_directory_body->items, "matrix.org"); + add_body_item_unique_title(room_directory_body->items, "kde.org"); + add_body_item_unique_title(room_directory_body->items, "librem.one"); + add_body_item_unique_title(room_directory_body->items, "grats.pw"); + add_body_item_unique_title(room_directory_body->items, "maunium.net"); + add_body_item_unique_title(room_directory_body->items, "halogen.city"); + add_body_item_unique_title(room_directory_body->items, "gnome.org"); + add_body_item_unique_title(room_directory_body->items, "shivering-isles.com"); + add_body_item_unique_title(room_directory_body->items, "nerdsin.space"); + add_body_item_unique_title(room_directory_body->items, "glowers.club"); + add_body_item_unique_title(room_directory_body->items, "privacytools.io"); + add_body_item_unique_title(room_directory_body->items, "linuxdelta.com"); + add_body_item_unique_title(room_directory_body->items, "tchncs.de"); + add_body_item_unique_title(room_directory_body->items, "jupiterbroadcasting.com"); auto matrix_room_directory_page = std::make_unique<MatrixRoomDirectoryPage>(this, matrix); MatrixQuickMedia matrix_handler(this, matrix, matrix_rooms_page.get(), matrix_rooms_tag_page.get(), matrix_invites_page.get()); diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index bbe9897..6050b18 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1740,16 +1740,12 @@ namespace QuickMedia { static std::string message_content_extract_thumbnail_url(const rapidjson::Value &content_json, const std::string &homeserver) { const rapidjson::Value &info_json = GetMember(content_json, "info"); if(info_json.IsObject()) { - sf::Vector2i thumbnail_size; - if(!message_content_extract_thumbnail_size(content_json, thumbnail_size)) - return ""; - const rapidjson::Value &thumbnail_url_json = GetMember(info_json, "thumbnail_url"); if(thumbnail_url_json.IsString()) { std::string thumbnail_str = thumbnail_url_json.GetString(); if(strncmp(thumbnail_str.c_str(), "mxc://", 6) == 0) { thumbnail_str.erase(thumbnail_str.begin(), thumbnail_str.begin() + 6); - return homeserver + "/_matrix/media/r0/thumbnail/" + std::move(thumbnail_str) + "?width=" + std::to_string(thumbnail_size.x) + "&height=" + std::to_string(thumbnail_size.y); + return homeserver + "/_matrix/media/r0/download/" + std::move(thumbnail_str); } } } |