[refactor](workspace): complete remaining architecture phases
Bundle all pending repository updates, including plugin context de-globalization, runtime hardening, config validation, boundary tests, and supporting docs/scripts. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -13,11 +13,11 @@ use tokio::sync::{broadcast, mpsc, oneshot, watch};
|
||||
use tokio::time::{self, Duration};
|
||||
use tokio_stream::wrappers::{IntervalStream, WatchStream};
|
||||
|
||||
use trx_frontend::FrontendRuntimeContext;
|
||||
use trx_protocol::{ClientResponse, parse_mode};
|
||||
use trx_core::radio::freq::Freq;
|
||||
use trx_core::rig::{RigAccessMethod, RigCapabilities, RigInfo};
|
||||
use trx_core::{RigCommand, RigRequest, RigSnapshot, RigState};
|
||||
use trx_frontend::FrontendRuntimeContext;
|
||||
use trx_protocol::{parse_mode, ClientResponse};
|
||||
|
||||
use crate::server::status;
|
||||
|
||||
@@ -450,28 +450,40 @@ async fn style_css() -> impl Responder {
|
||||
#[get("/app.js")]
|
||||
async fn app_js() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.insert_header((header::CONTENT_TYPE, "application/javascript; charset=utf-8"))
|
||||
.insert_header((
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
))
|
||||
.body(status::APP_JS)
|
||||
}
|
||||
|
||||
#[get("/aprs.js")]
|
||||
async fn aprs_js() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.insert_header((header::CONTENT_TYPE, "application/javascript; charset=utf-8"))
|
||||
.insert_header((
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
))
|
||||
.body(status::APRS_JS)
|
||||
}
|
||||
|
||||
#[get("/ft8.js")]
|
||||
async fn ft8_js() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.insert_header((header::CONTENT_TYPE, "application/javascript; charset=utf-8"))
|
||||
.insert_header((
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
))
|
||||
.body(status::FT8_JS)
|
||||
}
|
||||
|
||||
#[get("/cw.js")]
|
||||
async fn cw_js() -> impl Responder {
|
||||
HttpResponse::Ok()
|
||||
.insert_header((header::CONTENT_TYPE, "application/javascript; charset=utf-8"))
|
||||
.insert_header((
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
))
|
||||
.body(status::CW_JS)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
//! - Browser sends binary messages: raw Opus packets (TX)
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use actix_web::{Error, HttpRequest, HttpResponse, get, web};
|
||||
use actix_web::{get, web, Error, HttpRequest, HttpResponse};
|
||||
use actix_ws::Message;
|
||||
use bytes::Bytes;
|
||||
use tokio::sync::broadcast;
|
||||
@@ -62,7 +62,10 @@ fn record_aprs(context: &FrontendRuntimeContext, pkt: AprsPacket) {
|
||||
}
|
||||
|
||||
fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
||||
let mut history = context.cw_history.lock().expect("cw history mutex poisoned");
|
||||
let mut history = context
|
||||
.cw_history
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
history.push_back((Instant::now(), event));
|
||||
prune_cw_history(&mut history);
|
||||
}
|
||||
@@ -86,7 +89,10 @@ pub fn snapshot_aprs_history(context: &FrontendRuntimeContext) -> Vec<AprsPacket
|
||||
}
|
||||
|
||||
pub fn snapshot_cw_history(context: &FrontendRuntimeContext) -> Vec<CwEvent> {
|
||||
let mut history = context.cw_history.lock().expect("cw history mutex poisoned");
|
||||
let mut history = context
|
||||
.cw_history
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
prune_cw_history(&mut history);
|
||||
history.iter().map(|(_, evt)| evt.clone()).collect()
|
||||
}
|
||||
@@ -109,7 +115,10 @@ pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
||||
}
|
||||
|
||||
pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context.cw_history.lock().expect("cw history mutex poisoned");
|
||||
let mut history = context
|
||||
.cw_history
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
history.clear();
|
||||
}
|
||||
|
||||
@@ -128,7 +137,10 @@ pub fn subscribe_decode(
|
||||
}
|
||||
|
||||
pub fn start_decode_history_collector(context: Arc<FrontendRuntimeContext>) {
|
||||
if context.decode_collector_started.swap(true, Ordering::AcqRel) {
|
||||
if context
|
||||
.decode_collector_started
|
||||
.swap(true, Ordering::AcqRel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,3 @@ pub fn register_frontend_on(context: &mut trx_frontend::FrontendRegistrationCont
|
||||
use trx_frontend::FrontendSpawner;
|
||||
context.register_frontend("http", server::HttpFrontend::spawn_frontend);
|
||||
}
|
||||
|
||||
pub fn register_frontend() {
|
||||
use trx_frontend::FrontendSpawner;
|
||||
trx_frontend::register_frontend("http", server::HttpFrontend::spawn_frontend);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use tracing::{error, info};
|
||||
|
||||
use trx_core::RigRequest;
|
||||
use trx_core::RigState;
|
||||
use trx_frontend::{FrontendSpawner, FrontendRuntimeContext};
|
||||
use trx_frontend::{FrontendRuntimeContext, FrontendSpawner};
|
||||
|
||||
/// HTTP frontend implementation.
|
||||
pub struct HttpFrontend;
|
||||
|
||||
Reference in New Issue
Block a user