Skip to content

Commit

Permalink
Allow to forward custom API tokens for Kepka.
Browse files Browse the repository at this point in the history
You can obtain your tokens from https://core.telegram.org/api/obtaining_api_id.

Export API_ID and API_TOKEN environment options with your tokens before
running Cmake to use them.

Signed-off-by: Vitaly Zaitsev <[email protected]>
  • Loading branch information
xvitaly authored and leha-bot committed Jun 28, 2019
1 parent d0de5d3 commit e49340e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ if (LINUX)
endif()
endif()

##================================================
## API tokens
##================================================
if (DEFINED ENV{API_ID} AND DEFINED ENV{API_HASH})
set(API_ID ENV{API_ID})
set(API_HASH ENV{API_HASH})
else()
message(WARNING "No custom API tokens detected. You must grab your own tokens from https://core.telegram.org/api/obtaining_api_id and export them using environment options. Will use default for testing purposes.")
set(API_ID 17349)
set(API_HASH "344583e45741c457fe1862106095a5eb")
endif()

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
##================================================
Expand Down
8 changes: 2 additions & 6 deletions Telegram/SourceFiles/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,8 @@ 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 qint32 ApiId = 17349;
static const char *ApiHash = "344583e45741c457fe1862106095a5eb";
#endif
constexpr auto ApiId = @API_ID@;
constexpr auto ApiHash = "@API_HASH@";

#if Q_BYTE_ORDER == Q_BIG_ENDIAN
#warning "Big endian support in Kepka is experimental. Proceed with caution!"
Expand Down

0 comments on commit e49340e

Please sign in to comment.