community: the library overlap shelf, their share folders against your albums on this device after a browse

This commit is contained in:
KeelrLeek committed 2026-09-02 17:08:25 -05:00
1 parent d7bc92fda7
commit 0846b39d45
6 files changed
+451 -7

No files matched your search

+29 -2
View File
@@ -83,6 +83,8 @@ export const community = $state({
/** space_board: the proposal board beside the open Space's pinned playlist, or null. */
board: null,
boardError: "",
/** overlap_list: library comparisons computed on this device, best first. */
overlap: [],
/** persona key → ProfileView | {none} | {error} | {pending}: other
* people's signed profiles, read once per session when surfaced. */
remoteProfiles: {},
@@ -335,11 +337,12 @@ export async function initCommunity() {
void refreshShares();
void refreshPublished();
});
api.onEvent("community:overlap", () => void refreshOverlap());
api.onEvent("soulseek:user-state", (p) => {
if (p.status === 1 || p.status === 2) noteSeen(p.username);
});
}
await Promise.all([refreshFreenet(), loadContacts(), refreshLinks(), refreshFriends(), refreshShares(), refreshPublished(), refreshInbox(), refreshSpaces()]);
await Promise.all([refreshFreenet(), loadContacts(), refreshLinks(), refreshFriends(), refreshShares(), refreshPublished(), refreshInbox(), refreshSpaces(), refreshOverlap()]);
await refreshPersona();
}
@@ -581,6 +584,30 @@ export const leaveSpace = (owner, space) =>
await refreshSpaces();
});
// ---- library overlap ------------------------------------------------------------
export async function refreshOverlap() {
try {
community.overlap = await api.overlapList();
} catch {
// stays as it was
}
}
export const overlapFor = (username) => {
const k = (username ?? "").trim().toLowerCase();
return community.overlap.find((o) => o.username.toLowerCase() === k) ?? null;
};
/** Browse them on purpose and compare — nothing is uploaded to do it. */
export const computeOverlap = (username) =>
run("overlap:" + username, async () => {
await api.overlapCompute(username);
await refreshOverlap();
});
export const forgetOverlap = (username) =>
run("overlap:" + username, async () => {
await api.overlapForget(username);
await refreshOverlap();
});
// ---- the proposal board ---------------------------------------------------------
/** Read the board beside the Space's pinned playlist; the playlist's owner also
* brings its roster in line with the members here. */
@@ -621,4 +648,4 @@ export const decideProposal = (owner, space, proposal, accept, reason) =>
// Dev handle beside `__soulstream` (state.svelte.js): probes reach the store
// through this, never through a bare import (which would be a second copy).
if (import.meta.env.DEV) globalThis.__community = community;
if (import.meta.env.DEV) globalThis.__communityActions = { friendRequest, friendRequestByKey, friendAccept, friendDecline, friendRemove, friendForget, checkLink, refreshFriends, sharedPublish, sharedWithdraw, shareSend, sharePreview, shareImport, refreshShares, refreshPublished, publishInbox, checkInbox, refreshInbox, refreshSpaces, openSpace, createSpace, postToSpace, inviteToSpace, removeFromSpace, pinToSpace, leaveSpace, openBoard, proposeToBoard, decideProposal };
if (import.meta.env.DEV) globalThis.__communityActions = { friendRequest, friendRequestByKey, friendAccept, friendDecline, friendRemove, friendForget, checkLink, refreshFriends, sharedPublish, sharedWithdraw, shareSend, sharePreview, shareImport, refreshShares, refreshPublished, publishInbox, checkInbox, refreshInbox, refreshSpaces, openSpace, createSpace, postToSpace, inviteToSpace, removeFromSpace, pinToSpace, leaveSpace, openBoard, proposeToBoard, decideProposal, refreshOverlap, computeOverlap, forgetOverlap };