Skip to content

Commit 6b11c8f

Browse files
committed
Merge branch 'smp-web' into ep/smp-web
2 parents c57ed9e + 1a12ee0 commit 6b11c8f

File tree

7 files changed

+17
-21
lines changed

7 files changed

+17
-21
lines changed

simplexmq.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 1.12
22

33
name: simplexmq
4-
version: 6.5.0.10
4+
version: 6.5.0.11
55
synopsis: SimpleXMQ message broker
66
description: This package includes <./docs/Simplex-Messaging-Server.html server>,
77
<./docs/Simplex-Messaging-Client.html client> and

src/Simplex/Messaging/Agent/Store/AgentStore.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ checkConfirmedSndQueueExists_ db SndQueue {server, sndId} =
457457
DB.query
458458
db
459459
( "SELECT 1 FROM snd_queues WHERE host = ? AND port = ? AND snd_id = ? AND status != ? LIMIT 1"
460-
#if defined(dpPostgres)
460+
#if defined(dbPostgres)
461461
<> " FOR UPDATE"
462462
#endif
463463
)

src/Simplex/Messaging/Util.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ groupAllOn f = groupOn f . sortOn f
350350
-- n must be > 0
351351
toChunks :: Int -> [a] -> [NonEmpty a]
352352
toChunks _ [] = []
353+
toChunks 0 (x : xs) = [x :| xs]
353354
toChunks n xs =
354355
let (ys, xs') = splitAt n xs
355356
in maybe id (:) (L.nonEmpty ys) (toChunks n xs')

src/Simplex/RemoteControl/Types.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ module Simplex.RemoteControl.Types
1313
RCPVersion,
1414
VersionRCP,
1515
VersionRangeRCP,
16-
IpProbe (..),
1716
RCHostHello (..),
1817
RCCtrlHello (..),
1918
RCHostPairing (..),
@@ -141,16 +140,6 @@ currentRCPVersion = VersionRCP 1
141140
supportedRCPVRange :: VersionRangeRCP
142141
supportedRCPVRange = mkVersionRange (VersionRCP 1) currentRCPVersion
143142

144-
data IpProbe = IpProbe
145-
{ versionRange :: VersionRangeRCP,
146-
randomNonce :: ByteString
147-
}
148-
deriving (Show)
149-
150-
instance Encoding IpProbe where
151-
smpEncode IpProbe {versionRange, randomNonce} = smpEncode (versionRange, 'I', randomNonce)
152-
smpP = IpProbe <$> (smpP <* "I") *> smpP
153-
154143
-- * Session
155144

156145
data RCHostHello = RCHostHello

tests/Test.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import XFTPWebTests (xftpWebTests)
4040

4141
#if defined(dbPostgres)
4242
import Fixtures
43+
import Simplex.Messaging.Agent.Store.Postgres.Util (dropAllSchemasExceptSystem)
4344
#else
4445
import AgentTests.SchemaDump (schemaDumpTest)
4546
#endif
@@ -151,7 +152,11 @@ main = do
151152
describe "XFTP file description" fileDescriptionTests
152153
describe "XFTP CLI" xftpCLITests
153154
describe "XFTP agent" xftpAgentTests
154-
describe "XFTP Web Client" xftpWebTests
155+
#if defined(dbPostgres)
156+
describe "XFTP Web Client" $ xftpWebTests (dropAllSchemasExceptSystem testDBConnectInfo)
157+
#else
158+
describe "XFTP Web Client" $ xftpWebTests (pure ())
159+
#endif
155160
describe "XRCP" remoteControlTests
156161
describe "Web" webTests
157162
describe "Server CLIs" cliTests

tests/XFTPWebTests.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import AgentTests.FunctionalAPITests (rfGet, runRight, runRight_, sfGet, withAge
5050
import Simplex.Messaging.Agent (AgentClient, xftpReceiveFile, xftpSendFile, xftpStartWorkers)
5151
import Simplex.Messaging.Agent.Protocol (AEvent (..))
5252
import SMPAgentClient (agentCfg, initAgentServers, testDB)
53-
import XFTPCLI (recipientFiles, senderFiles)
53+
import XFTPCLI (recipientFiles, senderFiles, testBracket)
5454
import qualified Simplex.Messaging.Crypto.File as CF
5555

5656
xftpWebDir :: FilePath
@@ -167,8 +167,8 @@ impAddr = "import * as Addr from './dist/protocol/address.js';"
167167
jsOut :: String -> String
168168
jsOut expr = "process.stdout.write(Buffer.from(" <> expr <> "));"
169169

170-
xftpWebTests :: Spec
171-
xftpWebTests = do
170+
xftpWebTests :: IO () -> Spec
171+
xftpWebTests dbCleanup = do
172172
distExists <- runIO $ doesDirectoryExist (xftpWebDir <> "/dist")
173173
if distExists
174174
then do
@@ -187,7 +187,7 @@ xftpWebTests = do
187187
tsClientTests
188188
tsDownloadTests
189189
tsAddressTests
190-
tsIntegrationTests
190+
tsIntegrationTests dbCleanup
191191
else
192192
it "skipped (run 'cd xftp-web && npm install && npm run build' first)" $
193193
pendingWith "TS project not compiled"
@@ -2829,8 +2829,9 @@ tsAddressTests = describe "protocol/address" $ do
28292829

28302830
-- ── integration ───────────────────────────────────────────────────
28312831

2832-
tsIntegrationTests :: Spec
2833-
tsIntegrationTests = describe "integration" $ do
2832+
tsIntegrationTests :: IO () -> Spec
2833+
tsIntegrationTests dbCleanup = describe "integration" $
2834+
around_ testBracket . after_ dbCleanup $ do
28342835
it "web handshake with Ed25519 identity verification" $
28352836
webHandshakeTest testXFTPServerConfigEd25519SNI "tests/fixtures/ed25519/ca.crt"
28362837
it "web handshake with Ed448 identity verification" $

xftp-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simplex-chat/xftp-web",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "XFTP file transfer protocol client for web/browser environments",
55
"license": "AGPL-3.0-only",
66
"repository": {

0 commit comments

Comments
 (0)