mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
adds name to /package/data
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
!/package/#S9PK AppR GET -- get most recent appId at appversion spec, defaults to >=0.0.0 -- ?spec={semver-spec}
|
!/package/#S9PK AppR GET -- get most recent appId at appversion spec, defaults to >=0.0.0 -- ?spec={semver-spec}
|
||||||
/package/data CategoriesR GET -- get all marketplace categories
|
/package/data InfoR GET -- get all marketplace categories
|
||||||
/package/index PackageListR GET -- filter marketplace services by various query params
|
/package/index PackageListR GET -- filter marketplace services by various query params
|
||||||
-- /package/updates
|
-- /package/updates
|
||||||
/eos/latest EosVersionR GET -- get eos information
|
/eos/latest EosVersionR GET -- get eos information
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ import Yesod.Core
|
|||||||
import Yesod.Core.Types hiding ( Logger )
|
import Yesod.Core.Types hiding ( Logger )
|
||||||
import Yesod.Default.Config2
|
import Yesod.Default.Config2
|
||||||
|
|
||||||
import Control.Arrow ( (***) )
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.List ( lookup )
|
import Data.List ( lookup )
|
||||||
import Data.String.Interpolate.IsString
|
import Data.String.Interpolate.IsString
|
||||||
|
|||||||
@@ -129,13 +129,14 @@ import Yesod.Core ( MonadResource
|
|||||||
import Yesod.Persist ( YesodDB )
|
import Yesod.Persist ( YesodDB )
|
||||||
import Yesod.Persist.Core ( YesodPersist(runDB) )
|
import Yesod.Persist.Core ( YesodPersist(runDB) )
|
||||||
|
|
||||||
getCategoriesR :: Handler CategoryRes
|
getInfoR :: Handler InfoRes
|
||||||
getCategoriesR = do
|
getInfoR = do
|
||||||
|
name <- getsYesod $ marketplaceName . appSettings
|
||||||
allCategories <- runDB $ select $ do
|
allCategories <- runDB $ select $ do
|
||||||
cats <- from $ table @Category
|
cats <- from $ table @Category
|
||||||
orderBy [desc (cats ^. CategoryPriority)]
|
orderBy [desc (cats ^. CategoryPriority)]
|
||||||
pure cats
|
pure cats
|
||||||
pure $ CategoryRes $ categoryName . entityVal <$> allCategories
|
pure $ InfoRes name $ categoryName . entityVal <$> allCategories
|
||||||
|
|
||||||
getEosVersionR :: Handler EosRes
|
getEosVersionR :: Handler EosRes
|
||||||
getEosVersionR = do
|
getEosVersionR = do
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ import Yesod
|
|||||||
|
|
||||||
|
|
||||||
type URL = Text
|
type URL = Text
|
||||||
newtype CategoryRes = CategoryRes {
|
data InfoRes = InfoRes
|
||||||
categories :: [CategoryTitle]
|
{ name :: Text
|
||||||
} deriving (Show, Generic)
|
, categories :: [CategoryTitle]
|
||||||
instance ToJSON CategoryRes
|
}
|
||||||
instance ToContent CategoryRes where
|
deriving (Show, Generic)
|
||||||
|
instance ToJSON InfoRes
|
||||||
|
instance ToContent InfoRes where
|
||||||
toContent = toContent . toJSON
|
toContent = toContent . toJSON
|
||||||
instance ToTypedContent CategoryRes where
|
instance ToTypedContent InfoRes where
|
||||||
toTypedContent = toTypedContent . toJSON
|
toTypedContent = toTypedContent . toJSON
|
||||||
data PackageRes = PackageRes
|
data PackageRes = PackageRes
|
||||||
{ packageResIcon :: URL
|
{ packageResIcon :: URL
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ data AppSettings = AppSettings
|
|||||||
, torPort :: AppPort
|
, torPort :: AppPort
|
||||||
, staticBinDir :: FilePath
|
, staticBinDir :: FilePath
|
||||||
, errorLogRoot :: FilePath
|
, errorLogRoot :: FilePath
|
||||||
|
, marketplaceName :: Text
|
||||||
}
|
}
|
||||||
instance Has PkgRepo AppSettings where
|
instance Has PkgRepo AppSettings where
|
||||||
extract = liftA2 PkgRepo ((</> "apps") . resourcesDir) staticBinDir
|
extract = liftA2 PkgRepo ((</> "apps") . resourcesDir) staticBinDir
|
||||||
@@ -84,6 +85,8 @@ instance FromJSON AppSettings where
|
|||||||
let sslCertLocation = sslPath </> "certificate.pem"
|
let sslCertLocation = sslPath </> "certificate.pem"
|
||||||
let registryVersion = fromJust . parseMaybe parseJSON . String . toS . showVersion $ version
|
let registryVersion = fromJust . parseMaybe parseJSON . String . toS . showVersion $ version
|
||||||
|
|
||||||
|
marketplaceName <- o .:? "marketplace-name" .!= "Start9 Embassy Marketplace"
|
||||||
|
|
||||||
return AppSettings { .. }
|
return AppSettings { .. }
|
||||||
|
|
||||||
-- | Raw bytes at compile time of @config/settings.yml@
|
-- | Raw bytes at compile time of @config/settings.yml@
|
||||||
|
|||||||
@@ -44,11 +44,7 @@ extra-deps:
|
|||||||
- esqueleto-3.5.1.0
|
- esqueleto-3.5.1.0
|
||||||
- monad-logger-extras-0.1.1.1
|
- monad-logger-extras-0.1.1.1
|
||||||
- wai-request-spec-0.10.2.4
|
- wai-request-spec-0.10.2.4
|
||||||
- git: https://github.com/ProofOfKeags/wai
|
- warp-3.3.19
|
||||||
commit: 2eef8506c7eec67fa5c1be0e0470a38e277ab5d8
|
|
||||||
subdirs:
|
|
||||||
- warp
|
|
||||||
- warp-tls
|
|
||||||
# Override default flag values for local packages and extra-deps
|
# Override default flag values for local packages and extra-deps
|
||||||
# flags: {}
|
# flags: {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user