diff --git a/src/APSettingsService.h b/src/APSettingsService.h index d652d6b..63aaf9c 100644 --- a/src/APSettingsService.h +++ b/src/APSettingsService.h @@ -17,7 +17,7 @@ #define AP_DEFAULT_PASSWORD "password" #define AP_SETTINGS_FILE "/config/apSettings.json" -#define AP_SETTINGS_SERVICE_PATH "/apSettings" +#define AP_SETTINGS_SERVICE_PATH "/rest/apSettings" class APSettingsService : public SettingsService { diff --git a/src/APStatus.cpp b/src/APStatus.cpp index b4ec693..ef65402 100644 --- a/src/APStatus.cpp +++ b/src/APStatus.cpp @@ -1,7 +1,7 @@ #include APStatus::APStatus(AsyncWebServer *server) : _server(server) { - _server->on("/apStatus", HTTP_GET, std::bind(&APStatus::apStatus, this, std::placeholders::_1)); + _server->on(AP_STATUS_SERVICE_PATH, HTTP_GET, std::bind(&APStatus::apStatus, this, std::placeholders::_1)); } void APStatus::apStatus(AsyncWebServerRequest *request) { diff --git a/src/APStatus.h b/src/APStatus.h index 9a32391..72bea98 100644 --- a/src/APStatus.h +++ b/src/APStatus.h @@ -8,6 +8,8 @@ #include #include +#define AP_STATUS_SERVICE_PATH "/rest/apStatus" + class APStatus { public: diff --git a/src/AuthSettingsService.cpp b/src/AuthSettingsService.cpp index 4180684..0b8645c 100644 --- a/src/AuthSettingsService.cpp +++ b/src/AuthSettingsService.cpp @@ -1,10 +1,10 @@ #include AuthSettingsService::AuthSettingsService(AsyncWebServer* server, FS* fs) : SettingsService(server, fs, AUTH_SETTINGS_SERVICE_PATH, AUTH_SETTINGS_FILE) { - _server->on(AUTH_LOGOUT_PATH, HTTP_GET, std::bind(&AuthSettingsService::logout, this, std::placeholders::_1)); + _server->on(AUTH_LOGOUT_SERVICE_PATH, HTTP_GET, std::bind(&AuthSettingsService::logout, this, std::placeholders::_1)); // configure authentication handler - _authenticationHandler.setUri(AUTH_AUTHENTICATE_PATH); + _authenticationHandler.setUri(AUTH_AUTHENTICATE_SERVICE_PATH); _authenticationHandler.setMethod(HTTP_POST); _authenticationHandler.onRequest(std::bind(&AuthSettingsService::authenticate, this, std::placeholders::_1, std::placeholders::_2)); _server->addHandler(&_authenticationHandler); diff --git a/src/AuthSettingsService.h b/src/AuthSettingsService.h index 46e7444..cdbea15 100644 --- a/src/AuthSettingsService.h +++ b/src/AuthSettingsService.h @@ -8,10 +8,10 @@ #define AUTH_DEFAULT_SESSION_TIMEOUT 3600 #define AUTH_SETTINGS_FILE "/config/authSettings.json" -#define AUTH_SETTINGS_SERVICE_PATH "/authSettings" -#define AUTH_LOGOUT_PATH "/logout" -#define AUTH_AUTHENTICATE_PATH "/authenticate" +#define AUTH_SETTINGS_SERVICE_PATH "/rest/authSettings" +#define AUTH_LOGOUT_SERVICE_PATH "/rest/logout" +#define AUTH_AUTHENTICATE_SERVICE_PATH "/rest/authenticate" // max number of concurrently authenticated clients #define AUTH_MAX_CLIENTS 10 diff --git a/src/NTPSettingsService.h b/src/NTPSettingsService.h index 309deab..386385f 100644 --- a/src/NTPSettingsService.h +++ b/src/NTPSettingsService.h @@ -16,7 +16,7 @@ #define NTP_SETTINGS_MAX_INTERVAL 86400 #define NTP_SETTINGS_FILE "/config/ntpSettings.json" -#define NTP_SETTINGS_SERVICE_PATH "/ntpSettings" +#define NTP_SETTINGS_SERVICE_PATH "/rest/ntpSettings" class NTPSettingsService : public SettingsService { @@ -34,7 +34,7 @@ class NTPSettingsService : public SettingsService { void onConfigUpdated(); private: - + WiFiEventHandler _onStationModeDisconnectedHandler; WiFiEventHandler _onStationModeGotIPHandler; diff --git a/src/NTPStatus.cpp b/src/NTPStatus.cpp index 979c1d7..f4162a9 100644 --- a/src/NTPStatus.cpp +++ b/src/NTPStatus.cpp @@ -1,7 +1,7 @@ #include NTPStatus::NTPStatus(AsyncWebServer *server) : _server(server) { - _server->on("/ntpStatus", HTTP_GET, std::bind(&NTPStatus::ntpStatus, this, std::placeholders::_1)); + _server->on(NTP_STATUS_SERVICE_PATH, HTTP_GET, std::bind(&NTPStatus::ntpStatus, this, std::placeholders::_1)); } void NTPStatus::ntpStatus(AsyncWebServerRequest *request) { diff --git a/src/NTPStatus.h b/src/NTPStatus.h index 85f68d9..b9dfa00 100644 --- a/src/NTPStatus.h +++ b/src/NTPStatus.h @@ -9,6 +9,8 @@ #include #include +#define NTP_STATUS_SERVICE_PATH "/rest/ntpStatus" + class NTPStatus { public: diff --git a/src/OTASettingsService.h b/src/OTASettingsService.h index 0c3caa6..9e9fc8b 100644 --- a/src/OTASettingsService.h +++ b/src/OTASettingsService.h @@ -12,7 +12,7 @@ #define DEFAULT_OTA_PASSWORD "esp-react" #define OTA_SETTINGS_FILE "/config/otaSettings.json" -#define OTA_SETTINGS_SERVICE_PATH "/otaSettings" +#define OTA_SETTINGS_SERVICE_PATH "/rest/otaSettings" class OTASettingsService : public SettingsService { diff --git a/src/WiFiScanner.cpp b/src/WiFiScanner.cpp index 0cefcb5..7312fb7 100644 --- a/src/WiFiScanner.cpp +++ b/src/WiFiScanner.cpp @@ -1,8 +1,8 @@ #include WiFiScanner::WiFiScanner(AsyncWebServer *server) : _server(server) { - _server->on("/scanNetworks", HTTP_GET, std::bind(&WiFiScanner::scanNetworks, this, std::placeholders::_1)); - _server->on("/listNetworks", HTTP_GET, std::bind(&WiFiScanner::listNetworks, this, std::placeholders::_1)); + _server->on(SCAN_NETWORKS_SERVICE_PATH, HTTP_GET, std::bind(&WiFiScanner::scanNetworks, this, std::placeholders::_1)); + _server->on(LIST_NETWORKS_SERVICE_PATH, HTTP_GET, std::bind(&WiFiScanner::listNetworks, this, std::placeholders::_1)); } void WiFiScanner::scanNetworks(AsyncWebServerRequest *request) { diff --git a/src/WiFiScanner.h b/src/WiFiScanner.h index a434752..b94784b 100644 --- a/src/WiFiScanner.h +++ b/src/WiFiScanner.h @@ -8,6 +8,9 @@ #include #include +#define SCAN_NETWORKS_SERVICE_PATH "/rest/scanNetworks" +#define LIST_NETWORKS_SERVICE_PATH "/rest/listNetworks" + class WiFiScanner { public: diff --git a/src/WiFiSettingsService.h b/src/WiFiSettingsService.h index c7395ba..5838d74 100644 --- a/src/WiFiSettingsService.h +++ b/src/WiFiSettingsService.h @@ -5,7 +5,7 @@ #include #define WIFI_SETTINGS_FILE "/config/wifiSettings.json" -#define WIFI_SETTINGS_SERVICE_PATH "/wifiSettings" +#define WIFI_SETTINGS_SERVICE_PATH "/rest/wifiSettings" class WiFiSettingsService : public SettingsService { @@ -40,7 +40,7 @@ class WiFiSettingsService : public SettingsService { void readIP(JsonObject& root, String key, IPAddress& _ip); void writeIP(JsonObject& root, String key, IPAddress& _ip); - + }; #endif // end WiFiSettingsService_h diff --git a/src/WiFiStatus.cpp b/src/WiFiStatus.cpp index bd52f9e..c8ef066 100644 --- a/src/WiFiStatus.cpp +++ b/src/WiFiStatus.cpp @@ -1,7 +1,7 @@ #include WiFiStatus::WiFiStatus(AsyncWebServer *server) : _server(server) { - _server->on("/wifiStatus", HTTP_GET, std::bind(&WiFiStatus::wifiStatus, this, std::placeholders::_1)); + _server->on(WIFI_STATUS_SERVICE_PATH, HTTP_GET, std::bind(&WiFiStatus::wifiStatus, this, std::placeholders::_1)); _onStationModeConnectedHandler = WiFi.onStationModeConnected(onStationModeConnected); _onStationModeDisconnectedHandler = WiFi.onStationModeDisconnected(onStationModeDisconnected); diff --git a/src/WiFiStatus.h b/src/WiFiStatus.h index 916214a..15fed19 100644 --- a/src/WiFiStatus.h +++ b/src/WiFiStatus.h @@ -8,6 +8,8 @@ #include #include +#define WIFI_STATUS_SERVICE_PATH "/rest/wifiStatus" + class WiFiStatus { public: