diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-10-24 02:48:57 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2022-10-24 02:48:57 -0400 |
commit | f751037717ee1f5592e437e2b91f4daa45239aae (patch) | |
tree | 93c18a7c1ee9e71893055f30c6eace03c2186f41 | |
parent | e888306272304224ac8edd37b3b2bd24ad8c0765 (diff) | |
parent | 64245bf7457a81eed063901ad8e5ce55fdc2ca0c (diff) | |
download | abaddon-portaudio-f751037717ee1f5592e437e2b91f4daa45239aae.tar.gz abaddon-portaudio-f751037717ee1f5592e437e2b91f4daa45239aae.zip |
Merge branch 'master' into voice
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | ci/msys-deps.txt | 3 | ||||
-rw-r--r-- | src/abaddon.cpp | 25 | ||||
-rw-r--r-- | src/settings.cpp | 4 | ||||
-rw-r--r-- | src/settings.hpp | 3 | ||||
-rw-r--r-- | src/windows/mainwindow.cpp | 24 | ||||
-rw-r--r-- | src/windows/mainwindow.hpp | 1 |
7 files changed, 70 insertions, 13 deletions
@@ -25,13 +25,15 @@ Current features: * Thread support<sup>3</sup> * Animated avatars, server icons, emojis (can be turned off) -1 - Abaddon tries its best (though is not perfect) to make Discord think it's a legitimate web client. Some of the things done to do this +1 - Abaddon tries its best (though is not perfect) to make Discord think it's a legitimate web client. Some of the +things done to do this include: using a browser user agent, sending the same IDENTIFY message that the official web client does, using API v9 endpoints in all cases, and not using endpoints the web client does not normally use. There are still a few smaller inconsistencies, however. For example the web client sends lots of telemetry via the `/science` endpoint (uBlock origin stops this) as well as in the headers of all requests.<br> -**See [here](#the-spam-filter)** for things you might want to avoid if you are worried about being caught in the spam filter. +**See [here](#the-spam-filter)** for things you might want to avoid if you are worried about being caught in the spam +filter. 2 - Unicode emojis are substituted manually as opposed to rendered by GTK on non-Windows platforms. This can be changed with the `stock_emojis` setting as shown at the bottom of this README. A CBDT-based font using Twemoji is provided to @@ -68,8 +70,11 @@ the result of fundamental issues with Discord's thread implementation. #### Linux: -1. Install dependencies: `libgtkmm-3.0-dev`, `libcurl4-gnutls-dev`, - and [nlohmann-json](https://github.com/nlohmann/json) +1. Install dependencies + * On Ubuntu 20.04 (Focal) and newer: + ```Shell + $ sudo apt install g++ cmake libgtkmm-3.0-dev libcurl4-gnutls-dev libsqlite3-dev libssl-dev nlohmann-json3-dev + ``` 2. `git clone https://github.com/uowuo/abaddon --recurse-submodules="subprojects" && cd abaddon` 3. `mkdir build && cd build` 4. `cmake ..` @@ -96,7 +101,12 @@ no `abaddon.ini` in the working directory #### The Spam Filter -Discord likes disabling accounts/forcing them to reset their passwords if they think the user is a spam bot or potentially had their account compromised. While the official client still often gets users caught in the spam filter, third party clients tend to upset the spam filter more often. If you get caught by it, you can usually [appeal](https://support.discord.com/hc/en-us/requests/new?ticket_form_id=360000029731) it and get it restored. Here are some things you might want to do with the official client instead if you are particularly afraid of evoking the spam filter's wrath: +Discord likes disabling accounts/forcing them to reset their passwords if they think the user is a spam bot or +potentially had their account compromised. While the official client still often gets users caught in the spam filter, +third party clients tend to upset the spam filter more often. If you get caught by it, you can +usually [appeal](https://support.discord.com/hc/en-us/requests/new?ticket_form_id=360000029731) it and get it restored. +Here are some things you might want to do with the official client instead if you are particularly afraid of evoking the +spam filter's wrath: * Joining or leaving servers (usually main cause of getting caught) * Frequently disconnecting and reconnecting @@ -249,6 +259,9 @@ For example, memory_db would be set by adding `memory_db = true` under the line over * owner_crown (true or false, default true) - show a crown next to the owner * unreads (true or false, default true) - show unread indicators and mention badges +* save_state (true or false, default true) - save the state of the gui (active channels, tabs, expanded channels) +* alt_menu (true or false, default false) - keep the menu hidden unless revealed with alt key +* hide_to_tray (true or false, default false) - hide abaddon to the system tray on window close #### style diff --git a/ci/msys-deps.txt b/ci/msys-deps.txt index 864a5e5..c2e626e 100644 --- a/ci/msys-deps.txt +++ b/ci/msys-deps.txt @@ -14,6 +14,7 @@ /bin/libdeflate.dll /bin/libepoxy-0.dll /bin/libexpat-1.dll +/bin/libffi-8.dll /bin/libfontconfig-1.dll /bin/libfreetype-6.dll /bin/libfribidi-0.dll @@ -41,7 +42,7 @@ /bin/libpangoft2-1.0-0.dll /bin/libpangomm-1.4-1.dll /bin/libpangowin32-1.0-0.dll -/bin/libpcre-1.dll +/bin/libpcre2-8-0.dll /bin/libpixman-1-0.dll /bin/libpng16-16.dll /bin/libpsl-5.dll diff --git a/src/abaddon.cpp b/src/abaddon.cpp index 664c0bd..692526c 100644 --- a/src/abaddon.cpp +++ b/src/abaddon.cpp @@ -80,14 +80,13 @@ Abaddon &Abaddon::Get() { return instance; } -#ifdef WITH_LIBHANDY - #ifdef _WIN32 +#ifdef _WIN32 constexpr static guint BUTTON_BACK = 4; constexpr static guint BUTTON_FORWARD = 5; - #else +#else constexpr static guint BUTTON_BACK = 8; constexpr static guint BUTTON_FORWARD = 9; - #endif +#endif static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { if (event->type != GDK_BUTTON_PRESS) return false; @@ -97,6 +96,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { auto *window = gtk_widget_get_toplevel(widget); if (static_cast<void *>(window) != static_cast<void *>(main_window->gobj())) return false; // is this the right way??? +#ifdef WITH_LIBHANDY switch (event->button.button) { case BUTTON_BACK: main_window->GoBack(); @@ -105,6 +105,7 @@ static bool HandleButtonEvents(GdkEvent *event, MainWindow *main_window) { main_window->GoForward(); break; } +#endif return false; } @@ -120,6 +121,15 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) { const bool ctrl = (event->key.state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK; const bool shft = (event->key.state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK; + constexpr static guint EXCLUDE_STATES = GDK_CONTROL_MASK | GDK_SHIFT_MASK; + + if (!(event->key.state & EXCLUDE_STATES) && event->key.keyval == GDK_KEY_Alt_L) { + if (Abaddon::Get().GetSettings().AltMenu) { + main_window->ToggleMenuVisibility(); + } + } + +#ifdef WITH_LIBHANDY if (ctrl) { switch (event->key.keyval) { case GDK_KEY_Tab: @@ -146,6 +156,7 @@ static bool HandleKeyEvents(GdkEvent *event, MainWindow *main_window) { return true; } } +#endif return false; } @@ -155,7 +166,6 @@ static void MainEventHandler(GdkEvent *event, void *main_window) { if (HandleKeyEvents(event, static_cast<MainWindow *>(main_window))) return; gtk_main_do_event(event); } -#endif int Abaddon::StartGTK() { m_gtk_app = Gtk::Application::create("com.github.uowuo.abaddon"); @@ -567,6 +577,11 @@ void Abaddon::RunFirstTimeDiscordStartup() { confirm.SetAcceptOnly(true); confirm.run(); } + + // autoconnect + if (cookie.has_value() && build_number.has_value() && GetSettings().Autoconnect && !GetDiscordToken().empty()) { + ActionConnect(); + } }); } diff --git a/src/settings.cpp b/src/settings.cpp index dd1fe83..0019a00 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -39,6 +39,7 @@ void SettingsManager::ReadSettings() { SMSTR("discord", "token", DiscordToken); SMBOOL("discord", "memory_db", UseMemoryDB); SMBOOL("discord", "prefetch", Prefetch); + SMBOOL("discord", "autoconnect", Autoconnect); SMSTR("gui", "css", MainCSS); SMBOOL("gui", "animated_guild_hover_only", AnimatedGuildHoverOnly); SMBOOL("gui", "animations", ShowAnimations); @@ -48,6 +49,7 @@ void SettingsManager::ReadSettings() { SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); SMBOOL("gui", "unreads", Unreads); + SMBOOL("gui", "alt_menu", AltMenu); SMBOOL("gui", "hide_to_tray", HideToTray); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); @@ -93,6 +95,7 @@ void SettingsManager::Close() { SMSTR("discord", "token", DiscordToken); SMBOOL("discord", "memory_db", UseMemoryDB); SMBOOL("discord", "prefetch", Prefetch); + SMBOOL("discord", "autoconnect", Autoconnect); SMSTR("gui", "css", MainCSS); SMBOOL("gui", "animated_guild_hover_only", AnimatedGuildHoverOnly); SMBOOL("gui", "animations", ShowAnimations); @@ -102,6 +105,7 @@ void SettingsManager::Close() { SMBOOL("gui", "save_state", SaveState); SMBOOL("gui", "stock_emojis", ShowStockEmojis); SMBOOL("gui", "unreads", Unreads); + SMBOOL("gui", "alt_menu", AltMenu); SMBOOL("gui", "hide_to_tray", HideToTray); SMINT("http", "concurrent", CacheHTTPConcurrency); SMSTR("http", "user_agent", UserAgent); diff --git a/src/settings.hpp b/src/settings.hpp index 7f5e015..9d32d2e 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -12,6 +12,7 @@ public: std::string DiscordToken; bool UseMemoryDB { false }; bool Prefetch { false }; + bool Autoconnect { false }; // [gui] std::string MainCSS { "main.css" }; @@ -27,7 +28,7 @@ public: bool ShowStockEmojis { true }; #endif bool Unreads { true }; - + bool AltMenu { false }; bool HideToTray { false }; // [http] diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 07a7f17..20da46b 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -158,6 +158,10 @@ void MainWindow::UpdateMenus() { OnViewSubmenuPopup(); } +void MainWindow::ToggleMenuVisibility() { + m_menu_bar.set_visible(!m_menu_bar.get_visible()); +} + #ifdef WITH_LIBHANDY void MainWindow::GoBack() { m_chat.GoBack(); @@ -279,7 +283,25 @@ void MainWindow::SetupMenu() { m_menu_bar.append(m_menu_file); m_menu_bar.append(m_menu_discord); m_menu_bar.append(m_menu_view); - m_menu_bar.show_all(); + + if (Abaddon::Get().GetSettings().AltMenu) { + auto set_hide_cb = [this](Gtk::Menu &menu) { + for (auto *child : menu.get_children()) { + auto *item = dynamic_cast<Gtk::MenuItem *>(child); + if (item != nullptr) { + item->signal_activate().connect([this]() { + m_menu_bar.hide(); + }); + } + } + }; + set_hide_cb(m_menu_discord_sub); + set_hide_cb(m_menu_file_sub); + set_hide_cb(m_menu_view_sub); + m_menu_bar.show_all_children(); + } else { + m_menu_bar.show_all(); + } m_menu_discord_connect.signal_activate().connect([this] { m_signal_action_connect.emit(); diff --git a/src/windows/mainwindow.hpp b/src/windows/mainwindow.hpp index b013e32..6e95b72 100644 --- a/src/windows/mainwindow.hpp +++ b/src/windows/mainwindow.hpp @@ -24,6 +24,7 @@ public: void UpdateChatReactionAdd(Snowflake id, const Glib::ustring ¶m); void UpdateChatReactionRemove(Snowflake id, const Glib::ustring ¶m); void UpdateMenus(); + void ToggleMenuVisibility(); #ifdef WITH_LIBHANDY void GoBack(); |