diff --git a/config/routes b/config/routes index e76519a..a1ade99 100644 --- a/config/routes +++ b/config/routes @@ -1,6 +1,8 @@ +/ RootR GET + -- EOS API V0 -/eos/v0/latest EosVersionR GET -- get eos information -/eos/v0/eos.img EosR GET -- get eos.img +/eos/v0/latest EosVersionR GET -- get eos information +/eos/v0/eos.img EosR GET -- get eos.img -- PACKAGE API V0 /package/#ApiVersion/info InfoR GET -- get all marketplace categories @@ -15,9 +17,9 @@ /package/#ApiVersion/version/#PkgId PkgVersionR GET -- get most recent appId version -- ADMIN API V0 -/admin/v0/upload PkgUploadR POST !admin -/admin/v0/eos-upload EosUploadR POST !admin -/admin/v0/index PkgIndexR POST !admin -/admin/v0/deindex PkgDeindexR GET POST !admin -/admin/v0/category/#Text CategoryR POST DELETE !admin -/admin/v0/categorize/#Text/#PkgId PkgCategorizeR POST DELETE !admin \ No newline at end of file +/admin/v0/upload PkgUploadR POST !admin +/admin/v0/eos-upload EosUploadR POST !admin +/admin/v0/index PkgIndexR POST !admin +/admin/v0/deindex PkgDeindexR GET POST !admin +/admin/v0/category/#Text CategoryR POST DELETE !admin +/admin/v0/categorize/#Text/#PkgId PkgCategorizeR POST DELETE !admin \ No newline at end of file diff --git a/src/Application.hs b/src/Application.hs index 839a590..d1a90ed 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -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. diff --git a/src/Foundation.hs b/src/Foundation.hs index 4f54bf2..39c1c2b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -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 diff --git a/src/Handler/Root.hs b/src/Handler/Root.hs new file mode 100644 index 0000000..a21a600 --- /dev/null +++ b/src/Handler/Root.hs @@ -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 \ No newline at end of file