mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-07-10 10:38:10 -07:00
replacing numbered options in config with rust enum implementation, unique commit to make easier to debug or rollback
This commit is contained in:
committed by
Will Greenberg
parent
0b91a6e5d3
commit
fee082cde4
+2
-1
@@ -7,6 +7,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
||||
use std::sync::Arc;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
|
||||
use crate::config::GpsMode;
|
||||
use crate::server::ServerState;
|
||||
|
||||
fn deserialize_unix_ts<'de, D>(deserializer: D) -> Result<i64, D::Error>
|
||||
@@ -79,7 +80,7 @@ pub async fn post_gps(
|
||||
State(state): State<Arc<ServerState>>,
|
||||
Json(gps_data): Json<GpsData>,
|
||||
) -> Result<StatusCode, (StatusCode, String)> {
|
||||
if state.config.gps_mode != 2 {
|
||||
if state.config.gps_mode != GpsMode::Api {
|
||||
return Err((
|
||||
StatusCode::FORBIDDEN,
|
||||
"GPS API endpoint is disabled. Set gps_mode to 2 in configuration.".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user