feat(api): expose and validate the audio resume rewind setting

GET/PUT /api/auth/profile now carries audio_resume_rewind_seconds
(always-present on the response: 0 is a real value, exact resume; the
request shape is the keep_screen_awake string precedent so the form
select can send an explicit 0=Off while JSON clients that omit it
leave the column untouched — a plain int with an omitempty contract
could not express 'set to off'). Strict allow-list {0,5,10}: the UI
offers exactly three choices and the API refuses everything else.

The audiobook chapters endpoint embeds resume_rewind_seconds in its
existing payload — it already loads the user row for playback speed,
so both players (web + Android, phone UI and the Android Auto service)
get the value with the fetch they perform anyway; zero extra round
trips.

Profile page gains the Resume Rewind select (Off / 5 s before /
10 s before) next to Default Playback Speed.
This commit is contained in:
John O'Keefe committed 2026-11-01 17:19:58 -05:00
1 parent daffe499eb
commit 9cf9e1d305
6 files changed
+153 -73

No files matched your search

+11
View File
@@ -87,6 +87,17 @@ templ ProfileForm(user User, actionURL string, requireCurrentPassword bool, show
}
</select>
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wide mb-1.5" style="color: var(--text-secondary)">Resume Rewind</label>
<select
name="audio_resume_rewind_seconds"
class="input"
>
<option value="0" selected?={ user.AudioResumeRewind == 0 }>Off (exact resume)</option>
<option value="5" selected?={ user.AudioResumeRewind == 5 }>5 seconds before</option>
<option value="10" selected?={ user.AudioResumeRewind == 10 }>10 seconds before</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold uppercase tracking-wide mb-1.5" style="color: var(--text-secondary)">Keep Screen Awake</label>
<select