mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
handle redirecting to marketplace paths for brochure
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/ RootR GET
|
||||
/marketplace/#PkgId MarketplaceR GET
|
||||
|
||||
-- EOS API V0
|
||||
/eos/v0/latest EosVersionR GET -- get eos information
|
||||
|
||||
@@ -4,8 +4,17 @@ import Yesod
|
||||
import Foundation
|
||||
import qualified Data.Text as T
|
||||
import Settings (AppSettings(registryHostname, marketplaceName))
|
||||
import Network.Wai (Request(pathInfo))
|
||||
|
||||
getRootR :: HandlerFor RegistryCtx ()
|
||||
getRootR = do
|
||||
(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 = do
|
||||
(url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings
|
||||
req <- waiRequest
|
||||
pathSegments <- pure $ pathInfo req
|
||||
let pathPiece = "/" <> T.intercalate "/" pathSegments
|
||||
redirect $ T.pack "https://marketplace.start9.com" <> pathPiece <> "?api=" <> url <> T.pack "&name=" <> name
|
||||
Reference in New Issue
Block a user