From 8f8902e0591ab634c1e986f01c993685b1625d5f Mon Sep 17 00:00:00 2001
From: PandaDEV <70103896+0PandaDEV@users.noreply.github.com>
Date: Thu, 2 Jan 2025 16:49:10 +1000
Subject: [PATCH] refactor: discord rpc which now shows as listening
---
app.vue | 54 +++++++++++++++------------
plugins/player.ts | 1 -
src-tauri/Cargo.lock | 64 +++++++++++++-------------------
src-tauri/Cargo.toml | 4 +-
src-tauri/src/api/discord_rpc.rs | 16 +++++---
5 files changed, 68 insertions(+), 71 deletions(-)
diff --git a/app.vue b/app.vue
index 148e575..7d0b175 100644
--- a/app.vue
+++ b/app.vue
@@ -6,43 +6,48 @@
\ No newline at end of file
+@use "~/assets/styles/global";
+
diff --git a/plugins/player.ts b/plugins/player.ts
index feced85..7720483 100644
--- a/plugins/player.ts
+++ b/plugins/player.ts
@@ -96,7 +96,6 @@ export default defineNuxtPlugin((nuxtApp) => {
await invoke('update_activity', {
details: `by ${this.currentSong.value?.artist}`,
largeImage: 'https://api.vleer.app/thumbnail?id=' + this.currentSong.value?.id,
- largeImageText: this.currentSong.value?.title,
state: this.currentSong.value?.title,
youtubeUrl: 'https://www.youtube.com/watch?v=' + this.currentSong.value?.id
})
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 41a6b23..47c6c9c 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -447,7 +447,7 @@ checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f"
dependencies = [
"byteorder",
"fnv",
- "uuid",
+ "uuid 1.11.0",
]
[[package]]
@@ -832,17 +832,16 @@ dependencies = [
]
[[package]]
-name = "discord-ipc-rp"
-version = "0.1.1"
+name = "discord-rich-presence"
+version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc8dd93037c781e0fbdf9aa61275926d8df199eb7dcba8ab163de394ca2fe81d"
+checksum = "a75db747ecd252c01bfecaf709b07fcb4c634adf0edb5fed47bc9c3052e7076b"
dependencies = [
- "log",
"serde",
+ "serde_derive",
"serde_json",
- "strum 0.25.0",
- "thiserror 1.0.69",
- "uuid",
+ "serde_repr",
+ "uuid 0.8.2",
]
[[package]]
@@ -3518,9 +3517,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "reqwest"
-version = "0.12.11"
+version = "0.12.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fe060fe50f524be480214aba758c71f99f90ee8c83c5a36b5e9e1d568eb4eb3"
+checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
dependencies = [
"base64 0.22.1",
"bytes",
@@ -3744,7 +3743,7 @@ dependencies = [
"serde",
"serde_json",
"url",
- "uuid",
+ "uuid 1.11.0",
]
[[package]]
@@ -4389,35 +4388,13 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
-[[package]]
-name = "strum"
-version = "0.25.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
-dependencies = [
- "strum_macros 0.25.3",
-]
-
[[package]]
name = "strum"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
dependencies = [
- "strum_macros 0.26.4",
-]
-
-[[package]]
-name = "strum_macros"
-version = "0.25.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
-dependencies = [
- "heck 0.4.1",
- "proc-macro2",
- "quote",
- "rustversion",
- "syn 2.0.93",
+ "strum_macros",
]
[[package]]
@@ -4697,7 +4674,7 @@ dependencies = [
"thiserror 2.0.9",
"time",
"url",
- "uuid",
+ "uuid 1.11.0",
"walkdir",
]
@@ -4789,7 +4766,7 @@ dependencies = [
"thiserror 2.0.9",
"toml 0.8.19",
"url",
- "uuid",
+ "uuid 1.11.0",
]
[[package]]
@@ -4834,7 +4811,7 @@ dependencies = [
"bitflags 2.6.0",
"itertools",
"serde",
- "strum 0.26.3",
+ "strum",
"tauri",
"tauri-plugin",
"thiserror 2.0.9",
@@ -4948,7 +4925,7 @@ dependencies = [
"toml 0.8.19",
"url",
"urlpattern",
- "uuid",
+ "uuid 1.11.0",
"walkdir",
]
@@ -5475,6 +5452,15 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+[[package]]
+name = "uuid"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
+dependencies = [
+ "getrandom 0.2.15",
+]
+
[[package]]
name = "uuid"
version = "1.11.0"
@@ -5510,7 +5496,7 @@ dependencies = [
"anyhow",
"base64 0.22.1",
"chrono",
- "discord-ipc-rp",
+ "discord-rich-presence",
"env_logger",
"include_dir",
"lazy_static",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index c67a96f..7c2b352 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -10,10 +10,10 @@ tauri-build = { version = "2.0.3", features = [] }
[dependencies]
anyhow = "1.0.95"
-discord-ipc-rp = "0.1.1"
+discord-rich-presence = "0.2.5"
lazy_static = "1.5.0"
regex = "1.11.1"
-reqwest = "0.12.11"
+reqwest = "0.12.12"
serde = "1.0.217"
serde_json = "1.0.134"
sqlx = { version = "0.8.2", features = [
diff --git a/src-tauri/src/api/discord_rpc.rs b/src-tauri/src/api/discord_rpc.rs
index 185182d..b6e3787 100644
--- a/src-tauri/src/api/discord_rpc.rs
+++ b/src-tauri/src/api/discord_rpc.rs
@@ -1,12 +1,13 @@
-use discord_ipc_rp::{activity, DiscordIpc, DiscordIpcClient};
+use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient};
use lazy_static::lazy_static;
use std::env;
use std::sync::Mutex;
use std::thread;
+use std::time::{SystemTime, UNIX_EPOCH};
lazy_static! {
static ref DRPC_CLIENT: Mutex