[fix](trx-frontend-http): drop rig_id http aliases
Remove the remaining legacy rig_id aliases across the HTTP frontend and use remote consistently for scheduler and audio requests. Disable browser caching for the HTML, CSS, and JS assets so clients pick up the parameter rename immediately instead of running stale frontend code. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -137,7 +137,6 @@ pub type SharedSessionRigManager = Arc<SessionRigManager>;
|
|||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct StatusQuery {
|
pub struct StatusQuery {
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +339,6 @@ fn decode_history_retention_min_from_context(context: &FrontendRuntimeContext) -
|
|||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct EventsQuery {
|
pub struct EventsQuery {
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,7 +906,6 @@ pub async fn unlock_panel(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct FreqQuery {
|
pub struct FreqQuery {
|
||||||
pub hz: u64,
|
pub hz: u64,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,7 +935,6 @@ pub async fn set_center_freq(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct ModeQuery {
|
pub struct ModeQuery {
|
||||||
pub mode: String,
|
pub mode: String,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -955,7 +951,6 @@ pub async fn set_mode(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct PttQuery {
|
pub struct PttQuery {
|
||||||
pub ptt: String,
|
pub ptt: String,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -978,7 +973,6 @@ pub async fn set_ptt(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct TxLimitQuery {
|
pub struct TxLimitQuery {
|
||||||
pub limit: u8,
|
pub limit: u8,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,7 +988,6 @@ pub async fn set_tx_limit(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct BandwidthQuery {
|
pub struct BandwidthQuery {
|
||||||
pub hz: u32,
|
pub hz: u32,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,7 +1003,6 @@ pub async fn set_bandwidth(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct SdrGainQuery {
|
pub struct SdrGainQuery {
|
||||||
pub db: f64,
|
pub db: f64,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1026,7 +1018,6 @@ pub async fn set_sdr_gain(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct SdrLnaGainQuery {
|
pub struct SdrLnaGainQuery {
|
||||||
pub db: f64,
|
pub db: f64,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1042,7 +1033,6 @@ pub async fn set_sdr_lna_gain(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct SdrAgcQuery {
|
pub struct SdrAgcQuery {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,7 +1049,6 @@ pub async fn set_sdr_agc(
|
|||||||
pub struct SdrSquelchQuery {
|
pub struct SdrSquelchQuery {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub threshold_db: f64,
|
pub threshold_db: f64,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1084,7 +1073,6 @@ pub async fn set_sdr_squelch(
|
|||||||
pub struct SdrNoiseBlankerQuery {
|
pub struct SdrNoiseBlankerQuery {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub threshold: f64,
|
pub threshold: f64,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1108,7 +1096,6 @@ pub async fn set_sdr_noise_blanker(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct WfmDeemphasisQuery {
|
pub struct WfmDeemphasisQuery {
|
||||||
pub us: u32,
|
pub us: u32,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1124,7 +1111,6 @@ pub async fn set_wfm_deemphasis(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct WfmStereoQuery {
|
pub struct WfmStereoQuery {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,7 +1126,6 @@ pub async fn set_wfm_stereo(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct WfmDenoiseQuery {
|
pub struct WfmDenoiseQuery {
|
||||||
pub level: WfmDenoiseLevel,
|
pub level: WfmDenoiseLevel,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,7 +1186,6 @@ pub async fn toggle_cw_decode(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct CwAutoQuery {
|
pub struct CwAutoQuery {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1217,7 +1201,6 @@ pub async fn set_cw_auto(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct CwWpmQuery {
|
pub struct CwWpmQuery {
|
||||||
pub wpm: u32,
|
pub wpm: u32,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1233,7 +1216,6 @@ pub async fn set_cw_wpm(
|
|||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct CwToneQuery {
|
pub struct CwToneQuery {
|
||||||
pub tone_hz: u32,
|
pub tone_hz: u32,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1484,6 +1466,18 @@ fn request_accepts_html(req: &HttpRequest) -> bool {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn no_cache_response<B>(content_type: &'static str, body: B) -> HttpResponse
|
||||||
|
where
|
||||||
|
B: actix_web::body::MessageBody + 'static,
|
||||||
|
{
|
||||||
|
HttpResponse::Ok()
|
||||||
|
.insert_header((header::CONTENT_TYPE, content_type))
|
||||||
|
.insert_header((header::CACHE_CONTROL, "no-cache, no-store, must-revalidate"))
|
||||||
|
.insert_header((header::PRAGMA, "no-cache"))
|
||||||
|
.insert_header((header::EXPIRES, "0"))
|
||||||
|
.body(body)
|
||||||
|
}
|
||||||
|
|
||||||
#[get("/bookmarks")]
|
#[get("/bookmarks")]
|
||||||
pub async fn list_bookmarks(
|
pub async fn list_bookmarks(
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
@@ -1491,9 +1485,10 @@ pub async fn list_bookmarks(
|
|||||||
query: web::Query<BookmarkQuery>,
|
query: web::Query<BookmarkQuery>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
if request_accepts_html(&req) {
|
if request_accepts_html(&req) {
|
||||||
return Ok(HttpResponse::Ok()
|
return Ok(no_cache_response(
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
"text/html; charset=utf-8",
|
||||||
.body(status::index_html()));
|
status::index_html(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
let mut list = store.list();
|
let mut list = store.list();
|
||||||
if let Some(ref cat) = query.category {
|
if let Some(ref cat) = query.category {
|
||||||
@@ -1658,7 +1653,6 @@ pub async fn list_rigs(
|
|||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct SelectRigQuery {
|
pub struct SelectRigQuery {
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: String,
|
pub remote: String,
|
||||||
pub session_id: Option<String>,
|
pub session_id: Option<String>,
|
||||||
}
|
}
|
||||||
@@ -1957,37 +1951,27 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
|||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
async fn index() -> impl Responder {
|
async fn index() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/html; charset=utf-8", status::index_html())
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
|
||||||
.body(status::index_html())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/map")]
|
#[get("/map")]
|
||||||
async fn map_index() -> impl Responder {
|
async fn map_index() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/html; charset=utf-8", status::index_html())
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
|
||||||
.body(status::index_html())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/decoders")]
|
#[get("/decoders")]
|
||||||
async fn decoders_index() -> impl Responder {
|
async fn decoders_index() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/html; charset=utf-8", status::index_html())
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
|
||||||
.body(status::index_html())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/settings")]
|
#[get("/settings")]
|
||||||
async fn settings_index() -> impl Responder {
|
async fn settings_index() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/html; charset=utf-8", status::index_html())
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
|
||||||
.body(status::index_html())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/about")]
|
#[get("/about")]
|
||||||
async fn about_index() -> impl Responder {
|
async fn about_index() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/html; charset=utf-8", status::index_html())
|
||||||
.insert_header((header::CONTENT_TYPE, "text/html; charset=utf-8"))
|
|
||||||
.body(status::index_html())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/favicon.ico")]
|
#[get("/favicon.ico")]
|
||||||
@@ -2013,185 +1997,115 @@ async fn logo() -> impl Responder {
|
|||||||
|
|
||||||
#[get("/style.css")]
|
#[get("/style.css")]
|
||||||
async fn style_css() -> impl Responder {
|
async fn style_css() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("text/css; charset=utf-8", status::STYLE_CSS)
|
||||||
.insert_header((header::CONTENT_TYPE, "text/css; charset=utf-8"))
|
|
||||||
.body(status::STYLE_CSS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/app.js")]
|
#[get("/app.js")]
|
||||||
async fn app_js() -> impl Responder {
|
async fn app_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::APP_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::APP_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/decode-history-worker.js")]
|
#[get("/decode-history-worker.js")]
|
||||||
async fn decode_history_worker_js() -> impl Responder {
|
async fn decode_history_worker_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::DECODE_HISTORY_WORKER_JS,
|
||||||
.body(status::DECODE_HISTORY_WORKER_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/webgl-renderer.js")]
|
#[get("/webgl-renderer.js")]
|
||||||
async fn webgl_renderer_js() -> impl Responder {
|
async fn webgl_renderer_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::WEBGL_RENDERER_JS,
|
||||||
.body(status::WEBGL_RENDERER_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/leaflet-ais-tracksymbol.js")]
|
#[get("/leaflet-ais-tracksymbol.js")]
|
||||||
async fn leaflet_ais_tracksymbol_js() -> impl Responder {
|
async fn leaflet_ais_tracksymbol_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::LEAFLET_AIS_TRACKSYMBOL_JS,
|
||||||
.body(status::LEAFLET_AIS_TRACKSYMBOL_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/aprs.js")]
|
#[get("/aprs.js")]
|
||||||
async fn aprs_js() -> impl Responder {
|
async fn aprs_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::APRS_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::APRS_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/hf-aprs.js")]
|
#[get("/hf-aprs.js")]
|
||||||
async fn hf_aprs_js() -> impl Responder {
|
async fn hf_aprs_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::HF_APRS_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::HF_APRS_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ais.js")]
|
#[get("/ais.js")]
|
||||||
async fn ais_js() -> impl Responder {
|
async fn ais_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::AIS_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::AIS_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/vdes.js")]
|
#[get("/vdes.js")]
|
||||||
async fn vdes_js() -> impl Responder {
|
async fn vdes_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::VDES_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::VDES_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft8.js")]
|
#[get("/ft8.js")]
|
||||||
async fn ft8_js() -> impl Responder {
|
async fn ft8_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::FT8_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::FT8_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft4.js")]
|
#[get("/ft4.js")]
|
||||||
async fn ft4_js() -> impl Responder {
|
async fn ft4_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::FT4_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::FT4_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft2.js")]
|
#[get("/ft2.js")]
|
||||||
async fn ft2_js() -> impl Responder {
|
async fn ft2_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::FT2_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::FT2_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/wspr.js")]
|
#[get("/wspr.js")]
|
||||||
async fn wspr_js() -> impl Responder {
|
async fn wspr_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::WSPR_JS)
|
||||||
.content_type("application/javascript; charset=utf-8")
|
|
||||||
.insert_header((header::CACHE_CONTROL, "no-cache, no-store, must-revalidate"))
|
|
||||||
.insert_header((header::PRAGMA, "no-cache"))
|
|
||||||
.insert_header((header::EXPIRES, "0"))
|
|
||||||
.body(status::WSPR_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/cw.js")]
|
#[get("/cw.js")]
|
||||||
async fn cw_js() -> impl Responder {
|
async fn cw_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::CW_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::CW_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/bookmarks.js")]
|
#[get("/bookmarks.js")]
|
||||||
async fn bookmarks_js() -> impl Responder {
|
async fn bookmarks_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::BOOKMARKS_JS,
|
||||||
.body(status::BOOKMARKS_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/scheduler.js")]
|
#[get("/scheduler.js")]
|
||||||
async fn scheduler_js() -> impl Responder {
|
async fn scheduler_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::SCHEDULER_JS,
|
||||||
.body(status::SCHEDULER_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/background-decode.js")]
|
#[get("/background-decode.js")]
|
||||||
async fn background_decode_js() -> impl Responder {
|
async fn background_decode_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response(
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
"application/javascript; charset=utf-8",
|
||||||
))
|
status::BACKGROUND_DECODE_JS,
|
||||||
.body(status::BACKGROUND_DECODE_JS)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/vchan.js")]
|
#[get("/vchan.js")]
|
||||||
async fn vchan_js() -> impl Responder {
|
async fn vchan_js() -> impl Responder {
|
||||||
HttpResponse::Ok()
|
no_cache_response("application/javascript; charset=utf-8", status::VCHAN_JS)
|
||||||
.insert_header((
|
|
||||||
header::CONTENT_TYPE,
|
|
||||||
"application/javascript; charset=utf-8",
|
|
||||||
))
|
|
||||||
.body(status::VCHAN_JS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic query extractor for endpoints that only need the optional remote.
|
/// Generic query extractor for endpoints that only need the optional remote.
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct RemoteQuery {
|
pub struct RemoteQuery {
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -475,7 +475,6 @@ pub fn start_decode_history_collector(context: Arc<FrontendRuntimeContext>) {
|
|||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct AudioQuery {
|
pub struct AudioQuery {
|
||||||
pub channel_id: Option<Uuid>,
|
pub channel_id: Option<Uuid>,
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,11 +643,4 @@ mod tests {
|
|||||||
serde_json::from_str(r#"{"remote":"lidzbark-vhf"}"#).expect("query parse");
|
serde_json::from_str(r#"{"remote":"lidzbark-vhf"}"#).expect("query parse");
|
||||||
assert_eq!(query.remote.as_deref(), Some("lidzbark-vhf"));
|
assert_eq!(query.remote.as_deref(), Some("lidzbark-vhf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn audio_query_accepts_legacy_rig_id_alias() {
|
|
||||||
let query: AudioQuery =
|
|
||||||
serde_json::from_str(r#"{"rig_id":"gdansk"}"#).expect("query parse");
|
|
||||||
assert_eq!(query.remote.as_deref(), Some("gdansk"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ pub struct ScheduleEntry {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
pub struct SchedulerConfig {
|
pub struct SchedulerConfig {
|
||||||
#[serde(alias = "rig_id")]
|
|
||||||
pub remote: String,
|
pub remote: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub mode: SchedulerMode,
|
pub mode: SchedulerMode,
|
||||||
@@ -913,7 +912,7 @@ pub struct SchedulerControlUpdate {
|
|||||||
pub session_id: Uuid,
|
pub session_id: Uuid,
|
||||||
pub released: bool,
|
pub released: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub rig_id: Option<String>,
|
pub remote: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/scheduler-control")]
|
#[get("/scheduler-control")]
|
||||||
@@ -935,10 +934,10 @@ pub async fn put_scheduler_control(
|
|||||||
let body = body.into_inner();
|
let body = body.into_inner();
|
||||||
let summary = control.set_released(body.session_id, body.released);
|
let summary = control.set_released(body.session_id, body.released);
|
||||||
if body.released && summary.all_released {
|
if body.released && summary.all_released {
|
||||||
if let Some(rig_id) = body.rig_id.as_deref() {
|
if let Some(remote) = body.remote.as_deref() {
|
||||||
apply_last_scheduler_cycle(
|
apply_last_scheduler_cycle(
|
||||||
rig_tx.get_ref(),
|
rig_tx.get_ref(),
|
||||||
rig_id,
|
remote,
|
||||||
status_map.get_ref(),
|
status_map.get_ref(),
|
||||||
bookmarks.get_ref().as_ref(),
|
bookmarks.get_ref().as_ref(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user