mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +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 = handleS9ErrT $ do
|
||||
s <- getsYesod appSettings
|
||||
v <- interp s $ Reg.getLatestAgentVersion
|
||||
pure $ VersionLatestRes v
|
||||
uncurry VersionLatestRes <$> interp s Reg.getLatestAgentVersion
|
||||
where interp s = ExceptT . liftIO . runError . injectFilesystemBaseFromContext s . runRegistryUrlIOC
|
||||
|
||||
|
||||
|
||||
@@ -15,11 +15,13 @@ import Lib.Types.Emver
|
||||
import Model
|
||||
|
||||
data VersionLatestRes = VersionLatestRes
|
||||
{ versionLatestVersion :: Version
|
||||
{ versionLatestVersion :: Version
|
||||
, versionLatestReleaseNotes :: Maybe Text
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
instance ToJSON VersionLatestRes where
|
||||
toJSON VersionLatestRes {..} = object $ ["versionLatest" .= versionLatestVersion]
|
||||
toJSON VersionLatestRes {..} =
|
||||
object $ ["versionLatest" .= versionLatestVersion, "releaseNotes" .= versionLatestReleaseNotes]
|
||||
instance ToTypedContent VersionLatestRes where
|
||||
toTypedContent = toTypedContent . toJSON
|
||||
instance ToContent VersionLatestRes where
|
||||
@@ -31,14 +33,15 @@ data ServerRes = ServerRes
|
||||
, serverStatus :: Maybe AppStatus
|
||||
, serverStatusAt :: UTCTime
|
||||
, serverVersionInstalled :: Version
|
||||
, serverNotifications :: [ Entity Notification ]
|
||||
, serverNotifications :: [Entity Notification]
|
||||
, serverWifi :: WifiList
|
||||
, serverSsh :: [ SshKeyFingerprint ]
|
||||
, serverSsh :: [SshKeyFingerprint]
|
||||
, serverAlternativeRegistryUrl :: Maybe Text
|
||||
, serverSpecs :: SpecsRes
|
||||
, serverWelcomeAck :: Bool
|
||||
, serverAutoCheckUpdates :: Bool
|
||||
} deriving (Eq, Show)
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
|
||||
type JsonEncoding a = Encoding
|
||||
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"
|
||||
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
|
||||
val <- registryRequest agentVersionPath
|
||||
parseOrThrow agentVersionPath val $ withObject "version response" $ \o -> do
|
||||
v <- o .: "version"
|
||||
pure v
|
||||
v <- o .: "version"
|
||||
rn <- o .:? "release-notes"
|
||||
pure (v, rn)
|
||||
where agentVersionPath = "sys/version/agent"
|
||||
|
||||
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
|
||||
sid <- getStart9AgentHostname
|
||||
let hostname = sid <> ".local"
|
||||
tor <- getAgentHiddenServiceUrl
|
||||
torAddr <- getAgentHiddenServiceUrl
|
||||
|
||||
caKeyPath <- toS <$> getAbsoluteLocationFor rootCaKeyPath
|
||||
caConfPath <- toS <$> getAbsoluteLocationFor rootCaOpenSslConfPath
|
||||
@@ -531,7 +531,7 @@ replaceDerivativeCerts = do
|
||||
, duration = 365
|
||||
}
|
||||
hostname
|
||||
tor
|
||||
torAddr
|
||||
liftIO $ do
|
||||
putStrLn @Text "openssl logs"
|
||||
putStrLn @Text "exit code: "
|
||||
|
||||
@@ -7,9 +7,7 @@ import Network.HTTP.Client
|
||||
import Network.Connection
|
||||
|
||||
import Lib.SystemPaths
|
||||
import Network.HTTP.Client.TLS ( mkManagerSettings
|
||||
, newTlsManagerWith
|
||||
)
|
||||
import Network.HTTP.Client.TLS ( mkManagerSettings )
|
||||
import Data.Default
|
||||
|
||||
getAgentHiddenServiceUrl :: (HasFilesystemBase sig m, MonadIO m) => m Text
|
||||
|
||||
Reference in New Issue
Block a user