diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 3a7b77db1..f07624edf 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -989,6 +989,7 @@ PRIVATE intro/intro_widget.h kotato/kotato_lang.cpp kotato/kotato_lang.h + kotato/kotato_version.h lang/lang_cloud_manager.cpp lang/lang_cloud_manager.h lang/lang_instance.cpp @@ -1840,7 +1841,7 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins ) endif() - if (DESKTOP_APP_SPECIAL_TARGET) + if (DESKTOP_APP_SPECIAL_TARGET OR KTGDESKTOP_ENABLE_PACKER) add_executable(Packer) init_target(Packer) diff --git a/Telegram/Resources/langs/rewrites/en.json b/Telegram/Resources/langs/rewrites/en.json index facc7406c..e77a886b4 100644 --- a/Telegram/Resources/langs/rewrites/en.json +++ b/Telegram/Resources/langs/rewrites/en.json @@ -4,6 +4,7 @@ "ktg_about_text1_tdesktop": "Telegram Desktop", "ktg_about_text3": "Visit {channel_link} or {faq_link} for more info.", "ktg_about_text3_channel": "Kotatogram channel", + "ktg_new_version": "Kotatogram Desktop has been updated to {version} (TD {td_version})\n\nFull version history is available here:\n{link}", "ktg_open_from_tray": "Open Kotatogram", "ktg_quit_from_tray": "Quit Kotatogram", "ktg_tray_icon_text": "Kotatogram is still running here,\nyou can change this from settings page.\nIf this icon disappears from tray menu,\nyou can drag it here from hidden icons.", @@ -25,5 +26,6 @@ "ktg_outdated_soon": "Otherwise, Kotatogram Desktop will stop updating on {date}.", "ktg_outdated_now": "So that Kotatogram Desktop can update to newer versions.", "ktg_mac_menu_show": "Show Kotatogram", + "ktg_in_app_update_disabled": "In-app updater is disabled.", "dummy_last_string": "" } diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index 156ba726a..f289aec30 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -13,17 +13,17 @@ bool OnlyAlphaKey = false; const char *PublicKey = "\ -----BEGIN RSA PUBLIC KEY-----\n\ -MIGJAoGBAMA4ViQrjkPZ9xj0lrer3r23JvxOnrtE8nI69XLGSr+sRERz9YnUptnU\n\ -BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\ -+9PKKlb8mmr3BB9A45ZNwLT6G9AK3+qkZLHojeSA+m84/a6GP4svAgMBAAE=\n\ +MIGJAoGBALUEi8NQfcq/GToD5CdgdNhgj2at2nusoWsHuUdIOGEOehpt2PiQlzt+\n\ +qziKJDO8+tPnQV0Nzq6UqZXA0eCT4CvP2jZyLq/xnNzlinQXT+wPu2wqBabRTfoC\n\ +TIiLseFjv2zEsXCCkhiaUfAtU3w09yw0/D8vl1/5+N/4mpAic+0VAgMBAAE=\n\ -----END RSA PUBLIC KEY-----\ "; const char *PublicBetaKey = "\ -----BEGIN RSA PUBLIC KEY-----\n\ -MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\ -0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\ -w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\ +MIGJAoGBAPgjMkWHsxk1d4NcPC5jyPlEddvOdl3yH+s8xpm8MxCVwhWu5dazkC0Z\n\ +v1/0UnkegO4jNkSY3ycDqn+T3NjxNxnL0EsKh7MjinyMUe3ZISzaIyrdq/8v4bvB\n\ +/Z1X5Ruw2HacoWo/EVsXY9zCTrY53IRrKy4HQbCOloK2+TBimyX5AgMBAAE=\n\ -----END RSA PUBLIC KEY-----\ "; @@ -181,10 +181,12 @@ int main(int argc, char *argv[]) AlphaVersion = QString(argv[i + 1]).toULongLong(); if (AlphaVersion > version * 1000ULL && AlphaVersion < (version + 1) * 1000ULL) { BetaChannel = false; + /* AlphaSignature = countAlphaVersionSignature(AlphaVersion); if (AlphaSignature.isEmpty()) { return -1; } + */ } else { cout << "Bad -alpha param value passed, should be for the same version: " << version << ", alpha: " << AlphaVersion << "\n"; return -1; @@ -499,9 +501,11 @@ int main(int argc, char *argv[]) #else QString outName(QString("tlinuxupd%1").arg(AlphaVersion ? AlphaVersion : version)); #endif + /* if (AlphaVersion) { outName += "_" + AlphaSignature; } + */ QFile out(outName); if (!out.open(QIODevice::WriteOnly)) { cout << "Can't open '" << outName.toUtf8().constData() << "' for write..\n"; diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index d3ea42ff1..8808639db 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/about_box.h" +#include "kotato/kotato_version.h" #include "kotato/kotato_lang.h" #include "lang/lang_keys.h" #include "lang/lang_instance.h" @@ -113,6 +114,7 @@ void AboutBox::resizeEvent(QResizeEvent *e) { } void AboutBox::showVersionHistory() { + /* if (cRealAlphaVersion()) { auto url = u"https://tdesktop.com/"_q; if (Platform::IsWindows32Bit()) { @@ -136,8 +138,11 @@ void AboutBox::showVersionHistory() { "version of Telegram Desktop was copied to the clipboard."), Ui::LayerOption::CloseOther); } else { + */ File::OpenUrl(Core::App().changelogLink()); + /* } + */ } void AboutBox::keyPressEvent(QKeyEvent *e) { @@ -166,14 +171,15 @@ QString telegramFaqLink() { } QString currentVersionText() { - auto result = QString::fromLatin1(AppVersionStr); + auto result = QString::fromLatin1(AppKotatoVersionStr); if (cAlphaVersion()) { - result += u" alpha %1"_q.arg(cAlphaVersion() % 1000); - } else if (AppBetaVersion) { + result += u"-%1.%2"_q.arg(AppKotatoTestBranch).arg(AppKotatoTestVersion); + } else if (AppKotatoBetaVersion) { result += " beta"; } if (Platform::IsWindows64Bit()) { result += " x64"; } + result += qsl(" (TD %1)").arg(AppVersionStr); return result; } diff --git a/Telegram/SourceFiles/boxes/phone_banned_box.cpp b/Telegram/SourceFiles/boxes/phone_banned_box.cpp index b29388e96..68be59594 100644 --- a/Telegram/SourceFiles/boxes/phone_banned_box.cpp +++ b/Telegram/SourceFiles/boxes/phone_banned_box.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/phone_banned_box.h" +#include "kotato/kotato_version.h" #include "ui/boxes/confirm_box.h" #include "core/click_handler_types.h" // UrlClickHandler #include "base/qthelp_url.h" // qthelp::url_encode @@ -19,10 +20,10 @@ namespace Ui { namespace { void SendToBannedHelp(const QString &phone) { - const auto version = QString::fromLatin1(AppVersionStr) + const auto version = QString::fromLatin1(AppKotatoVersionStr) + (cAlphaVersion() - ? qsl(" alpha %1").arg(cAlphaVersion()) - : (AppBetaVersion ? " beta" : "")); + ? qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion) + : (AppKotatoBetaVersion ? " beta" : "")); const auto subject = qsl("Banned phone number: ") + phone; diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 5dc8b7ce7..ade9f6354 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -49,17 +49,17 @@ inline const char *cGUIDStr() { static const char *UpdatesPublicKey = "\ -----BEGIN RSA PUBLIC KEY-----\n\ -MIGJAoGBAMA4ViQrjkPZ9xj0lrer3r23JvxOnrtE8nI69XLGSr+sRERz9YnUptnU\n\ -BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\ -+9PKKlb8mmr3BB9A45ZNwLT6G9AK3+qkZLHojeSA+m84/a6GP4svAgMBAAE=\n\ +MIGJAoGBALUEi8NQfcq/GToD5CdgdNhgj2at2nusoWsHuUdIOGEOehpt2PiQlzt+\n\ +qziKJDO8+tPnQV0Nzq6UqZXA0eCT4CvP2jZyLq/xnNzlinQXT+wPu2wqBabRTfoC\n\ +TIiLseFjv2zEsXCCkhiaUfAtU3w09yw0/D8vl1/5+N/4mpAic+0VAgMBAAE=\n\ -----END RSA PUBLIC KEY-----\ "; static const char *UpdatesPublicBetaKey = "\ -----BEGIN RSA PUBLIC KEY-----\n\ -MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\ -0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\ -w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\ +MIGJAoGBAPgjMkWHsxk1d4NcPC5jyPlEddvOdl3yH+s8xpm8MxCVwhWu5dazkC0Z\n\ +v1/0UnkegO4jNkSY3ycDqn+T3NjxNxnL0EsKh7MjinyMUe3ZISzaIyrdq/8v4bvB\n\ +/Z1X5Ruw2HacoWo/EVsXY9zCTrY53IRrKy4HQbCOloK2+TBimyX5AgMBAAE=\n\ -----END RSA PUBLIC KEY-----\ "; diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index 2d0d52fe0..cf0f15dd1 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -7,7 +7,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/changelogs.h" +#include "kotato/kotato_lang.h" +#include "kotato/kotato_version.h" +#include "storage/localstorage.h" #include "lang/lang_keys.h" +#include "lang/lang_instance.h" #include "core/application.h" #include "main/main_domain.h" #include "main/main_session.h" @@ -45,14 +49,18 @@ std::map BetaLogs() { } // namespace -Changelogs::Changelogs(not_null session, int oldVersion) +Changelogs::Changelogs(not_null session, int oldVersion, int oldKotatoVersion) : _session(session) -, _oldVersion(oldVersion) { +, _oldVersion(oldVersion) +, _oldKotatoVersion(oldKotatoVersion) { + + LOG(("Previous Kotatogram version: %1").arg(_oldKotatoVersion)); + _session->data().chatsListChanges( ) | rpl::filter([](Data::Folder *folder) { return !folder; }) | rpl::start_with_next([=] { - requestCloudLogs(); + addKotatoLogs(); }, _chatsSubscription); } @@ -60,12 +68,42 @@ std::unique_ptr Changelogs::Create( not_null session) { auto &local = Core::App().domain().local(); const auto oldVersion = local.oldVersion(); + const auto oldKotatoVersion = Local::oldKotatoVersion(); local.clearOldVersion(); - return (oldVersion > 0 && oldVersion < AppVersion) - ? std::make_unique(session, oldVersion) + return (oldVersion != 0 + && oldKotatoVersion < AppKotatoVersion) + ? std::make_unique(session, oldVersion, oldKotatoVersion) : nullptr; } +void Changelogs::addKotatoLogs() { + _chatsSubscription.destroy(); + + if (_addedSomeLocal) { + return; + } + auto baseLang = Lang::GetInstance().baseId(); + auto currentLang = Lang::Id(); + QString channelLink; + + for (const auto language : { "ru", "uk", "be" }) { + if (baseLang.startsWith(QLatin1String(language)) || currentLang == QString(language)) { + channelLink = "https://t.me/kotatogram_ru"; + break; + } + } + + if (channelLink.isEmpty()) { + channelLink = "https://t.me/kotatogram"; + } + + const auto text = ktr("ktg_new_version", + { "version", QString::fromLatin1(AppKotatoVersionStr) }, + { "td_version", QString::fromLatin1(AppVersionStr) }, + { "link", channelLink }); + addLocalLog(text.trimmed()); +} + void Changelogs::requestCloudLogs() { _chatsSubscription.destroy(); @@ -100,7 +138,7 @@ void Changelogs::requestCloudLogs() { } void Changelogs::addLocalLogs() { - if (AppBetaVersion || cAlphaVersion()) { + if (AppKotatoBetaVersion || cAlphaVersion()) { addBetaLogs(); } if (!_addedSomeLocal) { diff --git a/Telegram/SourceFiles/core/changelogs.h b/Telegram/SourceFiles/core/changelogs.h index ba5e312ff..eee8021fb 100644 --- a/Telegram/SourceFiles/core/changelogs.h +++ b/Telegram/SourceFiles/core/changelogs.h @@ -20,12 +20,13 @@ namespace Core { class Changelogs final : public base::has_weak_ptr { public: - Changelogs(not_null session, int oldVersion); + Changelogs(not_null session, int oldVersion, int oldKotatoVersion); static std::unique_ptr Create( not_null session); private: + void addKotatoLogs(); void requestCloudLogs(); void addLocalLogs(); void addLocalLog(const QString &text); @@ -34,6 +35,7 @@ private: const not_null _session; const int _oldVersion = 0; + const int _oldKotatoVersion = 0; rpl::lifetime _chatsSubscription; bool _addedSomeLocal = false; diff --git a/Telegram/SourceFiles/core/crash_report_window.cpp b/Telegram/SourceFiles/core/crash_report_window.cpp index 8549595b4..c66f8f7db 100644 --- a/Telegram/SourceFiles/core/crash_report_window.cpp +++ b/Telegram/SourceFiles/core/crash_report_window.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/crash_report_window.h" +#include "kotato/kotato_version.h" #include "core/crash_reports.h" #include "core/application.h" #include "core/sandbox.h" @@ -333,7 +334,7 @@ LastCrashedWindow::LastCrashedWindow( } if (_sendingState != SendingNoReport) { QString version = getReportField(qstr("version"), qstr("Version:")); - QString current = cAlphaVersion() ? u"-%1"_q.arg(cAlphaVersion()) : QString::number(AppVersion); + QString current = cAlphaVersion() ? u"-%1"_q.arg(cAlphaVersion()) : QString::number(AppKotatoVersion); if (version != current) { // currently don't accept crash reports from not current app version _sendingState = SendingNoReport; } @@ -502,7 +503,7 @@ QString LastCrashedWindow::getReportField(const QLatin1String &name, const QLati QString data = lines.at(i).trimmed().mid(prefix.size()).trimmed(); if (name == qstr("version")) { - if (data.endsWith(qstr(" alpha"))) { + if (data.endsWith(qstr(" %1").arg(AppKotatoTestBranch))) { data = QString::number(-data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong()); } else { data = QString::number(data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong()); @@ -714,7 +715,7 @@ void LastCrashedWindow::updateControls() { if (_sendingState == SendingTooOld || _sendingState == SendingUnofficial) { QString verStr = getReportField(qstr("version"), qstr("Version:")); qint64 ver = verStr.isEmpty() ? 0 : verStr.toLongLong(); - if (!ver || (ver == AppVersion) || (ver < 0 && (-ver / 1000) == AppVersion)) { + if (!ver || (ver == AppKotatoVersion) || (ver < 0 && (-ver / 1000) == AppKotatoVersion)) { h += _getApp.height() + padding; _getApp.show(); h -= _yourReportName.height() + padding; // hide report name diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp index fa0a8859c..e3a4367d3 100644 --- a/Telegram/SourceFiles/core/crash_reports.cpp +++ b/Telegram/SourceFiles/core/crash_reports.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/crash_reports.h" +#include "kotato/kotato_version.h" #include "platform/platform_specific.h" #include "base/platform/base_platform_info.h" #include "core/launcher.h" @@ -318,10 +319,10 @@ void StartCatching() { ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData(); ProcessAnnotations["Version"] = (cAlphaVersion() - ? u"%1 alpha"_q.arg(cAlphaVersion()) + ? u"%1 %2"_q.arg(cAlphaVersion()).arg(AppKotatoTestBranch) : (AppBetaVersion ? u"%1 beta"_q - : u"%1"_q).arg(AppVersion)).toUtf8().constData(); + : u"%1"_q).arg(AppKotatoVersion)).toUtf8().constData(); ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData(); ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData(); ProcessAnnotations["UserTag"] = QString::number(Core::Launcher::Instance().installationTag(), 16).toUtf8().constData(); diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 7e0b6c791..3ac9491a2 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/launcher.h" +#include "kotato/kotato_version.h" #include "platform/platform_launcher.h" #include "platform/platform_specific.h" #include "base/options.h" @@ -161,7 +162,7 @@ void ComputeInstallBetaVersions() { if (f.open(QIODevice::ReadOnly)) { cSetInstallBetaVersion(f.read(1) != "0"); } - } else if (AppBetaVersion) { + } else if (AppKotatoBetaVersion) { WriteInstallBetaVersionsSetting(); } } @@ -232,10 +233,13 @@ bool CheckPortableVersionFolder() { const auto portable = cExeDir() + u"TelegramForcePortable"_q; QFile key(portable + u"/tdata/alpha"_q); if (cAlphaVersion()) { + /* Assert(*AlphaPrivateKey != 0); + */ cForceWorkingDir(portable); QDir().mkpath(cWorkingDir() + u"tdata"_q); + /* cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey)); if (!key.open(QIODevice::WriteOnly)) { LOG(("FATAL: Could not open '%1' for writing private key!" @@ -245,6 +249,7 @@ bool CheckPortableVersionFolder() { QDataStream dataStream(&key); dataStream.setVersion(QDataStream::Qt_5_3); dataStream << quint64(cRealAlphaVersion()) << cAlphaPrivateKey(); + */ return true; } if (!QDir(portable).exists()) { diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index 7cf467c18..d02c320fb 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "core/update_checker.h" +#include "kotato/kotato_version.h" #include "platform/platform_specific.h" #include "base/platform/base_platform_info.h" #include "base/platform/base_platform_file_utilities.h" @@ -309,7 +310,7 @@ bool UnpackUpdate(const QString &filepath) { RSA *pbKey = [] { const auto bio = MakeBIO( const_cast( - AppBetaVersion + AppKotatoBetaVersion ? UpdatesPublicBetaKey : UpdatesPublicKey), -1); @@ -326,7 +327,7 @@ bool UnpackUpdate(const QString &filepath) { pbKey = [] { const auto bio = MakeBIO( const_cast( - AppBetaVersion + AppKotatoBetaVersion ? UpdatesPublicKey : UpdatesPublicBetaKey), -1); @@ -427,8 +428,8 @@ bool UnpackUpdate(const QString &filepath) { LOG(("Update Error: downloaded alpha version %1 is not greater, than mine %2").arg(alphaVersion).arg(cAlphaVersion())); return false; } - } else if (int32(version) <= AppVersion) { - LOG(("Update Error: downloaded version %1 is not greater, than mine %2").arg(version).arg(AppVersion)); + } else if (int32(version) <= AppKotatoVersion) { + LOG(("Update Error: downloaded version %1 is not greater, than mine %2").arg(version).arg(AppKotatoVersion)); return false; } @@ -558,7 +559,7 @@ bool ParseCommonMap( const auto types = (*it).toObject(); const auto list = [&]() -> std::vector { if (cAlphaVersion()) { - return { "alpha", "beta", "stable" }; + return { AppKotatoTestBranch }; } else if (cInstallBetaVersion()) { return { "beta", "stable" }; } @@ -581,7 +582,7 @@ bool ParseCommonMap( if (version == map.constEnd()) { continue; } - const auto isAvailableAlpha = (type == "alpha"); + const auto isAvailableAlpha = (type == AppKotatoTestBranch); const auto availableVersion = [&] { if ((*version).isString()) { const auto string = (*version).toString(); @@ -652,10 +653,8 @@ HttpChecker::HttpChecker(bool testing) : Checker(testing) { } void HttpChecker::start() { - const auto updaterVersion = Platform::AutoUpdateVersion(); const auto path = Local::readAutoupdatePrefix() - + qstr("/current") - + (updaterVersion > 1 ? QString::number(updaterVersion) : QString()); + + qstr("/current"); auto url = QUrl(path); DEBUG_LOG(("Update Info: requesting update state")); const auto request = QNetworkRequest(url); @@ -777,7 +776,7 @@ QString HttpChecker::validateLatestUrl( QString url) const { const auto myVersion = isAvailableAlpha ? cAlphaVersion() - : uint64(AppVersion); + : uint64(AppKotatoVersion); const auto validVersion = (cAlphaVersion() || !isAvailableAlpha); if (!validVersion || availableVersion <= myVersion) { return QString(); @@ -933,9 +932,7 @@ void MtpChecker::start() { crl::on_main(this, [=] { fail(); }); return; } - const auto updaterVersion = Platform::AutoUpdateVersion(); - const auto feed = "tdhbcfeed" - + (updaterVersion > 1 ? QString::number(updaterVersion) : QString()); + const auto feed = "ktghbcfeed"; MTP::ResolveChannel(&_mtp, feed, [=]( const MTPInputChannel &channel) { _mtp.send( @@ -1037,7 +1034,7 @@ auto MtpChecker::parseText(const QByteArray &text) const auto MtpChecker::validateLatestLocation( uint64 availableVersion, const FileLocation &location) const -> FileLocation { - const auto myVersion = uint64(AppVersion); + const auto myVersion = uint64(AppKotatoVersion); return (availableVersion <= myVersion) ? FileLocation() : location; } @@ -1532,17 +1529,17 @@ bool checkReadyUpdate() { if (versionNum == 0x7FFFFFFF) { // alpha version quint64 alphaVersion = 0; if (fVersion.read((char*)&alphaVersion, sizeof(quint64)) != sizeof(quint64)) { - LOG(("Update Error: cant read alpha version from file '%1'").arg(versionPath)); + LOG(("Update Error: cant read test version from file '%1'").arg(versionPath)); ClearAll(); return false; } if (!cAlphaVersion() || alphaVersion <= cAlphaVersion()) { - LOG(("Update Error: cant install alpha version %1 having alpha version %2").arg(alphaVersion).arg(cAlphaVersion())); + LOG(("Update Error: cant install test version %1 having %2 version %3").arg(alphaVersion).arg(AppKotatoTestBranch).arg(cAlphaVersion())); ClearAll(); return false; } - } else if (versionNum <= AppVersion) { - LOG(("Update Error: cant install version %1 having version %2").arg(versionNum).arg(AppVersion)); + } else if (versionNum <= AppKotatoVersion) { + LOG(("Update Error: cant install version %1 having version %2").arg(versionNum).arg(AppKotatoVersion)); ClearAll(); return false; } @@ -1673,7 +1670,7 @@ void UpdateApplication() { QString countAlphaVersionSignature(uint64 version) { // duplicated in packer.cpp if (cAlphaPrivateKey().isEmpty()) { - LOG(("Error: Trying to count alpha version signature without alpha private key!")); + //LOG(("Error: Trying to count alpha version signature without alpha private key!")); return QString(); } diff --git a/Telegram/SourceFiles/kotato/kotato_version.h b/Telegram/SourceFiles/kotato/kotato_version.h new file mode 100644 index 000000000..c418b981e --- /dev/null +++ b/Telegram/SourceFiles/kotato/kotato_version.h @@ -0,0 +1,22 @@ +/* +This file is part of Kotatogram Desktop, +the unofficial app based on Telegram Desktop. + +For license and copyright information please follow this link: +https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL +*/ +#pragma once + +constexpr auto AppKotatoVersion = 1004009; +constexpr auto AppKotatoVersionStr = "1.4.9"; +constexpr auto AppKotatoBetaVersion = true; + +//#define KTGDESKTOP_IS_TEST_VERSION +constexpr auto AppKotatoTestBranch = "dev"; +constexpr auto AppKotatoTestVersion = 0; + +#ifdef KTGDESKTOP_IS_TEST_VERSION +constexpr auto AppKotatoTestVersionFull = (1000ULL * AppKotatoVersion + AppKotatoTestVersion); +#else // KTGDESKTOP_IS_TEST_VERSION +constexpr auto AppKotatoTestVersionFull = (0ULL); +#endif // KTGDESKTOP_IS_TEST_VERSION diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 9a04542ef..0f1240294 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "logs.h" +#include "kotato/kotato_version.h" #include "platform/platform_specific.h" #include "core/crash_reports.h" #include "core/launcher.h" @@ -386,10 +387,11 @@ void start() { LogsData = nullptr; } - LOG(("Launched version: %1, install beta: %2, alpha: %3, debug mode: %4" + LOG(("Launched version: %1, install beta: %2, %3: %4, debug mode: %5" ).arg(AppVersion ).arg(Logs::b(cInstallBetaVersion()) - ).arg(cAlphaVersion() + ).arg(AppKotatoTestBranch + ).arg(AppKotatoTestVersion ).arg(Logs::b(DebugEnabled()))); LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName())); LOG(("Initial working dir: %1").arg(launcher.initialWorkingDir())); diff --git a/Telegram/SourceFiles/mtproto/session_private.cpp b/Telegram/SourceFiles/mtproto/session_private.cpp index 729a95ed6..0a36371c5 100644 --- a/Telegram/SourceFiles/mtproto/session_private.cpp +++ b/Telegram/SourceFiles/mtproto/session_private.cpp @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "mtproto/session_private.h" +#include "kotato/kotato_version.h" #include "mtproto/details/mtproto_bound_key_creator.h" #include "mtproto/details/mtproto_dcenter.h" #include "mtproto/details/mtproto_dump_to_text.h" @@ -81,7 +82,7 @@ using namespace details; #else const auto arch = ' ' + QSysInfo::buildCpuArchitecture(); #endif - return QString::fromLatin1(AppVersionStr) + arch + ([] { + return QString::fromLatin1(AppKotatoVersionStr) + arch + ([] { #if defined OS_MAC_STORE return u" Mac App Store"_q; #elif defined OS_WIN_STORE // OS_MAC_STORE @@ -93,7 +94,9 @@ using namespace details; ? u" Snap"_q : QString(); #endif // OS_MAC_STORE || OS_WIN_STORE - })(); + })() + (cAlphaVersion() + ? qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion) + : QString()); } void WrapInvokeAfter( diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index 4e2f6e878..aaacb31cc 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -7,13 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "settings.h" +#include "kotato/kotato_version.h" #include "ui/emoji_config.h" Qt::LayoutDirection gLangDir = Qt::LeftToRight; -bool gInstallBetaVersion = AppBetaVersion; -uint64 gAlphaVersion = AppAlphaVersion; -uint64 gRealAlphaVersion = AppAlphaVersion; +bool gInstallBetaVersion = AppKotatoBetaVersion; +uint64 gAlphaVersion = AppKotatoTestVersionFull; +uint64 gRealAlphaVersion = AppKotatoTestVersionFull; QByteArray gAlphaPrivateKey; bool gManyInstance = false; diff --git a/Telegram/SourceFiles/settings/settings_advanced.cpp b/Telegram/SourceFiles/settings/settings_advanced.cpp index f522fcea9..d92c94597 100644 --- a/Telegram/SourceFiles/settings/settings_advanced.cpp +++ b/Telegram/SourceFiles/settings/settings_advanced.cpp @@ -106,11 +106,9 @@ bool HasUpdate() { return !Core::UpdaterDisabled(); } -void SetupUpdate(not_null container) { - if (!HasUpdate()) { - return; - } - +void SetupUpdate( + not_null controller, + not_null container) { const auto texts = Ui::CreateChild>( container.get()); const auto downloading = Ui::CreateChild>( @@ -133,13 +131,39 @@ void SetupUpdate(not_null container) { container, object_ptr(container))); const auto inner = options->entity(); - const auto install = cAlphaVersion() + const auto install = (cAlphaVersion() || !HasUpdate()) ? nullptr : inner->add(object_ptr