mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
merge add package header
This commit is contained in:
committed by
Keagan McClelland
parent
40e7d5f097
commit
8f20f68c5e
@@ -3,6 +3,7 @@ module Util.Shared where
|
||||
import Startlude hiding (Handler)
|
||||
|
||||
import qualified Data.Text as T
|
||||
import Data.Text.Encoding
|
||||
import Network.HTTP.Types
|
||||
import Yesod.Core
|
||||
|
||||
@@ -10,6 +11,8 @@ import Foundation
|
||||
import Lib.Registry
|
||||
import Lib.Types.Emver
|
||||
import Data.Semigroup
|
||||
import Lib.External.AppMgr
|
||||
import Lib.Error
|
||||
|
||||
getVersionFromQuery :: KnownSymbol a => FilePath -> Extension a -> Handler (Maybe Version)
|
||||
getVersionFromQuery rootDir ext = do
|
||||
@@ -24,4 +27,9 @@ getBestVersion rootDir ext spec = do
|
||||
appVersions <- liftIO $ getAvailableAppVersions rootDir ext
|
||||
let satisfactory = filter ((<|| spec) . fst . unRegisteredAppVersion) appVersions
|
||||
let best = getMax <$> foldMap (Just . Max . fst . unRegisteredAppVersion) satisfactory
|
||||
pure best
|
||||
pure best
|
||||
|
||||
addPackageHeader :: (MonadHandler m, KnownSymbol a) => FilePath -> FilePath -> Extension a -> m ()
|
||||
addPackageHeader appMgrDir appDir appExt = do
|
||||
packageHash <- handleS9ErrT $ getPackageHash appMgrDir appDir appExt
|
||||
addHeader "X-S9PK-HASH" $ decodeUtf8 packageHash
|
||||
Reference in New Issue
Block a user