Add login function

TODO ws request auth

Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
This commit is contained in:
2025-09-26 11:35:10 +09:00
parent 6606be456b
commit 6be0512146
11 changed files with 604 additions and 55 deletions

View File

@@ -5,9 +5,15 @@
#include "freertos/FreeRTOS.h"
#include "sw.h"
#include "webserver.h"
#include "auth.h"
static esp_err_t control_get_handler(httpd_req_t* req)
{
esp_err_t err = api_auth_check(req);
if (err != ESP_OK) {
return err;
}
cJSON* root = cJSON_CreateObject();
cJSON_AddBoolToObject(root, "load_12v_on", get_main_load_switch());
@@ -25,6 +31,11 @@ static esp_err_t control_get_handler(httpd_req_t* req)
static esp_err_t control_post_handler(httpd_req_t* req)
{
esp_err_t err = api_auth_check(req);
if (err != ESP_OK) {
return err;
}
char buf[128];
int ret, remaining = req->content_len;