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
350
});
351
351
352
352
ctx.nc.publish("rocksky.scrobble", Buffer.from(message));
353
353
+
354
354
+
const trackMessage = JSON.stringify({
355
355
+
track: scrobble.track_id,
356
356
+
album_track,
357
357
+
artist_track,
358
358
+
artist_album,
359
359
+
});
360
360
+
361
361
+
ctx.nc.publish("rocksky.track", Buffer.from(trackMessage));
353
362
}
354
363
355
364
export async function scrobbleTrack(
+5
-1
apps/web/src/hooks/useProfile.tsx
···
64
64
useEffect(() => {
65
65
if (data !== "Unauthorized" && data !== "Internal Server Error" && data) {
66
66
const profile = JSON.parse(data);
67
67
+
if (Object.keys(profile).length === 0) {
68
68
+
localStorage.removeItem("token");
69
69
+
window.location.href = "/";
70
70
+
return;
71
71
+
}
67
72
setProfile({
68
73
avatar: profile.avatar,
69
74
displayName: profile.displayName,
···
84
89
85
90
if (
86
91
!data ||
87
87
-
Object.keys(data).length === 0 ||
88
92
data === "Unauthorized" ||
89
93
data === "Internal Server Error" ||
90
94
(error && localStorage.getItem("token"))