diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4660d0f..012c48e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: os: - - ubuntu-22.04 + - ubuntu-latest - windows-latest - macos-latest - macos-13 @@ -59,11 +59,11 @@ jobs: - name: Zip artifacts run: | - chmod +x cove-ubuntu-22.04/cove + chmod +x cove-ubuntu-latest/cove chmod +x cove-windows-latest/cove.exe chmod +x cove-macos-latest/cove chmod +x cove-macos-13/cove - zip -jr "cove-$(cat cove-ubuntu-22.04/host).zip" cove-ubuntu-22.04/cove + zip -jr "cove-$(cat cove-ubuntu-latest/host).zip" cove-ubuntu-latest/cove zip -jr "cove-$(cat cove-windows-latest/host).zip" cove-windows-latest/cove.exe zip -jr "cove-$(cat cove-macos-latest/host).zip" cove-macos-latest/cove zip -jr "cove-$(cat cove-macos-13/host).zip" cove-macos-13/cove diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f9ce8c..1f06e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,21 +15,6 @@ Procedure when bumping the version number: ## Unreleased -### Changed - -- Display emoji user id hashes in the nick list -- Compile linux binary with older glibc version - -## v0.9.3 - 2025-05-31 - -### Added - -- Key bindings for emoji-based user id hashing - -### Fixed - -- `keys.rooms.action.connect_autojoin` connecting to non-autojoin rooms - ## v0.9.2 - 2025-03-14 ### Added diff --git a/CONFIG.md b/CONFIG.md index 82a7242..e537310 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -537,14 +537,6 @@ Reply to message, inline if possible. Reply opposite to normal reply. -### `keys.tree.action.toggle_nick_emoji` - -**Required:** yes -**Type:** key binding -**Default:** `"e"` - -Toggle agent id based nick emoji. - ### `keys.tree.action.toggle_seen` **Required:** yes diff --git a/Cargo.lock b/Cargo.lock index 2f45a5a..157b640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -322,7 +322,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cove" -version = "0.9.3" +version = "0.9.2" dependencies = [ "anyhow", "async-trait", @@ -350,7 +350,7 @@ dependencies = [ [[package]] name = "cove-config" -version = "0.9.3" +version = "0.9.2" dependencies = [ "cove-input", "cove-macro", @@ -361,7 +361,7 @@ dependencies = [ [[package]] name = "cove-input" -version = "0.9.3" +version = "0.9.2" dependencies = [ "cove-macro", "crossterm", @@ -375,7 +375,7 @@ dependencies = [ [[package]] name = "cove-macro" -version = "0.9.3" +version = "0.9.2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 33f245f..0fa473f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["cove", "cove-*"] [workspace.package] -version = "0.9.3" +version = "0.9.2" edition = "2024" [workspace.dependencies] diff --git a/cove-config/src/keys.rs b/cove-config/src/keys.rs index 47c171c..8b5adeb 100644 --- a/cove-config/src/keys.rs +++ b/cove-config/src/keys.rs @@ -104,7 +104,6 @@ default_bindings! { pub fn mark_older_seen => ["ctrl+s"]; pub fn info => ["i"]; pub fn links => ["I"]; - pub fn toggle_nick_emoji => ["e"]; pub fn increase_caesar => ["c"]; pub fn decrease_caesar => ["C"]; } @@ -357,9 +356,6 @@ pub struct TreeAction { /// List links found in message. #[serde(default = "default::tree_action::links")] pub links: KeyBinding, - /// Toggle agent id based nick emoji. - #[serde(default = "default::tree_action::toggle_nick_emoji")] - pub toggle_nick_emoji: KeyBinding, /// Increase caesar cipher rotation. #[serde(default = "default::tree_action::increase_caesar")] pub increase_caesar: KeyBinding, diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 5db1790..003cd40 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -1,18 +1,15 @@ use crossterm::style::Stylize; -use euphoxide::api::{MessageId, Snowflake, Time, UserId}; +use euphoxide::api::{MessageId, Snowflake, Time}; use jiff::Timestamp; use toss::{Style, Styled}; use crate::{store::Msg, ui::ChatMsg}; -use super::util; - #[derive(Debug, Clone)] pub struct SmallMessage { pub id: MessageId, pub parent: Option, pub time: Time, - pub user_id: UserId, pub nick: String, pub content: String, pub seen: bool, @@ -73,10 +70,6 @@ impl Msg for SmallMessage { fn last_possible_id() -> Self::Id { MessageId(Snowflake::MAX) } - - fn nick_emoji(&self) -> Option { - Some(util::user_id_emoji(&self.user_id)) - } } impl ChatMsg for SmallMessage { diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index ea1782a..c2928ab 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -1,28 +1,11 @@ -use std::{ - collections::HashSet, - hash::{DefaultHasher, Hash, Hasher}, - sync::LazyLock, -}; +use std::sync::LazyLock; use crossterm::style::{Color, Stylize}; -use euphoxide::{Emoji, api::UserId}; +use euphoxide::Emoji; use toss::{Style, Styled}; pub static EMOJI: LazyLock = LazyLock::new(Emoji::load); -pub static EMOJI_LIST: LazyLock> = LazyLock::new(|| { - let mut list = EMOJI - .0 - .values() - .flatten() - .cloned() - .collect::>() - .into_iter() - .collect::>(); - list.sort_unstable(); - list -}); - /// Convert HSL to RGB following [this approach from wikipedia][1]. /// /// `h` must be in the range `[0, 360]`, `s` and `l` in the range `[0, 1]`. @@ -86,11 +69,3 @@ pub fn style_mention_exact(mention: &str, base: Style) -> Styled { .expect("mention must start with @"); Styled::new(mention, nick_style(nick, base)) } - -pub fn user_id_emoji(user_id: &UserId) -> String { - let mut hasher = DefaultHasher::new(); - user_id.0.hash(&mut hasher); - let hash = hasher.finish(); - let emoji = &EMOJI_LIST[hash as usize % EMOJI_LIST.len()]; - emoji.clone() -} diff --git a/cove/src/store.rs b/cove/src/store.rs index b7031c1..f64f71e 100644 --- a/cove/src/store.rs +++ b/cove/src/store.rs @@ -8,10 +8,6 @@ pub trait Msg { fn parent(&self) -> Option; fn seen(&self) -> bool; - fn nick_emoji(&self) -> Option { - None - } - fn last_possible_id() -> Self::Id; } diff --git a/cove/src/ui.rs b/cove/src/ui.rs index 5ebd540..1c03834 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -50,7 +50,6 @@ impl From for UiError { } } -#[expect(clippy::large_enum_variant)] pub enum UiEvent { GraphemeWidthsChanged, LogChanged, diff --git a/cove/src/ui/chat.rs b/cove/src/ui/chat.rs index 1116935..405339b 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -37,7 +37,6 @@ pub struct ChatState> { cursor: Cursor, editor: EditorState, - nick_emoji: bool, caesar: i8, mode: Mode, @@ -49,7 +48,6 @@ impl + Clone> ChatState { Self { cursor: Cursor::Bottom, editor: EditorState::new(), - nick_emoji: false, caesar: 0, mode: Mode::Tree, @@ -58,10 +56,6 @@ impl + Clone> ChatState { store, } } - - pub fn nick_emoji(&self) -> bool { - self.nick_emoji - } } impl> ChatState { @@ -85,7 +79,6 @@ impl> ChatState { &mut self.editor, nick, focused, - self.nick_emoji, self.caesar, ) .boxed_async(), @@ -124,11 +117,6 @@ impl> ChatState { Reaction::Composed { parent, content } } - Reaction::NotHandled if event.matches(&keys.tree.action.toggle_nick_emoji) => { - self.nick_emoji = !self.nick_emoji; - Reaction::Handled - } - Reaction::NotHandled if event.matches(&keys.tree.action.increase_caesar) => { self.caesar = (self.caesar + 1).rem_euclid(26); Reaction::Handled diff --git a/cove/src/ui/chat/tree.rs b/cove/src/ui/chat/tree.rs index d9905fc..043e109 100644 --- a/cove/src/ui/chat/tree.rs +++ b/cove/src/ui/chat/tree.rs @@ -389,7 +389,6 @@ impl> TreeViewState { editor: &'a mut EditorState, nick: String, focused: bool, - nick_emoji: bool, caesar: i8, ) -> TreeView<'a, M, S> { TreeView { @@ -398,7 +397,6 @@ impl> TreeViewState { editor, nick, focused, - nick_emoji, caesar, } } @@ -412,8 +410,6 @@ pub struct TreeView<'a, M: Msg, S: MsgStore> { nick: String, focused: bool, - - nick_emoji: bool, caesar: i8, } @@ -442,7 +438,6 @@ where size, nick: self.nick.clone(), focused: self.focused, - nick_emoji: self.nick_emoji, caesar: self.caesar, last_cursor: self.state.last_cursor.clone(), last_cursor_top: self.state.last_cursor_top, diff --git a/cove/src/ui/chat/tree/renderer.rs b/cove/src/ui/chat/tree/renderer.rs index 225191b..142624e 100644 --- a/cove/src/ui/chat/tree/renderer.rs +++ b/cove/src/ui/chat/tree/renderer.rs @@ -80,7 +80,6 @@ pub struct TreeContext { pub size: Size, pub nick: String, pub focused: bool, - pub nick_emoji: bool, pub caesar: i8, pub last_cursor: Cursor, pub last_cursor_top: i32, @@ -208,7 +207,6 @@ where self.tz.clone(), indent, msg, - self.context.nick_emoji, self.context.caesar, folded_info, ); diff --git a/cove/src/ui/chat/tree/scroll.rs b/cove/src/ui/chat/tree/scroll.rs index a8a1305..ab3ddae 100644 --- a/cove/src/ui/chat/tree/scroll.rs +++ b/cove/src/ui/chat/tree/scroll.rs @@ -22,7 +22,6 @@ where size: self.last_size, nick: self.last_nick.clone(), focused: true, - nick_emoji: false, caesar: 0, last_cursor: self.last_cursor.clone(), last_cursor_top: self.last_cursor_top, diff --git a/cove/src/ui/chat/tree/widgets.rs b/cove/src/ui/chat/tree/widgets.rs index dd7fa89..d46920e 100644 --- a/cove/src/ui/chat/tree/widgets.rs +++ b/cove/src/ui/chat/tree/widgets.rs @@ -59,17 +59,10 @@ pub fn msg( tz: TimeZone, indent: usize, msg: &M, - nick_emoji: bool, caesar: i8, folded_info: Option, ) -> Boxed<'static, Infallible> { - let (mut nick, mut content) = msg.styled(); - - if nick_emoji { - if let Some(emoji) = msg.nick_emoji() { - nick = nick.then_plain("(").then_plain(emoji).then_plain(")"); - } - } + let (nick, mut content) = msg.styled(); if caesar != 0 { // Apply caesar in inverse because we're decoding diff --git a/cove/src/ui/euph/nick_list.rs b/cove/src/ui/euph/nick_list.rs index 8fbdb7b..e1e4e3d 100644 --- a/cove/src/ui/euph/nick_list.rs +++ b/cove/src/ui/euph/nick_list.rs @@ -22,10 +22,9 @@ pub fn widget<'a>( list: &'a mut ListState, joined: &Joined, focused: bool, - nick_emoji: bool, ) -> impl Widget + use<'a> { let mut list_builder = ListBuilder::new(); - render_rows(&mut list_builder, joined, focused, nick_emoji); + render_rows(&mut list_builder, joined, focused); list_builder.build(list) } @@ -71,7 +70,6 @@ fn render_rows( list_builder: &mut ListBuilder<'_, SessionId, Background>, joined: &Joined, focused: bool, - nick_emoji: bool, ) { let mut people = vec![]; let mut bots = vec![]; @@ -97,38 +95,10 @@ fn render_rows( lurkers.sort_unstable(); nurkers.sort_unstable(); - render_section( - list_builder, - "People", - &people, - &joined.session, - focused, - nick_emoji, - ); - render_section( - list_builder, - "Bots", - &bots, - &joined.session, - focused, - nick_emoji, - ); - render_section( - list_builder, - "Lurkers", - &lurkers, - &joined.session, - focused, - nick_emoji, - ); - render_section( - list_builder, - "Nurkers", - &nurkers, - &joined.session, - focused, - nick_emoji, - ); + render_section(list_builder, "People", &people, &joined.session, focused); + render_section(list_builder, "Bots", &bots, &joined.session, focused); + render_section(list_builder, "Lurkers", &lurkers, &joined.session, focused); + render_section(list_builder, "Nurkers", &nurkers, &joined.session, focused); } fn render_section( @@ -137,7 +107,6 @@ fn render_section( sessions: &[HalfSession], own_session: &SessionView, focused: bool, - nick_emoji: bool, ) { if sessions.is_empty() { return; @@ -155,7 +124,7 @@ fn render_section( list_builder.add_unsel(Text::new(row).background()); for session in sessions { - render_row(list_builder, session, own_session, focused, nick_emoji); + render_row(list_builder, session, own_session, focused); } } @@ -164,7 +133,6 @@ fn render_row( session: &HalfSession, own_session: &SessionView, focused: bool, - nick_emoji: bool, ) { let (name, style, style_inv, perms_style_inv) = if session.name.is_empty() { let name = "lurk".to_string(); @@ -198,24 +166,16 @@ fn render_row( " " }; - let emoji = if nick_emoji { - format!(" ({})", euph::user_id_emoji(&session.id)) - } else { - "".to_string() - }; - list_builder.add_sel(session.session_id.clone(), move |selected| { if focused && selected { let text = Styled::new_plain(owner) .then(name, style_inv) - .then(perms, perms_style_inv) - .then(emoji, perms_style_inv); + .then(perms, perms_style_inv); Text::new(text).background().with_style(style_inv) } else { let text = Styled::new_plain(owner) .then(&name, style) - .then_plain(perms) - .then_plain(emoji); + .then_plain(perms); Text::new(text).background() } }); diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 7e8ff99..ebae5a8 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -121,7 +121,7 @@ impl EuphRoom { .server_config .clone() .room(self.vault().room().name.clone()) - .name(format!("{room:?}-{next_instance_id}")) + .name(format!("{room:?}-{}", next_instance_id)) .human(true) .username(self.room_config.username.clone()) .force_username(self.room_config.force_username) @@ -291,16 +291,11 @@ impl EuphRoom { joined: &Joined, focus: Focus, ) -> BoxedAsync<'a, UiError> { - let nick_list_widget = nick_list::widget( - nick_list, - joined, - focus == Focus::NickList, - chat.nick_emoji(), - ) - .padding() - .with_right(1) - .border() - .desync(); + let nick_list_widget = nick_list::widget(nick_list, joined, focus == Focus::NickList) + .padding() + .with_right(1) + .border() + .desync(); let chat_widget = chat.widget(joined.session.name.clone(), focus == Focus::Chat); diff --git a/cove/src/ui/rooms.rs b/cove/src/ui/rooms.rs index c3d6a40..f901f30 100644 --- a/cove/src/ui/rooms.rs +++ b/cove/src/ui/rooms.rs @@ -536,10 +536,7 @@ impl Rooms { } if event.matches(&keys.rooms.action.connect_autojoin) { for (domain, server) in &self.config.euph.servers { - for (name, room) in &server.rooms { - if !room.autojoin { - continue; - } + for name in server.rooms.keys() { let id = RoomIdentifier::new(domain.clone(), name.clone()); self.connect_to_room(id).await; } diff --git a/cove/src/vault/euph.rs b/cove/src/vault/euph.rs index 4a4109e..931091c 100644 --- a/cove/src/vault/euph.rs +++ b/cove/src/vault/euph.rs @@ -611,7 +611,7 @@ impl Action for GetMsg { let msg = conn .query_row( " - SELECT id, parent, time, user_id, name, content, seen + SELECT id, parent, time, name, content, seen FROM euph_msgs WHERE domain = ? AND room = ? @@ -623,10 +623,9 @@ impl Action for GetMsg { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - user_id: UserId(row.get(3)?), - nick: row.get(4)?, - content: row.get(5)?, - seen: row.get(6)?, + nick: row.get(3)?, + content: row.get(4)?, + seen: row.get(5)?, }) }, ) @@ -704,7 +703,7 @@ impl Action for GetTree { AND tree.room = euph_msgs.room AND tree.id = euph_msgs.parent ) - SELECT id, parent, time, user_id, name, content, seen + SELECT id, parent, time, name, content, seen FROM euph_msgs JOIN tree USING (domain, room, id) ORDER BY id ASC @@ -717,10 +716,9 @@ impl Action for GetTree { id: MessageId(row.get::<_, WSnowflake>(0)?.0), parent: row.get::<_, Option>(1)?.map(|s| MessageId(s.0)), time: row.get::<_, WTime>(2)?.0, - user_id: UserId(row.get(3)?), - nick: row.get(4)?, - content: row.get(5)?, - seen: row.get(6)?, + nick: row.get(3)?, + content: row.get(4)?, + seen: row.get(5)?, }) }, )?