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..7d87d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +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 diff --git a/cove/src/euph/small_message.rs b/cove/src/euph/small_message.rs index 5db1790..d306226 100644 --- a/cove/src/euph/small_message.rs +++ b/cove/src/euph/small_message.rs @@ -1,3 +1,5 @@ +use std::hash::{DefaultHasher, Hash, Hasher}; + use crossterm::style::Stylize; use euphoxide::api::{MessageId, Snowflake, Time, UserId}; use jiff::Timestamp; @@ -75,7 +77,11 @@ impl Msg for SmallMessage { } fn nick_emoji(&self) -> Option { - Some(util::user_id_emoji(&self.user_id)) + let mut hasher = DefaultHasher::new(); + self.user_id.0.hash(&mut hasher); + let hash = hasher.finish(); + let emoji = &util::EMOJI_LIST[hash as usize % util::EMOJI_LIST.len()]; + Some(emoji.clone()) } } diff --git a/cove/src/euph/util.rs b/cove/src/euph/util.rs index ea1782a..ecea304 100644 --- a/cove/src/euph/util.rs +++ b/cove/src/euph/util.rs @@ -1,11 +1,7 @@ -use std::{ - collections::HashSet, - hash::{DefaultHasher, Hash, Hasher}, - sync::LazyLock, -}; +use std::{collections::HashSet, 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); @@ -86,11 +82,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/ui/chat.rs b/cove/src/ui/chat.rs index 1116935..02adeb7 100644 --- a/cove/src/ui/chat.rs +++ b/cove/src/ui/chat.rs @@ -58,10 +58,6 @@ impl + Clone> ChatState { store, } } - - pub fn nick_emoji(&self) -> bool { - self.nick_emoji - } } impl> ChatState { 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);