Normalize API paths: remove unnecessary /v1/ prefix
- Update all internal API routes from /api/v1/* to /api/* - Protection API: /api/security/protection/* - Botmodels calls: /api/vision/*, /api/audio/*, /api/speech/* - Remove /api/v1/health from anonymous paths (keep /api/health) External APIs (Reddit, Facebook, etc.) keep their original versioned paths
This commit is contained in:
parent
79ee009983
commit
e3b3f04206
6 changed files with 27 additions and 28 deletions
|
|
@ -1279,7 +1279,7 @@ async fn process_qrcode(
|
|||
.map_err(|e| format!("Failed to fetch image: {e}"))?;
|
||||
|
||||
let response = client
|
||||
.post(format!("{botmodels_url}/api/v1/vision/qrcode"))
|
||||
.post(format!("{botmodels_url}/api/vision/qrcode"))
|
||||
.header("Content-Type", "application/octet-stream")
|
||||
.body(image_data.to_vec())
|
||||
.send()
|
||||
|
|
@ -1327,7 +1327,7 @@ async fn process_audio_to_text(
|
|||
.map_err(|e| format!("Failed to read audio: {e}"))?;
|
||||
|
||||
let response = client
|
||||
.post(format!("{botmodels_url}/api/v1/speech/to-text"))
|
||||
.post(format!("{botmodels_url}/api/speech/to-text"))
|
||||
.header("Content-Type", "application/octet-stream")
|
||||
.body(audio_data.to_vec())
|
||||
.send()
|
||||
|
|
@ -1376,7 +1376,7 @@ async fn process_video_description(
|
|||
.map_err(|e| format!("Failed to fetch video: {e}"))?;
|
||||
|
||||
let response = client
|
||||
.post(format!("{botmodels_url}/api/v1/vision/describe-video"))
|
||||
.post(format!("{botmodels_url}/api/vision/describe-video"))
|
||||
.header("Content-Type", "application/octet-stream")
|
||||
.body(video_data.to_vec())
|
||||
.send()
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ pub async fn check_services_status(State(state): State<Arc<AppState>>) -> impl I
|
|||
}
|
||||
|
||||
if let Ok(response) = client
|
||||
.get("https://localhost:3000/api/v1/version")
|
||||
.get("https://localhost:3000/api/version")
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
|
|
@ -474,9 +474,9 @@ impl InternalUrls {
|
|||
pub const QDRANT: &'static str = "http://localhost:6334";
|
||||
pub const FORGEJO: &'static str = "http://localhost:3000";
|
||||
pub const LIVEKIT: &'static str = "http://localhost:7880";
|
||||
pub const BOTMODELS_VISION_QRCODE: &'static str = "/api/v1/vision/qrcode";
|
||||
pub const BOTMODELS_SPEECH_TO_TEXT: &'static str = "/api/v1/speech/to-text";
|
||||
pub const BOTMODELS_VISION_DESCRIBE_VIDEO: &'static str = "/api/v1/vision/describe-video";
|
||||
pub const BOTMODELS_VISION_QRCODE: &'static str = "/api/vision/qrcode";
|
||||
pub const BOTMODELS_SPEECH_TO_TEXT: &'static str = "/api/speech/to-text";
|
||||
pub const BOTMODELS_VISION_DESCRIBE_VIDEO: &'static str = "/api/vision/describe-video";
|
||||
}
|
||||
|
||||
impl ApiUrls {
|
||||
|
|
|
|||
|
|
@ -527,7 +527,6 @@ impl Default for AuthConfig {
|
|||
"/health".to_string(),
|
||||
"/healthz".to_string(),
|
||||
"/api/health".to_string(),
|
||||
"/api/v1/health".to_string(),
|
||||
"/.well-known".to_string(),
|
||||
"/metrics".to_string(),
|
||||
"/api/auth/login".to_string(),
|
||||
|
|
|
|||
|
|
@ -66,42 +66,42 @@ struct ActionResponse {
|
|||
|
||||
pub fn configure_protection_routes() -> Router {
|
||||
Router::new()
|
||||
.route("/api/v1/security/protection/status", get(get_all_status))
|
||||
.route("/api/security/protection/status", get(get_all_status))
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/status",
|
||||
"/api/security/protection/:tool/status",
|
||||
get(get_tool_status),
|
||||
)
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/install",
|
||||
"/api/security/protection/:tool/install",
|
||||
post(install_tool),
|
||||
)
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/uninstall",
|
||||
"/api/security/protection/:tool/uninstall",
|
||||
post(uninstall_tool),
|
||||
)
|
||||
.route("/api/v1/security/protection/:tool/start", post(start_service))
|
||||
.route("/api/v1/security/protection/:tool/stop", post(stop_service))
|
||||
.route("/api/security/protection/:tool/start", post(start_service))
|
||||
.route("/api/security/protection/:tool/stop", post(stop_service))
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/enable",
|
||||
"/api/security/protection/:tool/enable",
|
||||
post(enable_service),
|
||||
)
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/disable",
|
||||
"/api/security/protection/:tool/disable",
|
||||
post(disable_service),
|
||||
)
|
||||
.route("/api/v1/security/protection/:tool/run", post(run_scan))
|
||||
.route("/api/v1/security/protection/:tool/report", get(get_report))
|
||||
.route("/api/security/protection/:tool/run", post(run_scan))
|
||||
.route("/api/security/protection/:tool/report", get(get_report))
|
||||
.route(
|
||||
"/api/v1/security/protection/:tool/update",
|
||||
"/api/security/protection/:tool/update",
|
||||
post(update_definitions),
|
||||
)
|
||||
.route("/api/v1/security/protection/:tool/auto", post(toggle_auto))
|
||||
.route("/api/security/protection/:tool/auto", post(toggle_auto))
|
||||
.route(
|
||||
"/api/v1/security/protection/clamav/quarantine",
|
||||
"/api/security/protection/clamav/quarantine",
|
||||
get(get_quarantine),
|
||||
)
|
||||
.route(
|
||||
"/api/v1/security/protection/clamav/quarantine/:id",
|
||||
"/api/security/protection/clamav/quarantine/:id",
|
||||
post(remove_from_quarantine),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -590,7 +590,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/audio/transcribe", botmodels_url))
|
||||
.post(format!("{}/api/audio/transcribe", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"audio_url": &clip.source_url,
|
||||
"language": language.unwrap_or_else(|| "auto".to_string()),
|
||||
|
|
@ -695,7 +695,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/audio/tts", botmodels_url))
|
||||
.post(format!("{}/api/audio/tts", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"text": text,
|
||||
"voice": voice,
|
||||
|
|
@ -1026,7 +1026,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/video/remove-background", botmodels_url))
|
||||
.post(format!("{}/api/video/remove-background", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"video_url": &clip.source_url,
|
||||
"replacement": replacement,
|
||||
|
|
@ -1060,7 +1060,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/video/enhance", botmodels_url))
|
||||
.post(format!("{}/api/video/enhance", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"video_url": &clip.source_url,
|
||||
"upscale_factor": req.upscale_factor,
|
||||
|
|
@ -1101,7 +1101,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/audio/detect-beats", botmodels_url))
|
||||
.post(format!("{}/api/audio/detect-beats", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"audio_url": &track.source_url,
|
||||
"sensitivity": sensitivity.unwrap_or(0.5),
|
||||
|
|
@ -1147,7 +1147,7 @@ impl VideoEngine {
|
|||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post(format!("{}/api/v1/audio/waveform", botmodels_url))
|
||||
.post(format!("{}/api/audio/waveform", botmodels_url))
|
||||
.json(&serde_json::json!({
|
||||
"audio_url": &track.source_url,
|
||||
"samples_per_second": samples_per_second.unwrap_or(10),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue