@rmdes/indiekit-endpoint-funkwhale 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,21 +66,16 @@ export const dashboardController = {
66
66
  // Get stats from cache (same source as public API)
67
67
  // If cache is empty, try to refresh it from database
68
68
  let cachedStats = getCachedStats();
69
- console.log("[Funkwhale Dashboard] cachedStats:", cachedStats ? "exists" : "null");
70
69
  if (!cachedStats) {
71
70
  const getDb = request.app.locals.application.getFunkwhaleDb;
72
- console.log("[Funkwhale Dashboard] getFunkwhaleDb:", getDb ? "exists" : "null");
73
71
  if (getDb) {
74
72
  const db = getDb();
75
- console.log("[Funkwhale Dashboard] db:", db ? "exists" : "null");
76
73
  if (db) {
77
74
  cachedStats = await refreshStatsCache(db, limits);
78
- console.log("[Funkwhale Dashboard] after refresh:", cachedStats ? "exists" : "null");
79
75
  }
80
76
  }
81
77
  }
82
78
  const summary = cachedStats?.summary?.all || null;
83
- console.log("[Funkwhale Dashboard] summary:", JSON.stringify(summary));
84
79
 
85
80
  // Determine public frontend URL (strip 'api' from mount path)
86
81
  // e.g., /funkwhaleapi -> /funkwhale
@@ -91,7 +86,10 @@ export const dashboardController = {
91
86
  nowPlaying,
92
87
  listenings: listenings.slice(0, 5),
93
88
  favorites: favorites.slice(0, 5),
94
- summary,
89
+ totalPlays: summary?.totalPlays || 0,
90
+ uniqueTracks: summary?.uniqueTracks || 0,
91
+ uniqueArtists: summary?.uniqueArtists || 0,
92
+ hasStats: !!summary,
95
93
  publicUrl,
96
94
  mountPath: request.baseUrl,
97
95
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rmdes/indiekit-endpoint-funkwhale",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Funkwhale listening activity endpoint for Indiekit. Display listening history, favorites, and statistics.",
5
5
  "keywords": [
6
6
  "indiekit",
@@ -193,20 +193,20 @@
193
193
  {% endif %}
194
194
 
195
195
  {# Quick Stats Summary #}
196
- {% if summary %}
196
+ {% if hasStats %}
197
197
  <section class="fw-section">
198
198
  <h2>{{ __("funkwhale.stats") }}</h2>
199
199
  <div class="fw-stats-grid">
200
200
  <div class="fw-stat">
201
- <span class="fw-stat-value">{{ summary.totalPlays | default(0) }}</span>
201
+ <span class="fw-stat-value">{{ totalPlays }}</span>
202
202
  <span class="fw-stat-label">{{ __("funkwhale.plays") }}</span>
203
203
  </div>
204
204
  <div class="fw-stat">
205
- <span class="fw-stat-value">{{ summary.uniqueTracks | default(0) }}</span>
205
+ <span class="fw-stat-value">{{ uniqueTracks }}</span>
206
206
  <span class="fw-stat-label">{{ __("funkwhale.tracks") }}</span>
207
207
  </div>
208
208
  <div class="fw-stat">
209
- <span class="fw-stat-value">{{ summary.uniqueArtists | default(0) }}</span>
209
+ <span class="fw-stat-value">{{ uniqueArtists }}</span>
210
210
  <span class="fw-stat-label">{{ __("funkwhale.artists") }}</span>
211
211
  </div>
212
212
  </div>