Don't provide 'api_id' and 'api_hash' by default.

We ask the developer to obtain his own api credentials, because
the bundled 'api_id' / 'api_hash' are strictly limited by the server.

The old credentials still could be used for test purposes,
but the developer will need to explicitly opt-in to use them.
This commit is contained in:
John Preston
2018-11-04 14:29:30 +04:00
parent 617d21129f
commit 65b2db2160
12 changed files with 205 additions and 138 deletions
+35 -7
View File
@@ -192,12 +192,40 @@ 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
static const int32 ApiId = 17349;
static const char *ApiHash = "344583e45741c457fe1862106095a5eb";
#endif
#if defined TDESKTOP_API_ID && defined TDESKTOP_API_HASH
#define TDESKTOP_API_HASH_TO_STRING_HELPER(V) #V
#define TDESKTOP_API_HASH_TO_STRING(V) TDESKTOP_API_HASH_TO_STRING_HELPER(V)
constexpr auto ApiId = TDESKTOP_API_ID;
constexpr auto ApiHash = TDESKTOP_API_HASH_TO_STRING(TDESKTOP_API_HASH);
#undef TDESKTOP_API_HASH_TO_STRING
#undef TDESKTOP_API_HASH_TO_STRING_HELPER
#else // TDESKTOP_API_ID && TDESKTOP_API_HASH
// To build your version of Telegram Desktop you're required to provide
// your own 'api_id' and 'api_hash' for the Telegram API access.
//
// How to obtain your 'api_id' and 'api_hash' is described here:
// https://core.telegram.org/api/obtaining_api_id
//
// If you're building the application not for deployment,
// but only for test purposes you can comment out the error below.
//
// This will allow you to use TEST ONLY 'api_id' and 'api_hash' which are
// very limited by the Telegram API server.
//
// Your users will start getting internal server errors on login
// if you deploy an app using those 'api_id' and 'api_hash'.
#error You are required to provide API_ID and API_HASH.
constexpr auto ApiId = 17349;
constexpr auto ApiHash = "344583e45741c457fe1862106095a5eb";
#endif // TDESKTOP_API_ID && TDESKTOP_API_HASH
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
#error "Only little endian is supported!"
@@ -207,7 +235,7 @@ static const char *ApiHash = "344583e45741c457fe1862106095a5eb";
#error "Alpha version macro is not defined."
#endif
#if (defined CUSTOM_API_ID) && (ALPHA_VERSION_MACRO > 0ULL)
#if (defined TDESKTOP_OFFICIAL_TARGET) && (ALPHA_VERSION_MACRO > 0ULL)
#include "../../../TelegramPrivate/alpha_private.h" // private key for downloading closed alphas
#else
static const char *AlphaPrivateKey = "";