tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
[api] publish track on scrobble
tsiry-sandratraina.com
8 months ago
375dff6e
ca7a36de
+14
-1
2 changed files
expand all
collapse all
unified
split
apps
api
src
nowplaying
nowplaying.service.ts
web
src
hooks
useProfile.tsx
+9
apps/api/src/nowplaying/nowplaying.service.ts
···
350
});
351
352
ctx.nc.publish("rocksky.scrobble", Buffer.from(message));
0
0
0
0
0
0
0
0
0
353
}
354
355
export async function scrobbleTrack(
···
350
});
351
352
ctx.nc.publish("rocksky.scrobble", Buffer.from(message));
353
+
354
+
const trackMessage = JSON.stringify({
355
+
track: scrobble.track_id,
356
+
album_track,
357
+
artist_track,
358
+
artist_album,
359
+
});
360
+
361
+
ctx.nc.publish("rocksky.track", Buffer.from(trackMessage));
362
}
363
364
export async function scrobbleTrack(
+5
-1
apps/web/src/hooks/useProfile.tsx
···
64
useEffect(() => {
65
if (data !== "Unauthorized" && data !== "Internal Server Error" && data) {
66
const profile = JSON.parse(data);
0
0
0
0
0
67
setProfile({
68
avatar: profile.avatar,
69
displayName: profile.displayName,
···
84
85
if (
86
!data ||
87
-
Object.keys(data).length === 0 ||
88
data === "Unauthorized" ||
89
data === "Internal Server Error" ||
90
(error && localStorage.getItem("token"))
···
64
useEffect(() => {
65
if (data !== "Unauthorized" && data !== "Internal Server Error" && data) {
66
const profile = JSON.parse(data);
67
+
if (Object.keys(profile).length === 0) {
68
+
localStorage.removeItem("token");
69
+
window.location.href = "/";
70
+
return;
71
+
}
72
setProfile({
73
avatar: profile.avatar,
74
displayName: profile.displayName,
···
89
90
if (
91
!data ||
0
92
data === "Unauthorized" ||
93
data === "Internal Server Error" ||
94
(error && localStorage.getItem("token"))