pinboard-notes-backup 1.0.6 → 1.0.7
raw patch · 7 files changed
+58/−17 lines, 7 filesdep +crypton-connectiondep +data-default-classdep +http-client-tlsdep ~tls
Dependencies added: crypton-connection, data-default-class, http-client-tls
Dependency ranges changed: tls
Files
- CHANGELOG.md +4/−0
- pinboard-notes-backup.cabal +11/−3
- src/Pinboard.hs +4/−1
- src/Utils.hs +2/−0
- src/Utils/HttpConfig.hs +36/−0
- stack.yaml +0/−5
- stack.yaml.lock +1/−8
CHANGELOG.md view
@@ -4,6 +4,10 @@ [PVP]: https://pvp.haskell.org/ +## 1.0.7 (2025-02-11)++The program should now build with any version of the `tls` library. (In our previous release, 1.0.6, we started requiring a pre-2.0 version of `tls` to avoid [issue #1](https://github.com/bdesham/pinboard-notes-backup/issues/1). This was an unnecessarily brittle solution: newer versions of `tls` work fine as long as we configure them properly.)+ ## 1.0.6 (2025-02-01) - If the database contains two notes with the same ID, the program will now abort rather than try to update any of them. (A database constraint should have prevented this situation from ever occurring; this is more of a “belt and braces” change than anything.)
pinboard-notes-backup.cabal view
@@ -1,5 +1,5 @@ name: pinboard-notes-backup-version: 1.0.6+version: 1.0.7 synopsis: Back up the notes you've saved to Pinboard description: A command-line application to back up your notes from the Pinboard bookmarking service to a local SQLite database.@@ -25,14 +25,22 @@ executable pnbackup hs-source-dirs: src main-is: Main.hs- other-modules: Paths_pinboard_notes_backup Pinboard Types Utils Utils.FriendlyReqError+ other-modules: Paths_pinboard_notes_backup+ Pinboard+ Types+ Utils+ Utils.FriendlyReqError+ Utils.HttpConfig default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , aeson >= 0.8 && < 2.3 , ansi-wl-pprint >= 0.6 && < 1.1 , bytestring >= 0.10 && < 0.13 , containers >= 0.5 && < 0.8+ , crypton-connection+ , data-default-class , http-client >= 0.5 && < 0.8+ , http-client-tls , http-types >= 0.12 && < 0.13 , mtl >= 2.2 && < 2.4 , optparse-applicative >= 0.11 && < 0.19@@ -40,7 +48,7 @@ , sqlite-simple >= 0.4 && < 0.5 , text >= 1.2 && < 2.2 , time >= 1.5 && < 1.15- , tls < 2.0+ , tls default-extensions: DataKinds DeriveFunctor GeneralizedNewtypeDeriving
src/Pinboard.hs view
@@ -27,7 +27,7 @@ import Network.HTTP.Req import Paths_pinboard_notes_backup (version) import Types-import Utils (count, friendlyReqError)+import Utils (count, friendlyReqError, makeHttpConfig) -- * Constants@@ -78,6 +78,9 @@ instance MonadHttp PinboardM where handleHttpException :: HttpException -> PinboardM a handleHttpException = throwError . friendlyReqError++ getHttpConfig :: PinboardM HttpConfig+ getHttpConfig = liftIO makeHttpConfig runPinboard :: String -> Verbosity -> PinboardM a -> IO (Either Text a) runPinboard token verbosity k =
src/Utils.hs view
@@ -1,5 +1,6 @@ module Utils ( count , friendlyReqError+ , makeHttpConfig , pluralize , putStrLnErr ) where@@ -9,6 +10,7 @@ import Data.Text.IO (hPutStrLn) import System.IO (hFlush, stderr, stdout) import Utils.FriendlyReqError (friendlyReqError)+import Utils.HttpConfig (makeHttpConfig) -- | Counts the number of occurrences of the given value within the given list. count :: (Eq a, Foldable t) => a -> t a -> Int
+ src/Utils/HttpConfig.hs view
@@ -0,0 +1,36 @@+{-# LANGUAGE CPP #-}++module Utils.HttpConfig (makeHttpConfig) where++import qualified Network.HTTP.Req as Req++#if MIN_VERSION_tls(2,0,0)+import Data.Default.Class+import Network.Connection (TLSSettings (..))+import Network.HTTP.Client (newManager)+import Network.HTTP.Client.TLS (mkManagerSettings)+import Network.TLS (EMSMode (..), Supported (..))+#endif++-- | Creates an 'Network.HTTP.Req.HttpConfig' suitable for connecting to the Pinboard API server.+--+-- As of February 2025, the latest TLS version supported by the Pinboard server is 1.2, and the+-- server does not support the Extended Main Secret (also called Extended Master Secret or EMS)+-- extension. As of version 2.0.0 of the tls library, we need to use a custom configuration to+-- connect to such a server.+makeHttpConfig :: IO Req.HttpConfig++#if MIN_VERSION_tls(2,0,0)++makeHttpConfig = do+ let supported = def {supportedExtendedMainSecret=AllowEMS}+ tlsSettings = TLSSettingsSimple False False False supported+ managerSettings = mkManagerSettings tlsSettings Nothing+ manager <- newManager managerSettings+ pure $ Req.defaultHttpConfig {Req.httpConfigAltManager=Just manager}++#else++makeHttpConfig = pure Req.defaultHttpConfig++#endif
stack.yaml view
@@ -1,6 +1,1 @@ resolver: lts-23.5-extra-deps:- # Version 2.0 of the tls package started requiring hosts to support Extended- # Main Secret, but the Pinboard server doesn't support this and so the- # program would fail at runtime if build with tls 2.0 or later. See issue #1.- - tls-1.9.0@sha256:8ad332dc0224decb1b137bf6c9678b4f786487b9aaa5c9068cd3ad19d42c39a7,5571
stack.yaml.lock view
@@ -3,14 +3,7 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/lock_files -packages:-- completed:- hackage: tls-1.9.0@sha256:8ad332dc0224decb1b137bf6c9678b4f786487b9aaa5c9068cd3ad19d42c39a7,5571- pantry-tree:- sha256: 91d022739795013aad4d5fee48ff5248623ed4cc83a611c9aa7c52e21766221b- size: 4897- original:- hackage: tls-1.9.0@sha256:8ad332dc0224decb1b137bf6c9678b4f786487b9aaa5c9068cd3ad19d42c39a7,5571+packages: [] snapshots: - completed: sha256: 2d580e973dc1a5ff70cd2bb1248613f835829b38eed5db5dafc3615a22cb1bcd