commit 85c2cf395906e944174eb8e7acac1afe6426fefa parent d0b9b5b0ee47f6d6b0d53dc7d365f61bd7f87af0 Author: MTRNord <mtrnord1@gmail.com> Date: Sat, 22 Aug 2020 17:51:50 +0200 feat: Replace github_emoji codes with their unicode version Diffstat:
32 files changed, 107 insertions(+), 32 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock @@ -7,6 +7,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] +name = "aho-corasick" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +dependencies = [ + "memchr", +] + +[[package]] name = "anyhow" version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -142,6 +151,7 @@ version = "0.1.0" dependencies = [ "console_error_panic_hook", "futures-locks", + "gh-emoji", "i18n-embed", "lazy_static", "linkify", @@ -445,6 +455,16 @@ dependencies = [ ] [[package]] +name = "gh-emoji" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17a050b7eb420553344e1cf1db648e8b584c79e98b74e6e6d119eeedd9ddcbc" +dependencies = [ + "phf", + "regex", +] + +[[package]] name = "gloo" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1019,6 +1039,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] name = "pin-project" version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1179,6 +1217,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] +name = "regex" +version = "1.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", + "thread_local", +] + +[[package]] +name = "regex-syntax" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" + +[[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1500,6 +1556,12 @@ dependencies = [ ] [[package]] +name = "siphasher" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" + +[[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1607,6 +1669,15 @@ dependencies = [ ] [[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static", +] + +[[package]] name = "time" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml @@ -26,6 +26,7 @@ wasm-bindgen-futures = "0.4" wasm-logger = "0.2" #wee_alloc = "0.4" lazy_static = "1.4.0" +gh-emoji = "1.0.3" # Yew yew = { git = "https://github.com/daydream-mx/yew.git", branch = "MTRNord/daydream-no-bincode" } diff --git a/i18n/pot/daydream.pot b/i18n/pot/daydream.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/event_list.pot b/i18n/pot/src/app/components/event_list.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/events/image.pot b/i18n/pot/src/app/components/events/image.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/events/mod.pot b/i18n/pot/src/app/components/events/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/events/notice.pot b/i18n/pot/src/app/components/events/notice.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/events/text.pot b/i18n/pot/src/app/components/events/text.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/events/video.pot b/i18n/pot/src/app/components/events/video.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/input.pot b/i18n/pot/src/app/components/input.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/mod.pot b/i18n/pot/src/app/components/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/raw_html.pot b/i18n/pot/src/app/components/raw_html.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/room_list/item.pot b/i18n/pot/src/app/components/room_list/item.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/components/room_list/mod.pot b/i18n/pot/src/app/components/room_list/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/matrix/login.pot b/i18n/pot/src/app/matrix/login.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/matrix/mod.pot b/i18n/pot/src/app/matrix/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/matrix/sync.pot b/i18n/pot/src/app/matrix/sync.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/matrix/types.pot b/i18n/pot/src/app/matrix/types.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/mod.pot b/i18n/pot/src/app/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/views/login.pot b/i18n/pot/src/app/views/login.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/views/main_view.pot b/i18n/pot/src/app/views/main_view.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/app/views/mod.pot b/i18n/pot/src/app/views/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/bin/app.pot b/i18n/pot/src/bin/app.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/bin/native_worker.pot b/i18n/pot/src/bin/native_worker.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/constants.pot b/i18n/pot/src/constants.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/errors.pot b/i18n/pot/src/errors.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/lib.pot b/i18n/pot/src/lib.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/utils/mod.pot b/i18n/pot/src/utils/mod.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/utils/notifications.pot b/i18n/pot/src/utils/notifications.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/utils/ruma.pot b/i18n/pot/src/utils/ruma.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/i18n/pot/src/utils/string_utils.pot b/i18n/pot/src/utils/string_utils.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: daydream 0.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-08-22 14:52+0000\n" +"POT-Creation-Date: 2020-08-22 15:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/src/app/matrix/mod.rs b/src/app/matrix/mod.rs @@ -376,12 +376,15 @@ impl Agent for MatrixAgent { } }); } - Request::SendMessage((room_id, message)) => { + Request::SendMessage((room_id, raw_message)) => { let client = self.matrix_client.clone().unwrap(); spawn_local(async move { + let replacer = gh_emoji::Replacer::new(); + let message = replacer.replace_all(raw_message.as_str()); + let mut options = Options::empty(); options.insert(Options::ENABLE_STRIKETHROUGH); - let parser = Parser::new_ext(message.as_str(), options); + let parser = Parser::new_ext(message.as_ref(), options); let mut formatted_message: String = String::with_capacity(message.len() * 3 / 2); @@ -393,7 +396,7 @@ impl Agent for MatrixAgent { MessageEventContent::Text(TextMessageEventContent::plain(message)) } else { MessageEventContent::Text(TextMessageEventContent { - body: message, + body: message.to_string(), relates_to: None, formatted: Some(FormattedBody::html(formatted_message)), })