diff options
author | Lia Lenckowski <lialenck@protonmail.com> | 2023-08-04 16:56:23 +0200 |
---|---|---|
committer | Lia Lenckowski <lialenck@protonmail.com> | 2023-08-04 16:56:23 +0200 |
commit | 6e73d741c828c0e12c3ba1e1270d8b3c4d3182f0 (patch) | |
tree | 0b2a17a4cd45f3b11621f85bbcabfad20e3256dd /src/Main.hs | |
parent | be01871f267f396373801ffb97a11470c5b563ec (diff) | |
download | fastbangs-6e73d741c828c0e12c3ba1e1270d8b3c4d3182f0.tar fastbangs-6e73d741c828c0e12c3ba1e1270d8b3c4d3182f0.tar.bz2 fastbangs-6e73d741c828c0e12c3ba1e1270d8b3c4d3182f0.tar.zst |
add bang to search engine name
this allows firefox users to add fastbangs multiple times as a search engine, when using different default bangs
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 11 |
1 files changed, 2 insertions, 9 deletions
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 |