- The theme is now a stylesheet linked from index.html (ConfigMap funkwhale-theme), not in-app custom CSS, so it applies on first paint. Primary buttons and links use Dex's mauve/lavender exactly; the welcome page gets a Catppuccin gradient and the eom.dev logo instead of the sky-blue banner and whales, and its login card is a plain surface. tools/gen-palettes.py regenerates the palette ramps, with the light and dark halves fixed. - funkwhale-oidc v0.2.0 with funkwhale_oidc_local_login: false. Dex is the only way in, and the break-glass admin is skipped. - common__api_authentication_required: false (anonymous access), plus a long description for the welcome page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
1.5 KiB
Django/Jinja
45 lines
1.5 KiB
Django/Jinja
# Run with: funkwhale-manage shell -c "$(cat configure.py)"
|
|
# Converges instance preferences and the break-glass admin; prints the number
|
|
# of changes as the last line.
|
|
import base64
|
|
import json
|
|
|
|
from dynamic_preferences.registries import global_preferences_registry
|
|
|
|
from funkwhale_api.cli.users import handler_create_user
|
|
from funkwhale_api.users.models import User
|
|
|
|
want = json.loads(base64.b64decode({{ (funkwhale_preferences | combine(funkwhale_preferences_extra)) | to_json | b64encode | to_json }}))
|
|
admin = json.loads(base64.b64decode({{ {'username': funkwhale_admin_user, 'email': funkwhale_admin_email, 'password': funkwhale_admin_password} | to_json | b64encode | to_json }}))
|
|
|
|
changed = 0
|
|
prefs = global_preferences_registry.manager()
|
|
for key, value in want.items():
|
|
if prefs[key] != value:
|
|
prefs[key] = value
|
|
changed += 1
|
|
|
|
{% if funkwhale_oidc_enabled | bool and not funkwhale_oidc_local_login | bool %}
|
|
# Local login is off: the break-glass account could not log in anyway.
|
|
user = False
|
|
{% else %}
|
|
user = User.objects.filter(username=admin["username"]).first()
|
|
{% endif %}
|
|
if user is False:
|
|
pass
|
|
elif user is None:
|
|
handler_create_user(
|
|
username=admin["username"],
|
|
password=admin["password"],
|
|
email=admin["email"],
|
|
is_superuser=True,
|
|
permissions=["library", "moderation", "settings"],
|
|
)
|
|
changed += 1
|
|
elif not user.check_password(admin["password"]):
|
|
user.set_password(admin["password"])
|
|
user.save(update_fields=["password"])
|
|
changed += 1
|
|
|
|
print(changed)
|