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.cpp
kotato/settings.h
kotato/version.h
kotato/kotato_version.h
lang/lang_cloud_manager.cpp
lang/lang_cloud_manager.h
lang/lang_instance.cpp

View File

@ -182,10 +182,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;
@ -506,9 +508,11 @@ int main(int argc, char *argv[])
#else
#error Unknown platform!
#endif
/*
if (AlphaVersion) {
outName += "_" + AlphaSignature;
}
*/
QFile out(outName);
if (!out.open(QIODevice::WriteOnly)) {
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 "kotato/kotato_version.h"
#include "lang/lang_keys.h"
#include "lang/lang_instance.h"
#include "mainwidget.h"
@ -105,6 +106,7 @@ void AboutBox::resizeEvent(QResizeEvent *e) {
}
void AboutBox::showVersionHistory() {
/*
if (cRealAlphaVersion()) {
auto url = qsl("https://tdesktop.com/");
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."));
} else {
*/
UrlClickHandler::Open(Core::App().changelogLink());
/*
}
*/
}
void AboutBox::keyPressEvent(QKeyEvent *e) {
@ -158,8 +163,8 @@ QString telegramFaqLink() {
QString currentVersionText() {
auto result = QString::fromLatin1(AppKotatoVersionStr);
if (cAlphaVersion()) {
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000);
} else if (AppBetaVersion) {
result += qsl("-%1.%2").arg(AppKotatoTestBranch).arg(AppKotatoTestVersion);
} else if (AppKotatoBetaVersion) {
result += " beta";
}
if (Platform::IsWindows64Bit()) {

View File

@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "boxes/confirm_phone_box.h"
#include "kotato/kotato_version.h"
#include "boxes/confirm_box.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
@ -29,10 +30,10 @@ namespace {
object_ptr<ConfirmPhoneBox> CurrentConfirmPhoneBox = { nullptr };
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;

View File

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

View File

@ -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/launcher.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();
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());
} else {
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 "kotato/kotato_version.h"
#include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h"
#include "core/launcher.h"
@ -311,7 +312,7 @@ void StartCatching(not_null<Core::Launcher*> launcher) {
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
ProcessAnnotations["Binary"] = cExeName().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["Platform"] = PlatformString().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 "kotato/kotato_version.h"
#include "platform/platform_launcher.h"
#include "platform/platform_specific.h"
#include "base/platform/base_platform_info.h"
@ -150,7 +151,7 @@ void ComputeInstallBetaVersions() {
if (f.open(QIODevice::ReadOnly)) {
cSetInstallBetaVersion(f.read(1) != "0");
}
} else if (AppBetaVersion) {
} else if (AppKotatoBetaVersion) {
WriteInstallBetaVersionsSetting();
}
}
@ -221,10 +222,13 @@ bool CheckPortableVersionFolder() {
const auto portable = cExeDir() + qsl("TelegramForcePortable");
QFile key(portable + qsl("/tdata/alpha"));
if (cAlphaVersion()) {
/*
Assert(*AlphaPrivateKey != 0);
*/
cForceWorkingDir(portable + '/');
QDir().mkpath(cWorkingDir() + qstr("tdata"));
/*
cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey));
if (!key.open(QIODevice::WriteOnly)) {
LOG(("FATAL: Could not open '%1' for writing private key!"
@ -234,6 +238,7 @@ bool CheckPortableVersionFolder() {
QDataStream dataStream(&key);
dataStream.setVersion(QDataStream::Qt_5_3);
dataStream << quint64(cRealAlphaVersion()) << cAlphaPrivateKey();
*/
return true;
}
if (!QDir(portable).exists()) {

View File

@ -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"
@ -304,7 +305,7 @@ bool UnpackUpdate(const QString &filepath) {
RSA *pbKey = [] {
const auto bio = MakeBIO(
const_cast<char*>(
AppBetaVersion
AppKotatoBetaVersion
? UpdatesPublicBetaKey
: UpdatesPublicKey),
-1);
@ -321,7 +322,7 @@ bool UnpackUpdate(const QString &filepath) {
pbKey = [] {
const auto bio = MakeBIO(
const_cast<char*>(
AppBetaVersion
AppKotatoBetaVersion
? UpdatesPublicKey
: UpdatesPublicBetaKey),
-1);
@ -550,7 +551,7 @@ bool ParseCommonMap(
const auto types = (*it).toObject();
const auto list = [&]() -> std::vector<QString> {
if (cAlphaVersion()) {
return { "alpha", "beta", "stable" };
return { AppKotatoTestBranch };
} else if (cInstallBetaVersion()) {
return { "beta", "stable" };
}
@ -573,7 +574,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();
@ -1520,12 +1521,12 @@ 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;
}
@ -1660,7 +1661,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();
}

View File

@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#pragma once
#include "base/const_string.h"
#include "kotato/version.h"
#define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL)
@ -25,5 +24,5 @@ constexpr auto AppName = "Kotatogram Desktop"_cs;
constexpr auto AppFile = "Kotatogram"_cs;
constexpr auto AppVersion = 2008011;
constexpr auto AppVersionStr = "2.8.11";
constexpr auto AppBetaVersion = true;
constexpr auto AppBetaVersion = false;
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/kotato_version.h"
#include "mainwindow.h"
#include "mainwidget.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 "kotato/kotato_version.h"
#include "platform/platform_specific.h"
#include "core/crash_reports.h"
#include "core/launcher.h"
@ -428,10 +429,11 @@ void start(not_null<Core::Launcher*> launcher) {
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(initialWorkingDir));

View File

@ -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"
@ -88,7 +89,9 @@ using namespace details;
#else // OS_MAC_STORE || OS_WIN_STORE || (defined Q_OS_UNIX && !defined Q_OS_MAC)
return Platform::IsWindows64Bit() ? u" x64"_q : QString();
#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(

View File

@ -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;

View File

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