2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 06:07:45 +00:00

Rework versioning

This commit is contained in:
RadRussianRus 2021-08-23 18:22:12 +03:00
parent f620f7480b
commit 263d7a48a3
17 changed files with 74 additions and 36 deletions

View File

@ -750,7 +750,7 @@ PRIVATE
kotato/settings_menu.h kotato/settings_menu.h
kotato/settings.cpp kotato/settings.cpp
kotato/settings.h kotato/settings.h
kotato/version.h kotato/kotato_version.h
lang/lang_cloud_manager.cpp lang/lang_cloud_manager.cpp
lang/lang_cloud_manager.h lang/lang_cloud_manager.h
lang/lang_instance.cpp lang/lang_instance.cpp

View File

@ -182,10 +182,12 @@ int main(int argc, char *argv[])
AlphaVersion = QString(argv[i + 1]).toULongLong(); AlphaVersion = QString(argv[i + 1]).toULongLong();
if (AlphaVersion > version * 1000ULL && AlphaVersion < (version + 1) * 1000ULL) { if (AlphaVersion > version * 1000ULL && AlphaVersion < (version + 1) * 1000ULL) {
BetaChannel = false; BetaChannel = false;
/*
AlphaSignature = countAlphaVersionSignature(AlphaVersion); AlphaSignature = countAlphaVersionSignature(AlphaVersion);
if (AlphaSignature.isEmpty()) { if (AlphaSignature.isEmpty()) {
return -1; return -1;
} }
*/
} else { } else {
cout << "Bad -alpha param value passed, should be for the same version: " << version << ", alpha: " << AlphaVersion << "\n"; cout << "Bad -alpha param value passed, should be for the same version: " << version << ", alpha: " << AlphaVersion << "\n";
return -1; return -1;
@ -506,9 +508,11 @@ int main(int argc, char *argv[])
#else #else
#error Unknown platform! #error Unknown platform!
#endif #endif
/*
if (AlphaVersion) { if (AlphaVersion) {
outName += "_" + AlphaSignature; outName += "_" + AlphaSignature;
} }
*/
QFile out(outName); QFile out(outName);
if (!out.open(QIODevice::WriteOnly)) { if (!out.open(QIODevice::WriteOnly)) {
cout << "Can't open '" << outName.toUtf8().constData() << "' for write..\n"; cout << "Can't open '" << outName.toUtf8().constData() << "' for write..\n";

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/about_box.h" #include "boxes/about_box.h"
#include "kotato/kotato_version.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "lang/lang_instance.h" #include "lang/lang_instance.h"
#include "mainwidget.h" #include "mainwidget.h"
@ -105,6 +106,7 @@ void AboutBox::resizeEvent(QResizeEvent *e) {
} }
void AboutBox::showVersionHistory() { void AboutBox::showVersionHistory() {
/*
if (cRealAlphaVersion()) { if (cRealAlphaVersion()) {
auto url = qsl("https://tdesktop.com/"); auto url = qsl("https://tdesktop.com/");
if (Platform::IsWindows32Bit()) { if (Platform::IsWindows32Bit()) {
@ -126,8 +128,11 @@ void AboutBox::showVersionHistory() {
Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard.")); Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard."));
} else { } else {
*/
UrlClickHandler::Open(Core::App().changelogLink()); UrlClickHandler::Open(Core::App().changelogLink());
/*
} }
*/
} }
void AboutBox::keyPressEvent(QKeyEvent *e) { void AboutBox::keyPressEvent(QKeyEvent *e) {
@ -158,8 +163,8 @@ QString telegramFaqLink() {
QString currentVersionText() { QString currentVersionText() {
auto result = QString::fromLatin1(AppKotatoVersionStr); auto result = QString::fromLatin1(AppKotatoVersionStr);
if (cAlphaVersion()) { if (cAlphaVersion()) {
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000); result += qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion);
} else if (AppBetaVersion) { } else if (AppKotatoBetaVersion) {
result += " beta"; result += " beta";
} }
if (Platform::IsWindows64Bit()) { if (Platform::IsWindows64Bit()) {

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "boxes/confirm_phone_box.h" #include "boxes/confirm_phone_box.h"
#include "kotato/kotato_version.h"
#include "boxes/confirm_box.h" #include "boxes/confirm_box.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h" #include "ui/widgets/input_fields.h"
@ -29,10 +30,10 @@ namespace {
object_ptr<ConfirmPhoneBox> CurrentConfirmPhoneBox = { nullptr }; object_ptr<ConfirmPhoneBox> CurrentConfirmPhoneBox = { nullptr };
void SendToBannedHelp(const QString &phone) { void SendToBannedHelp(const QString &phone) {
const auto version = QString::fromLatin1(AppVersionStr) const auto version = QString::fromLatin1(AppKotatoVersionStr)
+ (cAlphaVersion() + (cAlphaVersion()
? qsl(" alpha %1").arg(cAlphaVersion()) ? qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion)
: (AppBetaVersion ? " beta" : "")); : (AppKotatoBetaVersion ? " beta" : ""));
const auto subject = qsl("Banned phone number: ") + phone; const auto subject = qsl("Banned phone number: ") + phone;

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "core/changelogs.h" #include "core/changelogs.h"
#include "kotato/kotato_version.h"
#include "storage/localstorage.h" #include "storage/localstorage.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "lang/lang_instance.h" #include "lang/lang_instance.h"
@ -247,7 +248,7 @@ void Changelogs::requestCloudLogs() {
} }
void Changelogs::addLocalLogs() { void Changelogs::addLocalLogs() {
if (AppBetaVersion || cAlphaVersion()) { if (AppKotatoBetaVersion || cAlphaVersion()) {
addBetaLogs(); addBetaLogs();
} }
if (!_addedSomeLocal) { if (!_addedSomeLocal) {

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "core/crash_report_window.h" #include "core/crash_report_window.h"
#include "kotato/kotato_version.h"
#include "core/crash_reports.h" #include "core/crash_reports.h"
#include "core/launcher.h" #include "core/launcher.h"
#include "core/sandbox.h" #include "core/sandbox.h"
@ -482,7 +483,7 @@ QString LastCrashedWindow::getReportField(const QLatin1String &name, const QLati
QString data = lines.at(i).trimmed().mid(prefix.size()).trimmed(); QString data = lines.at(i).trimmed().mid(prefix.size()).trimmed();
if (name == qstr("version")) { if (name == qstr("version")) {
if (data.endsWith(qstr(" alpha"))) { if (data.endsWith(qstr(" %1").arg(AppKotatoTestBranch))) {
data = QString::number(-data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong()); data = QString::number(-data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong());
} else { } else {
data = QString::number(data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong()); data = QString::number(data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong());

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "core/crash_reports.h" #include "core/crash_reports.h"
#include "kotato/kotato_version.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
#include "core/launcher.h" #include "core/launcher.h"
@ -311,7 +312,7 @@ void StartCatching(not_null<Core::Launcher*> launcher) {
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS #ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
ProcessAnnotations["ApiId"] = QString::number(cApiId()).toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(cApiId()).toUtf8().constData();
ProcessAnnotations["Version"] = (cAlphaVersion() ? qsl("%1 alpha").arg(cAlphaVersion()) : (AppBetaVersion ? qsl("%1 beta") : qsl("%1")).arg(AppKotatoVersion)).toUtf8().constData(); ProcessAnnotations["Version"] = (cAlphaVersion() ? qsl("%1 %2").arg(cAlphaVersion()).arg(AppKotatoTestBranch) : (AppBetaVersion ? qsl("%1 beta") : qsl("%1")).arg(AppKotatoVersion)).toUtf8().constData();
ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData(); ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData();
ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData(); ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData();
ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData(); ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData();

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "core/launcher.h" #include "core/launcher.h"
#include "kotato/kotato_version.h"
#include "platform/platform_launcher.h" #include "platform/platform_launcher.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
@ -150,7 +151,7 @@ void ComputeInstallBetaVersions() {
if (f.open(QIODevice::ReadOnly)) { if (f.open(QIODevice::ReadOnly)) {
cSetInstallBetaVersion(f.read(1) != "0"); cSetInstallBetaVersion(f.read(1) != "0");
} }
} else if (AppBetaVersion) { } else if (AppKotatoBetaVersion) {
WriteInstallBetaVersionsSetting(); WriteInstallBetaVersionsSetting();
} }
} }
@ -221,10 +222,13 @@ bool CheckPortableVersionFolder() {
const auto portable = cExeDir() + qsl("TelegramForcePortable"); const auto portable = cExeDir() + qsl("TelegramForcePortable");
QFile key(portable + qsl("/tdata/alpha")); QFile key(portable + qsl("/tdata/alpha"));
if (cAlphaVersion()) { if (cAlphaVersion()) {
/*
Assert(*AlphaPrivateKey != 0); Assert(*AlphaPrivateKey != 0);
*/
cForceWorkingDir(portable + '/'); cForceWorkingDir(portable + '/');
QDir().mkpath(cWorkingDir() + qstr("tdata")); QDir().mkpath(cWorkingDir() + qstr("tdata"));
/*
cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey)); cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey));
if (!key.open(QIODevice::WriteOnly)) { if (!key.open(QIODevice::WriteOnly)) {
LOG(("FATAL: Could not open '%1' for writing private key!" LOG(("FATAL: Could not open '%1' for writing private key!"
@ -234,6 +238,7 @@ bool CheckPortableVersionFolder() {
QDataStream dataStream(&key); QDataStream dataStream(&key);
dataStream.setVersion(QDataStream::Qt_5_3); dataStream.setVersion(QDataStream::Qt_5_3);
dataStream << quint64(cRealAlphaVersion()) << cAlphaPrivateKey(); dataStream << quint64(cRealAlphaVersion()) << cAlphaPrivateKey();
*/
return true; return true;
} }
if (!QDir(portable).exists()) { if (!QDir(portable).exists()) {

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "core/update_checker.h" #include "core/update_checker.h"
#include "kotato/kotato_version.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h" #include "base/platform/base_platform_info.h"
#include "base/platform/base_platform_file_utilities.h" #include "base/platform/base_platform_file_utilities.h"
@ -304,7 +305,7 @@ bool UnpackUpdate(const QString &filepath) {
RSA *pbKey = [] { RSA *pbKey = [] {
const auto bio = MakeBIO( const auto bio = MakeBIO(
const_cast<char*>( const_cast<char*>(
AppBetaVersion AppKotatoBetaVersion
? UpdatesPublicBetaKey ? UpdatesPublicBetaKey
: UpdatesPublicKey), : UpdatesPublicKey),
-1); -1);
@ -321,7 +322,7 @@ bool UnpackUpdate(const QString &filepath) {
pbKey = [] { pbKey = [] {
const auto bio = MakeBIO( const auto bio = MakeBIO(
const_cast<char*>( const_cast<char*>(
AppBetaVersion AppKotatoBetaVersion
? UpdatesPublicKey ? UpdatesPublicKey
: UpdatesPublicBetaKey), : UpdatesPublicBetaKey),
-1); -1);
@ -550,7 +551,7 @@ bool ParseCommonMap(
const auto types = (*it).toObject(); const auto types = (*it).toObject();
const auto list = [&]() -> std::vector<QString> { const auto list = [&]() -> std::vector<QString> {
if (cAlphaVersion()) { if (cAlphaVersion()) {
return { "alpha", "beta", "stable" }; return { AppKotatoTestBranch };
} else if (cInstallBetaVersion()) { } else if (cInstallBetaVersion()) {
return { "beta", "stable" }; return { "beta", "stable" };
} }
@ -573,7 +574,7 @@ bool ParseCommonMap(
if (version == map.constEnd()) { if (version == map.constEnd()) {
continue; continue;
} }
const auto isAvailableAlpha = (type == "alpha"); const auto isAvailableAlpha = (type == AppKotatoTestBranch);
const auto availableVersion = [&] { const auto availableVersion = [&] {
if ((*version).isString()) { if ((*version).isString()) {
const auto string = (*version).toString(); const auto string = (*version).toString();
@ -1520,12 +1521,12 @@ bool checkReadyUpdate() {
if (versionNum == 0x7FFFFFFF) { // alpha version if (versionNum == 0x7FFFFFFF) { // alpha version
quint64 alphaVersion = 0; quint64 alphaVersion = 0;
if (fVersion.read((char*)&alphaVersion, sizeof(quint64)) != sizeof(quint64)) { 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(); ClearAll();
return false; return false;
} }
if (!cAlphaVersion() || alphaVersion <= cAlphaVersion()) { 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(); ClearAll();
return false; return false;
} }
@ -1660,7 +1661,7 @@ void UpdateApplication() {
QString countAlphaVersionSignature(uint64 version) { // duplicated in packer.cpp QString countAlphaVersionSignature(uint64 version) { // duplicated in packer.cpp
if (cAlphaPrivateKey().isEmpty()) { 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(); return QString();
} }

View File

@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once #pragma once
#include "base/const_string.h" #include "base/const_string.h"
#include "kotato/version.h"
#define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL) #define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL)
@ -25,5 +24,5 @@ constexpr auto AppName = "Kotatogram Desktop"_cs;
constexpr auto AppFile = "Kotatogram"_cs; constexpr auto AppFile = "Kotatogram"_cs;
constexpr auto AppVersion = 2008011; constexpr auto AppVersion = 2008011;
constexpr auto AppVersionStr = "2.8.11"; constexpr auto AppVersionStr = "2.8.11";
constexpr auto AppBetaVersion = true; constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@ -7,6 +7,7 @@ https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
*/ */
#include "kotato/json_settings.h" #include "kotato/json_settings.h"
#include "kotato/kotato_version.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "window/window_controller.h" #include "window/window_controller.h"

View File

@ -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 = 1004002;
constexpr auto AppKotatoVersionStr = "1.4.2";
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

View File

@ -1,11 +0,0 @@
/*
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 = 1004002;
constexpr auto AppKotatoVersionStr = "1.4.2";

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "logs.h" #include "logs.h"
#include "kotato/kotato_version.h"
#include "platform/platform_specific.h" #include "platform/platform_specific.h"
#include "core/crash_reports.h" #include "core/crash_reports.h"
#include "core/launcher.h" #include "core/launcher.h"
@ -428,10 +429,11 @@ void start(not_null<Core::Launcher*> launcher) {
LogsData = nullptr; 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(AppVersion
).arg(Logs::b(cInstallBetaVersion()) ).arg(Logs::b(cInstallBetaVersion())
).arg(cAlphaVersion() ).arg(AppKotatoTestBranch
).arg(AppKotatoTestVersion
).arg(Logs::b(DebugEnabled()))); ).arg(Logs::b(DebugEnabled())));
LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName())); LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName()));
LOG(("Initial working dir: %1").arg(initialWorkingDir)); LOG(("Initial working dir: %1").arg(initialWorkingDir));

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "mtproto/session_private.h" #include "mtproto/session_private.h"
#include "kotato/kotato_version.h"
#include "mtproto/details/mtproto_bound_key_creator.h" #include "mtproto/details/mtproto_bound_key_creator.h"
#include "mtproto/details/mtproto_dcenter.h" #include "mtproto/details/mtproto_dcenter.h"
#include "mtproto/details/mtproto_dump_to_text.h" #include "mtproto/details/mtproto_dump_to_text.h"
@ -88,7 +89,9 @@ using namespace details;
#else // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) #else // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC)
return Platform::IsWindows64Bit() ? u" x64"_q : QString(); return Platform::IsWindows64Bit() ? u" x64"_q : QString();
#endif // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC) #endif // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC)
})() + qsl(" (TD %1)").arg(AppVersionStr); })() + (cAlphaVersion()
? qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion)
: QString());
} }
void WrapInvokeAfter( void WrapInvokeAfter(

View File

@ -7,13 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "settings.h" #include "settings.h"
#include "kotato/kotato_version.h"
#include "ui/emoji_config.h" #include "ui/emoji_config.h"
Qt::LayoutDirection gLangDir = Qt::LeftToRight; Qt::LayoutDirection gLangDir = Qt::LeftToRight;
bool gInstallBetaVersion = AppBetaVersion; bool gInstallBetaVersion = AppKotatoBetaVersion;
uint64 gAlphaVersion = AppAlphaVersion; uint64 gAlphaVersion = AppKotatoTestVersionFull;
uint64 gRealAlphaVersion = AppAlphaVersion; uint64 gRealAlphaVersion = AppKotatoTestVersionFull;
QByteArray gAlphaPrivateKey; QByteArray gAlphaPrivateKey;
bool gManyInstance = false; bool gManyInstance = false;

View File

@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/ */
#include "storage/localstorage.h" #include "storage/localstorage.h"
// //
#include "kotato/kotato_version.h"
#include "storage/serialize_common.h" #include "storage/serialize_common.h"
#include "storage/storage_account.h" #include "storage/storage_account.h"
#include "storage/details/storage_file_utilities.h" #include "storage/details/storage_file_utilities.h"