feat: distinguish owned and shared games
CI / test (push) Successful in 40s

Add game_ownership (schema v10) and tools/check_ownership.py, compare the local library with GetOwnedGames, expose owned/shared counts and filters, and show a shared-game badge on cards.
This commit is contained in:
strsv committed 2026-11-07 01:40:47 +03:00
1 parent 528fcb7474
commit 2ed00b7912
18 files changed
+255 -10

No files matched your search

+8 -2
View File
@@ -19,7 +19,7 @@ let coldStartManual = false;
function defaultFilters() {
return {
status: "", genres: [], tags: [], installed: false, unplayed: false, favorite: false,
duration: "", minHours: "", maxHours: "", minYear: "", maxYear: "",
ownership: "", duration: "", minHours: "", maxHours: "", minYear: "", maxYear: "",
minReview: "", maxReview: "",
};
}
@@ -273,6 +273,9 @@ function cardHtml(g, mode = "library") {
? `<span class="badge score">${g.score}</span>`
: (g.review != null ? `<span class="badge review ${g.review < 85 ? "warn" : ""}">${g.review}%</span>` : "");
const installed = g.installed ? `<span class="badge installed" title="установлена">●</span>` : "";
const shared = g.owned === 0
? `<span class="badge shared" title="Не в списке владения (возможно, семейная)">семейная</span>`
: "";
const selectBox = mode === "library" && state.selectionMode
? `<label class="select-box" title="Выбрать игру"><input type="checkbox" value="${g.appid}" data-select="${g.appid}"${state.selected.has(g.appid) ? " checked" : ""} aria-label="Выбрать игру"></label>`
: "";
@@ -304,7 +307,7 @@ function cardHtml(g, mode = "library") {
<img data-appid="${g.appid}" loading="lazy" width="300" height="450"
src="${coverUrl(g.appid)}" alt="">
<div class="fallback">${esc(initials(g.name))}</div>
${review}${installed}${selectBox}
${review}${installed}${shared}${selectBox}
</div>
<div class="card-body">
<h3 class="card-title">${esc(g.name)}</h3>
@@ -667,6 +670,7 @@ function syncFilterControls() {
$("#search").value = state.q;
$("#sort").value = state.sort;
$("#fStatus").value = state.filters.status;
$("#fOwnership").value = state.filters.ownership;
$("#fDuration").value = state.filters.duration;
$("#fInstalled").checked = !!state.filters.installed;
$("#fUnplayed").checked = !!state.filters.unplayed;
@@ -880,6 +884,7 @@ function filterParams() {
if (state.filters.installed) p.set("installed", "1");
if (state.filters.unplayed) p.set("unplayed", "1");
if (state.filters.favorite) p.set("favorite", "1");
if (state.filters.ownership) p.set("ownership", state.filters.ownership);
if (state.filters.duration) p.set("duration", state.filters.duration);
p.set("dir", state.dir);
[
@@ -1728,6 +1733,7 @@ $("#sort").addEventListener("change", (e) => {
});
$("#fStatus").addEventListener("change", (e) => { state.filters.status = e.target.value; loadGames(true); });
$("#fOwnership").addEventListener("change", (e) => { state.filters.ownership = e.target.value; loadGames(true); });
$("#fDuration").addEventListener("change", (e) => { state.filters.duration = e.target.value; loadGames(true); });
let rangeTimer = null;
document.querySelectorAll("[data-filter]").forEach((input) => {