Before publish a custom version of Telegram Desktop application you need to get new api_id
and api_hash
values.
To do that you need to follow instructions at the page: Obtaining api_id.
See also the thread: GitHub: "internal server error" on login.
So, after obtaining new values of api_id
and api_hash
you need to create a new directory next to your tdesktop
folder with the name: TelegramPrivate
.
And place a new file custom_api_id.h
there with the content:
static const int32 ApiId = [api_id];
static const char *ApiHash = "[api_hash]";
And please check that we set CUSTOM_API_ID
define at the Telegram.gyp
file.
Also please note that we do not need to place the custom_api_id.h
to Git.
It is because we should keep api_id
and api_hash
values private.
If you want to support autoupdates feature you should do the following things:
- Change autoupdate url
- Generate your own
UpdatesPublicKey
andUpdatesPublicAlphaKey
RSA keys - Build
Packer
project - Make update packages with
Packer
utility - Setup your own server for maintaining update packages
The current autoupdate url is https://updates.bettergram.io
. It is hard coded at the readAutoupdatePrefixRaw()
method from localstorage.cpp
file. In order to temporary change this value you can create <working-directory>/tdata/prefix
file with new autoupdate url value. So, if this file exists and does not empty the application uses the file content as an autoupdate url prefix.
In order to be able to use your own updates you should replace UpdatesPublicKey
and UpdatesPublicAlphaKey
variables at the config.h
and packer.cpp
files. To do that you need to generate two RSA keys by using the following commands:
$ openssl genrsa -passout stdin -out bettergram-updates-key-private.pem 1024
$ openssl rsa -in bettergram-updates-key-private.pem -RSAPublicKey_out -out bettergram-updates-key-public.pem
$ openssl genrsa -passout stdin -out bettergram-updates-alpha-key-private.pem 1024
$ openssl rsa -in bettergram-updates-alpha-key-private.pem -RSAPublicKey_out -out bettergram-updates-alpha-key-public.pem
Please do not forget to assign strong passwords for both keys (you should type them right after you typed commands to generate private keys). After you will have generated them you should replace UpdatesPublicKey
and UpdatesPublicAlphaKey
variables at the config.h
and packer.cpp
files with contents of the *-public.pem
keys and store private keys in safe place and do NOT publish it or store in git.
There is Packer
project in the Bettergram solution. In order to make update packages you should do the following steps:
-
Add
packer_private.h
file to theTelegramPrivate
directory. This file should containPrivateKey
andPrivateAlphaKey
variables:const char *PrivateKey = "\ -----BEGIN RSA PRIVATE KEY-----\n\ ... -----END RSA PRIVATE KEY-----\ "; const char *PrivateAlphaKey = "\ -----BEGIN RSA PRIVATE KEY-----\n\ ... -----END RSA PRIVATE KEY-----\ ";
-
Add
beta_private.h
file to theTelegramPrivate
directory. This file should containBetaPrivateKey
variable:const char *BetaPrivateKey = "\ -----BEGIN RSA PRIVATE KEY-----\n\ ... -----END RSA PRIVATE KEY-----\ ";
I assume this value may be equal to
PrivateAlphaKey
variable. -
Build the
Packer
project for each platform (Linux, macOS and Windows) -
Run
Packer
utility:$ ./Packer -path Bettergram -path Updater -version 1003014
You should use actual Bettergram version number instead of
1003014
. ThePacker
should generate one file that will contain all files from-path
arguments, something like this:tlinuxupd1003014
In order to build new release you should do the following steps:
- Change
Version
at theTelegram/Resources/uwp/AppX/AppxManifest.xml
file - Change
FILEVERSION
,PRODUCTVERSION
,FileVersion
andProductVersion
at theTelegram/Resources/winrc/Telegram.rc
file - Change
FILEVERSION
,PRODUCTVERSION
,FileVersion
andProductVersion
at theTelegram/Resources/winrc/Updater.rc
file - Change
BETA_VERSION_MACRO
to0ULL
,AppVersion
,AppVersionStr
atTelegram/SourceFiles/core/version.h
file - Change
BetaVersion
to0
,AppVersion
,AppVersionStrMajor
,AppVersionStrSmall
andAppVersionStr
atTelegram/build/version
file - Add description of the new version into
bettergram_changelog.txt
file - Add new commit with the description from
bettergram_changelog.txt
file - Add new tag with the version to git
As an example you can see the Version 1.3.13. commit.
Or you can use set_version.bat
and set_version.sh
files.