From 1b1c4831b9d18cabd230a0b3257f0f01cfbf73a6 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Fri, 20 Feb 2026 13:04:50 +0100 Subject: [PATCH] fix(server): use explicit #[get] and #[post] attributes for server endpoints Replace #[server(endpoint = "...")] with explicit HTTP method attributes to ensure correct method handling behind Traefik reverse proxy. Co-Authored-By: Claude Opus 4.6 --- assets/tailwind.css | 3 +++ src/infrastructure/llm.rs | 4 ++-- src/infrastructure/ollama.rs | 2 +- src/infrastructure/searxng.rs | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/tailwind.css b/assets/tailwind.css index d30c32c..7177b28 100644 --- a/assets/tailwind.css +++ b/assets/tailwind.css @@ -1733,6 +1733,9 @@ .text-center { text-align: center; } + .lowercase { + text-transform: lowercase; + } .outline { outline-style: var(--tw-outline-style); outline-width: 1px; diff --git a/src/infrastructure/llm.rs b/src/infrastructure/llm.rs index abaade2..5addf44 100644 --- a/src/infrastructure/llm.rs +++ b/src/infrastructure/llm.rs @@ -159,7 +159,7 @@ mod inner { /// # Errors /// /// Returns `ServerFnError` if the Ollama request fails or response parsing fails -#[server(endpoint = "summarize")] +#[post("/api/summarize")] pub async fn summarize_article( snippet: String, article_url: String, @@ -258,7 +258,7 @@ pub struct FollowUpMessage { /// # Errors /// /// Returns `ServerFnError` if the Ollama request fails or response parsing fails -#[server(endpoint = "chat")] +#[post("/api/chat")] pub async fn chat_followup( messages: Vec, ollama_url: String, diff --git a/src/infrastructure/ollama.rs b/src/infrastructure/ollama.rs index 0e8e248..5ef0449 100644 --- a/src/infrastructure/ollama.rs +++ b/src/infrastructure/ollama.rs @@ -45,7 +45,7 @@ struct OllamaModel { /// /// Returns `ServerFnError` only on serialization issues; network failures /// are caught and returned as `online: false` -#[server(endpoint = "ollama-status")] +#[post("/api/ollama-status")] pub async fn get_ollama_status(ollama_url: String) -> Result { dotenvy::dotenv().ok(); diff --git a/src/infrastructure/searxng.rs b/src/infrastructure/searxng.rs index f01194c..67e6274 100644 --- a/src/infrastructure/searxng.rs +++ b/src/infrastructure/searxng.rs @@ -110,7 +110,7 @@ mod inner { /// # Errors /// /// Returns `ServerFnError` if the SearXNG request fails or response parsing fails -#[server(endpoint = "search")] +#[post("/api/search")] pub async fn search_topic(query: String) -> Result, ServerFnError> { dotenvy::dotenv().ok(); use inner::{extract_source, rank_and_deduplicate, SearxngResponse}; @@ -196,7 +196,7 @@ pub async fn search_topic(query: String) -> Result, ServerFnError> /// # Errors /// /// Returns `ServerFnError` if the SearXNG search request fails -#[server(endpoint = "trending")] +#[get("/api/trending")] pub async fn get_trending_topics() -> Result, ServerFnError> { dotenvy::dotenv().ok(); use inner::SearxngResponse;