This commit is contained in:
Mateusz Gruszczyński
2026-09-18 10:27:39 +02:00
parent 7d9e6c8189
commit 3ffb02595e
28 changed files with 610 additions and 480 deletions
+1 -2
View File
@@ -99,7 +99,6 @@ fn hash_token(token: &str) -> String {
fn generate_access_token() -> String {
let mut bytes = [0u8; 32];
let mut rng = OsRng;
rng.fill_bytes(&mut bytes);
rand::fill(&mut bytes);
format!("gree_controller_{}", URL_SAFE_NO_PAD.encode(bytes))
}
+1 -2
View File
@@ -550,8 +550,7 @@ fn validate_public_chart_spec(series: &[String]) -> Result<(), AppError> {
fn generate_public_chart_token() -> String {
let mut bytes = [0u8; 32];
let mut rng = OsRng;
rng.fill_bytes(&mut bytes);
rand::fill(&mut bytes);
format!("chart_{}", URL_SAFE_NO_PAD.encode(bytes))
}
+2 -4
View File
@@ -12,10 +12,8 @@ pub(super) fn swagger_ui(base_path: &str) -> SwaggerUi {
.external_url_unchecked("/api-docs/openapi.json", document(base_path))
.config(
SwaggerConfig::new([docs_url])
.filter(true)
.try_it_out_enabled(true)
.display_request_duration(true)
.persist_authorization(true),
.doc_expansion("none")
.default_models_expand_depth(-1),
)
}
+3 -3
View File
@@ -47,7 +47,7 @@ async fn send_ws_bootstrap(state: &AppState, socket: &mut WebSocket) -> Result<O
),
};
socket
.send(Message::Text(message.to_string()))
.send(Message::Text(message.to_string().into()))
.await
.map_err(|_| ())?;
Ok(revision)
@@ -81,7 +81,7 @@ async fn websocket_loop(state: AppState, mut socket: WebSocket) {
match event {
Ok(event) => {
if let Ok(text) = serde_json::to_string(&event) {
if socket.send(Message::Text(text)).await.is_err() { break; }
if socket.send(Message::Text(text.into())).await.is_err() { break; }
}
}
Err(tokio::sync::broadcast::error::RecvError::Lagged(skipped)) => {
@@ -105,7 +105,7 @@ async fn websocket_loop(state: AppState, mut socket: WebSocket) {
continue;
}
let text = control_plan_ws_message(snapshot.as_ref()).to_string();
if socket.send(Message::Text(text)).await.is_err() { break; }
if socket.send(Message::Text(text.into())).await.is_err() { break; }
last_control_plan_revision = Some(snapshot.revision);
}
}