what the fuck
This commit is contained in:
1 parent
c1b1c2f372
commit
72a99a5bcd
69 files changed
+7519
-558
No files matched your search
@@ -4,13 +4,58 @@
|
||||
<h1 class="h4 mb-3">Site Settings</h1>
|
||||
{% for msg in app.flashes('success') %}<div class="alert alert-success">{{ msg }}</div>{% endfor %}
|
||||
{% for msg in app.flashes('info') %}<div class="alert alert-info">{{ msg }}</div>{% endfor %}
|
||||
{% for msg in app.flashes('warning') %}<div class="alert alert-warning">{{ msg }}</div>{% endfor %}
|
||||
{% for msg in app.flashes('danger') %}<div class="alert alert-danger">{{ msg }}</div>{% endfor %}
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
{{ form_start(form, {attr: {class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
|
||||
{{ form_start(form, {attr: {id: 'site-settings-form', class: 'vstack gap-3', novalidate: 'novalidate'}}) }}
|
||||
<div>
|
||||
{{ form_label(form.EXTERNAL_ALBUM_PROVIDER) }}
|
||||
{{ form_widget(form.EXTERNAL_ALBUM_PROVIDER, {attr: {class: 'form-select', 'data-initial-provider': storedProvider}}) }}
|
||||
<div class="form-text">Switching provider clears album/review catalog data to prevent mixed-source duplicates.</div>
|
||||
<div class="form-text">Stored provider: <strong>{{ providerLabelStored }}</strong> • Active provider: <strong>{{ providerLabelActive }}</strong> • Effective now: <strong>{{ providerLabelEffective }}</strong></div>
|
||||
{% if envOverrideProvider %}
|
||||
<div class="form-text text-warning">Environment override <code>EXTERNAL_ALBUM_PROVIDER={{ envOverrideProvider }}</code> is active and takes priority over saved settings.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
{{ form_label(form.LASTFM_API_KEY) }}
|
||||
{{ form_widget(form.LASTFM_API_KEY, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Environment override: <code>LASTFM_API_KEY</code>.</div>
|
||||
</div>
|
||||
<hr class="my-1">
|
||||
<div>
|
||||
{{ form_label(form.MUSICBRAINZ_CLIENT_ID) }}
|
||||
{{ form_widget(form.MUSICBRAINZ_CLIENT_ID, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Optional. Not required for album search. Create OAuth app credentials at <a href="https://musicbrainz.org/account/applications" target="_blank" rel="noopener">MusicBrainz account applications</a>. Environment override: <code>MUSICBRAINZ_CLIENT_ID</code>.</div>
|
||||
</div>
|
||||
<div>
|
||||
{{ form_label(form.MUSICBRAINZ_CLIENT_SECRET) }}
|
||||
{{ form_widget(form.MUSICBRAINZ_CLIENT_SECRET, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Optional. Not required for album search. Pairs with client ID from <a href="https://musicbrainz.org/account/applications" target="_blank" rel="noopener">MusicBrainz account applications</a>. Environment override: <code>MUSICBRAINZ_CLIENT_SECRET</code>.</div>
|
||||
</div>
|
||||
<div>
|
||||
{{ form_label(form.MUSICBRAINZ_ACCESS_TOKEN) }}
|
||||
{{ form_widget(form.MUSICBRAINZ_ACCESS_TOKEN, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Optional. Leave empty for normal search.</div>
|
||||
<div class="form-text">If you need authenticated MusicBrainz features, create an OAuth app under <a href="https://musicbrainz.org/account/applications" target="_blank" rel="noopener">MusicBrainz account applications</a>, authorize it, then paste the returned access token here. Environment override: <code>MUSICBRAINZ_ACCESS_TOKEN</code>.</div>
|
||||
</div>
|
||||
<hr class="my-1">
|
||||
<div>
|
||||
{{ form_label(form.TIDAL_CLIENT_ID) }}
|
||||
{{ form_widget(form.TIDAL_CLIENT_ID, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Required for TIDAL provider. Create credentials at <a href="https://developer.tidal.com/" target="_blank" rel="noopener">developer.tidal.com</a>. Environment override: <code>TIDAL_CLIENT_ID</code>.</div>
|
||||
</div>
|
||||
<div>
|
||||
{{ form_label(form.TIDAL_CLIENT_SECRET) }}
|
||||
{{ form_widget(form.TIDAL_CLIENT_SECRET, {attr: {class: 'form-control'}}) }}
|
||||
<div class="form-text">Required for TIDAL provider. Environment override: <code>TIDAL_CLIENT_SECRET</code>.</div>
|
||||
</div>
|
||||
<div>
|
||||
{{ form_label(form.TIDAL_COUNTRY_CODE) }}
|
||||
{{ form_widget(form.TIDAL_COUNTRY_CODE, {attr: {class: 'form-control', placeholder: 'US'}}) }}
|
||||
<div class="form-text">Optional ISO 3166-1 alpha-2 country code used for catalog availability (defaults to <code>US</code>). Environment override: <code>TIDAL_COUNTRY_CODE</code>.</div>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
{% set registrationToggleAttrs = {class: 'form-check-input'} %}
|
||||
@@ -88,3 +133,31 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script>
|
||||
(function () {
|
||||
const form = document.getElementById('site-settings-form');
|
||||
const providerField = document.getElementById('{{ form.EXTERNAL_ALBUM_PROVIDER.vars.id }}');
|
||||
if (!form || !providerField) {
|
||||
return;
|
||||
}
|
||||
|
||||
const initialProvider = providerField.dataset.initialProvider || providerField.value;
|
||||
const envOverrideActive = {{ envOverrideProvider ? 'true' : 'false' }};
|
||||
form.addEventListener('submit', function (event) {
|
||||
if (providerField.value === initialProvider) {
|
||||
return;
|
||||
}
|
||||
|
||||
const message = envOverrideActive
|
||||
? 'EXTERNAL_ALBUM_PROVIDER override is active. This change saves your preferred provider, but reset only occurs when the effective provider actually changes. Continue?'
|
||||
: 'Changing the external provider will reset all albums, tracks, and reviews to avoid mixed-source duplicates. Continue?';
|
||||
const ok = window.confirm(message);
|
||||
if (!ok) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -6,7 +6,7 @@
|
||||
<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 Last.fm metadata
|
||||
Refresh {{ externalProviderLabel }} 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.externalId %}
|
||||
{% set publicId = a.externalId %}
|
||||
<div class="d-flex justify-content-between align-items-start">
|
||||
<div class="me-2">
|
||||
<div>
|
||||
@@ -77,11 +77,11 @@
|
||||
{% 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">Last.fm</span>{% endif %}
|
||||
{% if a.source == 'user' %}<span class="badge text-bg-primary">User</span>{% else %}<span class="badge text-bg-success">{{ externalProviderLabel }}</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>
|
||||
{% if publicId %}
|
||||
{% if publicId and a.source == 'user' %}
|
||||
<form method="post" action="{{ path('album_delete', {id: publicId}) }}" onsubmit="return confirm('Delete this album?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete-album-' ~ publicId) }}" />
|
||||
<button class="btn btn-sm btn-outline-danger" type="submit">Delete</button>
|
||||
@@ -97,4 +97,3 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in new issue
Block a user