mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
release notes plumbing
This commit is contained in:
committed by
Aiden McClelland
parent
18df87b8f5
commit
44def3be85
@@ -40,8 +40,7 @@ getVersionR = pure . AppVersionRes $ agentVersion
|
|||||||
getVersionLatestR :: Handler VersionLatestRes
|
getVersionLatestR :: Handler VersionLatestRes
|
||||||
getVersionLatestR = handleS9ErrT $ do
|
getVersionLatestR = handleS9ErrT $ do
|
||||||
s <- getsYesod appSettings
|
s <- getsYesod appSettings
|
||||||
v <- interp s $ Reg.getLatestAgentVersion
|
uncurry VersionLatestRes <$> interp s Reg.getLatestAgentVersion
|
||||||
pure $ VersionLatestRes v
|
|
||||||
where interp s = ExceptT . liftIO . runError . injectFilesystemBaseFromContext s . runRegistryUrlIOC
|
where interp s = ExceptT . liftIO . runError . injectFilesystemBaseFromContext s . runRegistryUrlIOC
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ import Lib.Types.Emver
|
|||||||
import Model
|
import Model
|
||||||
|
|
||||||
data VersionLatestRes = VersionLatestRes
|
data VersionLatestRes = VersionLatestRes
|
||||||
{ versionLatestVersion :: Version
|
{ versionLatestVersion :: Version
|
||||||
|
, versionLatestReleaseNotes :: Maybe Text
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
instance ToJSON VersionLatestRes where
|
instance ToJSON VersionLatestRes where
|
||||||
toJSON VersionLatestRes {..} = object $ ["versionLatest" .= versionLatestVersion]
|
toJSON VersionLatestRes {..} =
|
||||||
|
object $ ["versionLatest" .= versionLatestVersion, "releaseNotes" .= versionLatestReleaseNotes]
|
||||||
instance ToTypedContent VersionLatestRes where
|
instance ToTypedContent VersionLatestRes where
|
||||||
toTypedContent = toTypedContent . toJSON
|
toTypedContent = toTypedContent . toJSON
|
||||||
instance ToContent VersionLatestRes where
|
instance ToContent VersionLatestRes where
|
||||||
@@ -31,14 +33,15 @@ data ServerRes = ServerRes
|
|||||||
, serverStatus :: Maybe AppStatus
|
, serverStatus :: Maybe AppStatus
|
||||||
, serverStatusAt :: UTCTime
|
, serverStatusAt :: UTCTime
|
||||||
, serverVersionInstalled :: Version
|
, serverVersionInstalled :: Version
|
||||||
, serverNotifications :: [ Entity Notification ]
|
, serverNotifications :: [Entity Notification]
|
||||||
, serverWifi :: WifiList
|
, serverWifi :: WifiList
|
||||||
, serverSsh :: [ SshKeyFingerprint ]
|
, serverSsh :: [SshKeyFingerprint]
|
||||||
, serverAlternativeRegistryUrl :: Maybe Text
|
, serverAlternativeRegistryUrl :: Maybe Text
|
||||||
, serverSpecs :: SpecsRes
|
, serverSpecs :: SpecsRes
|
||||||
, serverWelcomeAck :: Bool
|
, serverWelcomeAck :: Bool
|
||||||
, serverAutoCheckUpdates :: Bool
|
, serverAutoCheckUpdates :: Bool
|
||||||
} deriving (Eq, Show)
|
}
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
||||||
type JsonEncoding a = Encoding
|
type JsonEncoding a = Encoding
|
||||||
jsonEncode :: (Monad m, ToJSON a) => a -> m (JsonEncoding a)
|
jsonEncode :: (Monad m, ToJSON a) => a -> m (JsonEncoding a)
|
||||||
|
|||||||
7
agent/src/Lib/External/Registry.hs
vendored
7
agent/src/Lib/External/Registry.hs
vendored
@@ -150,12 +150,13 @@ getAppVersionForSpec appId spec = do
|
|||||||
v <- o .: "version"
|
v <- o .: "version"
|
||||||
pure v
|
pure v
|
||||||
|
|
||||||
getLatestAgentVersion :: (Has RegistryUrl sig m, Has (Error S9Error) sig m, MonadIO m) => m Version
|
getLatestAgentVersion :: (Has RegistryUrl sig m, Has (Error S9Error) sig m, MonadIO m) => m (Version, Maybe Text)
|
||||||
getLatestAgentVersion = do
|
getLatestAgentVersion = do
|
||||||
val <- registryRequest agentVersionPath
|
val <- registryRequest agentVersionPath
|
||||||
parseOrThrow agentVersionPath val $ withObject "version response" $ \o -> do
|
parseOrThrow agentVersionPath val $ withObject "version response" $ \o -> do
|
||||||
v <- o .: "version"
|
v <- o .: "version"
|
||||||
pure v
|
rn <- o .:? "release-notes"
|
||||||
|
pure (v, rn)
|
||||||
where agentVersionPath = "sys/version/agent"
|
where agentVersionPath = "sys/version/agent"
|
||||||
|
|
||||||
getLatestAgentVersionForSpec :: (Has RegistryUrl sig m, Has (Lift IO) sig m, Has (Error S9Error) sig m)
|
getLatestAgentVersionForSpec :: (Has RegistryUrl sig m, Has (Lift IO) sig m, Has (Error S9Error) sig m)
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ replaceDerivativeCerts :: (HasFilesystemBase sig m, Fused.Has (Error S9Error) si
|
|||||||
replaceDerivativeCerts = do
|
replaceDerivativeCerts = do
|
||||||
sid <- getStart9AgentHostname
|
sid <- getStart9AgentHostname
|
||||||
let hostname = sid <> ".local"
|
let hostname = sid <> ".local"
|
||||||
tor <- getAgentHiddenServiceUrl
|
torAddr <- getAgentHiddenServiceUrl
|
||||||
|
|
||||||
caKeyPath <- toS <$> getAbsoluteLocationFor rootCaKeyPath
|
caKeyPath <- toS <$> getAbsoluteLocationFor rootCaKeyPath
|
||||||
caConfPath <- toS <$> getAbsoluteLocationFor rootCaOpenSslConfPath
|
caConfPath <- toS <$> getAbsoluteLocationFor rootCaOpenSslConfPath
|
||||||
@@ -531,7 +531,7 @@ replaceDerivativeCerts = do
|
|||||||
, duration = 365
|
, duration = 365
|
||||||
}
|
}
|
||||||
hostname
|
hostname
|
||||||
tor
|
torAddr
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
putStrLn @Text "openssl logs"
|
putStrLn @Text "openssl logs"
|
||||||
putStrLn @Text "exit code: "
|
putStrLn @Text "exit code: "
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ import Network.HTTP.Client
|
|||||||
import Network.Connection
|
import Network.Connection
|
||||||
|
|
||||||
import Lib.SystemPaths
|
import Lib.SystemPaths
|
||||||
import Network.HTTP.Client.TLS ( mkManagerSettings
|
import Network.HTTP.Client.TLS ( mkManagerSettings )
|
||||||
, newTlsManagerWith
|
|
||||||
)
|
|
||||||
import Data.Default
|
import Data.Default
|
||||||
|
|
||||||
getAgentHiddenServiceUrl :: (HasFilesystemBase sig m, MonadIO m) => m Text
|
getAgentHiddenServiceUrl :: (HasFilesystemBase sig m, MonadIO m) => m Text
|
||||||
|
|||||||
Reference in New Issue
Block a user