From 3f3611be541cb47d7e5fc0824fde3b3772780a5b Mon Sep 17 00:00:00 2001 From: Joe Farrelly Date: Tue, 30 Jun 2026 23:34:19 +0100 Subject: [PATCH] Serve gold and played time from cached addon file --- apicore/views.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apicore/views.py b/apicore/views.py index c027021..b48bbd4 100644 --- a/apicore/views.py +++ b/apicore/views.py @@ -227,6 +227,21 @@ def list(self, request): data = LuaParser(lines).parse() cache.set(cache_key, data, timeout=None) + if page == "addon": + addon_alts = data.get("alts", {}) + result = [] + for alt in ProfileAlt.objects.filter(user=user_id): + addon_alt = addon_alts.get(f"{alt.alt_name}-{alt.alt_realm}", {}) + result.append( + { + "alt_id": alt.alt_id, + "gold": addon_alt.get("gold"), + "played_time_total": addon_alt.get("playedTimeTotal"), + "played_time_level": addon_alt.get("playedTimeLevel"), + } + ) + return response.Response(result) + return response.Response([])