Repository navigation
feat: content badges for live and last played media - #1186
Merged
Merged
Conversation
Add /badges/now.json and /badges/last.json to the hosted service. Both take ?id= or ?user= plus an optional ?kind= filter (track, episode, movie, show, unknown, default any), so a README can carry one badge for the film last watched and another for what is playing now. On an accepted non-idle ingest the service records the last playback of each kind under np:last:user or np:last:card, holding only the title, subtitle, state and kind the public card already shows, with a 7-day expiry. Legacy cards migrate their records to the user scope when they alias during GitHub sign-in, never overwriting a newer record. Revoking a legacy card or signing out everywhere deletes them. Card reads now share one presence resolver; badge reads reuse it without counting a card render. Badge responses refresh after 60 seconds and show the media text as a Shields endpoint badge with kind-based labels. Document the content badges and the 7-day retention in the privacy and hosted-service docs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hosted service now serves two content badges next to the usage counters, so a README can carry one badge for the film last watched and another for what is playing now.
GET /badges/now.json(the card's live playback) andGET /badges/last.json(the same, falling back to the most recent playback of that kind whenever nothing of that kind is playing). Both take?id=<cardId>or?user=<login>and an optional?kind=track|episode|movie|show|unknownfilter (defaultany).np:last:user:<githubId>:<kind>ornp:last:card:<cardId>:<kind>: only the title, subtitle, state and kind the public card already shows, expiring after 7 days. Recording is best effort and never fails an accepted ingest; idle updates never touch records.Validation:
Deployment: the badges go live when the hosted service deploys after merge. This PR does not deploy production or touch the desktop app.