This commit is contained in:
Mateusz Gruszczyński
2026-09-16 16:56:13 +02:00
parent 143ff0d272
commit 1862fed87f
27 changed files with 1368 additions and 178 deletions
+8 -2
View File
@@ -23,7 +23,7 @@ use axum::{
body::Body,
extract::{
ws::{Message, WebSocket},
Path, Query, Request, State, WebSocketUpgrade,
ConnectInfo, Path, Query, Request, State, WebSocketUpgrade,
},
http::{header, HeaderMap, HeaderValue, StatusCode},
middleware::{self, Next},
@@ -39,7 +39,7 @@ use serde::Deserialize;
use serde_json::{json, Value};
use sha2::{Digest, Sha256};
use std::{
net::IpAddr,
net::{IpAddr, SocketAddr},
sync::atomic::Ordering,
time::{Duration, Instant},
};
@@ -49,6 +49,8 @@ use uuid::Uuid;
mod openapi;
const INDEX_HTML: &str = include_str!("../web/index.html");
const CUSTOM_CHART_HTML: &str = include_str!("../web/custom-chart.html");
const CUSTOM_CHART_JS: &str = include_str!("../web/custom-chart.js");
const NOT_FOUND_HTML: &str = include_str!("../web/404.html");
const APP_JS: &str = include_str!(concat!(env!("OUT_DIR"), "/app.bundle.js"));
const THEME_INIT_JS: &str = include_str!("../web/theme-init.js");
@@ -156,6 +158,7 @@ pub fn router(state: AppState) -> Router {
)
.route("/api/readings", get(readings))
.route("/api/history", get(history))
.route("/api/charts/custom/share", post(create_public_custom_chart))
.route("/api/history/energy", get(energy_history))
.route("/api/history/network", get(network_history))
.route("/api/control-plan", get(control_plan))
@@ -300,6 +303,9 @@ pub fn router(state: AppState) -> Router {
let mut app = Router::new()
.route("/api/health", get(health))
.route("/api/public/charts/custom/:token", get(public_custom_chart))
.route("/charts/custom/:token", get(custom_chart_page))
.route("/custom-chart.js", get(custom_chart_js))
.route("/ws", get(websocket))
.route("/", get(index))
.route("/index.html", get(index))