config.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "core/version.h"
  9. #include "settings.h"
  10. enum {
  11. MaxSelectedItems = 100,
  12. LocalEncryptIterCount = 4000, // key derivation iteration count
  13. LocalEncryptNoPwdIterCount = 4, // key derivation iteration count without pwd (not secure anyway)
  14. LocalEncryptSaltSize = 32, // 256 bit
  15. RecentInlineBotsLimit = 10,
  16. AutoSearchTimeout = 900, // 0.9 secs
  17. PreloadHeightsCount = 3, // when 3 screens to scroll left make a preload request
  18. SearchPeopleLimit = 5,
  19. MaxMessageSize = 4096,
  20. WebPageUserId = 701000,
  21. UpdateDelayConstPart = 8 * 3600, // 8 hour min time between update check requests
  22. UpdateDelayRandPart = 8 * 3600, // 8 hour max - min time between update check requests
  23. WrongPasscodeTimeout = 1500,
  24. ChoosePeerByDragTimeout = 1000, // 1 second mouse not moved to choose dialog when dragging a file
  25. };
  26. inline const char *cGUIDStr() {
  27. #ifndef OS_MAC_STORE
  28. static const char *gGuidStr = "{87A94AB0-E370-4cde-98D3-ACC110C5967D}";
  29. #else // OS_MAC_STORE
  30. static const char *gGuidStr = "{E51FB841-8C0B-4EF9-9E9E-5A0078567627}";
  31. #endif // OS_MAC_STORE
  32. return gGuidStr;
  33. }
  34. static const char *UpdatesPublicKey = "\
  35. -----BEGIN RSA PUBLIC KEY-----\n\
  36. MIGJAoGBAMA4ViQrjkPZ9xj0lrer3r23JvxOnrtE8nI69XLGSr+sRERz9YnUptnU\n\
  37. BZpkIfKaRcl6XzNJiN28cVwO1Ui5JSa814UAiDHzWUqCaXUiUEQ6NmNTneiGx2sQ\n\
  38. +9PKKlb8mmr3BB9A45ZNwLT6G9AK3+qkZLHojeSA+m84/a6GP4svAgMBAAE=\n\
  39. -----END RSA PUBLIC KEY-----\
  40. ";
  41. static const char *UpdatesPublicBetaKey = "\
  42. -----BEGIN RSA PUBLIC KEY-----\n\
  43. MIGJAoGBALWu9GGs0HED7KG7BM73CFZ6o0xufKBRQsdnq3lwA8nFQEvmdu+g/I1j\n\
  44. 0LQ+0IQO7GW4jAgzF/4+soPDb6uHQeNFrlVx1JS9DZGhhjZ5rf65yg11nTCIHZCG\n\
  45. w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\
  46. -----END RSA PUBLIC KEY-----\
  47. ";
  48. #if defined TDESKTOP_API_ID && defined TDESKTOP_API_HASH
  49. constexpr auto ApiId = TDESKTOP_API_ID;
  50. constexpr auto ApiHash = QT_STRINGIFY(TDESKTOP_API_HASH);
  51. #else // TDESKTOP_API_ID && TDESKTOP_API_HASH
  52. // To build your version of Telegram Desktop you're required to provide
  53. // your own 'api_id' and 'api_hash' for the Telegram API access.
  54. //
  55. // How to obtain your 'api_id' and 'api_hash' is described here:
  56. // https://core.telegram.org/api/obtaining_api_id
  57. //
  58. // If you're building the application not for deployment,
  59. // but only for test purposes you can comment out the error below.
  60. //
  61. // This will allow you to use TEST ONLY 'api_id' and 'api_hash' which are
  62. // very limited by the Telegram API server.
  63. //
  64. // Your users will start getting internal server errors on login
  65. // if you deploy an app using those 'api_id' and 'api_hash'.
  66. #error You are required to provide API_ID and API_HASH.
  67. constexpr auto ApiId = 17349;
  68. constexpr auto ApiHash = "344583e45741c457fe1862106095a5eb";
  69. #endif // TDESKTOP_API_ID && TDESKTOP_API_HASH
  70. #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  71. #error "Only little endian is supported!"
  72. #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN
  73. #if (TDESKTOP_ALPHA_VERSION != 0)
  74. // Private key for downloading closed alphas.
  75. #include "../../../DesktopPrivate/alpha_private.h"
  76. #else
  77. static const char *AlphaPrivateKey = "";
  78. #endif
  79. extern QString gKeyFile;
  80. inline const QString &cDataFile() {
  81. if (!gKeyFile.isEmpty()) return gKeyFile;
  82. static const QString res(u"data"_q);
  83. return res;
  84. }
  85. inline const QRegularExpression &cRussianLetters() {
  86. static QRegularExpression regexp(QString::fromUtf8("[а-яА-ЯёЁ]"));
  87. return regexp;
  88. }