feat: add per-user customization suppression toggles and API endpoints for profile

This commit is contained in:
2026-06-09 20:52:51 +00:00
parent c2c5166720
commit a3f9b949ca
15 changed files with 495 additions and 19 deletions
+23
View File
@@ -160,6 +160,29 @@
<p class="api-key-hint">Use this key with <code>X-API-KEY</code>, <code>Authorization: Bearer</code>, or HTTP Basic auth on any request. {% if is_owner %}Regenerating immediately invalidates the old key.{% endif %}</p>
</div>
{% endif %}
{% if can_manage_customization %}
<div class="customization-card" data-customization data-username="{{ profile_user['username'] }}">
<div class="customization-head">
<span class="customization-title">{% if is_owner %}My customizations{% else %}{{ profile_user['username'] }}'s customizations{% endif %}</span>
</div>
<div class="customization-row">
<span class="customization-label">Site-wide custom CSS and JS</span>
<form method="POST" action="/profile/{{ profile_user['username'] }}/customization/global" data-customization-form>
<input type="hidden" name="value" value="{{ 1 if cust_disable_global else 0 }}">
<button type="submit" class="btn btn-sm {% if cust_disable_global %}btn-primary{% endif %}" data-customization-toggle="global" data-confirm="{% if cust_disable_global %}Re-enable your site-wide custom CSS and JS?{% else %}Disable your site-wide custom CSS and JS? Your saved code is kept and can be re-enabled.{% endif %}">{% if cust_disable_global %}Enable{% else %}Disable{% endif %}</button>
</form>
</div>
<div class="customization-row">
<span class="customization-label">Per-page custom CSS and JS</span>
<form method="POST" action="/profile/{{ profile_user['username'] }}/customization/pagetype" data-customization-form>
<input type="hidden" name="value" value="{{ 1 if cust_disable_pagetype else 0 }}">
<button type="submit" class="btn btn-sm {% if cust_disable_pagetype %}btn-primary{% endif %}" data-customization-toggle="pagetype" data-confirm="{% if cust_disable_pagetype %}Re-enable your per-page custom CSS and JS?{% else %}Disable your per-page custom CSS and JS? Your saved code is kept and can be re-enabled.{% endif %}">{% if cust_disable_pagetype %}Enable{% else %}Disable{% endif %}</button>
</form>
</div>
<p class="customization-hint">Disabling hides your custom code without deleting it.</p>
</div>
{% endif %}
</aside>
<div class="profile-content">