[style](trx-rs): apply rustfmt formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -4,15 +4,12 @@
|
||||
|
||||
//! Static asset serving endpoints (HTML pages, JS, CSS, favicon, logo).
|
||||
|
||||
use actix_web::{get, HttpRequest, HttpResponse, Responder};
|
||||
use actix_web::http::header;
|
||||
use actix_web::{get, HttpRequest, HttpResponse, Responder};
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use super::{gz_cache_entry, static_asset_response, GzCacheEntry, FAVICON_BYTES, LOGO_BYTES};
|
||||
use crate::server::status;
|
||||
use super::{
|
||||
static_asset_response, GzCacheEntry, gz_cache_entry,
|
||||
FAVICON_BYTES, LOGO_BYTES,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Pre-compressed asset caches
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse};
|
||||
use actix_web::Error;
|
||||
use actix_web::{delete, get, post, put, web, HttpRequest, HttpResponse};
|
||||
|
||||
use super::{no_cache_response, request_accepts_html, require_control};
|
||||
use crate::server::status;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{get, post, web, HttpResponse, Responder};
|
||||
use actix_web::Error;
|
||||
use actix_web::http::header;
|
||||
use actix_web::Error;
|
||||
use actix_web::{get, post, web, HttpResponse, Responder};
|
||||
use bytes::Bytes;
|
||||
use futures_util::stream::{select, StreamExt};
|
||||
use tokio::sync::{broadcast, mpsc, watch};
|
||||
|
||||
@@ -902,7 +902,9 @@ mod tests {
|
||||
)
|
||||
.await;
|
||||
|
||||
let req = actix_test::TestRequest::post().uri("/set_freq").to_request();
|
||||
let req = actix_test::TestRequest::post()
|
||||
.uri("/set_freq")
|
||||
.to_request();
|
||||
let resp = actix_test::call_service(&app, req).await;
|
||||
assert_eq!(resp.status(), 400);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{get, web, HttpResponse};
|
||||
use actix_web::Error;
|
||||
use actix_web::http::header;
|
||||
use actix_web::Error;
|
||||
use actix_web::{get, web, HttpResponse};
|
||||
use bytes::Bytes;
|
||||
use futures_util::stream::{select, StreamExt};
|
||||
use tokio::sync::{broadcast, watch};
|
||||
@@ -23,8 +23,8 @@ use trx_frontend::FrontendRuntimeContext;
|
||||
use crate::server::vchan::ClientChannelManager;
|
||||
|
||||
use super::{
|
||||
base64_encode, frontend_meta_from_context, wait_for_view,
|
||||
RemoteQuery, SessionRigManager, SnapshotWithMeta,
|
||||
base64_encode, frontend_meta_from_context, wait_for_view, RemoteQuery, SessionRigManager,
|
||||
SnapshotWithMeta,
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use actix_web::{delete, get, post, put, web, HttpResponse, Responder};
|
||||
use actix_web::Error;
|
||||
use actix_web::{delete, get, post, put, web, HttpResponse, Responder};
|
||||
use tokio::sync::mpsc;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
@@ -563,9 +563,7 @@ fn evaluate_bookmark(
|
||||
};
|
||||
}
|
||||
if !enabled {
|
||||
return ChannelAction::Skip {
|
||||
reason: "disabled",
|
||||
};
|
||||
return ChannelAction::Skip { reason: "disabled" };
|
||||
}
|
||||
if !users_connected {
|
||||
return ChannelAction::Skip {
|
||||
@@ -702,15 +700,15 @@ mod tests {
|
||||
#[test]
|
||||
fn active_when_all_conditions_met() {
|
||||
let action = evaluate_bookmark(
|
||||
false, // decoder_kinds_empty
|
||||
true, // enabled
|
||||
true, // users_connected
|
||||
false, // scheduler_has_control
|
||||
false, // decoder_kinds_empty
|
||||
true, // enabled
|
||||
true, // users_connected
|
||||
false, // scheduler_has_control
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false, // vchan_covers_bookmark
|
||||
false, // vchan_covers_bookmark
|
||||
Some((14_074_000, 96_000)), // spectrum_span (center, half)
|
||||
14_074_000, // freq_hz
|
||||
14_074_000, // freq_hz
|
||||
);
|
||||
assert_eq!(action, ChannelAction::Active);
|
||||
}
|
||||
@@ -718,8 +716,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_no_supported_decoders() {
|
||||
let action = evaluate_bookmark(
|
||||
true, true, true, false, &empty_scheduled(), "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -732,8 +737,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_disabled() {
|
||||
let action = evaluate_bookmark(
|
||||
false, false, true, false, &empty_scheduled(), "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(action, ChannelAction::Skip { reason: "disabled" });
|
||||
}
|
||||
@@ -741,8 +753,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_waiting_for_user() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, false, false, &empty_scheduled(), "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -755,8 +774,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_scheduler_has_control() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, true, &empty_scheduled(), "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -771,8 +797,15 @@ mod tests {
|
||||
let mut scheduled = HashSet::new();
|
||||
scheduled.insert("bm1".to_string());
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, false, &scheduled, "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&scheduled,
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -785,8 +818,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_handled_by_virtual_channel() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, false, &empty_scheduled(), "bm1", true,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
true,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -799,8 +839,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_waiting_for_spectrum() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, false, &empty_scheduled(), "bm1", false,
|
||||
None, 14_074_000,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
None,
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -813,9 +860,15 @@ mod tests {
|
||||
#[test]
|
||||
fn skip_out_of_span() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, false, &empty_scheduled(), "bm1", false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)), // center 14.074 MHz, half span 96 kHz
|
||||
7_074_000, // way outside the span
|
||||
7_074_000, // way outside the span
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
@@ -828,7 +881,13 @@ mod tests {
|
||||
#[test]
|
||||
fn active_at_edge_of_span() {
|
||||
let action = evaluate_bookmark(
|
||||
false, true, true, false, &empty_scheduled(), "bm1", false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000 + 96_000, // exactly at the edge
|
||||
);
|
||||
@@ -839,8 +898,15 @@ mod tests {
|
||||
fn priority_no_decoders_over_disabled() {
|
||||
// Even if disabled, "no_supported_decoders" should take precedence
|
||||
let action = evaluate_bookmark(
|
||||
true, false, true, false, &empty_scheduled(), "bm1", false,
|
||||
Some((14_074_000, 96_000)), 14_074_000,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
&empty_scheduled(),
|
||||
"bm1",
|
||||
false,
|
||||
Some((14_074_000, 96_000)),
|
||||
14_074_000,
|
||||
);
|
||||
assert_eq!(
|
||||
action,
|
||||
|
||||
Reference in New Issue
Block a user