This commit is contained in:
2026-08-07 00:01:16 +08:00
parent 114207f85d
commit ef0893c259
26 changed files with 1474 additions and 566 deletions
+5 -5
View File
@@ -12,11 +12,11 @@ Radio_State make_radio_state(Radio_Mode mode, int port, int buffer_count, int lo
return result;
}
}
Server_App::Server_App(int port, std::filesystem::path frontend_dist, std::filesystem::path config_file) : port_(port), frontend_dist_(std::move(frontend_dist)), config_store_(std::move(config_file)), state_resource_("/admin/radio_states", make_radio_states()), service_config_resource_(config_store_.data().radio_service, "/admin/config/radio", [this](Radio_Service_Config&, Radio_Service_Config value) {
config_store_.persist_radio_service(value);
}, &config_store_.mutex()), alert_config_resource_(config_store_.data().alerts, "/admin/config/alerts", [this](Alert_Config&, Alert_Config value) {
config_store_.persist_alerts(value);
}, &config_store_.mutex()), device_tables_(config_store_) {
Server_App::Server_App(int port, std::filesystem::path frontend_dist, std::filesystem::path config_file) : port_(port), frontend_dist_(std::move(frontend_dist)), config_store_(std::move(config_file)), state_resource_("/admin/radio_states", make_radio_states()), service_config_resource_(config_store_.data().radio_service, "/admin/config/radio", adminive::make_resource_transaction<Radio_Service_Config>([this](const Radio_Service_Config& value, const Request_Context&) {
config_store_.write_radio_service_candidate(value);
}), &config_store_.mutex()), alert_config_resource_(config_store_.data().alerts, "/admin/config/alerts", adminive::make_resource_transaction<Alert_Config>([this](const Alert_Config& value, const Request_Context&) {
config_store_.write_alerts_candidate(value);
}), &config_store_.mutex()), device_tables_(config_store_) {
state_resource_.register_overview_status<Server_Status>("/admin/status", 2000);
state_resource_.register_status<&Radio_State::status>(2000);
bind_routes();