dev-channel versions added

This commit is contained in:
John Preston 2015-02-05 14:49:50 +00:00
parent 2f7c1cca78
commit 6dada1294e
9 changed files with 75 additions and 28 deletions

View File

@ -1,11 +1,25 @@
@echo OFF
set "AppVersionStrSmall=0.7.10"
set "AppVersionStr=0.7.10"
set "AppVersionStrFull=0.7.10.0"
set "AppVersionStrSmall=0.7.11"
set "AppVersionStr=0.7.11"
set "AppVersionStrFull=0.7.11.0"
set "DevChannel=1"
if %DevChannel% neq 0 goto preparedev
set "DevPostfix="
set "DevParam="
goto devprepared
:preparedev
set "DevPostfix=.dev"
set "DevParam=-dev"
:devprepared
echo.
echo Preparing version %AppVersionStr%..
echo Preparing version %AppVersionStr%%DevPostfix%..
echo.
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
@ -17,23 +31,23 @@ if %errorlevel% neq 0 goto error1
call ..\..\..\TelegramPrivate\Sign.bat Updater.exe
if %errorlevel% neq 0 goto error1
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppFullVersion=%AppVersionStrFull% ..\..\Telegram\Setup.iss
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppFullVersion=%AppVersionStrFull% /dMyAppVersionForExe=%AppVersionStr%%DevPostfix% ..\..\Telegram\Setup.iss
if %errorlevel% neq 0 goto error1
call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStr%.exe
call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStr%%DevPostfix%.exe
if %errorlevel% neq 0 goto error1
call Prepare.exe -path Telegram.exe -path Updater.exe
call Prepare.exe -path Telegram.exe -path Updater.exe %DevParam%
if %errorlevel% neq 0 goto error1
cd deploy\%AppVersionStr%
cd deploy\%AppVersionStr%%DevPostfix%
mkdir Telegram
move Telegram.exe Telegram\
7z a -mx9 tportable.%AppVersionStr%.zip Telegram\
7z a -mx9 tportable.%AppVersionStr%%DevPostfix%.zip Telegram\
if %errorlevel% neq 0 goto error2
echo .
echo Version %AppVersionStr% is ready for deploy!
echo Version %AppVersionStr%%DevPostfix% is ready for deploy!
echo .
cd ..\..\..\..\Telegram

View File

@ -24,7 +24,7 @@ DefaultDirName={userappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir=.\..\Win32\Deploy
OutputBaseFilename=tsetup.{#MyAppVersionZero}
OutputBaseFilename=tsetup.{#MyAppVersionForExe}
SetupIconFile=.\SourceFiles\art\icon256.ico
UninstallDisplayIcon={app}\Telegram.exe
Compression=lzma

View File

@ -32,6 +32,8 @@ Q_IMPORT_PLUGIN(QWbmpPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#endif
bool DevChannel = false;
const char *publicKey = "\
-----BEGIN RSA PUBLIC KEY-----\n\
MIGJAoGBAMA4ViQrjkPZ9xj0lrer3r23JvxOnrtE8nI69XLGSr+sRERz9YnUptnU\n\
@ -40,8 +42,17 @@ BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\
-----END RSA PUBLIC KEY-----\
";
const char *publicDevKey = "\
-----BEGIN RSA PUBLIC KEY-----\n\
MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\
0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\
w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\
-----END RSA PUBLIC KEY-----\
";
extern const char *privateKey;
#include "../../../../TelegramPrivate/packer_private.h" // RSA PRIVATE KEY for update signing
extern const char *privateDevKey;
#include "../../../../TelegramPrivate/packer_private.h" // RSA PRIVATE KEYS for update signing
// sha1 hash
typedef unsigned char uchar;
@ -151,6 +162,8 @@ int main(int argc, char *argv[])
if (remove.isEmpty()) remove = info.canonicalPath() + "/";
} else if (string("-version") == argv[i] && i + 1 < argc) {
version = QString(argv[i + 1]).toInt();
} else if (string("-dev") == argv[i]) {
DevChannel = true;
}
}
@ -388,7 +401,7 @@ int main(int argc, char *argv[])
uint32 siglen = 0;
cout << "Signing..\n";
RSA *prKey = PEM_read_bio_RSAPrivateKey(BIO_new_mem_buf(const_cast<char*>(privateKey), -1), 0, 0, 0);
RSA *prKey = PEM_read_bio_RSAPrivateKey(BIO_new_mem_buf(const_cast<char*>(DevChannel ? privateDevKey : privateKey), -1), 0, 0, 0);
if (!prKey) {
cout << "Could not read RSA private key!\n";
return -1;
@ -411,7 +424,7 @@ int main(int argc, char *argv[])
}
cout << "Checking signature..\n";
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(publicKey), -1), 0, 0, 0);
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(DevChannel ? publicDevKey : publicKey), -1), 0, 0, 0);
if (!pbKey) {
cout << "Could not read RSA public key!\n";
return -1;

View File

@ -17,6 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#include "prepare.h"
bool DevChannel = false;
int prepare(QFileInfo f, QStringList paths) {
if (paths.isEmpty()) {
cout << "No -path args were passed :(\n";
@ -28,7 +30,7 @@ int prepare(QFileInfo f, QStringList paths) {
QFileInfo last;
QFileInfoList l = f.absoluteDir().entryInfoList(QDir::Files);
for (QFileInfoList::iterator i = l.begin(), e = l.end(); i != e; ++i) {
QRegularExpressionMatch m = QRegularExpression("/tsetup.((\\d+).(\\d+).(\\d+)).exe$").match(i->absoluteFilePath());
QRegularExpressionMatch m = QRegularExpression("/tsetup\\.((\\d+)\\.(\\d+)\\.(\\d+))(?:\\.dev)?\\.exe$").match(i->absoluteFilePath());
if (!m.hasMatch()) continue;
int version = m.captured(2).toInt() * 1000000 + m.captured(3).toInt() * 1000 + m.captured(4).toInt();
@ -40,15 +42,18 @@ int prepare(QFileInfo f, QStringList paths) {
}
if (!lastVersion) {
cout << "No tsetup.X.Y.Z.exe found :(\n";
cout << "No tsetup.X.Y.Z.exe or tsetup.X.Y.Z.dev.exe found :(\n";
return -1;
}
cout << "Last version: " << lastVersionStr.toUtf8().constData() << " (" << lastVersion << "), executing packer..\n";
cout << "Last version: " << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << " (" << lastVersion << "), executing packer..\n";
QDir dir("deploy/" + lastVersionStr);
QDir dir("deploy/" + lastVersionStr + (DevChannel ? ".dev" : ""));
if (dir.exists()) {
cout << "Version " << lastVersionStr.toUtf8().constData() << " already exists in /deploy..\n";
cout << "Version " << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << " already exists in /deploy..\n";
return -1;
} else if (QDir("deploy/" + lastVersionStr + (DevChannel ? "" : ".dev")).exists()) {
cout << "Version " << (lastVersionStr + (DevChannel ? "" : ".dev")).toUtf8().constData() << " already exists in /deploy..\n";
return -1;
}
@ -56,6 +61,7 @@ int prepare(QFileInfo f, QStringList paths) {
for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
packer += " -path " + *i;
}
if (DevChannel) packer += " -dev";
int res = system(packer.toUtf8().constData());
@ -65,11 +71,11 @@ int prepare(QFileInfo f, QStringList paths) {
paths.push_back("Telegram.pdb");
paths.push_back("Updater.pdb");
paths.push_back("tsetup." + lastVersionStr + ".exe");
paths.push_back("tsetup." + lastVersionStr + (DevChannel ? ".dev" : "") + ".exe");
paths.push_back(QString("tupdate%1").arg(lastVersion));
for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
if (!QFile::copy(*i, "deploy/" + lastVersionStr + "/" + *i)) {
cout << "Could not copy " << i->toUtf8().constData() << " to deploy/" << lastVersionStr.toUtf8().constData() << "\n";
if (!QFile::copy(*i, "deploy/" + lastVersionStr + (DevChannel ? ".dev" : "") + "/" + *i)) {
cout << "Could not copy " << i->toUtf8().constData() << " to deploy/" << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << "\n";
return -1;
}
cout << "Copied " << i->toUtf8().constData() << "..\n";
@ -78,7 +84,7 @@ int prepare(QFileInfo f, QStringList paths) {
QFile::remove(*i);
}
cout << "Update created in deploy/" << lastVersionStr.toUtf8().constData() << "\n";
cout << "Update created in deploy/" << (lastVersionStr + (DevChannel ? ".dev" : "")).toUtf8().constData() << "\n";
return 0;
}
@ -91,6 +97,8 @@ int main(int argc, char *argv[])
for (int i = 1; i < argc; ++i) {
if (string(argv[i]) == "-path" && i + 1 < argc) {
paths.push_back(QString(argv[i + 1]));
} else if (string(argv[i]) == "-dev") {
DevChannel = true;
}
}
int res = prepare(f, paths);

View File

@ -527,7 +527,10 @@ void Application::startUpdateCheck(bool forceWait) {
if (cManyInstance() && !cDebug()) return; // only main instance is updating
if (sendRequest) {
QNetworkRequest checkVersion(cUpdateURL());
QUrl url(cUpdateURL());
if (DevChannel) url.setQuery("dev=1");
QString u = url.toString();
QNetworkRequest checkVersion(url);
if (updateReply) updateReply->deleteLater();
App::setProxySettings(updateManager);

View File

@ -24,7 +24,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
AboutBox::AboutBox() :
_done(this, lang(lng_about_done), st::aboutCloseButton),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (DevChannel ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle),
_hiding(false), a_opacity(0, 1) {

View File

@ -17,8 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 7010;
static const wchar_t *AppVersionStr = L"0.7.10";
static const int32 AppVersion = 7011;
static const wchar_t *AppVersionStr = L"0.7.11";
static const bool DevChannel = true;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";
@ -189,6 +190,14 @@ BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\
-----END RSA PUBLIC KEY-----\
";
static const char *UpdatesPublicDevKey = "\
-----BEGIN RSA PUBLIC KEY-----\n\
MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\
0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\
w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\
-----END RSA PUBLIC KEY-----\
";
#ifdef CUSTOM_API_ID
#include "../../../TelegramPrivate/custom_api_id.h" // Custom API id and API hash
#else

View File

@ -1622,7 +1622,7 @@ void PsUpdateDownloader::unpackUpdate() {
return fatalFail();
}
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(UpdatesPublicKey), -1), 0, 0, 0);
RSA *pbKey = PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast<char*>(DevChannel ? UpdatesPublicDevKey : UpdatesPublicKey), -1), 0, 0, 0);
if (!pbKey) {
LOG(("Update Error: cant read public rsa key!"));
return fatalFail();

Binary file not shown.