From 6e73d741c828c0e12c3ba1e1270d8b3c4d3182f0 Mon Sep 17 00:00:00 2001 From: Lia Lenckowski Date: Fri, 4 Aug 2023 16:56:23 +0200 Subject: add bang to search engine name this allows firefox users to add fastbangs multiple times as a search engine, when using different default bangs --- src/Main.hs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index ff6823d..b5b35a1 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -15,7 +15,6 @@ import Data.Aeson import Database.Persist.Sqlite import Data.Char (isAlphaNum) import Data.Function ((&)) -import Data.Functor ((<&>)) import Data.Maybe (maybeToList) import Network.Wai.Handler.Warp hiding (getPort, getHost) import Yesod @@ -123,15 +122,9 @@ postSubmitR = do getOpenSearchR :: Handler TypedContent getOpenSearchR = do neverExpires - baseUrl <- liftIO getBaseUrl - url <- lookupGetParam "default" <&> \case - Nothing -> baseUrl <> "/#{searchTerms}" - Just b -> baseUrl <> "/#" <> b <> "#{searchTerms}" - - liftIO $ - TypedContent "application/opensearchdescription+xml" - . toContent - <$> makeOpenSearch url + + resXml <- liftIO . makeOpenSearch =<< lookupGetParam "default" + return $ TypedContent "application/opensearchdescription+xml" $ toContent resXml postVerdictR :: Bool -> Handler () postVerdictR b = do -- cgit v1.2.3-70-g09d2