mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-30 11:51:57 +00:00
temp fix icon path for dependencies
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
|
|
||||||
module Handler.Marketplace where
|
module Handler.Marketplace where
|
||||||
|
|
||||||
import Startlude hiding (from, Handler, on)
|
import Startlude hiding (from, Handler, on)
|
||||||
import Foundation
|
import Foundation
|
||||||
import Yesod.Core
|
import Yesod.Core
|
||||||
@@ -188,6 +187,7 @@ getServiceR = do
|
|||||||
(versions, mappedVersions) <- fetchAllAppVersions (entityKey service)
|
(versions, mappedVersions) <- fetchAllAppVersions (entityKey service)
|
||||||
categories <- runDB $ fetchAppCategories (entityKey service)
|
categories <- runDB $ fetchAppCategories (entityKey service)
|
||||||
(appsDir, appMgrDir) <- getsYesod $ ((</> "apps") . resourcesDir &&& staticBinDir) . appSettings
|
(appsDir, appMgrDir) <- getsYesod $ ((</> "apps") . resourcesDir &&& staticBinDir) . appSettings
|
||||||
|
domain <- getsYesod $ registryHostname . appSettings
|
||||||
let appId = sAppAppId $ entityVal service
|
let appId = sAppAppId $ entityVal service
|
||||||
let appDir = (<> "/") . (</> show (sVersionNumber $ entityVal version)) . (</> toS appId) $ appsDir
|
let appDir = (<> "/") . (</> show (sVersionNumber $ entityVal version)) . (</> toS appId) $ appsDir
|
||||||
let appExt = Extension (toS appId) :: Extension "s9pk"
|
let appExt = Extension (toS appId) :: Extension "s9pk"
|
||||||
@@ -198,7 +198,7 @@ getServiceR = do
|
|||||||
$logError (show e)
|
$logError (show e)
|
||||||
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) (HM.toList $ serviceManifestDependencies manifest)
|
d <- traverse (mapDependencyMetadata appsDir appMgrDir domain) (HM.toList $ serviceManifestDependencies manifest)
|
||||||
icon <- decodeIcon appMgrDir appsDir appExt
|
icon <- decodeIcon appMgrDir appsDir appExt
|
||||||
addPackageHeader appMgrDir appDir appExt
|
addPackageHeader appMgrDir appDir appExt
|
||||||
pure $ ServiceRes
|
pure $ ServiceRes
|
||||||
@@ -211,18 +211,20 @@ getServiceR = do
|
|||||||
}
|
}
|
||||||
|
|
||||||
type URL = Text
|
type URL = Text
|
||||||
mapDependencyMetadata :: (MonadIO m, MonadHandler m) => FilePath -> FilePath -> (AppIdentifier, ServiceDependencyInfo) -> m (AppIdentifier, DependencyInfo)
|
mapDependencyMetadata :: (MonadIO m, MonadHandler m) => FilePath -> FilePath -> Text -> (AppIdentifier, ServiceDependencyInfo) -> m (AppIdentifier, DependencyInfo)
|
||||||
mapDependencyMetadata appsDir appmgrPath (appId, depInfo) = do
|
mapDependencyMetadata appsDir appmgrPath domain (appId, depInfo) = do
|
||||||
let ext = (Extension (toS appId) :: Extension "s9pk")
|
let ext = (Extension (toS appId) :: Extension "s9pk")
|
||||||
-- use if we have VersionRange instead of Version
|
-- get best version from VersionRange of dependency
|
||||||
-- version <- getBestVersion appsDir ext (snd dep) >>= \case
|
version <- getBestVersion appsDir ext (serviceDependencyInfoVersion depInfo) >>= \case
|
||||||
-- Nothing -> sendResponseStatus status400 ("Specified App Version Not Found" :: Text)
|
Nothing -> sendResponseStatus status400 ("Specified App Version Not Found" :: Text)
|
||||||
-- Just v -> pure v
|
Just v -> pure v
|
||||||
let depPath = appsDir </> toS appId </> show (serviceDependencyInfoVersion depInfo)
|
let depPath = appsDir </> toS appId </> show version
|
||||||
icon <- decodeIcon appmgrPath depPath ext
|
-- @TODO uncomment when sdk icon working
|
||||||
|
-- icon <- decodeIcon appmgrPath depPath ext
|
||||||
pure (appId, DependencyInfo
|
pure (appId, DependencyInfo
|
||||||
{ dependencyInfoTitle = appId
|
{ dependencyInfoTitle = appId
|
||||||
, dependencyInfoIcon = icon
|
, dependencyInfoIcon = [i|https://#{domain}/icons/#{appId}.png|]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
decodeIcon :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m URL
|
decodeIcon :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m URL
|
||||||
|
|||||||
Reference in New Issue
Block a user