From ca97e3c375c0fdf5c06e3b4bcdddbafb9ea90e6f Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 12:44:46 +0400 Subject: [PATCH 1/6] Add more warnings for suspicious urls. --- Telegram/SourceFiles/overview/overview_layout.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index f456de3fe..171ed4e8a 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -1433,6 +1433,11 @@ Link::Link( } } + const auto createHandler = [](const QString &url) { + return UrlClickHandler::IsSuspicious(url) + ? std::make_shared(url) + : std::make_shared(url); + }; _page = media ? media->webpage() : nullptr; if (_page) { mainUrl = _page->url; @@ -1442,7 +1447,7 @@ Link::Link( parent->fullId()); } else if (_page->photo) { if (_page->type == WebPageType::Profile || _page->type == WebPageType::Video) { - _photol = std::make_shared(_page->url); + _photol = createHandler(_page->url); } else if (_page->type == WebPageType::Photo || _page->siteName == qstr("Twitter") || _page->siteName == qstr("Facebook")) { @@ -1450,13 +1455,13 @@ Link::Link( _page->photo, parent->fullId()); } else { - _photol = std::make_shared(_page->url); + _photol = createHandler(_page->url); } } else { - _photol = std::make_shared(_page->url); + _photol = createHandler(_page->url); } } else if (!mainUrl.isEmpty()) { - _photol = std::make_shared(mainUrl); + _photol = createHandler(mainUrl); } if (from >= till && _page) { text = _page->description.text; From 63c6a1db82d0ee8ff1f40df202320c7657cd8c75 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 12:57:36 +0400 Subject: [PATCH 2/6] Allow removing users invited by me. --- .../boxes/peers/edit_participants_box.cpp | 14 +++++++++++++- .../boxes/peers/edit_participants_box.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 114918feb..fb1a84375 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -354,6 +354,16 @@ bool ParticipantsAdditionalData::canRestrictUser( Unexpected("Peer in ParticipantsAdditionalData::canRestrictUser."); } +bool ParticipantsAdditionalData::canRemoveUser( + not_null user) const { + if (canRestrictUser(user)) { + return true; + } else if (const auto chat = _peer->asChat()) { + return chat->invitedByMe.contains(user); + } + return false; +} + auto ParticipantsAdditionalData::adminRights( not_null user) const -> std::optional { @@ -1436,6 +1446,8 @@ base::unique_qptr ParticipantsBoxController::rowContextMenu( tr::lng_context_restrict_user(tr::now), crl::guard(this, [=] { showRestricted(user); })); } + } + if (_additional.canRemoveUser(user)) { if (!_additional.isKicked(user)) { const auto isGroup = _peer->isChat() || _peer->isMegagroup(); result->addAction( @@ -1806,7 +1818,7 @@ auto ParticipantsBoxController::computeType( : _additional.adminRights(user).has_value() ? Rights::Admin : Rights::Normal; - result.canRemove = _additional.canRestrictUser(user); + result.canRemove = _additional.canRemoveUser(user); return result; } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.h b/Telegram/SourceFiles/boxes/peers/edit_participants_box.h index fd36c97ce..5c439f198 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.h @@ -88,6 +88,7 @@ public: [[nodiscard]] bool canEditAdmin(not_null user) const; [[nodiscard]] bool canAddOrEditAdmin(not_null user) const; [[nodiscard]] bool canRestrictUser(not_null user) const; + [[nodiscard]] bool canRemoveUser(not_null user) const; [[nodiscard]] std::optional adminRights( not_null user) const; QString adminRank(not_null user) const; From f88b97553ef91cbe5ec5b0bd8afc62910ff9a5e5 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 13:48:11 +0400 Subject: [PATCH 3/6] Fix crash in destructor of Data::CloudFile. --- Telegram/SourceFiles/data/data_cloud_file.cpp | 9 ++++++++- Telegram/SourceFiles/data/data_cloud_file.h | 2 ++ Telegram/lib_ui | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/data/data_cloud_file.cpp b/Telegram/SourceFiles/data/data_cloud_file.cpp index 258b71d50..6fe8accbb 100644 --- a/Telegram/SourceFiles/data/data_cloud_file.cpp +++ b/Telegram/SourceFiles/data/data_cloud_file.cpp @@ -16,6 +16,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Data { +CloudFile::~CloudFile() { + // Destroy loader with still alive CloudFile with already zero '.loader'. + // Otherwise in ~FileLoader it tries to clear file.loader and crashes. + base::take(loader); +} + void CloudImageView::set( not_null session, QImage image) { @@ -224,7 +230,8 @@ void LoadCloudFile( } // NB! file.loader may be in ~FileLoader() already. if (const auto loader = base::take(file.loader)) { - if (file.flags & CloudFile::Flag::Cancelled) { + if ((file.flags & CloudFile::Flag::Cancelled) + && !loader->cancelled()) { loader->cancel(); } } diff --git a/Telegram/SourceFiles/data/data_cloud_file.h b/Telegram/SourceFiles/data/data_cloud_file.h index e295cd9cc..60fdf72b1 100644 --- a/Telegram/SourceFiles/data/data_cloud_file.h +++ b/Telegram/SourceFiles/data/data_cloud_file.h @@ -34,6 +34,8 @@ struct CloudFile final { }; friend inline constexpr bool is_flag_type(Flag) { return true; }; + ~CloudFile(); + ImageLocation location; std::unique_ptr loader; int byteSize = 0; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 6451ae507..30d223bef 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 6451ae50741a13b6b8e48835da654e24f34695aa +Subproject commit 30d223befe328ff697b3af879ef69c514d21c5f3 From 85904e302239cf9e97470a2b55b42f5fa490e990 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 15:51:15 +0400 Subject: [PATCH 4/6] Update submodules. --- Telegram/lib_spellcheck | 2 +- Telegram/lib_ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/lib_spellcheck b/Telegram/lib_spellcheck index 019bb19f0..48865e514 160000 --- a/Telegram/lib_spellcheck +++ b/Telegram/lib_spellcheck @@ -1 +1 @@ -Subproject commit 019bb19f0923af2e8c7e0cd1abc2b8d9264afb7c +Subproject commit 48865e514979b4e2610fe6ca22bbb145bcfab4ea diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 30d223bef..f7b499488 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 30d223befe328ff697b3af879ef69c514d21c5f3 +Subproject commit f7b4994887612b25bdcad8df7766af479a2603c3 From 383e6dec43037b313a852bb3ad7e43a6ed094668 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 15:51:27 +0400 Subject: [PATCH 5/6] Beta version 2.1.8. - Add support for full group message history export. - Allow export of a single chat message history in JSON format. --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++--- Telegram/Resources/winrc/Updater.rc | 8 ++--- Telegram/SourceFiles/core/changelogs.cpp | 31 +++++--------------- Telegram/SourceFiles/core/version.h | 8 ++--- Telegram/build/version | 12 ++++---- changelog.txt | 5 ++++ 7 files changed, 31 insertions(+), 43 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 314e26dbc..2261e12d6 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="2.1.8.0" /> Telegram Desktop Telegram FZ-LLC diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 7e097b1e3..31ea6cb6f 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,7,4 - PRODUCTVERSION 2,1,7,4 + FILEVERSION 2,1,8,0 + PRODUCTVERSION 2,1,8,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "2.1.7.4" + VALUE "FileVersion", "2.1.8.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.7.4" + VALUE "ProductVersion", "2.1.8.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index e3c4bb9b3..aef821f64 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,7,4 - PRODUCTVERSION 2,1,7,4 + FILEVERSION 2,1,8,0 + PRODUCTVERSION 2,1,8,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram FZ-LLC" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "2.1.7.4" + VALUE "FileVersion", "2.1.8.0" VALUE "LegalCopyright", "Copyright (C) 2014-2020" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "2.1.7.4" + VALUE "ProductVersion", "2.1.8.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index 82b6dfc51..828a6efb7 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -18,30 +18,6 @@ namespace { std::map BetaLogs() { return { - { - 1009010, - "\xE2\x80\xA2 Switch to the Picture-in-Picture mode " - "to watch your video in a small window.\n" - - "\xE2\x80\xA2 Change video playback speed " - "in the playback controls '...' menu.\n" - - "\xE2\x80\xA2 Rotate photos and videos in the media viewer " - "using the rotate button in the bottom right corner.\n" - }, - { - 1009015, - "\xE2\x80\xA2 Mark new messages as read " - "while scrolling down through them.\n" - - "\xE2\x80\xA2 Bug fixes and other minor improvements." - }, - { - 1009017, - "\xE2\x80\xA2 Spell checker on Windows 7.\n" - - "\xE2\x80\xA2 Bug fixes and other minor improvements." - }, { 1009020, "\xE2\x80\xA2 Fix crash in shared links search.\n" @@ -63,6 +39,13 @@ std::map BetaLogs() { "was added to archive.\n" "\xE2\x80\xA2 Fix font issues in Linux version." + }, + { + 2001008, + "\xE2\x80\xA2 Add support for full group message history export.\n" + + "\xE2\x80\xA2 Allow export of a single chat message history " + "in JSON format." } }; }; diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 6364af5a7..8e7cfe44c 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/const_string.h" -#define TDESKTOP_REQUESTED_ALPHA_VERSION (2001007004ULL) +#define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL) #ifdef TDESKTOP_ALLOW_CLOSED_ALPHA #define TDESKTOP_ALPHA_VERSION TDESKTOP_REQUESTED_ALPHA_VERSION @@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs; constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs; constexpr auto AppName = "Telegram Desktop"_cs; constexpr auto AppFile = "Telegram"_cs; -constexpr auto AppVersion = 2001007; -constexpr auto AppVersionStr = "2.1.7"; -constexpr auto AppBetaVersion = false; +constexpr auto AppVersion = 2001008; +constexpr auto AppVersionStr = "2.1.8"; +constexpr auto AppBetaVersion = true; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/build/version b/Telegram/build/version index 143da2267..49b43a09d 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,7 +1,7 @@ -AppVersion 2001007 +AppVersion 2001008 AppVersionStrMajor 2.1 -AppVersionStrSmall 2.1.7 -AppVersionStr 2.1.7 -BetaChannel 0 -AlphaVersion 2001007004 -AppVersionOriginal 2.1.7.4 +AppVersionStrSmall 2.1.8 +AppVersionStr 2.1.8 +BetaChannel 1 +AlphaVersion 0 +AppVersionOriginal 2.1.8.beta diff --git a/changelog.txt b/changelog.txt index 6fd363d75..d24caa27b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +2.1.8 beta (03.06.20) + +- Add support for full group message history export. +- Allow export of a single chat message history in JSON format. + 2.1.7 (24.05.20) - Fix the Fcitx input method plugin. From 9d1a4cdbfe04348e47901bfd4f75fdb957b07091 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jun 2020 16:18:03 +0400 Subject: [PATCH 6/6] Beta version 2.1.8: Fix build on 64 bit systems. --- Telegram/lib_ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/lib_ui b/Telegram/lib_ui index f7b499488..62feafef7 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit f7b4994887612b25bdcad8df7766af479a2603c3 +Subproject commit 62feafef7ebba8df227904759f7f5684f35cb4d3