Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,780 changes: 1,694 additions & 86 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
ratatui = "0.29"
ratatui = "0.30"
crossterm = { version = "0.28", features = ["event-stream"] }
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
Expand All @@ -17,3 +17,5 @@ futures = "0.3"
tokio-stream = "0.1"
which = "7"
bech32 = "0.11"
ratatui-image = { version = "10", default-features = false, features = ["crossterm"] }
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "gif", "webp"] }
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

![wn-tui](https://blossom.primal.net/ac0d58ade515b45cdc9281f86e2467a9df999394aa28e95ea093cadedf868aaa.png)

A terminal user interface for [WhiteNoise](https://github.com/marmot-protocol/whitenoise), a secure group messenger built on MLS and Nostr.
A terminal user interface for [WhiteNoise](https://github.com/marmot-protocol/whitenoise-rs), a secure group messenger built on MLS and Nostr.

```
```text
+-[Chats]--------+-[Coffee Chat]-------------------------------+
| > Coffee Chat | [10:31] alice: Hey everyone |
| Work | [10:32] bob: What's up? |
Expand All @@ -26,13 +26,12 @@ wn-tui is a pure presentation layer over the WhiteNoise CLI. It spawns `wn` comm

### 1. WhiteNoise daemon and CLI

Build from the [`feat/cli`](https://github.com/marmot-protocol/whitenoise/pull/537) branch of whitenoise-rs:
Build from [whitenoise-rs](https://github.com/marmot-protocol/whitenoise-rs):

```sh
git clone https://github.com/marmot-protocol/whitenoise.git
cd whitenoise
git checkout feat/cli
cargo build --release
git clone https://github.com/marmot-protocol/whitenoise-rs.git
cd whitenoise-rs
cargo build --release --bin wn --features cli --bin wnd
Comment thread
jgmontoya marked this conversation as resolved.
```

This produces two binaries in `target/release/`:
Expand Down
114 changes: 114 additions & 0 deletions src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,40 @@ pub enum Action {
MessageSent,
MessageSendError(String),

// Reactions
ReactionSuccess,
ReactionError(String),
MessagesLoaded(Vec<Value>),
Comment thread
jgmontoya marked this conversation as resolved.

// Message deletion
MessageDeleted {
message_id: String,
},
MessageDeleteError(String),

// Media upload
MediaUploaded,
MediaUploadError(String),

// Media
MediaDownloaded {
file_hash: String,
file_path: String,
},
MediaDownloadFailed {
file_hash: String,
error: String,
},
MediaImageLoaded {
file_hash: String,
bytes: Vec<u8>,
},
MediaPopupReady {
bytes: Vec<u8>,
img_width: u32,
img_height: u32,
},

// Notifications (streaming)
NotificationUpdate(Value),
NotificationStreamEnded,
Expand All @@ -46,8 +80,11 @@ pub enum Action {

// Profile
ProfileLoaded(Value),
ProfileImageFetched(Vec<u8>),
ProfileUpdateSuccess(String),
ProfileUpdateError(String),
NsecExported(String),
NsecExportError(String),

// Settings
SettingsLoaded(Value),
Expand All @@ -58,10 +95,20 @@ pub enum Action {
FollowsLoaded(Vec<Value>),
FollowSuccess(String),
FollowError(String),
FollowCheckResult {
pubkey: String,
following: bool,
},

// User search
SearchResult(Value),
SearchStreamEnded,
UserProfileLoaded(Value),
UserProfileError(String),

// Account management
LogoutSuccess,
LogoutError(String),

// Logs
Log(String),
Expand Down Expand Up @@ -91,6 +138,30 @@ pub enum Effect {
account: String,
group_id: String,
text: String,
reply_to: Option<String>,
},

LoadMessages {
account: String,
group_id: String,
},

// Reactions
ReactToMessage {
account: String,
group_id: String,
message_id: String,
emoji: String,
},
UnreactToMessage {
account: String,
group_id: String,
message_id: String,
},
DeleteMessage {
account: String,
group_id: String,
message_id: String,
},

// Group management
Expand All @@ -108,6 +179,7 @@ pub enum Effect {
CreateGroup {
account: String,
name: String,
members: Vec<String>,
},
AddMember {
account: String,
Expand Down Expand Up @@ -144,7 +216,17 @@ pub enum Effect {
UpdateProfile {
account: String,
name: Option<String>,
display_name: Option<String>,
about: Option<String>,
picture: Option<String>,
nip05: Option<String>,
lud16: Option<String>,
},
ExportNsec {
account: String,
},
FetchProfileImage {
url: String,
},

// Settings
Expand All @@ -170,13 +252,45 @@ pub enum Effect {
account: String,
pubkey: String,
},
CheckFollow {
account: String,
pubkey: String,
},

// User search
SearchUsers {
account: String,
query: String,
},
UnsubscribeSearch,
ShowUserProfile {
account: String,
pubkey: String,
},

// Account management
Logout {
account: String,
},

// Media
DownloadMedia {
account: String,
group_id: String,
file_hash: String,
},
LoadMediaImage {
file_hash: String,
file_path: String,
},
LoadMediaPopup {
file_path: String,
},
UploadMedia {
account: String,
group_id: String,
file_path: String,
},

// Daemon logs
TailDaemonLog,
Expand Down
Loading