[style](trx-rs): apply rustfmt formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -337,7 +337,6 @@ pub struct OwnerInfo {
|
||||
pub ais_vessel_url_base: Option<String>,
|
||||
}
|
||||
|
||||
|
||||
/// Virtual channel audio management.
|
||||
pub struct VChanContext {
|
||||
/// Per-virtual-channel Opus audio senders.
|
||||
|
||||
@@ -348,7 +348,7 @@ pub async fn events(
|
||||
let active_rig_id = query.remote.clone().filter(|s| !s.is_empty()).or_else(|| {
|
||||
context
|
||||
.routing
|
||||
.active_rig_id
|
||||
.active_rig_id
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|g| g.clone())
|
||||
@@ -425,7 +425,7 @@ pub async fn events(
|
||||
let rig_id_opt = session_rig_mgr.get_rig(session_id).or_else(|| {
|
||||
context
|
||||
.routing
|
||||
.active_rig_id
|
||||
.active_rig_id
|
||||
.lock()
|
||||
.ok()
|
||||
.and_then(|g| g.clone())
|
||||
@@ -448,9 +448,9 @@ pub async fn events(
|
||||
rig_id_opt.as_deref(),
|
||||
),
|
||||
};
|
||||
serde_json::to_string(&combined).ok().map(|json| {
|
||||
Ok::<Bytes, Error>(Bytes::from(format!("data: {json}\n\n")))
|
||||
})
|
||||
serde_json::to_string(&combined)
|
||||
.ok()
|
||||
.map(|json| Ok::<Bytes, Error>(Bytes::from(format!("data: {json}\n\n"))))
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -1357,7 +1357,12 @@ struct SatPassesResponse {
|
||||
/// are not yet available.
|
||||
#[get("/sat_passes")]
|
||||
pub async fn sat_passes(context: web::Data<Arc<FrontendRuntimeContext>>) -> impl Responder {
|
||||
let cached = context.routing.sat_passes.read().ok().and_then(|g| g.clone());
|
||||
let cached = context
|
||||
.routing
|
||||
.sat_passes
|
||||
.read()
|
||||
.ok()
|
||||
.and_then(|g| g.clone());
|
||||
match cached {
|
||||
Some(result) => {
|
||||
let error = match result.tle_source {
|
||||
@@ -1612,7 +1617,10 @@ fn static_asset_response(
|
||||
if val == etag || val == "*" {
|
||||
return HttpResponse::NotModified()
|
||||
.insert_header((header::ETAG, etag.to_owned()))
|
||||
.insert_header((header::CACHE_CONTROL, "public, max-age=86400, must-revalidate"))
|
||||
.insert_header((
|
||||
header::CACHE_CONTROL,
|
||||
"public, max-age=86400, must-revalidate",
|
||||
))
|
||||
.finish();
|
||||
}
|
||||
}
|
||||
@@ -1621,7 +1629,10 @@ fn static_asset_response(
|
||||
.insert_header((header::CONTENT_TYPE, content_type))
|
||||
.insert_header((header::CONTENT_ENCODING, "gzip"))
|
||||
.insert_header((header::ETAG, etag.to_owned()))
|
||||
.insert_header((header::CACHE_CONTROL, "public, max-age=86400, must-revalidate"))
|
||||
.insert_header((
|
||||
header::CACHE_CONTROL,
|
||||
"public, max-age=86400, must-revalidate",
|
||||
))
|
||||
.body(Bytes::copy_from_slice(gz_bytes))
|
||||
}
|
||||
|
||||
@@ -1652,9 +1663,21 @@ macro_rules! define_gz_cache {
|
||||
define_gz_cache!(gz_index_html, status::index_html(), "index.html");
|
||||
define_gz_cache!(gz_style_css, status::STYLE_CSS, "style.css");
|
||||
define_gz_cache!(gz_app_js, status::APP_JS, "app.js");
|
||||
define_gz_cache!(gz_decode_history_worker_js, status::DECODE_HISTORY_WORKER_JS, "decode-history-worker.js");
|
||||
define_gz_cache!(gz_webgl_renderer_js, status::WEBGL_RENDERER_JS, "webgl-renderer.js");
|
||||
define_gz_cache!(gz_leaflet_ais_tracksymbol_js, status::LEAFLET_AIS_TRACKSYMBOL_JS, "leaflet-ais-tracksymbol.js");
|
||||
define_gz_cache!(
|
||||
gz_decode_history_worker_js,
|
||||
status::DECODE_HISTORY_WORKER_JS,
|
||||
"decode-history-worker.js"
|
||||
);
|
||||
define_gz_cache!(
|
||||
gz_webgl_renderer_js,
|
||||
status::WEBGL_RENDERER_JS,
|
||||
"webgl-renderer.js"
|
||||
);
|
||||
define_gz_cache!(
|
||||
gz_leaflet_ais_tracksymbol_js,
|
||||
status::LEAFLET_AIS_TRACKSYMBOL_JS,
|
||||
"leaflet-ais-tracksymbol.js"
|
||||
);
|
||||
define_gz_cache!(gz_ais_js, status::AIS_JS, "ais.js");
|
||||
define_gz_cache!(gz_vdes_js, status::VDES_JS, "vdes.js");
|
||||
define_gz_cache!(gz_aprs_js, status::APRS_JS, "aprs.js");
|
||||
@@ -1667,8 +1690,16 @@ define_gz_cache!(gz_cw_js, status::CW_JS, "cw.js");
|
||||
define_gz_cache!(gz_sat_js, status::SAT_JS, "sat.js");
|
||||
define_gz_cache!(gz_bookmarks_js, status::BOOKMARKS_JS, "bookmarks.js");
|
||||
define_gz_cache!(gz_scheduler_js, status::SCHEDULER_JS, "scheduler.js");
|
||||
define_gz_cache!(gz_sat_scheduler_js, status::SAT_SCHEDULER_JS, "sat-scheduler.js");
|
||||
define_gz_cache!(gz_background_decode_js, status::BACKGROUND_DECODE_JS, "background-decode.js");
|
||||
define_gz_cache!(
|
||||
gz_sat_scheduler_js,
|
||||
status::SAT_SCHEDULER_JS,
|
||||
"sat-scheduler.js"
|
||||
);
|
||||
define_gz_cache!(
|
||||
gz_background_decode_js,
|
||||
status::BACKGROUND_DECODE_JS,
|
||||
"background-decode.js"
|
||||
);
|
||||
define_gz_cache!(gz_vchan_js, status::VCHAN_JS, "vchan.js");
|
||||
|
||||
/// A bookmark with its owning scope tag for the list response.
|
||||
@@ -2308,115 +2339,210 @@ async fn style_css(req: HttpRequest) -> impl Responder {
|
||||
#[get("/app.js")]
|
||||
async fn app_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_app_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/decode-history-worker.js")]
|
||||
async fn decode_history_worker_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_decode_history_worker_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/webgl-renderer.js")]
|
||||
async fn webgl_renderer_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_webgl_renderer_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/leaflet-ais-tracksymbol.js")]
|
||||
async fn leaflet_ais_tracksymbol_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_leaflet_ais_tracksymbol_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/aprs.js")]
|
||||
async fn aprs_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_aprs_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/hf-aprs.js")]
|
||||
async fn hf_aprs_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_hf_aprs_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/ais.js")]
|
||||
async fn ais_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_ais_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/vdes.js")]
|
||||
async fn vdes_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_vdes_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/ft8.js")]
|
||||
async fn ft8_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_ft8_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/ft4.js")]
|
||||
async fn ft4_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_ft4_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/ft2.js")]
|
||||
async fn ft2_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_ft2_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/wspr.js")]
|
||||
async fn wspr_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_wspr_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/cw.js")]
|
||||
async fn cw_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_cw_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/sat.js")]
|
||||
async fn sat_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_sat_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/bookmarks.js")]
|
||||
async fn bookmarks_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_bookmarks_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/scheduler.js")]
|
||||
async fn scheduler_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_scheduler_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/sat-scheduler.js")]
|
||||
async fn sat_scheduler_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_sat_scheduler_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/background-decode.js")]
|
||||
async fn background_decode_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_background_decode_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/vchan.js")]
|
||||
async fn vchan_js(req: HttpRequest) -> impl Responder {
|
||||
let c = gz_vchan_js();
|
||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
||||
static_asset_response(
|
||||
&req,
|
||||
"application/javascript; charset=utf-8",
|
||||
&c.gz,
|
||||
&c.etag,
|
||||
)
|
||||
}
|
||||
|
||||
/// Generic query extractor for endpoints that only need the optional remote.
|
||||
|
||||
@@ -126,7 +126,8 @@ fn record_ais(context: &FrontendRuntimeContext, mut msg: AisMessage) {
|
||||
}
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.ais
|
||||
.decode_history
|
||||
.ais
|
||||
.lock()
|
||||
.expect("ais history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -139,7 +140,8 @@ fn record_vdes(context: &FrontendRuntimeContext, mut msg: VdesMessage) {
|
||||
}
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.vdes
|
||||
.decode_history
|
||||
.vdes
|
||||
.lock()
|
||||
.expect("vdes history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -217,7 +219,8 @@ fn record_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
||||
}
|
||||
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.aprs
|
||||
.decode_history
|
||||
.aprs
|
||||
.lock()
|
||||
.expect("aprs history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, pkt));
|
||||
@@ -230,7 +233,8 @@ fn record_hf_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
||||
}
|
||||
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.hf_aprs
|
||||
.decode_history
|
||||
.hf_aprs
|
||||
.lock()
|
||||
.expect("hf_aprs history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, pkt));
|
||||
@@ -240,7 +244,8 @@ fn record_hf_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
||||
fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
||||
let rig_id = event.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.cw
|
||||
.decode_history
|
||||
.cw
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, event));
|
||||
@@ -250,7 +255,8 @@ fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
||||
fn record_ft8(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.ft8
|
||||
.decode_history
|
||||
.ft8
|
||||
.lock()
|
||||
.expect("ft8 history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -260,7 +266,8 @@ fn record_ft8(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
fn record_ft4(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.ft4
|
||||
.decode_history
|
||||
.ft4
|
||||
.lock()
|
||||
.expect("ft4 history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -270,7 +277,8 @@ fn record_ft4(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
fn record_ft2(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.ft2
|
||||
.decode_history
|
||||
.ft2
|
||||
.lock()
|
||||
.expect("ft2 history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -280,7 +288,8 @@ fn record_ft2(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||
fn record_wspr(context: &FrontendRuntimeContext, msg: WsprMessage) {
|
||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||
let mut history = context
|
||||
.decode_history.wspr
|
||||
.decode_history
|
||||
.wspr
|
||||
.lock()
|
||||
.expect("wspr history mutex poisoned");
|
||||
history.push_back((Instant::now(), rig_id, msg));
|
||||
@@ -301,7 +310,8 @@ pub fn snapshot_aprs_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<AprsPacket> {
|
||||
let mut history = context
|
||||
.decode_history.aprs
|
||||
.decode_history
|
||||
.aprs
|
||||
.lock()
|
||||
.expect("aprs history mutex poisoned");
|
||||
prune_aprs_history(context, &mut history);
|
||||
@@ -317,7 +327,8 @@ pub fn snapshot_hf_aprs_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<AprsPacket> {
|
||||
let mut history = context
|
||||
.decode_history.hf_aprs
|
||||
.decode_history
|
||||
.hf_aprs
|
||||
.lock()
|
||||
.expect("hf_aprs history mutex poisoned");
|
||||
prune_hf_aprs_history(context, &mut history);
|
||||
@@ -340,7 +351,8 @@ pub fn snapshot_ais_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<AisMessage> {
|
||||
let mut history = context
|
||||
.decode_history.ais
|
||||
.decode_history
|
||||
.ais
|
||||
.lock()
|
||||
.expect("ais history mutex poisoned");
|
||||
prune_ais_history(context, &mut history);
|
||||
@@ -362,7 +374,8 @@ pub fn snapshot_vdes_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<VdesMessage> {
|
||||
let mut history = context
|
||||
.decode_history.vdes
|
||||
.decode_history
|
||||
.vdes
|
||||
.lock()
|
||||
.expect("vdes history mutex poisoned");
|
||||
prune_vdes_history(context, &mut history);
|
||||
@@ -378,7 +391,8 @@ pub fn snapshot_cw_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<CwEvent> {
|
||||
let mut history = context
|
||||
.decode_history.cw
|
||||
.decode_history
|
||||
.cw
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
prune_cw_history(context, &mut history);
|
||||
@@ -394,7 +408,8 @@ pub fn snapshot_ft8_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<Ft8Message> {
|
||||
let mut history = context
|
||||
.decode_history.ft8
|
||||
.decode_history
|
||||
.ft8
|
||||
.lock()
|
||||
.expect("ft8 history mutex poisoned");
|
||||
prune_ft8_history(context, &mut history);
|
||||
@@ -410,7 +425,8 @@ pub fn snapshot_ft4_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<Ft8Message> {
|
||||
let mut history = context
|
||||
.decode_history.ft4
|
||||
.decode_history
|
||||
.ft4
|
||||
.lock()
|
||||
.expect("ft4 history mutex poisoned");
|
||||
prune_ft4_history(context, &mut history);
|
||||
@@ -426,7 +442,8 @@ pub fn snapshot_ft2_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<Ft8Message> {
|
||||
let mut history = context
|
||||
.decode_history.ft2
|
||||
.decode_history
|
||||
.ft2
|
||||
.lock()
|
||||
.expect("ft2 history mutex poisoned");
|
||||
prune_ft2_history(context, &mut history);
|
||||
@@ -442,7 +459,8 @@ pub fn snapshot_wspr_history(
|
||||
rig_filter: Option<&str>,
|
||||
) -> Vec<WsprMessage> {
|
||||
let mut history = context
|
||||
.decode_history.wspr
|
||||
.decode_history
|
||||
.wspr
|
||||
.lock()
|
||||
.expect("wspr history mutex poisoned");
|
||||
prune_wspr_history(context, &mut history);
|
||||
@@ -455,7 +473,8 @@ pub fn snapshot_wspr_history(
|
||||
|
||||
pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.aprs
|
||||
.decode_history
|
||||
.aprs
|
||||
.lock()
|
||||
.expect("aprs history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -463,7 +482,8 @@ pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_hf_aprs_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.hf_aprs
|
||||
.decode_history
|
||||
.hf_aprs
|
||||
.lock()
|
||||
.expect("hf_aprs history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -471,7 +491,8 @@ pub fn clear_hf_aprs_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_ais_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.ais
|
||||
.decode_history
|
||||
.ais
|
||||
.lock()
|
||||
.expect("ais history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -479,7 +500,8 @@ pub fn clear_ais_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_vdes_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.vdes
|
||||
.decode_history
|
||||
.vdes
|
||||
.lock()
|
||||
.expect("vdes history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -487,7 +509,8 @@ pub fn clear_vdes_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.cw
|
||||
.decode_history
|
||||
.cw
|
||||
.lock()
|
||||
.expect("cw history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -495,7 +518,8 @@ pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_ft8_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.ft8
|
||||
.decode_history
|
||||
.ft8
|
||||
.lock()
|
||||
.expect("ft8 history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -503,7 +527,8 @@ pub fn clear_ft8_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_ft4_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.ft4
|
||||
.decode_history
|
||||
.ft4
|
||||
.lock()
|
||||
.expect("ft4 history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -511,7 +536,8 @@ pub fn clear_ft4_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_ft2_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.ft2
|
||||
.decode_history
|
||||
.ft2
|
||||
.lock()
|
||||
.expect("ft2 history mutex poisoned");
|
||||
history.clear();
|
||||
@@ -519,7 +545,8 @@ pub fn clear_ft2_history(context: &FrontendRuntimeContext) {
|
||||
|
||||
pub fn clear_wspr_history(context: &FrontendRuntimeContext) {
|
||||
let mut history = context
|
||||
.decode_history.wspr
|
||||
.decode_history
|
||||
.wspr
|
||||
.lock()
|
||||
.expect("wspr history mutex poisoned");
|
||||
history.clear();
|
||||
|
||||
@@ -6,8 +6,8 @@ use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::RwLock;
|
||||
use std::time::Duration;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use actix_web::{delete, get, put, web, HttpResponse, Responder};
|
||||
use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod};
|
||||
@@ -183,7 +183,10 @@ impl BackgroundDecodeManager {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn put_config(&self, mut config: BackgroundDecodeConfig) -> Option<BackgroundDecodeConfig> {
|
||||
pub async fn put_config(
|
||||
&self,
|
||||
mut config: BackgroundDecodeConfig,
|
||||
) -> Option<BackgroundDecodeConfig> {
|
||||
config.bookmark_ids = dedup_ids(&config.bookmark_ids);
|
||||
if self.store.upsert(&config).await {
|
||||
self.trigger();
|
||||
|
||||
Reference in New Issue
Block a user