mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-30 11:51:57 +00:00
fix instruction and license parsing
This commit is contained in:
@@ -49,7 +49,7 @@ data ServiceRes = ServiceRes
|
|||||||
{ serviceResIcon :: Text
|
{ serviceResIcon :: Text
|
||||||
, serviceResManifest :: ServiceManifest
|
, serviceResManifest :: ServiceManifest
|
||||||
, serviceResCategories :: [CategoryTitle]
|
, serviceResCategories :: [CategoryTitle]
|
||||||
, serviceResInstructions :: Text -- markdown
|
, serviceResInstructions :: Text
|
||||||
, serviceResLicense :: Text
|
, serviceResLicense :: Text
|
||||||
, serviceResVersions :: [Version]
|
, serviceResVersions :: [Version]
|
||||||
, serviceResDependencyInfo :: HM.HashMap AppIdentifier DependencyInfo
|
, serviceResDependencyInfo :: HM.HashMap AppIdentifier DependencyInfo
|
||||||
@@ -307,7 +307,6 @@ getServiceDetails maybeVersion service = do
|
|||||||
sendResponseStatus status500 ("Internal Server Error" :: Text)
|
sendResponseStatus status500 ("Internal Server Error" :: Text)
|
||||||
Right (a :: ServiceManifest) -> pure a
|
Right (a :: ServiceManifest) -> pure a
|
||||||
d <- traverse (mapDependencyMetadata appsDir appMgrDir domain) (HM.toList $ serviceManifestDependencies manifest)
|
d <- traverse (mapDependencyMetadata appsDir appMgrDir domain) (HM.toList $ serviceManifestDependencies manifest)
|
||||||
$logInfo $ show appDir
|
|
||||||
-- @TODO uncomment when sdk icon working
|
-- @TODO uncomment when sdk icon working
|
||||||
-- icon <- decodeIcon appMgrDir appDir appExt
|
-- icon <- decodeIcon appMgrDir appDir appExt
|
||||||
let icon = [i|https://#{domain}/icons/#{appId}.png|]
|
let icon = [i|https://#{domain}/icons/#{appId}.png|]
|
||||||
@@ -352,20 +351,12 @@ decodeIcon appmgrPath depPath e@(Extension icon) = do
|
|||||||
decodeInstructions :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m Text
|
decodeInstructions :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m Text
|
||||||
decodeInstructions appmgrPath depPath package = do
|
decodeInstructions appmgrPath depPath package = do
|
||||||
instructions <- handleS9ErrT $ getInstructions appmgrPath depPath package
|
instructions <- handleS9ErrT $ getInstructions appmgrPath depPath package
|
||||||
case eitherDecode $ BS.fromStrict instructions of
|
pure $ decodeUtf8 instructions
|
||||||
Left e -> do
|
|
||||||
$logInfo $ T.pack e
|
|
||||||
sendResponseStatus status400 e
|
|
||||||
Right a -> pure a
|
|
||||||
|
|
||||||
decodeLicense :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m Text
|
decodeLicense :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m Text
|
||||||
decodeLicense appmgrPath depPath package = do
|
decodeLicense appmgrPath depPath package = do
|
||||||
license <- handleS9ErrT $ getLicense appmgrPath depPath package
|
license <- handleS9ErrT $ getLicense appmgrPath depPath package
|
||||||
case eitherDecode $ BS.fromStrict license of
|
pure $ decodeUtf8 license
|
||||||
Left e -> do
|
|
||||||
$logInfo $ T.pack e
|
|
||||||
sendResponseStatus status400 e
|
|
||||||
Right a -> pure a
|
|
||||||
|
|
||||||
fetchAllAppVersions :: Key SApp -> HandlerFor RegistryCtx ([VersionInfo], ReleaseNotes)
|
fetchAllAppVersions :: Key SApp -> HandlerFor RegistryCtx ([VersionInfo], ReleaseNotes)
|
||||||
fetchAllAppVersions appId = do
|
fetchAllAppVersions appId = do
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ getBestVersion rootDir ext spec = do
|
|||||||
appVersions <- liftIO $ getAvailableAppVersions rootDir ext
|
appVersions <- liftIO $ getAvailableAppVersions rootDir ext
|
||||||
let satisfactory = filter ((<|| spec) . fst . unRegisteredAppVersion) appVersions
|
let satisfactory = filter ((<|| spec) . fst . unRegisteredAppVersion) appVersions
|
||||||
let best = getMax <$> foldMap (Just . Max . fst . unRegisteredAppVersion) satisfactory
|
let best = getMax <$> foldMap (Just . Max . fst . unRegisteredAppVersion) satisfactory
|
||||||
$logInfo $ show satisfactory
|
|
||||||
$logInfo $ show best
|
|
||||||
pure best
|
pure best
|
||||||
|
|
||||||
addPackageHeader :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m ()
|
addPackageHeader :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m ()
|
||||||
|
|||||||
Reference in New Issue
Block a user