From f70cc8cf4ecd8c041043020e6ce6ef03fd185b9a Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 28 Jun 2026 19:15:53 +0200 Subject: bahnhof-name: some logic deduplication --- app/Main.hs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 132e132..ad7a575 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -210,7 +210,6 @@ app AppData{..} request respond = mkAnswer >>= (respond . toResponse) & maybeAnswer (Plaintext . unRil100) Fuzzy (_,match) -> Redirect (ril100BaseUrl <> "/" <> match) where query = T.intercalate "/" (pathInfo request) - _ -> pure Notfound queriedRil100 :: Text -> MatchResult Ril100 Text queriedRil100 query = if | not (T.any isLower query) && host `elem` ["leitpunkt"] @@ -218,18 +217,13 @@ app AppData{..} request respond = mkAnswer >>= (respond . toResponse) & maybe None Exact | not (T.any isLower query) -> Exact (Ril100 query) - | host `elem` ["leitpunkt"] - -> case findStationName query ril100set of - None -> None - Exact (_,match) -> lookupName match ril100map - & maybe None Exact - Fuzzy (_,match) -> Fuzzy (leitpunktBaseUrl <> "/" <> match) | otherwise -> case findStationName query ril100set of None -> None Exact (_,match) -> lookupName match ril100map & maybe None Exact - Fuzzy (_,match) -> Fuzzy (ril100BaseUrl <> "/" <> match) + Fuzzy (_,match) -> Fuzzy (baseUrl <> "/" <> match) + where baseUrl = if host `elem` ["leitpunkt"] then leitpunktBaseUrl else ril100BaseUrl helptext = Html $ "\ \
\
       \ril100 → Name: " <> ril100BaseUrl <> "/RM\n\
-- 
cgit v1.3.1