From e7e1521fd25ecbb03de5089070b0437216d40f98 Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Mon, 23 Dec 2019 21:33:03 +0400 Subject: [PATCH] Fix example/tdweb build GitOrigin-RevId: f924d875361fc363af32e5d703e3cac373927405 --- CMakeLists.txt | 4 ++-- example/web/build-openssl.sh | 4 ++-- example/web/build-tdlib.sh | 2 +- td/telegram/ConfigManager.cpp | 13 +++++++------ td/telegram/MessagesManager.cpp | 2 +- td/telegram/StickersManager.cpp | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ff4e2a32..5d3ac731c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,8 @@ if (EMSCRIPTEN) set(ZLIB_LIBRARIES) set(ZLIB_INCLUDE_DIR) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\"") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\"") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 -s USE_ZLIB=1 -s MODULARIZE=1 -s WEBSOCKET_URL=\"'wss:#'\" -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['FS','cwrap']\" -lidbfs.js -lworkerfs.js") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1") diff --git a/example/web/build-openssl.sh b/example/web/build-openssl.sh index ec339d54b..0766399f6 100755 --- a/example/web/build-openssl.sh +++ b/example/web/build-openssl.sh @@ -1,6 +1,6 @@ #!/bin/sh -emconfigure 2> /dev/null || { echo 'emconfigure not found. Install emsdk and add emconfigure and emmake to PATH environment variable. See instruction at https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html. Do not forget to add `emconfigure` and `emmake` to the PATH environment variable via `emsdk/emsdk_env.sh` script.'; exit 1; } +emconfigure true 2> /dev/null || { echo 'emconfigure not found. Install emsdk and add emconfigure and emmake to PATH environment variable. See instruction at https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html. Do not forget to add `emconfigure` and `emmake` to the PATH environment variable via `emsdk/emsdk_env.sh` script.'; exit 1; } OPENSSL=OpenSSL_1_1_0j if [ ! -f $OPENSSL.tar.gz ]; then @@ -12,7 +12,7 @@ echo "Unpacking OpenSSL sources..." tar xzf $OPENSSL.tar.gz || exit 1 cd openssl-$OPENSSL -emconfigure ./Configure linux-generic32 no-shared no-dso no-engine no-unit-test no-ui || exit 1 +emconfigure ./Configure linux-generic32 no-shared no-threads no-dso no-engine no-unit-test no-ui || exit 1 sed -i.bak 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile || exit 1 sed -i.bak 's/-ldl //g' Makefile || exit 1 sed -i.bak 's/-O3/-Os/g' Makefile || exit 1 diff --git a/example/web/build-tdlib.sh b/example/web/build-tdlib.sh index cd83361c9..6ab6c3455 100755 --- a/example/web/build-tdlib.sh +++ b/example/web/build-tdlib.sh @@ -1,6 +1,6 @@ #!/bin/sh -emconfigure 2> /dev/null || { echo 'emconfigure not found. Install emsdk and add emconfigure and emmake to PATH environment variable. See instruction at https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html. Do not forget to add `emconfigure` and `emmake` to the PATH environment variable via `emsdk/emsdk_env.sh` script.'; exit 1; } +emconfigure true 2> /dev/null || { echo 'emconfigure not found. Install emsdk and add emconfigure and emmake to PATH environment variable. See instruction at https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html. Do not forget to add `emconfigure` and `emmake` to the PATH environment variable via `emsdk/emsdk_env.sh` script.'; exit 1; } rm -rf build/generate rm -rf build/asmjs diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 67b3de210..453931ae6 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -200,9 +200,10 @@ Result decode_config(Slice input) { return std::move(config); } +template static ActorOwn<> get_simple_config_impl(Promise promise, int32 scheduler_id, string url, string host, std::vector> headers, bool prefer_ipv6, - std::function(HttpQuery &)> get_config, + F &&get_config, string content = string(), string content_type = string()) { VLOG(config_recoverer) << "Request simple config from " << url; #if TD_EMSCRIPTEN // FIXME @@ -242,7 +243,7 @@ ActorOwn<> get_simple_config_azure(Promise promise, const Co << "v2/config.txt"; const bool prefer_ipv6 = shared_config == nullptr ? false : shared_config->get_option_boolean("prefer_ipv6"); return get_simple_config_impl(std::move(promise), scheduler_id, std::move(url), "tcdnb.azureedge.net", {}, - prefer_ipv6, [](HttpQuery &http_query) { return http_query.content_.str(); }); + prefer_ipv6, [](auto &http_query) -> Result { return http_query.content_.str(); }); } static ActorOwn<> get_simple_config_dns(Slice address, Slice host, Promise promise, @@ -252,7 +253,7 @@ static ActorOwn<> get_simple_config_dns(Slice address, Slice host, Promise Result { + auto get_config = [](auto &http_query) -> Result { TRY_RESULT(json, json_decode(http_query.content_)); if (json.type() != JsonValue::Type::Object) { return Status::Error("Expected JSON object"); @@ -320,7 +321,7 @@ ActorOwn<> get_simple_config_firebase_remote_config(Promise "https://firebaseremoteconfig.googleapis.com/v1/projects/peak-vista-421/namespaces/" "firebase:fetch?key=AIzaSyC2-kAkpDsroixRXw-sTw-Wfqo4NxjMwwM"; const bool prefer_ipv6 = shared_config == nullptr ? false : shared_config->get_option_boolean("prefer_ipv6"); - auto get_config = [](HttpQuery &http_query) -> Result { + auto get_config = [](auto &http_query) -> Result { TRY_RESULT(json, json_decode(http_query.get_arg("entries"))); if (json.type() != JsonValue::Type::Object) { return Status::Error("Expected JSON object"); @@ -342,7 +343,7 @@ ActorOwn<> get_simple_config_firebase_realtime(Promise promi string url = "https://reserve-5a846.firebaseio.com/ipconfigv3.json"; const bool prefer_ipv6 = shared_config == nullptr ? false : shared_config->get_option_boolean("prefer_ipv6"); - auto get_config = [](HttpQuery &http_query) -> Result { + auto get_config = [](auto &http_query) -> Result { return http_query.get_arg("content").str(); }; return get_simple_config_impl(std::move(promise), scheduler_id, std::move(url), "reserve-5a846.firebaseio.com", {}, @@ -358,7 +359,7 @@ ActorOwn<> get_simple_config_firebase_firestore(Promise prom string url = "https://www.google.com/v1/projects/reserve-5a846/databases/(default)/documents/ipconfig/v3"; const bool prefer_ipv6 = shared_config == nullptr ? false : shared_config->get_option_boolean("prefer_ipv6"); - auto get_config = [](HttpQuery &http_query) -> Result { + auto get_config = [](auto &http_query) -> Result { TRY_RESULT(json, json_decode(http_query.get_arg("fields"))); if (json.type() != JsonValue::Type::Object) { return Status::Error("Expected JSON object"); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index d2d11af0d..f82f4de8e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17341,7 +17341,7 @@ Result MessagesManager::get_message_schedule_date( switch (scheduling_state->get_id()) { case td_api::messageSchedulingStateSendWhenOnline::ID: - return SCHEDULE_WHEN_ONLINE_DATE; + return int32(SCHEDULE_WHEN_ONLINE_DATE); case td_api::messageSchedulingStateSendAtDate::ID: { auto send_at_date = td_api::move_object_as(scheduling_state); auto send_date = send_at_date->send_date_; diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index ce93a45cb..2451ff96f 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1065,11 +1065,11 @@ StickersManager::StickersManager(Td *td, ActorShared<> parent) : td_(td), parent void StickersManager::start_up() { // add animated emoji sticker set if (G()->is_test_dc()) { - animated_emoji_sticker_set_id_ = StickerSetId(1258816259751954); + animated_emoji_sticker_set_id_ = StickerSetId(td::int64(1258816259751954)); animated_emoji_sticker_set_access_hash_ = 4879754868529595811; animated_emoji_sticker_set_name_ = "emojies"; } else { - animated_emoji_sticker_set_id_ = StickerSetId(1258816259751983); + animated_emoji_sticker_set_id_ = StickerSetId(td::int64(1258816259751983)); animated_emoji_sticker_set_access_hash_ = 5100237018658464041; animated_emoji_sticker_set_name_ = "animatedemojies"; }