Migration to last.fm, removed old spotify api client. FOSRestBundle API serving data driven front end (JWT).

This commit is contained in:
boris committed 2026-02-27 16:52:57 +00:00
1 parent 391ecf1732
commit 56dea097d6
51 files changed
+1749 -844

No files matched your search

+2 -7
View File
@@ -9,12 +9,8 @@
<div class="card-body">
{{ form_start(form, {attr: {class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
<div>
{{ form_label(form.SPOTIFY_CLIENT_ID) }}
{{ form_widget(form.SPOTIFY_CLIENT_ID, {attr: {class: 'form-control'}}) }}
</div>
<div>
{{ form_label(form.SPOTIFY_CLIENT_SECRET) }}
{{ form_widget(form.SPOTIFY_CLIENT_SECRET, {attr: {class: 'form-control'}}) }}
{{ form_label(form.LASTFM_API_KEY) }}
{{ form_widget(form.LASTFM_API_KEY, {attr: {class: 'form-control'}}) }}
</div>
<div class="form-check form-switch">
{% set registrationToggleAttrs = {class: 'form-check-input'} %}
@@ -92,4 +88,3 @@
</div>
{% endblock %}
+5 -6
View File
@@ -3,10 +3,10 @@
{% block body %}
<div class="d-flex flex-wrap align-items-center gap-3 mb-3">
<h1 class="h4 mb-0">Site dashboard</h1>
<form method="post" action="{{ path('admin_dashboard_refresh_spotify') }}" class="ms-auto">
<input type="hidden" name="_token" value="{{ csrf_token('dashboard_refresh_spotify') }}">
<form method="post" action="{{ path('admin_dashboard_refresh_external') }}" class="ms-auto">
<input type="hidden" name="_token" value="{{ csrf_token('dashboard_refresh_external') }}">
<button class="btn btn-outline-success" type="submit">
Refresh Spotify metadata
Refresh Last.fm metadata
</button>
</form>
</div>
@@ -68,7 +68,7 @@
<h2 class="h6 mb-3">Latest albums (50)</h2>
<div class="vstack gap-2">
{% for a in recentAlbums %}
{% set publicId = a.source == 'user' ? a.localId : a.spotifyId %}
{% set publicId = a.source == 'user' ? a.localId : a.externalId %}
<div class="d-flex justify-content-between align-items-start">
<div class="me-2">
<div>
@@ -77,7 +77,7 @@
{% else %}
<span>{{ a.name }}</span>
{% endif %}
{% if a.source == 'user' %}<span class="badge text-bg-primary">User</span>{% else %}<span class="badge text-bg-success">Spotify</span>{% endif %}
{% if a.source == 'user' %}<span class="badge text-bg-primary">User</span>{% else %}<span class="badge text-bg-success">Last.fm</span>{% endif %}
</div>
<div class="text-secondary small">{{ a.artists|join(', ') }}{% if a.releaseDate %} • {{ a.releaseDate }}{% endif %} • {{ a.createdAt|date('Y-m-d H:i') }}</div>
</div>
@@ -98,4 +98,3 @@
</div>
{% endblock %}
+8 -10
View File
@@ -28,11 +28,11 @@
{% endif %}
<h1 class="{{ landing_view ? 'display-6 text-center mb-4' : 'h4 mb-3' }}">Search Albums</h1>
{% if source_value != 'user' and spotifyConfigured is defined and not spotifyConfigured %}
{% if source_value != 'user' and externalConfigured is defined and not externalConfigured %}
<div class="alert alert-info">
Spotify is not configured yet. Results will only include user-created albums.
Last.fm is not configured yet. Results will only include user-created albums.
{% if is_granted('ROLE_ADMIN') %}
<a class="alert-link" href="{{ path('admin_settings') }}">Enter Spotify credentials</a>.
<a class="alert-link" href="{{ path('admin_settings') }}">Enter Last.fm API key</a>.
{% endif %}
</div>
{% endif %}
@@ -51,7 +51,7 @@
<div class="col-sm-3 order-sm-4">
<select class="form-select" name="source">
<option value="all" {{ source_value == 'all' ? 'selected' : '' }}>All sources</option>
<option value="spotify" {{ source_value == 'spotify' ? 'selected' : '' }}>Spotify</option>
<option value="external" {{ source_value == 'external' ? 'selected' : '' }}>Last.fm</option>
<option value="user" {{ source_value == 'user' ? 'selected' : '' }}>User-created</option>
</select>
</div>
@@ -86,7 +86,7 @@
<div class="col-sm-3 order-sm-4">
<select class="form-select" name="source">
<option value="all" {{ source_value == 'all' ? 'selected' : '' }}>All sources</option>
<option value="spotify" {{ source_value == 'spotify' ? 'selected' : '' }}>Spotify</option>
<option value="external" {{ source_value == 'external' ? 'selected' : '' }}>Last.fm</option>
<option value="user" {{ source_value == 'user' ? 'selected' : '' }}>User-created</option>
</select>
</div>
@@ -115,7 +115,7 @@
{% for album in albums %}
<div class="col">
<div class="card h-100">
{% set image = (album.images[1] ?? album.images[0] ?? null) %}
{% set image = (album.images[0] ?? album.images[1] ?? null) %}
{% if image %}
<a href="{{ path('album_show', {id: album.id}) }}">
<img class="card-img-top" src="{{ image.url }}" alt="{{ album.name }} cover" />
@@ -133,8 +133,8 @@
{% set s = stats[album.id] ?? { 'avg': 0, 'count': 0 } %}
<p class="card-text"><small class="text-secondary">User score: {{ s.avg }}/10 ({{ s.count }})</small></p>
<div class="mt-auto">
{% if album.external_urls.spotify is defined and album.external_urls.spotify %}
<a class="btn btn-outline-success btn-sm" href="{{ album.external_urls.spotify }}" target="_blank" rel="noopener">Open in Spotify</a>
{% if album.external_urls.external is defined and album.external_urls.external %}
<a class="btn btn-outline-success btn-sm" href="{{ album.external_urls.external }}" target="_blank" rel="noopener">Open Source</a>
{% endif %}
<a class="btn btn-success btn-sm" href="{{ path('album_show', {id: album.id}) }}">Reviews</a>
{% if app.user and (album.source is not defined or album.source != 'user') %}
@@ -157,5 +157,3 @@
<p>No albums found.</p>
{% endif %}
{% endblock %}
+3 -5
View File
@@ -4,7 +4,7 @@
<div class="row g-4 mb-4">
<div class="col-md-4">
<div class="card h-100">
{% set image = (album.images[1] ?? album.images[0] ?? null) %}
{% set image = (album.images[0] ?? album.images[1] ?? null) %}
{% if image %}
<img class="card-img-top" src="{{ image.url }}" alt="{{ album.name }} cover" />
{% endif %}
@@ -28,8 +28,8 @@
<p class="text-secondary mb-2">Genres: {{ album.genres|join(', ') }}</p>
{% endif %}
<p class="mb-2"><strong>User score:</strong> {{ avg }}/10 ({{ count }})</p>
{% if album.external_urls.spotify %}
<a class="btn btn-outline-success btn-sm" href="{{ album.external_urls.spotify }}" target="_blank" rel="noopener">Open in Spotify</a>
{% if album.external_urls.external %}
<a class="btn btn-outline-success btn-sm" href="{{ album.external_urls.external }}" target="_blank" rel="noopener">Open Source</a>
{% endif %}
{% if album.source is defined and album.source == 'user' %}
<span class="badge text-bg-primary ms-2">User album</span>
@@ -153,5 +153,3 @@
</div>
</div>
{% endblock %}
+1 -1
View File
@@ -20,7 +20,7 @@
</div>
<p class="text-secondary">
{{ review.album.name }} — {{ review.album.artists|join(', ') }}
<a class="ms-1" href="{{ path('album_show', {id: review.album.spotifyId ?? review.album.localId}) }}">View album</a>
<a class="ms-1" href="{{ path('album_show', {id: review.album.externalId ?? review.album.localId}) }}">View album</a>
</p>
<article class="mb-3">
<p>{{ review.content|nl2br }}</p>