From ea6eb52debd7b77bf0e43f4f4acfd0e1e1bedbb0 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Thu, 13 Apr 2023 18:00:12 +0300 Subject: [PATCH] web: only include web printer when needed --- code/espurna/api.h | 20 +++++++++----------- code/espurna/terminal.cpp | 6 ++++-- code/espurna/web.h | 4 ---- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/code/espurna/api.h b/code/espurna/api.h index ce2092c1..8eb98d39 100644 --- a/code/espurna/api.h +++ b/code/espurna/api.h @@ -13,15 +13,10 @@ Copyright (C) 2020-2021 by Maxim Prokhorov -#include "api_path.h" - -#if WEB_SUPPORT -#include "api_impl.h" #include "web.h" -bool apiAuthenticateHeader(AsyncWebServerRequest*, const String& key); -bool apiAuthenticateParam(AsyncWebServerRequest*, const String& key); -bool apiAuthenticate(AsyncWebServerRequest*); +#include "api_path.h" +#include "api_impl.h" namespace espurna { namespace api { @@ -32,6 +27,10 @@ using JsonHandler = std::function; } // namespace api } // namespace espurna +using ApiRequest = espurna::api::Request; +using ApiBasicHandler = espurna::api::BasicHandler; +using ApiJsonHandler = espurna::api::JsonHandler; + void apiRegister(String path, espurna::api::BasicHandler&& get, espurna::api::BasicHandler&& put); @@ -42,11 +41,10 @@ void apiRegister(String path, bool apiError(espurna::api::Request&); bool apiOk(espurna::api::Request&); -#endif -using ApiRequest = espurna::api::Request; -using ApiBasicHandler = espurna::api::BasicHandler; -using ApiJsonHandler = espurna::api::JsonHandler; +bool apiAuthenticateHeader(AsyncWebServerRequest*, const String& key); +bool apiAuthenticateParam(AsyncWebServerRequest*, const String& key); +bool apiAuthenticate(AsyncWebServerRequest*); void apiCommonSetup(); bool apiEnabled(); diff --git a/code/espurna/terminal.cpp b/code/espurna/terminal.cpp index f0418b16..e625d3b8 100644 --- a/code/espurna/terminal.cpp +++ b/code/espurna/terminal.cpp @@ -25,8 +25,6 @@ Copyright (C) 2020-2022 by Maxim Prokhorov #include @@ -38,6 +36,10 @@ Copyright (C) 2020-2022 by Maxim Prokhorov #include "espurna.h" -#if WEB_SUPPORT - #include #include @@ -36,5 +34,3 @@ void webRequestRegister(web_request_callback_f); uint16_t webPort(); void webSetup(); - -#endif // WEB_SUPPORT == 1