+1
-1
crates/jetstream/src/repo.rs
+1
-1
crates/jetstream/src/repo.rs
+2
-8
crates/jetstream/src/webhook/discord/mod.rs
+2
-8
crates/jetstream/src/webhook/discord/mod.rs
···
3
3
use crate::webhook::discord::model::*;
4
4
use reqwest::Client;
5
5
6
-
pub fn embed_from_scrobble(s: &ScrobbleData) -> DiscordEmbed {
7
-
let url = s
8
-
.track
9
-
.spotify_url
10
-
.as_ref()
11
-
.or(s.track.tidal_url.as_ref())
12
-
.or(s.track.youtube_url.as_ref())
13
-
.cloned();
6
+
pub fn embed_from_scrobble(s: &ScrobbleData, rkey: &str) -> DiscordEmbed {
7
+
let url = format!("https://rocksky.app/{}/scrobble/{}", s.user.did, rkey);
14
8
15
9
let mut desc = format!("**{}**\nby {}", esc(&s.track.title), esc(&s.track.artist));
16
10
desc.push_str(&format!("\non *{}*", esc(&s.track.album)));
+2
-4
crates/jetstream/src/webhook/discord/model.rs
+2
-4
crates/jetstream/src/webhook/discord/model.rs
···
4
4
pub struct WebhookEnvelope {
5
5
#[serde(default)]
6
6
pub r#type: String,
7
-
#[serde(default)]
8
-
pub id: Option<String>,
7
+
pub id: String,
9
8
#[serde(default)]
10
9
pub delivered_at: Option<String>,
11
10
pub data: ScrobbleData,
···
54
53
#[derive(Debug, Serialize)]
55
54
pub struct DiscordEmbed {
56
55
pub title: String,
57
-
#[serde(skip_serializing_if = "Option::is_none")]
58
-
pub url: Option<String>,
56
+
pub url: String,
59
57
#[serde(skip_serializing_if = "Option::is_none")]
60
58
pub description: Option<String>,
61
59
#[serde(skip_serializing_if = "Option::is_none")]
+1
-1
crates/jetstream/src/webhook_worker.rs
+1
-1
crates/jetstream/src/webhook_worker.rs
···
74
74
match brpop_once(st.clone(), 1).await {
75
75
Ok(Some(json_str)) => {
76
76
if let Ok(env) = serde_json::from_str::<WebhookEnvelope>(&json_str) {
77
-
embeds.push(discord::embed_from_scrobble(&env.data));
77
+
embeds.push(discord::embed_from_scrobble(&env.data, &env.id));
78
78
}
79
79
}
80
80
Ok(None) => break,