Música: a playlist screen per profile, with Apple's limits stated plainly
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
The idea was "each person types their Apple Music username and their public playlists appear". Apple does not allow that, and it is worth writing down rather than discovering later: there is no API for another person's public playlists — their own developer forums answer that request with "you can't" (threads 692941 and 123894) — and a profile page is rendered by JavaScript with nothing behind it to call. MusicKit offers the catalog and the *signed-in* user's own library, and the second needs an Apple Developer Program membership for a developer token plus a Music-User-Token per person: a private key and a third-party secret in an app that holds none, to fetch something other than what was asked for. What a self-hosted app can do is the share link, which every playlist has: Music → Share → Copy Link. So the Música screen (next to Salud in Home's header, plus a section in Settings) keeps a list of them per profile, in the profile document like the routines — so they sync to the other devices and travel in a backup — and tapping one opens it in Apple Music on the iPhone. The username is a link to the person's public profile. The list is nicer than a column of URLs because the API reads each link's public page for a title, artwork and track count. That is scraping, so it is built to lose: a page that says nothing leaves the card showing the name its owner typed, and nothing on the screen depends on it. `POST /api/music/lookup` is host-allowlisted to Apple's music hosts — https only, checked again on the URL a redirect lands on — because the api container sits on the same network as everything else the owner runs, and a route that fetches whatever it is handed is a request-forgery lever. That boundary has its own tests, including the LAN addresses it must refuse. The parsing lives in api/music.js rather than in both halves: two copies of a parser kept in step by hand is a bomb, and this is the same shape as vitals.js. It is in the Dockerfile's COPY for the same reason vitals.js had to be.
This commit is contained in:
1 parent
45183c725f
commit
caed0cbaa0
18 files changed
+743
-16
No files matched your search
@@ -1368,6 +1368,31 @@ body.chips-dragging *{cursor:inherit}
|
||||
.vh-when{margin-top:3px;font-size:11px;color:var(--label-3);letter-spacing:0}
|
||||
.vh-when .vh-ago::before{content:' · '}
|
||||
|
||||
/* A labelled block inside a grouped section: the title, a full-width field, and the note under it.
|
||||
Same padding as a `.lrow` so it lines up with the rows around it inside the same card. */
|
||||
.set-field{padding:12px 14px}
|
||||
.set-field .field{background:var(--surface-2)}
|
||||
|
||||
/* --- Música (Apple Music playlists) ----------------------------------------
|
||||
A playlist is a card that is really one big link: the whole row opens Apple Music, so the tap
|
||||
target is the artwork and the title together rather than a small chevron, and the only button
|
||||
inside it is the one that removes it (offset from the link so a thumb aiming at a playlist
|
||||
cannot delete it). */
|
||||
.mus-card{position:relative;padding:10px}
|
||||
.mus-link{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit;min-width:0}
|
||||
.mus-art{width:56px;height:56px;border-radius:9px;flex:none;object-fit:cover;background:var(--surface-2)}
|
||||
.mus-art-ph{display:grid;place-items:center;font-size:24px;color:var(--label-2)}
|
||||
.mus-meta{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1;padding-right:30px}
|
||||
.mus-name{font-size:16px;font-weight:600;letter-spacing:-.014em;overflow-wrap:anywhere}
|
||||
.mus-sub{font-size:12.5px;color:var(--label-2)}
|
||||
.mus-go{font-size:16px;color:var(--acc);flex:none}
|
||||
.mus-del{position:absolute;top:50%;right:10px;transform:translateY(-50%);width:32px;height:32px;font-size:15px;color:var(--label-2)}
|
||||
.mus-del:active{transform:translateY(-50%) scale(.92)}
|
||||
.mus-profile{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit}
|
||||
.mus-profile-i{font-size:28px;color:var(--acc);flex:none}
|
||||
.mus-hint{display:flex;gap:12px;align-items:flex-start}
|
||||
.mus-hint-i{font-size:24px;color:var(--label-2);flex:none;margin-top:2px}
|
||||
|
||||
/* --- the chart panels -----------------------------------------------------
|
||||
Full-width panels for the few metrics people open this screen for. Same `--tint` contract as
|
||||
the tiles, so a panel and its card are recognisably the same metric. */
|
||||
|
||||
Reference in new issue
Block a user