android: a peer in full — their card, their interests, and what they have that you don't

The peer sheet's new "About this user" row opens a screen of its own: the
card their client serves (their own words, their picture, the upload slot
and the queue), the likes and hates they declared, and the comparison this
phone makes of their share against the library. The comparison is the
point of opening a stranger — every record they have by an artist in your
library that you don't, each row opening the search that finds it, and a
way to forget the whole comparison again. Nothing is uploaded to work it
out. Their picture opens in the artwork viewer, which now takes a data:
key beside a library path and an https URL.
This commit is contained in:
KeelrLeek committed 2026-09-13 22:28:38 -05:00
1 parent 694a29eb0d
commit f792d7955d
8 files changed
+292

No files matched your search

+53
View File
@@ -388,6 +388,22 @@ const PEERS = [
{ username: "mp3_marge", slot: true, speed: 500, queue: 0, ext: "mp3", bitrate: 320 },
{ username: "slowpoke", slot: false, speed: 60, queue: 12, ext: "mp3", bitrate: 192 },
];
/* a peer's own card, and the comparison overlap.rs keeps per username */
const MOCK_PIC = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEUlEQVR42mOQz+7HihiGlgQAV11GQceAU4sAAAAASUVORK5CYII=";
const MOCK_ABOUT = "Ripping my own vinyl since 2004. FLAC only, folders named Artist - Year - Album. Ask before you queue a whole discography.";
const MOCK_LIKES = ["french house", "vinyl rips", "detroit techno", "boards of canada"];
const MOCK_HATES = ["transcodes", "128 kbps"];
const OVERLAP_COMMON = [["Daft Punk", "Discovery"], ["Daft Punk", "Homework"], ["Caribou", "Swim"]];
const OVERLAP_GAPS = [
["Boards of Canada", "Geogaddi"],
["Aphex Twin", "Drukqs"],
["Daft Punk", "Alive 2007"],
["Burial", "Untrue"],
["Four Tet", "Rounds"],
["Autechre", "Amber"],
];
const overlaps = new Map();
const pairsOf = (list) => list.map(([artist, album]) => ({ artist, album }));
const TITLES = ["One More Time", "Aerodynamic", "Digital Love", "Harder, Better, Faster, Stronger", "Crescendolls", "Nightvision", "Superheroes", "High Life", "Something About Us", "Voyager", "Veridis Quo", "Short Circuit", "Face to Face", "Too Long"];
function peerResponse(token, peer, query) {
const artist = /daft/i.test(query) ? "Daft Punk" : (query.split(/\s+/)[0] || "Various");
@@ -601,6 +617,43 @@ function mockNet(cmd, args) {
{ name: "@@shared\\Music\\Scans", files: [{ name: "front.jpg", path: "@@shared\\Music\\Scans\\front.jpg", size: 1200000, ext: "jpg", bitrate: null, duration: null }] },
]), 600));
}
if (cmd === "slsk_user_info") {
const u = String(args?.username || "");
const peer = PEERS.find((x) => x.username === u);
return new Promise((r) => setTimeout(() => r({
username: u,
description: MOCK_ABOUT,
picture_png_base64: MOCK_PIC,
picture_note: null,
total_uploads: 18422,
queue_size: peer ? peer.queue : 0,
has_free_slot: peer ? peer.slot : true,
}), 450));
}
if (cmd === "slsk_user_interests") {
return new Promise((r) => setTimeout(() => r({ likes: MOCK_LIKES.slice(), hates: MOCK_HATES.slice() }), 400));
}
if (cmd === "overlap_list") return Promise.resolve([...overlaps.values()]);
if (cmd === "overlap_compute") {
/* the real one browses their whole share before it compares: the wait is the point */
const u = String(args?.username || "");
const o = {
username: u,
computed_at: Math.floor(Date.now() / 1000),
folders: 812,
audio_files: 9134,
their_albums: 74,
albums_in_common: pairsOf(OVERLAP_COMMON),
albums_in_common_count: OVERLAP_COMMON.length,
artists_in_common: ["Daft Punk", "Caribou"],
artists_in_common_count: 2,
gaps: pairsOf(OVERLAP_GAPS),
gaps_count: OVERLAP_GAPS.length,
score: OVERLAP_COMMON.length / 74,
};
return new Promise((r) => setTimeout(() => { overlaps.set(u.toLowerCase(), o); r(o); }, 1100));
}
if (cmd === "overlap_forget") { overlaps.delete(String(args?.username || "").toLowerCase()); return Promise.resolve(); }
if (cmd === "start_search") {
const t = ++token;
const q = String(args?.query || "");