prefix all endpoints with /rest
This commit is contained in:
parent
1d2284068a
commit
b6bc520341
@ -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 {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <APStatus.h>
|
||||
|
||||
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) {
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
#define AP_STATUS_SERVICE_PATH "/rest/apStatus"
|
||||
|
||||
class APStatus {
|
||||
|
||||
public:
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <AuthSettingsService.h>
|
||||
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <NTPStatus.h>
|
||||
|
||||
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) {
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <TimeLib.h>
|
||||
#include <NtpClientLib.h>
|
||||
|
||||
#define NTP_STATUS_SERVICE_PATH "/rest/ntpStatus"
|
||||
|
||||
class NTPStatus {
|
||||
|
||||
public:
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <WiFiScanner.h>
|
||||
|
||||
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) {
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <TimeLib.h>
|
||||
|
||||
#define SCAN_NETWORKS_SERVICE_PATH "/rest/scanNetworks"
|
||||
#define LIST_NETWORKS_SERVICE_PATH "/rest/listNetworks"
|
||||
|
||||
class WiFiScanner {
|
||||
|
||||
public:
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <SettingsService.h>
|
||||
|
||||
#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
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <WiFiStatus.h>
|
||||
|
||||
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);
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
#define WIFI_STATUS_SERVICE_PATH "/rest/wifiStatus"
|
||||
|
||||
class WiFiStatus {
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user