Repository navigation
Your play time card counts every PC of the account - #328
Merged
elripalda merged 7 commits intoNov 20, 2026
Merged
Conversation
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.
What this changes
A game page's Your play time card (this week, this month, sessions, longest, the last two weeks) now counts every PC of the account when signed in, not just this one. Played and Last played were already account wide (#251 and the playtime sync); the card was still drawn from this PC's sessions only, because the website kept a total per game and no sessions.
Launcher
Each PC sends, with each game's total, what the card needs and no more (
PlayEntryinlibrary.rs):count: how many sessions it kept of the game (10 seconds or more each, its newest 500).longest: the longest of them.recent: its sessions of the last 31 days, as[start, secs], for this week, this month and the bars.Older sessions aren't sent: the card shows nothing of them but count and longest, so a full send stays small.
playStats(games.js) builds the card: the account's recent sessions joined with this PC's (a session is the same one when start and length match, so this PC's own aren't counted twice), and the larger of the account's and this PC's count and longest, so a session the website hasn't heard about yet still shows. Anything malformed from the website is left out. Signed out, or a website without these fields: the card is this PC's own, as before.Website (needed before other PCs show up)
docs/LAUNCHER-API.md, Playtime: per PC,countandlongestkeep the larger of stored and sent (likesecs);recentsessions are added to what it had (deduped by both numbers), with anything older than 31 days dropped.GET ?a=playgives each gamecountsummed over the PCs,longestthe largest, and every PC'srecenttogether, oldest first. Titles don't carry them.tools/fake-play-site.cjsdoes this, to try it locally withRL_API.Signing in again doesn't count a PC twice
The website told PCs apart by their sign-in token, so a PC that signed out and back in became a new PC sending its whole running total again: Played (and now Sessions) counted twice. Each
?a=playsend now carriespc, a random play ID kept inplay.idin the data folder (cloud::play_id), the same however often the PC signs in. The website keeps play rows by account and play ID; a sign-in's earlier rows move to its play ID when it first sends one, merged by the larger of each number.It's its own ID, used for play time only: not the usage ID (
install.id), which only goes when the player shares usage and Settings can reset. Sign-in, the PC list and cloud saves are unchanged. Rows from sign-ins already gone before this stay as they are.Testing
node --test tests/*.test.cjs: 340 passed (5 new: every PC's recent sessions once, count and longest from the account, a session not on the account yet, signed out, bad data left out).cargo test: 693 passed (4 new: entries carry recent sessions; older sessions count but aren't sent; the play ID stays the same; it isn't the usage ID).recent.