Update/root url (#136)

* handle root url

* add handler file

* fix compilation bug

* fix compilation error

* attempt redirect

* add query param of hostname

* add name to root query params

* cleanup
This commit is contained in:
Lucy
2023-06-19 14:53:06 -06:00
committed by GitHub
parent 683b9d1712
commit e4cd1bae09
4 changed files with 22 additions and 10 deletions

View File

@@ -186,6 +186,7 @@ import Handler.Admin (
postPkgUploadR,
)
import Handler.Eos (getEosR, getEosVersionR)
import Handler.Root(getRootR)
import Handler.Package
import Lib.Ssl (
doesSslNeedRenew,
@@ -214,7 +215,6 @@ import System.Posix.Process (exitImmediately)
import System.Time.Extra (sleep)
import Yesod (YesodPersist (runDB))
-- This line actually creates our YesodDispatch instance. It is the second half
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
-- comments there for more details.

View File

@@ -154,7 +154,6 @@ import Database.Persist ((==.))
import Database.Persist (selectFirst)
import Database.Persist (entityVal)
-- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application
-- starts running, such as database connections. Every handler will have

11
src/Handler/Root.hs Normal file
View File

@@ -0,0 +1,11 @@
module Handler.Root where
import Startlude
import Yesod
import Foundation
import qualified Data.Text as T
import Settings (AppSettings(registryHostname, marketplaceName))
getRootR :: HandlerFor RegistryCtx ()
getRootR = do
(url, name) <- getsYesod $ (registryHostname &&& marketplaceName) . appSettings
redirect $ T.pack "https://marketplace.start9.com?api=" <> url <> T.pack "&name=" <> name