mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
agent: adds ui to app installed preview
This commit is contained in:
committed by
Aiden McClelland
parent
3a63dab586
commit
0962a20852
@@ -68,6 +68,7 @@ import Lib.Background
|
||||
import Lib.Error
|
||||
import qualified Lib.External.AppMgr as AppMgr
|
||||
import qualified Lib.External.Registry as Reg
|
||||
import qualified Lib.External.AppManifest as AppManifest
|
||||
import Lib.IconCache
|
||||
import qualified Lib.Notifications as Notifications
|
||||
import Lib.SystemPaths
|
||||
@@ -230,7 +231,7 @@ getInstalledAppsLogic :: (Has (Reader AgentCtx) sig m, Has AppMgr2.AppMgr sig m,
|
||||
getInstalledAppsLogic = do
|
||||
jobCache <- asks appBackgroundJobs >>= liftIO . readTVarIO
|
||||
let installCache = installInfo . fst <$> inspect SInstalling jobCache
|
||||
serverApps <- AppMgr2.list [AppMgr2.flags|-s -d|]
|
||||
serverApps <- AppMgr2.list [AppMgr2.flags|-s -d -m|]
|
||||
let remapped = remapAppMgrInfo jobCache serverApps
|
||||
installingPreviews = flip
|
||||
HM.mapWithKey
|
||||
@@ -242,6 +243,7 @@ getInstalledAppsLogic = do
|
||||
, appInstalledPreviewStatus = AppStatusTmp Installing
|
||||
, appInstalledPreviewVersionInstalled = storeAppVersionInfoVersion
|
||||
, appInstalledPreviewTorAddress = Nothing
|
||||
, appInstalledPreviewUi = False
|
||||
}
|
||||
installedPreviews = flip
|
||||
HML.mapWithKey
|
||||
@@ -251,6 +253,7 @@ getInstalledAppsLogic = do
|
||||
, appInstalledPreviewStatus = s
|
||||
, appInstalledPreviewVersionInstalled = v
|
||||
, appInstalledPreviewTorAddress = infoResTorAddress
|
||||
, appInstalledPreviewUi = withSome1 infoResManifest AppManifest.hasUi
|
||||
}
|
||||
|
||||
pure $ HML.elems $ HML.union installingPreviews installedPreviews
|
||||
|
||||
@@ -43,6 +43,7 @@ data AppInstalledPreview = AppInstalledPreview
|
||||
, appInstalledPreviewStatus :: AppStatus
|
||||
, appInstalledPreviewVersionInstalled :: Version
|
||||
, appInstalledPreviewTorAddress :: Maybe TorAddress
|
||||
, appInstalledPreviewUi :: Bool
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
instance ToJSON AppInstalledPreview where
|
||||
@@ -50,6 +51,7 @@ instance ToJSON AppInstalledPreview where
|
||||
[ "status" .= appInstalledPreviewStatus
|
||||
, "versionInstalled" .= appInstalledPreviewVersionInstalled
|
||||
, "torAddress" .= (unTorAddress <$> appInstalledPreviewTorAddress)
|
||||
, "ui" .= appInstalledPreviewUi
|
||||
]
|
||||
|
||||
data InstallNewAppReq = InstallNewAppReq
|
||||
|
||||
3
agent/src/Lib/External/AppManifest.hs
vendored
3
agent/src/Lib/External/AppManifest.hs
vendored
@@ -64,6 +64,9 @@ data AppManifest (n :: Nat) where
|
||||
, appManifestV0Dependencies :: HM.HashMap AppId VersionRange
|
||||
} -> AppManifest 0
|
||||
|
||||
hasUi :: forall n. AppManifest n -> Bool
|
||||
hasUi AppManifestV0 {..} = isJust $ HM.lookup 80 appManifestV0PortMapping
|
||||
|
||||
instance FromJSON (Some1 AppManifest) where
|
||||
parseJSON = withObject "App Manifest" $ \o -> do
|
||||
o .: "compat" >>= \case
|
||||
|
||||
Reference in New Issue
Block a user