add: channels, messages

This commit is contained in:
trisua 2025-04-27 23:11:37 -04:00
parent 67492cf73f
commit 7774124bd0
40 changed files with 2238 additions and 115 deletions

View file

@ -364,18 +364,23 @@
});
self.define("push_con_shown", async (_, connection, shown) => {
return await (
await fetch("/api/v1/auth/user/connections/_shown", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
connection,
shown,
}),
})
).json();
fetch("/api/v1/auth/user/connections/_shown", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
connection,
shown,
}),
})
.then((res) => res.json())
.then((res) => {
trigger("atto::toast", [
res.ok ? "success" : "error",
res.message,
]);
});
});
})();
@ -665,14 +670,9 @@
]);
}
const mb_info = await $.pull_track_info(
playing.artist.name,
playing.name,
);
if (
window.localStorage.getItem("atto:connections.last_fm/name") ===
playing.name + mb_info.id
playing.name
) {
// item already pushed to connection, no need right now
return;
@ -680,7 +680,12 @@
window.localStorage.setItem(
"atto:connections.last_fm/name",
playing.name + mb_info.id,
playing.name,
);
const mb_info = await $.pull_track_info(
playing.artist.name,
playing.name,
);
return await trigger("connections::push_con_state", [