diff --git a/README.md b/README.md index ef007bfcfb..81ce38d27f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ SimpleX chat prototype is a thin terminal UI on top of [SimpleXMQ](https://github.com/simplex-chat/simplexmq) message broker that uses [SMP protocols](https://github.com/simplex-chat/simplexmq/blob/master/protocol). The motivation for SimpleX chat is [presented here](./simplex.md). See [simplex.chat](https://simplex.chat) website for chat demo and the explanations of the system and how SMP protocol works. +**NEW in v0.5.0: [user contact addresses](#user-contact-addresses-alpha)!** + +**Please note**: v0.5.0 of SimpleX Chat works with the same database, but the connection links are not compatible with the previous version - please ask all your contacts to upgrade! + ### :zap: Quick installation ```sh @@ -55,7 +59,7 @@ We appreciate all the help from our contributors, thank you! - [How to use SimpleX chat](#how-to-use-simplex-chat) - [Groups](#groups) - [Sending files](#sending-files) - - [User contact addresses](#user-contact-addresses) + - [User contact addresses](#user-contact-addresses-alpha) - [Access chat history](#access-chat-history) - [Roadmap](#Roadmap) - [License](#license) @@ -80,8 +84,6 @@ The routing of messages relies on the knowledge of client devices how user conta ## Terminal chat features -**NEW in v0.4.3: [user contact addresses](#user-contact-addresses)!** - - 1-to-1 chat with multiple people in the same terminal window. - Group messaging. - Sending files to contacts and groups. @@ -256,7 +258,7 @@ You can send a file to your contact with `/f @ ` - the recip You can send files to a group with `/f # `. -### User contact addresses +### User contact addresses (alpha) As an alternative to one-time invitation links, you can create a long-term address with `/ad` (for `/address`). The created address can then be shared via any channel, and used by other users as a link to make a contact request with `/c `. @@ -266,7 +268,7 @@ User address is "long-term" in a sense that it is a multiple-use connection link Use `/help address` for other commands. -> :warning: **Please note:** This is a beta feature - at the moment only request throttling is implemented as a countermeasure against spam. +> :warning: **Please note:** This is an "alpha" feature - at the moment there is nothing to prevent someone who has obtained this address from spamming you with connection requests; countermeasures will be added soon! (In the short term, you can simply delete the long-term address you created if it starts getting abused.) ![simplex-chat](./images/user-addresses.gif) diff --git a/apps/simplex-chat/Demo.hs b/apps/simplex-chat/Demo.hs deleted file mode 100644 index 2fff0b0a32..0000000000 --- a/apps/simplex-chat/Demo.hs +++ /dev/null @@ -1,119 +0,0 @@ -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} - -module Demo where - -import Simplex.Chat.Styled -import System.Console.ANSI.Types -import System.Terminal - -someViewUpdate :: Monad m => m () -someViewUpdate = pure () - -chatLayoutDemo :: MonadTerminal m => m () -chatLayoutDemo = - mapM_ - putStyledLn - [ " search " <> Styled gray "(ctrl-s) " <> lineV <> Styled toContact " @bob " <> "Bob Roberts " <> Styled greenColor "@john" <> "", - " " <> lineV <> Styled gray " 14:15 online profile (ctrl-p)", - lineH 20 <> crossover <> lineH 59, - "* " <> Styled [SetConsoleIntensity BoldIntensity] "all chats " <> " " <> lineV <> "", - Styled gray " (ctrl-a) " <> lineV <> "", - "*" <> Styled toContact " @alice " <> Styled darkGray "14:37 " <> lineV <> "", - Styled gray " Hello there! ... " <> lineV <> "", - Styled selected " " <> Styled (toContact <> selected) " @bob " <> Styled (selected <> gray) "12:35 " <> lineV <> "", - Styled selected " All good, John... " <> lineV <> "", - "*" <> Styled group " #team " <> Styled darkGray "10:55 " <> lineV <> "", - Styled gray " What's up ther... " <> lineV <> "", - " " <> Styled toContact " @tom " <> Styled darkGray "Wed " <> lineV <> "", - Styled gray " Have you seen ... " <> lineV <> "", - " " <> lineV, - " " <> lineV, - " " <> lineV, - " " <> lineV, - " " <> lineV, - " " <> lineV <> Styled greenColor " ✔︎" <> Styled darkGray " 12:30" <> Styled toContact " @bob" <> " hey bob - how is it going?", - " " <> lineV <> Styled greenColor " ✔︎" <> Styled darkGray " " <> Styled toContact " " <> " let's meet soon!", - " " <> lineV <> " *" <> Styled darkGray " 12:35" <> Styled contact " bob>" <> " All good, John! How are you?", - " " <> teeL <> lineH 59, - " " <> lineV <> " > " <> Styled toContact "@bob" <> " 😀 This is the message that will be sent to @bob" - ] - >> putStyled (Styled ctrlKeys " help (ctrl-h) new contact (ctrl-n) choose chat (ctrl-↓↑) new group (ctrl-g) ") - -contact :: [SGR] -contact = [SetConsoleIntensity BoldIntensity, SetColor Foreground Vivid Yellow] - -toContact :: [SGR] -toContact = [SetConsoleIntensity BoldIntensity, SetColor Foreground Vivid Cyan] - -group :: [SGR] -group = [SetConsoleIntensity BoldIntensity, SetColor Foreground Vivid Cyan] - -selected :: [SGR] -selected = [SetColor Background Vivid Black] - -ctrlKeys :: [SGR] -ctrlKeys = [SetColor Background Dull White, SetColor Foreground Dull Black] - -gray :: [SGR] -gray = [SetColor Foreground Dull White] - -darkGray :: [SGR] -darkGray = [SetColor Foreground Vivid Black] - -greenColor :: [SGR] -greenColor = [SetColor Foreground Vivid Green] - -lineV :: StyledString -lineV = Styled selected " " -- "\x2502" - -lineH :: Int -> StyledString -lineH n = Styled darkGray $ replicate n '\x2500' - -teeL :: StyledString -teeL = Styled selected " " -- "\x251C" - -crossover :: StyledString -crossover = Styled selected " " -- "\x253C" - -putStyledLn :: MonadTerminal m => StyledString -> m () -putStyledLn s = putStyled s >> putLn - -putStyled :: MonadTerminal m => StyledString -> m () -putStyled (s1 :<>: s2) = putStyled s1 >> putStyled s2 -putStyled (Styled [] s) = putString s -putStyled (Styled sgr s) = setSGR sgr >> putString s >> resetAttributes - -setSGR :: MonadTerminal m => [SGR] -> m () -setSGR = mapM_ $ \case - Reset -> resetAttributes - SetConsoleIntensity BoldIntensity -> setAttribute bold - SetConsoleIntensity _ -> resetAttribute bold - SetItalicized True -> setAttribute italic - SetItalicized _ -> resetAttribute italic - SetUnderlining NoUnderline -> resetAttribute underlined - SetUnderlining _ -> setAttribute underlined - SetSwapForegroundBackground True -> setAttribute inverted - SetSwapForegroundBackground _ -> resetAttribute inverted - SetColor l i c -> setAttribute . layer l . intensity i $ color c - SetBlinkSpeed _ -> pure () - SetVisible _ -> pure () - SetRGBColor _ _ -> pure () - SetPaletteColor _ _ -> pure () - SetDefaultColor _ -> pure () - where - layer = \case - Foreground -> foreground - Background -> background - intensity = \case - Dull -> id - Vivid -> bright - color = \case - Black -> black - Red -> red - Green -> green - Yellow -> yellow - Blue -> blue - Magenta -> magenta - Cyan -> cyan - White -> white diff --git a/apps/simplex-chat/Main.hs b/apps/simplex-chat/Main.hs index cd7f353bba..716dd7e39f 100644 --- a/apps/simplex-chat/Main.hs +++ b/apps/simplex-chat/Main.hs @@ -25,35 +25,3 @@ welcomeGetOpts = do putStrLn $ "db: " <> dbFile <> ".chat.db, " <> dbFile <> ".agent.db" putStrLn "type \"/help\" or \"/h\" for usage info" pure opts - --- defaultSettings :: C.Size -> C.VirtualTerminalSettings --- defaultSettings size = --- C.VirtualTerminalSettings --- { C.virtualType = "xterm", --- C.virtualWindowSize = pure size, --- C.virtualEvent = retry, --- C.virtualInterrupt = retry --- } - --- main :: IO () --- main = do --- void $ createStore "simplex-chat.db" 4 - --- hFlush stdout --- -- ChatTerminal {termSize} <- newChatTerminal --- -- pos <- C.withVirtualTerminal (defaultSettings termSize) $ --- -- \t -> runTerminalT (C.setAlternateScreenBuffer True >> C.putString "a" >> C.flush >> C.getCursorPosition) t --- -- print pos --- -- race_ (printEvents t) (updateTerminal t) --- void . withTerminal . runTerminalT $ chatLayoutDemo >> C.flush >> C.awaitEvent - --- printEvents :: C.VirtualTerminal -> IO () --- printEvents t = forever $ do --- event <- withTerminal . runTerminalT $ C.flush >> C.awaitEvent --- runTerminalT (putStringLn $ show event) t - --- updateTerminal :: C.VirtualTerminal -> IO () --- updateTerminal t = forever $ do --- threadDelay 10000 --- win <- readTVarIO $ C.virtualWindow t --- withTerminal . runTerminalT $ mapM_ C.putStringLn win >> C.flush diff --git a/package.yaml b/package.yaml index a46590627d..170fcb4691 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: simplex-chat -version: 0.4.2 +version: 0.5.0 #synopsis: #description: homepage: https://github.com/simplex-chat/simplex-chat#readme @@ -29,7 +29,7 @@ dependencies: - optparse-applicative == 0.15.* - process == 1.6.* - simple-logger == 0.1.* - - simplexmq == 0.4.* + - simplexmq == 0.5.* - sqlite-simple == 0.4.* - stm == 2.5.* - terminal == 0.2.* diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index 9fff4b0402..f8a2f3f902 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -26,7 +26,7 @@ import System.IO (Handle) import UnliftIO.STM versionNumber :: String -versionNumber = "0.4.2" +versionNumber = "0.5.0" data ChatConfig = ChatConfig { agentConfig :: AgentConfig, diff --git a/stack.yaml b/stack.yaml index 6526fb0f8d..027d032048 100644 --- a/stack.yaml +++ b/stack.yaml @@ -40,10 +40,10 @@ extra-deps: - simple-logger-0.1.0@sha256:be8ede4bd251a9cac776533bae7fb643369ebd826eb948a9a18df1a8dd252ff8,1079 - sqlite-simple-0.4.18.0@sha256:3ceea56375c0a3590c814e411a4eb86943f8d31b93b110ca159c90689b6b39e5,3002 - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977 - # - simplexmq-0.4.1@sha256:3a1bc40d85e4e398458e5b9b79757e0af4fe27b8ef44eb3157f7f1e07412a8e8,7640 + - simplexmq-0.5.0@sha256:3d9b84d986df7409839c19455a376722837d52a646cb5d136037cadd0b5a4b76,7828 # - ../simplexmq - - github: simplex-chat/simplexmq - commit: fe2d6607de44d6be468d3a3a1a8536cf85b4f237 + # - github: simplex-chat/simplexmq + # commit: f15067cf6891bda3216c6cf6d2e3ecdba9b7269e # # extra-deps: []