debug-me 1.20200820 → 1.20220324
raw patch · 5 files changed
+37/−16 lines, 5 filesdep ~aesondep ~websockets
Dependency ranges changed: aeson, websockets
Files
- CHANGELOG +10/−0
- Gpg/Wot.hs +12/−1
- Val.hs +3/−3
- WebSockets.hs +9/−9
- debug-me.cabal +3/−3
CHANGELOG view
@@ -1,3 +1,13 @@+debug-me (1.20220324) unstable; urgency=medium++ * Support ghc 8.8.+ Thanks, Tony Zorman+ * Support aeson 2.0.+ Thanks, Tony Zorman+ * Update to lts-19.0.++ -- Joey Hess <id@joeyh.name> Thu, 24 Mar 2022 11:39:51 -0400+ debug-me (1.20200820) unstable; urgency=medium * debug-me.service: Remove /etc from InaccessiblePaths,
Gpg/Wot.hs view
@@ -3,6 +3,7 @@ - Licensed under the GNU AGPL version 3 or higher. -} +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} -- | Gpg web of trust checking, using wotsap's JSON output@@ -15,8 +16,13 @@ import Network.HTTP.Client import Network.HTTP.Client.TLS import Data.List-import qualified Data.HashMap.Strict as M import qualified Data.Text as T+#if MIN_VERSION_aeson(2, 0, 0)+import qualified Data.Aeson.KeyMap as AM+import qualified Data.Aeson.Key as AK+#else+import qualified Data.HashMap.Strict as M+#endif data WotStats = WotStats { key :: Node@@ -43,9 +49,14 @@ -- | wotsap's json has some upper-case fields; lowercase field for parsing jsonLower :: Value -> Value+#if MIN_VERSION_aeson(2, 0, 0)+jsonLower (Object o) = Object . AM.mapKeyVal lowerKey id $ o+ where lowerKey = AK.fromText . T.toLower . AK.toText+#else jsonLower (Object o) = Object . M.fromList . map lowerPair . M.toList $ o where lowerPair (k, v) = (T.toLower k, v)+#endif jsonLower x = x instance FromJSON WotStats where
Val.hs view
@@ -9,8 +9,8 @@ import Memory import JSON+import qualified GHC.Generics as G -import GHC.Generics (Generic) import Data.Aeson.Types import qualified Codec.Binary.Base64 as B64 import qualified Data.Text as T@@ -20,7 +20,7 @@ -- | Newtype of ByteString so we can have JSON instances without orphans. newtype Val = Val { val :: B.ByteString }- deriving (Show, Generic, Eq, Sem.Semigroup, Monoid)+ deriving (Show, G.Generic, Eq, Sem.Semigroup, Monoid) instance DataSize Val where dataSize (Val b) = fromIntegral (B.length b)@@ -42,7 +42,7 @@ b64 :: B.ByteString -> T.Text b64 = T.decodeUtf8 . B64.encode -unb64 :: Monad m => T.Text -> m B.ByteString+unb64 :: MonadFail m => T.Text -> m B.ByteString unb64 t = either (\_ -> fail "bad base64 data") return
WebSockets.hs view
@@ -164,16 +164,16 @@ -> (AnyMessage -> Maybe received) -> (TMChan sent -> TMChan (MissingHashes received) -> SessionID -> IO a) -> ClientApp a-clientApp mode mksent filterreceived a conn = do+clientApp mode mksent filterreceived a conn = -- Ping every 30 seconds to avoid timeouts caused by proxies etc.- forkPingThread conn 30- _v <- negotiateWireVersion conn- sendBinaryData conn (SelectMode ClientSends mode)- r <- receiveData conn- case r of- Ready ServerSends sid -> bracket setup cleanup (go sid)- WireProtocolError e -> error e- _ -> protocolError conn "Did not get expected Ready message from server"+ withPingThread conn 30 (return ()) $ do+ _v <- negotiateWireVersion conn+ sendBinaryData conn (SelectMode ClientSends mode)+ r <- receiveData conn+ case r of+ Ready ServerSends sid -> bracket setup cleanup (go sid)+ WireProtocolError e -> error e+ _ -> protocolError conn "Did not get expected Ready message from server" where setup = do schan <- newTMChanIO
debug-me.cabal view
@@ -1,5 +1,5 @@ Name: debug-me-Version: 1.20200820+Version: 1.20220324 Cabal-Version: >= 1.10 Maintainer: Joey Hess <joey@kitenet.net> Author: Joey Hess@@ -64,7 +64,7 @@ , stm-chans (>= 3.0) , posix-pty (>= 0.2.1) , terminal-size (>= 0.3)- , aeson (>= 0.11 && < 1.5)+ , aeson (>= 0.11 && < 2.1) , sandi (>= 0.4) , text (>= 1.2.2) , optparse-applicative (>= 0.12)@@ -81,7 +81,7 @@ , http-types (>= 0.9) , http-client (>= 0.4) , http-client-tls (>= 0.2)- , websockets (>= 0.9)+ , websockets (>= 0.12.6.0) , wai-websockets (>= 3.0) , uuid (>= 1.3) , protobuf (>= 0.2)