diff options
| author | stuebinm | 2026-06-28 19:15:53 +0200 |
|---|---|---|
| committer | stuebinm | 2026-06-28 19:15:53 +0200 |
| commit | f70cc8cf4ecd8c041043020e6ce6ef03fd185b9a (patch) | |
| tree | 7f2083358ee0763154b689e8105403dc0b3f4f1b | |
| parent | 7800bc433772a66c6440ad3f4337545eb97eb73f (diff) | |
bahnhof-name: some logic deduplication
| -rw-r--r-- | app/Main.hs | 10 |
1 files 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 $ "\ \<pre>\ \ril100 → Name: " <> ril100BaseUrl <> "/RM\n\ |
