core: return controller app info in response when connecting, validate ID key (#3353)

This commit is contained in:
Evgeny Poberezkin
2023-11-12 14:40:49 +00:00
committed by GitHub
parent 8e3e58cac8
commit 92e3f576ca
8 changed files with 70 additions and 56 deletions
+8 -1
View File
@@ -4,6 +4,7 @@
module Simplex.Chat.Remote.AppVersion
( AppVersionRange (minVersion, maxVersion),
pattern AppVersionRange,
AppVersion (..),
pattern AppCompatible,
mkAppVersionRange,
@@ -22,7 +23,7 @@ import qualified Data.Version as V
import Simplex.Messaging.Parsers (defaultJSON)
import Text.ParserCombinators.ReadP (readP_to_S)
newtype AppVersion = AppVersion V.Version
newtype AppVersion = AppVersion {appVersion :: V.Version}
deriving (Eq, Ord, Show)
instance ToJSON AppVersion where
@@ -40,6 +41,12 @@ data AppVersionRange = AppVRange
{ minVersion :: AppVersion,
maxVersion :: AppVersion
}
deriving (Show)
pattern AppVersionRange :: AppVersion -> AppVersion -> AppVersionRange
pattern AppVersionRange v1 v2 <- AppVRange v1 v2
{-# COMPLETE AppVersionRange #-}
mkAppVersionRange :: AppVersion -> AppVersion -> AppVersionRange
mkAppVersionRange v1 v2
+5 -4
View File
@@ -96,7 +96,7 @@ data RHKey = RHNew | RHId {remoteHostId :: RemoteHostId}
-- | Storable/internal remote host data
data RemoteHost = RemoteHost
{ remoteHostId :: RemoteHostId,
hostName :: Text,
hostDeviceName :: Text,
storePath :: FilePath,
hostPairing :: RCHostPairing
}
@@ -104,7 +104,7 @@ data RemoteHost = RemoteHost
-- | UI-accessible remote host information
data RemoteHostInfo = RemoteHostInfo
{ remoteHostId :: RemoteHostId,
hostName :: Text,
hostDeviceName :: Text,
storePath :: FilePath,
sessionActive :: Bool
}
@@ -115,14 +115,14 @@ type RemoteCtrlId = Int64
-- | Storable/internal remote controller data
data RemoteCtrl = RemoteCtrl
{ remoteCtrlId :: RemoteCtrlId,
ctrlName :: Text,
ctrlDeviceName :: Text,
ctrlPairing :: RCCtrlPairing
}
-- | UI-accessible remote controller information
data RemoteCtrlInfo = RemoteCtrlInfo
{ remoteCtrlId :: RemoteCtrlId,
ctrlName :: Text,
ctrlDeviceName :: Text,
sessionActive :: Bool
}
deriving (Show)
@@ -151,6 +151,7 @@ data CtrlAppInfo = CtrlAppInfo
{ appVersionRange :: AppVersionRange,
deviceName :: Text
}
deriving (Show)
data HostAppInfo = HostAppInfo
{ appVersion :: AppVersion,