fix new route setup

This commit is contained in:
Lucy Cifferello
2023-11-08 10:17:00 -07:00
parent 2df99d40e9
commit f98af6cea1
2 changed files with 4 additions and 3 deletions

View File

@@ -186,7 +186,7 @@ import Handler.Admin (
postPkgUploadR, postPkgUploadR,
) )
import Handler.Eos (getEosR, getEosVersionR) import Handler.Eos (getEosR, getEosVersionR)
import Handler.Root(getRootR) import Handler.Root(getRootR, getMarketplaceR)
import Handler.Package import Handler.Package
import Lib.Ssl ( import Lib.Ssl (
doesSslNeedRenew, doesSslNeedRenew,

View File

@@ -5,14 +5,15 @@ import Foundation
import qualified Data.Text as T import qualified Data.Text as T
import Settings (AppSettings(registryHostname, marketplaceName)) import Settings (AppSettings(registryHostname, marketplaceName))
import Network.Wai (Request(pathInfo)) import Network.Wai (Request(pathInfo))
import Lib.Types.Core (PkgId)
getRootR :: HandlerFor RegistryCtx () getRootR :: HandlerFor RegistryCtx ()
getRootR = do getRootR = do
(url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings (url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings
redirect $ T.pack "https://marketplace.start9.com?api=" <> url <> T.pack "&name=" <> name redirect $ T.pack "https://marketplace.start9.com?api=" <> url <> T.pack "&name=" <> name
getMarketplaceR :: HandlerFor RegistryCtx () getMarketplaceR :: PkgId -> HandlerFor RegistryCtx ()
getMarketplaceR = do getMarketplaceR _ = do
(url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings (url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings
req <- waiRequest req <- waiRequest
pathSegments <- pure $ pathInfo req pathSegments <- pure $ pathInfo req