Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Support Audiobookshelf 2.36 and recover from more playback errors

Barnabas3616bc9d18be
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index 7d3d9e1d..5c9dcedc 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -114,6 +114,7 @@ flutter {
dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")
+ testImplementation("junit:junit:4.13.2")
// SAF document moves for custom download folders (MainActivity.moveBookToSaf).
implementation("androidx.documentfile:documentfile:1.0.1")
@@ -138,4 +139,4 @@ dependencies {
// fdroid flavor so the github/playstore builds are unchanged.
configurations.matching { it.name.startsWith("fdroid") }.configureEach {
exclude(group = "com.google.android.play")
-}
\ No newline at end of file
+}
diff --git a/android/app/src/gms/kotlin/com/barnabas/absorb/PlatformIntegration.kt b/android/app/src/gms/kotlin/com/barnabas/absorb/PlatformIntegration.kt
index b1f5dbb8..f7af4c76 100644
--- a/android/app/src/gms/kotlin/com/barnabas/absorb/PlatformIntegration.kt
+++ b/android/app/src/gms/kotlin/com/barnabas/absorb/PlatformIntegration.kt
@@ -83,6 +83,7 @@ object PlatformIntegration {
userId = call.argument<String>("userId"),
isLegacyToken = call.argument<Boolean>("isLegacyToken") ?: false,
customHeaders = headers,
+ supportsTokenReturn = call.argument<Boolean>("supportsTokenReturn") ?: false,
)
result.success(true)
}
diff --git a/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthBridge.kt b/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthBridge.kt
index 44bc7140..303cdfd6 100644
--- a/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthBridge.kt
+++ b/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthBridge.kt
@@ -27,6 +27,7 @@ object WearAuthBridge {
const val AUTH_PATH = "/absorb/auth/v1"
const val AUTH_REQUEST_PATH = "/absorb/auth/request"
const val AUTH_SIGN_OUT_PATH = "/absorb/auth/signout"
+ const val AUTH_ROTATED_PATH = "/absorb/auth/rotated"
private const val KEY_PAYLOAD = "payload"
private const val KEY_ISSUED_AT = "issuedAt"
@@ -45,6 +46,7 @@ object WearAuthBridge {
userId: String?,
isLegacyToken: Boolean,
customHeaders: Map<String, String> = emptyMap(),
+ supportsTokenReturn: Boolean = false,
) {
scope.launch {
try {
@@ -60,6 +62,8 @@ object WearAuthBridge {
put("userId", userId ?: JSONObject.NULL)
put("isLegacyToken", isLegacyToken)
put("customHeaders", headersJson)
+ put("source", "phone")
+ put("supportsTokenReturn", supportsTokenReturn)
put("issuedAt", now)
}.toString()
diff --git a/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthListenerService.kt b/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthListenerService.kt
index 44a2c50c..fdd54fae 100644
--- a/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthListenerService.kt
+++ b/android/app/src/gms/kotlin/com/barnabas/absorb/WearAuthListenerService.kt
@@ -28,10 +28,53 @@ class WearAuthListenerService : WearableListenerService() {
when (event.path) {
WearAuthBridge.AUTH_REQUEST_PATH -> republishFromStoredPrefs()
WearAuthBridge.AUTH_SIGN_OUT_PATH -> WearAuthBridge.clear(applicationContext)
+ WearAuthBridge.AUTH_ROTATED_PATH -> adoptRotatedTokens(event.data)
else -> super.onMessageReceived(event)
}
}
+ private fun adoptRotatedTokens(bytes: ByteArray) {
+ val payload = try {
+ JSONObject(bytes.toString(Charsets.UTF_8))
+ } catch (e: Exception) {
+ Log.w(TAG, "Watch returned malformed credentials", e)
+ return
+ }
+ val accessToken = payload.optString("accessToken").takeIf { it.isNotEmpty() }
+ val refreshToken = payload.optString("refreshToken").takeIf { it.isNotEmpty() }
+ val serverUrl = payload.optString("serverUrl").trimEnd('/')
+ val username = payload.optString("username")
+ if (accessToken == null || refreshToken == null || serverUrl.isEmpty()) {
+ Log.w(TAG, "Watch returned an incomplete token pair")
+ return
+ }
+
+ val prefs = applicationContext.getSharedPreferences(
+ FLUTTER_PREFS_FILE,
+ Context.MODE_PRIVATE,
+ )
+ val activeServer = prefs.getString("flutter.server_url", null)?.trimEnd('/')
+ val activeUsername = prefs.getString("flutter.username", null) ?: ""
+ if (!serverUrl.equals(activeServer, ignoreCase = true) || username != activeUsername) {
+ Log.w(TAG, "Ignoring rotated credentials for a different account")
+ return
+ }
+
+ // One synchronous commit keeps the access/refresh pair indivisible for
+ // Android Auto and Flutter readers in other isolates.
+ val saved = prefs.edit()
+ .putString("flutter.token", accessToken)
+ .putString("flutter.refresh_token", refreshToken)
+ .putBoolean("flutter.wear_token_pair_pending", true)
+ .commit()
+ if (!saved) {
+ Log.w(TAG, "Failed to persist rotated credentials from watch")
+ return
+ }
+ Log.i(TAG, "Adopted rotated credentials returned by watch")
+ republishFromStoredPrefs()
+ }
+
private fun republishFromStoredPrefs() {
val prefs = applicationContext.getSharedPreferences(
FLUTTER_PREFS_FILE,
@@ -73,6 +116,7 @@ class WearAuthListenerService : WearableListenerService() {
userId = userId,
isLegacyToken = isLegacy,
customHeaders = headers,
+ supportsTokenReturn = true,
)
}
diff --git a/android/app/src/main/kotlin/com/barnabas/absorb/CoverContentProvider.kt b/android/app/src/main/kotlin/com/barnabas/absorb/CoverContentProvider.kt
index 74208d87..bc7e0287 100644
--- a/android/app/src/main/kotlin/com/barnabas/absorb/CoverContentProvider.kt
+++ b/android/app/src/main/kotlin/com/barnabas/absorb/CoverContentProvider.kt
@@ -11,6 +11,7 @@ import android.util.Log
import java.io.File
import java.net.HttpURLConnection
import java.net.URL
+import org.json.JSONObject
/**
* ContentProvider that serves cover images to Android Auto.
@@ -29,6 +30,7 @@ class CoverContentProvider : ContentProvider() {
companion object {
const val AUTHORITY = "com.barnabas.absorb.covers"
private const val TAG = "CoverProvider"
+ private val refreshLock = Any()
fun buildCoverUri(itemId: String): Uri {
return Uri.parse("content://$AUTHORITY/cover/$itemId")
@@ -107,17 +109,18 @@ class CoverContentProvider : ContentProvider() {
}
val cleanUrl = serverUrl.trimEnd('/')
+ val customHeaders = readCustomHeaders(prefs)
val cacheDir = File(context.cacheDir, "aa_covers")
if (!cacheDir.exists()) cacheDir.mkdirs()
val cacheFile = File(cacheDir, "$itemId.jpg")
- var result = fetchCover(cleanUrl, itemId, token, cacheFile)
+ var result = fetchCover(cleanUrl, itemId, token, cacheFile, customHeaders)
if (result == 401) {
// Access token expired - try refreshing via the refresh token
- val newToken = refreshAccessToken(cleanUrl, prefs)
+ val newToken = refreshAccessToken(cleanUrl, token, prefs, customHeaders)
if (newToken != null) {
token = newToken
- result = fetchCover(cleanUrl, itemId, token, cacheFile)
+ result = fetchCover(cleanUrl, itemId, token, cacheFile, customHeaders)
}
}
@@ -133,12 +136,20 @@ class CoverContentProvider : ContentProvider() {
}
}
- private fun fetchCover(serverUrl: String, itemId: String, token: String, outFile: File): Int {
+ private fun fetchCover(
+ serverUrl: String,
+ itemId: String,
+ token: String,
+ outFile: File,
+ customHeaders: Map<String, String>,
+ ): Int {
val fetchUrl = "$serverUrl/api/items/$itemId/cover?width=400&token=$token"
val connection = URL(fetchUrl).openConnection() as HttpURLConnection
connection.connectTimeout = 5000
connection.readTimeout = 5000
connection.instanceFollowRedirects = true
+ connection.setRequestProperty("User-Agent", "Absorb Android Auto")
+ customHeaders.forEach { (key, value) -> connection.setRequestProperty(key, value) }
try {
val code = connection.responseCode
if (code != 200) {
@@ -158,40 +169,47 @@ class CoverContentProvider : ContentProvider() {
private fun refreshAccessToken(
serverUrl: String,
- prefs: android.content.SharedPreferences
- ): String? {
+ staleAccessToken: String,
+ prefs: android.content.SharedPreferences,
+ customHeaders: Map<String, String>,
+ ): String? = synchronized(refreshLock) {
+ // Flutter or another provider request may have completed the rotation
+ // while this cover request was receiving its 401.
+ val latestAccess = prefs.getString("flutter.token", null)
+ if (!latestAccess.isNullOrEmpty() && latestAccess != staleAccessToken) {
+ return@synchronized latestAccess
+ }
+
val refreshToken = prefs.getString("flutter.refresh_token", null)
if (refreshToken.isNullOrEmpty()) {
Log.w(TAG, "No refresh token available")
- return null
+ return@synchronized null
}
try {
- val connection = URL("$serverUrl/api/authorize").openConnection() as HttpURLConnection
+ val connection = URL("$serverUrl/auth/refresh").openConnection() as HttpURLConnection
connection.requestMethod = "POST"
connection.connectTimeout = 5000
connection.readTimeout = 5000
- connection.setRequestProperty("Authorization", "Bearer $refreshToken")
- connection.setRequestProperty("x-return-tokens", "true")
+ connection.setRequestProperty("x-refresh-token", refreshToken)
+ connection.setRequestProperty("User-Agent", "Absorb Android Auto")
+ customHeaders.forEach { (key, value) -> connection.setRequestProperty(key, value) }
try {
if (connection.responseCode != 200) {
Log.w(TAG, "Token refresh failed: HTTP ${connection.responseCode}")
- return null
+ return@synchronized null
}
val body = connection.inputStream.bufferedReader().readText()
- // Simple JSON parsing - extract accessToken and refreshToken
- val newAccess = extractJsonString(body, "accessToken")
- val newRefresh = extractJsonString(body, "refreshToken")
- if (newAccess != null) {
- prefs.edit()
- .putString("flutter.token", newAccess)
- .apply()
- if (newRefresh != null) {
- prefs.edit()
- .putString("flutter.refresh_token", newRefresh)
- .apply()
- }
+ val tokens = parseCoverRefreshTokens(body)
+ if (tokens != null) {
+ // Commit the rotating pair together so no reader can see a
+ // new access token paired with the spent refresh token.
+ val saved = prefs.edit()
+ .putString("flutter.token", tokens.accessToken)
+ .putString("flutter.refresh_token", tokens.refreshToken)
+ .commit()
+ if (!saved) return@synchronized null
Log.d(TAG, "Token refreshed successfully from CoverContentProvider")
- return newAccess
+ return@synchronized tokens.accessToken
}
} finally {
connection.disconnect()
@@ -199,13 +217,25 @@ class CoverContentProvider : ContentProvider() {
} catch (e: Exception) {
Log.e(TAG, "Token refresh error", e)
}
- return null
+ null
}
- private fun extractJsonString(json: String, key: String): String? {
- val pattern = "\"$key\"\\s*:\\s*\"([^\"]+)\""
- val match = Regex(pattern).find(json)
- return match?.groupValues?.get(1)
+ private fun readCustomHeaders(
+ prefs: android.content.SharedPreferences,
+ ): Map<String, String> {
+ val raw = prefs.getString("flutter.custom_headers", null) ?: return emptyMap()
+ return try {
+ val json = JSONObject(raw)
+ buildMap {
+ json.keys().forEach { key ->
+ val value = json.optString(key)
+ if (value.isNotEmpty()) put(key, value)
+ }
+ }
+ } catch (e: Exception) {
+ Log.w(TAG, "Failed to decode custom headers", e)
+ emptyMap()
+ }
}
// If the URI carries a `ts` query param newer than the aa_covers file's
@@ -276,3 +306,18 @@ class CoverContentProvider : ContentProvider() {
override fun update(uri: Uri, values: ContentValues?, s: String?, sa: Array<out String>?): Int = 0
override fun delete(uri: Uri, s: String?, sa: Array<out String>?): Int = 0
}
+
+internal data class CoverRefreshTokens(
+ val accessToken: String,
+ val refreshToken: String,
+)
+
+internal fun parseCoverRefreshTokens(json: String): CoverRefreshTokens? {
+ fun value(key: String): String? {
+ val match = Regex("\"$key\"\\s*:\\s*\"([^\"]+)\"").find(json)
+ return match?.groupValues?.get(1)
+ }
+ val accessToken = value("accessToken") ?: return null
+ val refreshToken = value("refreshToken") ?: return null
+ return CoverRefreshTokens(accessToken, refreshToken)
+}
diff --git a/android/app/src/test/kotlin/com/barnabas/absorb/CoverRefreshTokensTest.kt b/android/app/src/test/kotlin/com/barnabas/absorb/CoverRefreshTokensTest.kt
new file mode 100644
index 00000000..1c1a18e2
--- /dev/null
+++ b/android/app/src/test/kotlin/com/barnabas/absorb/CoverRefreshTokensTest.kt
@@ -0,0 +1,22 @@
+package com.barnabas.absorb
+
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
+import org.junit.Test
+
+class CoverRefreshTokensTest {
+ @Test
+ fun parsesNestedUserTokenPair() {
+ val tokens = parseCoverRefreshTokens(
+ """{"success":true,"user":{"accessToken":"access","refreshToken":"refresh"}}""",
+ )
+
+ assertEquals("access", tokens?.accessToken)
+ assertEquals("refresh", tokens?.refreshToken)
+ }
+
+ @Test
+ fun rejectsHalfATokenPair() {
+ assertNull(parseCoverRefreshTokens("""{"accessToken":"access"}"""))
+ }
+}
diff --git a/ios/Runner/Audio/AbsorbAudioEngine.swift b/ios/Runner/Audio/AbsorbAudioEngine.swift
index bb50ccc1..fc695ca8 100644
--- a/ios/Runner/Audio/AbsorbAudioEngine.swift
+++ b/ios/Runner/Audio/AbsorbAudioEngine.swift
@@ -365,6 +365,7 @@ final class AbsorbAudioEngine: NSObject {
guard let self = self else { completion(nil); return }
var err: NSError?
let status = asset.statusOfValue(forKey: "tracks", error: &err)
+ let decodedDurationS = asset.duration.seconds
if status != .loaded {
self.emit("[AudioEngine] loadTrack idx=\(index) tracks-load failed status=\(status.rawValue) err=\(err?.localizedDescription ?? "nil")")
}
@@ -398,7 +399,7 @@ final class AbsorbAudioEngine: NSObject {
}
self.queue.async {
self.emit("[AudioEngine] loadTrack idx=\(index) localStart=\(localStart) autoPlay=\(autoPlay)")
- completion(self.totalDurationS > 0 ? self.totalDurationS : nil)
+ completion(decodedDurationS.isFinite && decodedDurationS > 0 ? decodedDurationS : nil)
}
}
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index bed93502..e19917cb 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -1046,6 +1046,53 @@
"logOutTitle": "Log out?",
"logOutContent": "This will sign you out. Your downloads will stay on this device.",
"signOut": "Sign Out",
+ "changePasswordTitle": "Change Password",
+ "changePasswordSubtitle": "Update your Audiobookshelf password safely",
+ "currentPassword": "Current password",
+ "newPassword": "New password",
+ "confirmNewPassword": "Confirm new password",
+ "passwordChangeEffect": "Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.",
+ "passwordFieldsRequired": "Fill in all password fields",
+ "passwordsDoNotMatch": "New passwords do not match",
+ "passwordChanged": "Password changed. Other signed-in devices were disconnected.",
+ "passwordInvalid": "The current password is incorrect",
+ "passwordChangeUnsupported": "This server version does not support safe password changes in Absorb",
+ "passwordChangeFailed": "Could not change your password",
+ "otherUserPasswordResetWarning": "Changing this password signs the user out on every device.",
+ "manageSessionsTitle": "Signed-in Devices",
+ "manageSessionsSubtitle": "Review and remove Audiobookshelf sessions",
+ "sessionsCurrent": "Current device",
+ "sessionsUnknownDevice": "Unknown device",
+ "sessionsLastActive": "Last active {date}",
+ "@sessionsLastActive": {
+ "placeholders": {
+ "date": {
+ "type": "String"
+ }
+ }
+ },
+ "sessionsNone": "No active sessions",
+ "sessionsLoadMore": "Load more",
+ "sessionsUnsupported": "Session management requires Audiobookshelf 2.36 or newer.",
+ "sessionsLoadFailed": "Could not load signed-in devices",
+ "sessionsLegacyNotice": "This login does not have a refresh session, so Absorb cannot identify this device in the list.",
+ "sessionsRemove": "Sign out device",
+ "sessionsRemoveTitle": "Sign out this device?",
+ "sessionsRemoveContent": "This removes its refresh session. Its current access may keep working until that short-lived token expires.",
+ "sessionsRemoved": "Device signed out",
+ "sessionsRemoveFailed": "Could not sign out that device",
+ "sessionsSignOutAll": "Sign out all devices",
+ "sessionsSignOutAllTitle": "Sign out everywhere?",
+ "sessionsSignOutAllContent": "This removes every refresh session, including this device. Existing access tokens may work until they expire.",
+ "podcastScheduleServerTime": "Schedule uses server time ({timeZone})",
+ "@podcastScheduleServerTime": {
+ "placeholders": {
+ "timeZone": {
+ "type": "String"
+ }
+ }
+ },
+ "podcastScheduleServerTimeUnknown": "Schedule uses server time",
"editServerAddressTitle": "Edit Server Address",
"editServerAddressSubtitle": "Update the address for {username}. Use this if your server's address changed - it's still the same server, just a new URL. Your stats and downloads are kept.",
"@editServerAddressSubtitle": {
@@ -1059,6 +1106,19 @@
"editServerAddressUpdated": "Server address updated",
"editServerAddressFailed": "Couldn't update server address",
"editServerAddressAction": "Edit server address",
+ "editServerConnectionTitle": "Edit Server Connection",
+ "editServerConnectionSubtitle": "Update the server address and custom headers for {username}. Your stats and downloads are kept.",
+ "@editServerConnectionSubtitle": {
+ "placeholders": {
+ "username": {
+ "type": "String"
+ }
+ }
+ },
+ "editServerConnectionAction": "Edit server connection",
+ "editServerConnectionUpdated": "Server connection updated",
+ "editServerConnectionFailed": "Couldn't update server connection",
+ "editCustomHeadersDescription": "Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.",
"removeAccountAction": "Remove account",
"removeAccountTitle": "Remove Account?",
"removeAccountContent": "Remove {username} on {server} from saved accounts?\n\nYou can always add it back later by signing in again.",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index 7d34a103..c74c9936 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -3958,6 +3958,204 @@ abstract class AppLocalizations {
/// **'Sign Out'**
String get signOut;
+ /// No description provided for @changePasswordTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Change Password'**
+ String get changePasswordTitle;
+
+ /// No description provided for @changePasswordSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Update your Audiobookshelf password safely'**
+ String get changePasswordSubtitle;
+
+ /// No description provided for @currentPassword.
+ ///
+ /// In en, this message translates to:
+ /// **'Current password'**
+ String get currentPassword;
+
+ /// No description provided for @newPassword.
+ ///
+ /// In en, this message translates to:
+ /// **'New password'**
+ String get newPassword;
+
+ /// No description provided for @confirmNewPassword.
+ ///
+ /// In en, this message translates to:
+ /// **'Confirm new password'**
+ String get confirmNewPassword;
+
+ /// No description provided for @passwordChangeEffect.
+ ///
+ /// In en, this message translates to:
+ /// **'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.'**
+ String get passwordChangeEffect;
+
+ /// No description provided for @passwordFieldsRequired.
+ ///
+ /// In en, this message translates to:
+ /// **'Fill in all password fields'**
+ String get passwordFieldsRequired;
+
+ /// No description provided for @passwordsDoNotMatch.
+ ///
+ /// In en, this message translates to:
+ /// **'New passwords do not match'**
+ String get passwordsDoNotMatch;
+
+ /// No description provided for @passwordChanged.
+ ///
+ /// In en, this message translates to:
+ /// **'Password changed. Other signed-in devices were disconnected.'**
+ String get passwordChanged;
+
+ /// No description provided for @passwordInvalid.
+ ///
+ /// In en, this message translates to:
+ /// **'The current password is incorrect'**
+ String get passwordInvalid;
+
+ /// No description provided for @passwordChangeUnsupported.
+ ///
+ /// In en, this message translates to:
+ /// **'This server version does not support safe password changes in Absorb'**
+ String get passwordChangeUnsupported;
+
+ /// No description provided for @passwordChangeFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Could not change your password'**
+ String get passwordChangeFailed;
+
+ /// No description provided for @otherUserPasswordResetWarning.
+ ///
+ /// In en, this message translates to:
+ /// **'Changing this password signs the user out on every device.'**
+ String get otherUserPasswordResetWarning;
+
+ /// No description provided for @manageSessionsTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Signed-in Devices'**
+ String get manageSessionsTitle;
+
+ /// No description provided for @manageSessionsSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Review and remove Audiobookshelf sessions'**
+ String get manageSessionsSubtitle;
+
+ /// No description provided for @sessionsCurrent.
+ ///
+ /// In en, this message translates to:
+ /// **'Current device'**
+ String get sessionsCurrent;
+
+ /// No description provided for @sessionsUnknownDevice.
+ ///
+ /// In en, this message translates to:
+ /// **'Unknown device'**
+ String get sessionsUnknownDevice;
+
+ /// No description provided for @sessionsLastActive.
+ ///
+ /// In en, this message translates to:
+ /// **'Last active {date}'**
+ String sessionsLastActive(String date);
+
+ /// No description provided for @sessionsNone.
+ ///
+ /// In en, this message translates to:
+ /// **'No active sessions'**
+ String get sessionsNone;
+
+ /// No description provided for @sessionsLoadMore.
+ ///
+ /// In en, this message translates to:
+ /// **'Load more'**
+ String get sessionsLoadMore;
+
+ /// No description provided for @sessionsUnsupported.
+ ///
+ /// In en, this message translates to:
+ /// **'Session management requires Audiobookshelf 2.36 or newer.'**
+ String get sessionsUnsupported;
+
+ /// No description provided for @sessionsLoadFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Could not load signed-in devices'**
+ String get sessionsLoadFailed;
+
+ /// No description provided for @sessionsLegacyNotice.
+ ///
+ /// In en, this message translates to:
+ /// **'This login does not have a refresh session, so Absorb cannot identify this device in the list.'**
+ String get sessionsLegacyNotice;
+
+ /// No description provided for @sessionsRemove.
+ ///
+ /// In en, this message translates to:
+ /// **'Sign out device'**
+ String get sessionsRemove;
+
+ /// No description provided for @sessionsRemoveTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Sign out this device?'**
+ String get sessionsRemoveTitle;
+
+ /// No description provided for @sessionsRemoveContent.
+ ///
+ /// In en, this message translates to:
+ /// **'This removes its refresh session. Its current access may keep working until that short-lived token expires.'**
+ String get sessionsRemoveContent;
+
+ /// No description provided for @sessionsRemoved.
+ ///
+ /// In en, this message translates to:
+ /// **'Device signed out'**
+ String get sessionsRemoved;
+
+ /// No description provided for @sessionsRemoveFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Could not sign out that device'**
+ String get sessionsRemoveFailed;
+
+ /// No description provided for @sessionsSignOutAll.
+ ///
+ /// In en, this message translates to:
+ /// **'Sign out all devices'**
+ String get sessionsSignOutAll;
+
+ /// No description provided for @sessionsSignOutAllTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Sign out everywhere?'**
+ String get sessionsSignOutAllTitle;
+
+ /// No description provided for @sessionsSignOutAllContent.
+ ///
+ /// In en, this message translates to:
+ /// **'This removes every refresh session, including this device. Existing access tokens may work until they expire.'**
+ String get sessionsSignOutAllContent;
+
+ /// No description provided for @podcastScheduleServerTime.
+ ///
+ /// In en, this message translates to:
+ /// **'Schedule uses server time ({timeZone})'**
+ String podcastScheduleServerTime(String timeZone);
+
+ /// No description provided for @podcastScheduleServerTimeUnknown.
+ ///
+ /// In en, this message translates to:
+ /// **'Schedule uses server time'**
+ String get podcastScheduleServerTimeUnknown;
+
/// No description provided for @editServerAddressTitle.
///
/// In en, this message translates to:
@@ -3994,6 +4192,42 @@ abstract class AppLocalizations {
/// **'Edit server address'**
String get editServerAddressAction;
+ /// No description provided for @editServerConnectionTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Edit Server Connection'**
+ String get editServerConnectionTitle;
+
+ /// No description provided for @editServerConnectionSubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Update the server address and custom headers for {username}. Your stats and downloads are kept.'**
+ String editServerConnectionSubtitle(String username);
+
+ /// No description provided for @editServerConnectionAction.
+ ///
+ /// In en, this message translates to:
+ /// **'Edit server connection'**
+ String get editServerConnectionAction;
+
+ /// No description provided for @editServerConnectionUpdated.
+ ///
+ /// In en, this message translates to:
+ /// **'Server connection updated'**
+ String get editServerConnectionUpdated;
+
+ /// No description provided for @editServerConnectionFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Couldn\'t update server connection'**
+ String get editServerConnectionFailed;
+
+ /// No description provided for @editCustomHeadersDescription.
+ ///
+ /// In en, this message translates to:
+ /// **'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.'**
+ String get editCustomHeadersDescription;
+
/// No description provided for @removeAccountAction.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index a1e82e23..f93af3c2 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -2172,6 +2172,119 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get signOut => 'Abmelden';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Serveradresse bearbeiten';
@@ -2193,6 +2306,27 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get editServerAddressAction => 'Serveradresse bearbeiten';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Konto entfernen';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index c08e7f15..e3d4d32f 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index a3540eb8..9e93a0a4 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index d0cc0112..8e35c18c 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -2150,6 +2150,119 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2170,6 +2283,27 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 52a0fa65..e178df08 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -2168,6 +2168,119 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get signOut => 'Se déconnecter';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2188,6 +2301,27 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index bf4f80e9..4a94b941 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index efe2a2ff..094ab596 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index bc51713e..dac4ba5e 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 9aacd59f..f3093702 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index a71c43cb..7071c150 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -2148,6 +2148,119 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get signOut => 'Sign Out';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2168,6 +2281,27 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index 38644db6..ba374bff 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -2152,6 +2152,119 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get signOut => 'Выйти';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2172,6 +2285,27 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 08aa4ce7..30806806 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -2094,6 +2094,119 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get signOut => '退出登录';
+ @override
+ String get changePasswordTitle => 'Change Password';
+
+ @override
+ String get changePasswordSubtitle =>
+ 'Update your Audiobookshelf password safely';
+
+ @override
+ String get currentPassword => 'Current password';
+
+ @override
+ String get newPassword => 'New password';
+
+ @override
+ String get confirmNewPassword => 'Confirm new password';
+
+ @override
+ String get passwordChangeEffect =>
+ 'Changing your password signs out your other Audiobookshelf sessions. This device stays signed in.';
+
+ @override
+ String get passwordFieldsRequired => 'Fill in all password fields';
+
+ @override
+ String get passwordsDoNotMatch => 'New passwords do not match';
+
+ @override
+ String get passwordChanged =>
+ 'Password changed. Other signed-in devices were disconnected.';
+
+ @override
+ String get passwordInvalid => 'The current password is incorrect';
+
+ @override
+ String get passwordChangeUnsupported =>
+ 'This server version does not support safe password changes in Absorb';
+
+ @override
+ String get passwordChangeFailed => 'Could not change your password';
+
+ @override
+ String get otherUserPasswordResetWarning =>
+ 'Changing this password signs the user out on every device.';
+
+ @override
+ String get manageSessionsTitle => 'Signed-in Devices';
+
+ @override
+ String get manageSessionsSubtitle =>
+ 'Review and remove Audiobookshelf sessions';
+
+ @override
+ String get sessionsCurrent => 'Current device';
+
+ @override
+ String get sessionsUnknownDevice => 'Unknown device';
+
+ @override
+ String sessionsLastActive(String date) {
+ return 'Last active $date';
+ }
+
+ @override
+ String get sessionsNone => 'No active sessions';
+
+ @override
+ String get sessionsLoadMore => 'Load more';
+
+ @override
+ String get sessionsUnsupported =>
+ 'Session management requires Audiobookshelf 2.36 or newer.';
+
+ @override
+ String get sessionsLoadFailed => 'Could not load signed-in devices';
+
+ @override
+ String get sessionsLegacyNotice =>
+ 'This login does not have a refresh session, so Absorb cannot identify this device in the list.';
+
+ @override
+ String get sessionsRemove => 'Sign out device';
+
+ @override
+ String get sessionsRemoveTitle => 'Sign out this device?';
+
+ @override
+ String get sessionsRemoveContent =>
+ 'This removes its refresh session. Its current access may keep working until that short-lived token expires.';
+
+ @override
+ String get sessionsRemoved => 'Device signed out';
+
+ @override
+ String get sessionsRemoveFailed => 'Could not sign out that device';
+
+ @override
+ String get sessionsSignOutAll => 'Sign out all devices';
+
+ @override
+ String get sessionsSignOutAllTitle => 'Sign out everywhere?';
+
+ @override
+ String get sessionsSignOutAllContent =>
+ 'This removes every refresh session, including this device. Existing access tokens may work until they expire.';
+
+ @override
+ String podcastScheduleServerTime(String timeZone) {
+ return 'Schedule uses server time ($timeZone)';
+ }
+
+ @override
+ String get podcastScheduleServerTimeUnknown => 'Schedule uses server time';
+
@override
String get editServerAddressTitle => 'Edit Server Address';
@@ -2114,6 +2227,27 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get editServerAddressAction => 'Edit server address';
+ @override
+ String get editServerConnectionTitle => 'Edit Server Connection';
+
+ @override
+ String editServerConnectionSubtitle(String username) {
+ return 'Update the server address and custom headers for $username. Your stats and downloads are kept.';
+ }
+
+ @override
+ String get editServerConnectionAction => 'Edit server connection';
+
+ @override
+ String get editServerConnectionUpdated => 'Server connection updated';
+
+ @override
+ String get editServerConnectionFailed => 'Couldn\'t update server connection';
+
+ @override
+ String get editCustomHeadersDescription =>
+ 'Used for Cloudflare tunnels or reverse proxies. These headers apply only to this saved account.';
+
@override
String get removeAccountAction => 'Remove account';
diff --git a/lib/models/auth_session.dart b/lib/models/auth_session.dart
new file mode 100644
index 00000000..f9f94c06
--- /dev/null
+++ b/lib/models/auth_session.dart
@@ -0,0 +1,133 @@
+class AuthSessionDeviceInfo {
+ final String? browserName;
+ final String? browserVersion;
+ final String? osName;
+ final String? osVersion;
+ final String? deviceType;
+ final String? model;
+ final String? vendor;
+
+ const AuthSessionDeviceInfo({
+ this.browserName,
+ this.browserVersion,
+ this.osName,
+ this.osVersion,
+ this.deviceType,
+ this.model,
+ this.vendor,
+ });
+
+ factory AuthSessionDeviceInfo.fromJson(Map<String, dynamic> json) {
+ return AuthSessionDeviceInfo(
+ browserName: json['browserName'] as String?,
+ browserVersion: json['browserVersion'] as String?,
+ osName: json['osName'] as String?,
+ osVersion: json['osVersion'] as String?,
+ deviceType: json['deviceType'] as String?,
+ model: json['model'] as String?,
+ vendor: json['vendor'] as String?,
+ );
+ }
+
+ String? get deviceLabel {
+ final parts = <String?>[
+ vendor,
+ model,
+ deviceType,
+ ].whereType<String>().where((value) => value.trim().isNotEmpty).toList();
+ return parts.isEmpty ? null : parts.join(' ');
+ }
+
+ String? get softwareLabel {
+ final browser = [
+ browserName,
+ browserVersion,
+ ].whereType<String>().where((value) => value.trim().isNotEmpty).join(' ');
+ final os = [
+ osName,
+ osVersion,
+ ].whereType<String>().where((value) => value.trim().isNotEmpty).join(' ');
+ final parts = [browser, os].where((value) => value.isNotEmpty).toList();
+ return parts.isEmpty ? null : parts.join(' on ');
+ }
+}
+
+class AuthSession {
+ final String id;
+ final String? ipAddress;
+ final String? userAgent;
+ final AuthSessionDeviceInfo? deviceInfo;
+ final DateTime? createdAt;
+ final DateTime? updatedAt;
+ final bool current;
+
+ const AuthSession({
+ required this.id,
+ this.ipAddress,
+ this.userAgent,
+ this.deviceInfo,
+ this.createdAt,
+ this.updatedAt,
+ this.current = false,
+ });
+
+ factory AuthSession.fromJson(Map<String, dynamic> json) {
+ final rawDeviceInfo = json['deviceInfo'];
+ return AuthSession(
+ id: json['id'] as String? ?? '',
+ ipAddress: json['ipAddress'] as String?,
+ userAgent: json['userAgent'] as String?,
+ deviceInfo: rawDeviceInfo is Map<String, dynamic>
+ ? AuthSessionDeviceInfo.fromJson(rawDeviceInfo)
+ : null,
+ createdAt: _dateFromEpoch(json['createdAt']),
+ updatedAt: _dateFromEpoch(json['updatedAt']),
+ current: json['current'] == true,
+ );
+ }
+
+ static DateTime? _dateFromEpoch(Object? value) {
+ if (value is! num) return null;
+ return DateTime.fromMillisecondsSinceEpoch(value.toInt());
+ }
+}
+
+class AuthSessionsPage {
+ final List<AuthSession> sessions;
+ final int total;
+ final int numPages;
+ final int page;
+ final int itemsPerPage;
+
+ const AuthSessionsPage({
+ required this.sessions,
+ required this.total,
+ required this.numPages,
+ required this.page,
+ required this.itemsPerPage,
+ });
+
+ factory AuthSessionsPage.fromJson(Map<String, dynamic> json) {
+ final rawSessions = json['sessions'] as List<dynamic>? ?? const [];
+ return AuthSessionsPage(
+ sessions: rawSessions
+ .whereType<Map<String, dynamic>>()
+ .map(AuthSession.fromJson)
+ .where((session) => session.id.isNotEmpty)
+ .toList(),
+ total: (json['total'] as num?)?.toInt() ?? 0,
+ numPages: (json['numPages'] as num?)?.toInt() ?? 0,
+ page: (json['page'] as num?)?.toInt() ?? 0,
+ itemsPerPage: (json['itemsPerPage'] as num?)?.toInt() ?? 10,
+ );
+ }
+}
+
+enum AuthSessionsStatus { supported, unsupported, failed }
+
+class AuthSessionsResult {
+ final AuthSessionsStatus status;
+ final AuthSessionsPage? page;
+
+ const AuthSessionsResult(this.status, [this.page]);
+}
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dart
index cda7be1d..a30e1b1c 100644
--- a/lib/providers/_lp_core.dart
+++ b/lib/providers/_lp_core.dart
@@ -703,10 +703,8 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
try {
final pendingSyncs =
(await ScopedPrefs.getStringList('pending_syncs')).toSet();
- final me = await _api!.getMe();
- if (me != null) {
- final progressList = me['mediaProgress'] as List<dynamic>?;
- if (progressList != null) {
+ final progressList = await _api!.getAllProgress();
+ if (progressList != null) {
final localFinished = <String, Map<String, dynamic>>{};
if (_lastFinishedItemId != null &&
_progressMap.containsKey(_lastFinishedItemId!)) {
@@ -729,13 +727,11 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
}
_progressMap = {};
for (final mp in progressList) {
- if (mp is Map<String, dynamic>) {
- final itemId = mp['libraryItemId'] as String?;
- final episodeId = mp['episodeId'] as String?;
- if (itemId != null) {
- final key = episodeId != null ? '$itemId-$episodeId' : itemId;
- _progressMap[key] = mp;
- }
+ final itemId = mp['libraryItemId'] as String?;
+ final episodeId = mp['episodeId'] as String?;
+ if (itemId != null) {
+ final key = episodeId != null ? '$itemId-$episodeId' : itemId;
+ _progressMap[key] = mp;
}
}
for (final entry in localFinished.entries) {
@@ -795,7 +791,6 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
if (cleared > 0) {
debugPrint('[Progress] Cleared $cleared overrides');
}
- }
}
} catch (_) {}
}
diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart
index 75b9cf09..be9d2c82 100644
--- a/lib/providers/auth_provider.dart
+++ b/lib/providers/auth_provider.dart
@@ -277,9 +277,27 @@ class AuthProvider extends ChangeNotifier {
userId: _userId,
isLegacyToken: _isLegacyToken,
customHeaders: _customHeaders,
+ supportsTokenReturn: true,
);
}
+ /// Adopt a token pair rotated by Android Auto or the paired Wear app.
+ Future<void> adoptCompanionTokens() async {
+ final server = _serverUrl;
+ final username = _username;
+ if (server == null || _accessToken == null) return;
+ final tokens = await UserAccountService().loadPersistedTokens(server, username);
+ if (tokens?.accessToken == null || tokens!.accessToken == _accessToken) return;
+ await _onTokensRefreshed(
+ server,
+ username,
+ tokens.accessToken!,
+ tokens.refreshToken,
+ );
+ final prefs = await SharedPreferences.getInstance();
+ await prefs.remove('wear_token_pair_pending');
+ }
+
void _onAuthExpired(String sessionServer, String? sessionUsername) {
if (!_isCurrentSession(sessionServer, sessionUsername) ||
_accessToken == null ||
@@ -341,13 +359,26 @@ class AuthProvider extends ChangeNotifier {
_userId = prefs.getString('user_id');
_defaultLibraryId = savedLibraryId;
- // Restore custom headers
+ // Older releases stored one global header map. Saved accounts now own
+ // their headers, but keep the global value as a migration fallback.
final headersJson = prefs.getString('custom_headers');
+ var legacyCustomHeaders = <String, String>{};
if (headersJson != null) {
try {
- _customHeaders = Map<String, String>.from(jsonDecode(headersJson) as Map);
+ legacyCustomHeaders =
+ Map<String, String>.from(jsonDecode(headersJson) as Map);
} catch (_) {}
}
+ SavedAccount? restoredAccount;
+ for (final account in UserAccountService().accounts) {
+ if (normalizeServerUrl(account.serverUrl) == restoredUrl &&
+ account.username == savedUsername) {
+ restoredAccount = account;
+ break;
+ }
+ }
+ _customHeaders =
+ restoredAccount?.customHeaders ?? legacyCustomHeaders;
// Load local server config
await _loadLocalServerSettings();
@@ -606,6 +637,7 @@ class AuthProvider extends ChangeNotifier {
refreshToken: _refreshToken,
userId: _userId,
isLegacyToken: _isLegacyToken,
+ customHeaders: customHeaders,
));
} catch (_) {}
@@ -688,6 +720,7 @@ class AuthProvider extends ChangeNotifier {
refreshToken: null,
userId: _userId,
isLegacyToken: true,
+ customHeaders: customHeaders,
));
} catch (_) {}
@@ -785,6 +818,7 @@ class AuthProvider extends ChangeNotifier {
refreshToken: _refreshToken,
userId: _userId,
isLegacyToken: _isLegacyToken,
+ customHeaders: customHeaders,
));
} catch (_) {}
@@ -910,7 +944,11 @@ class AuthProvider extends ChangeNotifier {
Future<void> logout({
bool forgetAccount = true,
bool keepServer = false,
+ bool revokeServerSession = false,
+ bool allDevices = false,
}) async {
+ if (revokeServerSession) await adoptCompanionTokens();
+
// Stop any active playback
try {
final player = AudioPlayerService();
@@ -938,6 +976,21 @@ class AuthProvider extends ChangeNotifier {
final logoutServer = _serverUrl;
final logoutUser = _username;
+ // Only an explicit sign-out revokes the server session. Account switches
+ // and auth-expiry cleanup intentionally keep their existing local behavior.
+ if (revokeServerSession &&
+ logoutServer != null &&
+ _accessToken != null &&
+ _refreshToken != null) {
+ final api = _createSessionApi(
+ baseUrl: logoutServer,
+ token: _accessToken!,
+ refreshToken: _refreshToken,
+ isLegacyToken: _isLegacyToken,
+ );
+ await api.revokeServerSession(allDevices: allDevices);
+ }
+
_accessToken = null;
_refreshToken = null;
_isLegacyToken = false;
@@ -988,6 +1041,7 @@ class AuthProvider extends ChangeNotifier {
/// app reloads with the new user's data.
Future<bool> switchToAccount(SavedAccount account) async {
if (account.token.isEmpty) return false;
+ await adoptCompanionTokens();
// Stop current playback
try {
@@ -1025,12 +1079,13 @@ class AuthProvider extends ChangeNotifier {
await EqualizerService().reloadForActiveAccount();
// Set credentials
- _serverUrl = account.serverUrl;
- _accessToken = account.token;
- _refreshToken = account.refreshToken;
- _isLegacyToken = account.isLegacyToken;
- _username = account.username;
- _userId = account.userId;
+ _serverUrl = selected.serverUrl;
+ _accessToken = selected.token;
+ _refreshToken = selected.refreshToken;
+ _isLegacyToken = selected.isLegacyToken;
+ _username = selected.username;
+ _userId = selected.userId;
+ _customHeaders = selected.customHeaders;
_defaultLibraryId = null;
_userJson = null;
_serverSettings = null;
@@ -1045,6 +1100,11 @@ class AuthProvider extends ChangeNotifier {
if (_accessToken != null) await prefs.setString('token', _accessToken!);
if (_username != null) await prefs.setString('username', _username!);
if (_userId != null) await prefs.setString('user_id', _userId!);
+ if (_customHeaders.isNotEmpty) {
+ await prefs.setString('custom_headers', jsonEncode(_customHeaders));
+ } else {
+ await prefs.remove('custom_headers');
+ }
} catch (_) {}
// Clear the stats widget so the previous account's numbers don't linger
@@ -1052,23 +1112,6 @@ class AuthProvider extends ChangeNotifier {
await HomeWidgetService().clearStats();
HomeWidgetService().refreshStats(force: true);
- // Restore custom headers for this session
- try {
- final prefs = await SharedPreferences.getInstance();
- final headersJson = prefs.getString('custom_headers');
- if (headersJson != null) {
- try {
- _customHeaders = Map<String, String>.from(jsonDecode(headersJson) as Map);
- } catch (_) {
- _customHeaders = {};
- }
- } else {
- _customHeaders = {};
- }
- } catch (_) {
- _customHeaders = {};
- }
-
// Verify the token still works and get user info
try {
final api = _createSessionApi(
@@ -1127,12 +1170,37 @@ class AuthProvider extends ChangeNotifier {
/// next API call (and the [apiService] getter) uses the new address.
/// Returns true if the account was found and updated.
Future<bool> editServerUrl(SavedAccount account, String newServerUrl) async {
+ return editServerConnection(
+ account,
+ newServerUrl,
+ account.customHeaders,
+ );
+ }
+
+ /// Update the connection details for one saved account. Custom headers are
+ /// account-specific so users on different reverse proxies do not inherit
+ /// each other's credentials.
+ Future<bool> editServerConnection(
+ SavedAccount account,
+ String newServerUrl,
+ Map<String, String> customHeaders,
+ ) async {
final url = normalizeServerUrl(newServerUrl);
if (url.isEmpty) return false;
- if (url == account.serverUrl) return true; // nothing to change
+ final headersUnchanged =
+ customHeaders.length == account.customHeaders.length &&
+ customHeaders.entries.every(
+ (entry) => account.customHeaders[entry.key] == entry.value,
+ );
+ if (url == account.serverUrl && headersUnchanged) return true;
final ok = await UserAccountService()
- .updateAccountUrl(account.serverUrl, account.username, url);
+ .updateAccountConnection(
+ account.serverUrl,
+ account.username,
+ url,
+ customHeaders,
+ );
if (!ok) return false;
// If we just edited the currently active session, update it live.
@@ -1140,11 +1208,25 @@ class AuthProvider extends ChangeNotifier {
account.serverUrl == _serverUrl && account.username == _username;
if (isActiveSession) {
_serverUrl = url;
+ _customHeaders = Map.unmodifiable(customHeaders);
_serverReachable = true;
try {
final prefs = await SharedPreferences.getInstance();
await prefs.setString('server_url', url);
+ if (_customHeaders.isNotEmpty) {
+ await prefs.setString('custom_headers', jsonEncode(_customHeaders));
+ } else {
+ await prefs.remove('custom_headers');
+ }
} catch (_) {}
+ final token = _accessToken;
+ if (token != null) {
+ SocketService().connect(
+ activeServerUrl!,
+ token,
+ customHeaders: _customHeaders,
+ );
+ }
_pushSessionToWear();
notifyListeners();
}
diff --git a/lib/screens/admin_podcasts_screen.dart b/lib/screens/admin_podcasts_screen.dart
index 10f01c55..71b09b2f 100644
--- a/lib/screens/admin_podcasts_screen.dart
+++ b/lib/screens/admin_podcasts_screen.dart
@@ -1933,6 +1933,8 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
final hour = parsed.$2; // 0-23
final minute = parsed.$3; // 0-59
final dayOfWeek = parsed.$4; // 0-6 (Sun-Sat)
+ final serverTimeZone = context.read<AuthProvider>()
+ .serverSettings?['timeZone'] as String?;
void saveCron(String f, int h, int m, int d) {
String cron;
@@ -1979,6 +1981,13 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT
const SizedBox(width: 12),
Text(l.adminPodcastsCheckSchedule, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onSurface)),
]),
+ Padding(
+ padding: const EdgeInsets.only(left: 32, top: 4),
+ child: Text(serverTimeZone == null
+ ? l.podcastScheduleServerTimeUnknown
+ : l.podcastScheduleServerTime(serverTimeZone),
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ ),
const SizedBox(height: 10),
// Frequency
Text(l.adminPodcastsFrequency, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 10)),
diff --git a/lib/screens/admin_users_screen.dart b/lib/screens/admin_users_screen.dart
index f55010cf..96c93bf8 100644
--- a/lib/screens/admin_users_screen.dart
+++ b/lib/screens/admin_users_screen.dart
@@ -951,6 +951,8 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
late bool _hasOpenIDLink;
bool get _isNew => widget.user == null;
+ bool get _isSelf => !_isNew && widget.user?['id'] == context.read<AuthProvider>().userId;
+ bool get _canDeleteUser => !_isNew && !_isSelf && widget.user?['type'] != 'root';
@override
void initState() {
@@ -986,7 +988,7 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
Padding(padding: const EdgeInsets.fromLTRB(20, 16, 12, 0),
child: Row(children: [
Expanded(child: Text(_isNew ? l.adminUsersNewUser : l.adminUsersEditUser, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface))),
- if (!_isNew) IconButton(
+ if (_canDeleteUser) IconButton(
icon: Icon(Icons.delete_outline_rounded, color: Colors.red.shade300, size: 20),
onPressed: _deleting ? null : _deleteUser),
])),
@@ -996,10 +998,16 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
_lbl(cs, tt, l.adminUsersUsername), const SizedBox(height: 6),
TextField(controller: _usernameCtrl, enabled: _isNew, style: TextStyle(color: cs.onSurface),
decoration: _deco(cs, l.adminUsersEnterUsername)),
- const SizedBox(height: 16),
- _lbl(cs, tt, _isNew ? l.adminUsersPassword : l.adminUsersNewPassword), const SizedBox(height: 6),
- TextField(controller: _passwordCtrl, obscureText: true, style: TextStyle(color: cs.onSurface),
- decoration: _deco(cs, _isNew ? l.adminUsersEnterPassword : l.adminUsersLeaveBlankToKeep)),
+ if (_isNew || !_isSelf) ...[
+ const SizedBox(height: 16),
+ _lbl(cs, tt, _isNew ? l.adminUsersPassword : l.adminUsersNewPassword), const SizedBox(height: 6),
+ TextField(controller: _passwordCtrl, obscureText: true, style: TextStyle(color: cs.onSurface),
+ decoration: _deco(cs, _isNew ? l.adminUsersEnterPassword : l.adminUsersLeaveBlankToKeep)),
+ if (!_isNew) ...[
+ const SizedBox(height: 6),
+ Text(l.otherUserPasswordResetWarning, style: tt.bodySmall?.copyWith(color: cs.error)),
+ ],
+ ],
const SizedBox(height: 20),
_lbl(cs, tt, l.adminUsersAccountType), const SizedBox(height: 8),
Row(children: [
@@ -1119,7 +1127,7 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
} else {
final up = <String, dynamic>{'type': _type, 'isActive': _isActive, 'isLocked': _isLocked,
'permissions': perms, 'librariesAccessible': _accessAllLibraries ? [] : _selectedLibraries.toList()};
- if (_passwordCtrl.text.isNotEmpty) up['password'] = _passwordCtrl.text;
+ if (!_isSelf && _passwordCtrl.text.isNotEmpty) up['password'] = _passwordCtrl.text;
ok = await api.updateUser(widget.user!['id'] as String, up);
}
if (mounted) {
@@ -1131,6 +1139,7 @@ class _UserEditorSheetState extends State<_UserEditorSheet> {
}
Future<void> _deleteUser() async {
+ if (!_canDeleteUser) return;
final l = AppLocalizations.of(context)!;
final name = widget.user?['username'] ?? l.adminUsersThisUser;
final yes = await showDialog<bool>(context: context, builder: (ctx) => AlertDialog(
diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dart
index 36a20a91..d3668141 100644
--- a/lib/screens/app_shell.dart
+++ b/lib/screens/app_shell.dart
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
+import '../providers/auth_provider.dart';
import '../providers/library_provider.dart';
import '../services/audio_player_service.dart';
import '../services/chromecast_service.dart';
@@ -630,6 +631,7 @@ class _AppShellState extends State<AppShell>
// resume. The screens snap their own driver back to shown on next scroll
// anyway, but mirror it here in case the user resumes onto a stale tab.
_navBarAnimController.value = 1.0;
+ unawaited(context.read<AuthProvider>().adoptCompanionTokens());
context.read<LibraryProvider>().onAppForegrounded();
SleepTimerService().onAppForegrounded();
AudioPlayerService.onAppForegrounded();
diff --git a/lib/screens/auth_sessions_screen.dart b/lib/screens/auth_sessions_screen.dart
new file mode 100644
index 00000000..77f245ff
--- /dev/null
+++ b/lib/screens/auth_sessions_screen.dart
@@ -0,0 +1,291 @@
+import 'package:flutter/material.dart';
+import 'package:intl/intl.dart';
+import 'package:provider/provider.dart';
+
+import '../l10n/app_localizations.dart';
+import '../models/auth_session.dart';
+import '../providers/auth_provider.dart';
+import '../widgets/overlay_toast.dart';
+
+class AuthSessionsScreen extends StatefulWidget {
+ const AuthSessionsScreen({super.key});
+
+ @override
+ State<AuthSessionsScreen> createState() => _AuthSessionsScreenState();
+}
+
+class _AuthSessionsScreenState extends State<AuthSessionsScreen> {
+ final _sessions = <AuthSession>[];
+ bool _loading = true;
+ bool _loadingMore = false;
+ AuthSessionsStatus _status = AuthSessionsStatus.supported;
+ int _page = 0;
+ int _numPages = 0;
+
+ @override
+ void initState() {
+ super.initState();
+ _load();
+ }
+
+ Future<void> _load({bool more = false}) async {
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ if (more) {
+ setState(() => _loadingMore = true);
+ } else {
+ setState(() => _loading = true);
+ }
+ final requestedPage = more ? _page + 1 : 0;
+ final result = await api.getAuthSessions(page: requestedPage);
+ if (!mounted) return;
+ setState(() {
+ _status = result.status;
+ if (result.page != null) {
+ if (!more) _sessions.clear();
+ _sessions.addAll(result.page!.sessions);
+ _page = result.page!.page;
+ _numPages = result.page!.numPages;
+ }
+ _loading = false;
+ _loadingMore = false;
+ });
+ }
+
+ Future<void> _remove(AuthSession session) async {
+ if (session.current) return;
+ final l = AppLocalizations.of(context)!;
+ final confirmed = await showDialog<bool>(
+ context: context,
+ builder: (dialogContext) => AlertDialog(
+ title: Text(l.sessionsRemoveTitle),
+ content: Text(l.sessionsRemoveContent),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(dialogContext, false),
+ child: Text(l.cancel),
+ ),
+ FilledButton(
+ onPressed: () => Navigator.pop(dialogContext, true),
+ child: Text(l.sessionsRemove),
+ ),
+ ],
+ ),
+ );
+ if (confirmed != true || !mounted) return;
+ final api = context.read<AuthProvider>().apiService;
+ final ok = await api?.deleteAuthSession(session) ?? false;
+ if (!mounted) return;
+ if (ok) {
+ setState(() => _sessions.removeWhere((item) => item.id == session.id));
+ showOverlayToast(
+ context,
+ l.sessionsRemoved,
+ icon: Icons.check_circle_outline_rounded,
+ );
+ } else {
+ showOverlayToast(
+ context,
+ l.sessionsRemoveFailed,
+ icon: Icons.error_outline_rounded,
+ );
+ }
+ }
+
+ Future<void> _signOutAll() async {
+ final l = AppLocalizations.of(context)!;
+ final confirmed = await showDialog<bool>(
+ context: context,
+ builder: (dialogContext) => AlertDialog(
+ title: Text(l.sessionsSignOutAllTitle),
+ content: Text(l.sessionsSignOutAllContent),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(dialogContext, false),
+ child: Text(l.cancel),
+ ),
+ FilledButton(
+ onPressed: () => Navigator.pop(dialogContext, true),
+ child: Text(l.sessionsSignOutAll),
+ ),
+ ],
+ ),
+ );
+ if (confirmed != true || !mounted) return;
+ await context.read<AuthProvider>().logout(
+ keepServer: true,
+ revokeServerSession: true,
+ allDevices: true,
+ );
+ if (mounted) Navigator.of(context).popUntil((route) => route.isFirst);
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l = AppLocalizations.of(context)!;
+ final auth = context.watch<AuthProvider>();
+ final api = auth.apiService;
+ return Scaffold(
+ appBar: AppBar(title: Text(l.manageSessionsTitle)),
+ body: _loading
+ ? const Center(child: CircularProgressIndicator())
+ : RefreshIndicator(
+ onRefresh: _load,
+ child: ListView(
+ physics: const AlwaysScrollableScrollPhysics(),
+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 32),
+ children: [
+ if (api?.isLegacyToken == true)
+ _NoticeCard(
+ icon: Icons.info_outline_rounded,
+ text: l.sessionsLegacyNotice,
+ ),
+ if (_status == AuthSessionsStatus.unsupported)
+ _NoticeCard(
+ icon: Icons.update_rounded,
+ text: l.sessionsUnsupported,
+ )
+ else if (_status == AuthSessionsStatus.failed)
+ _NoticeCard(
+ icon: Icons.error_outline_rounded,
+ text: l.sessionsLoadFailed,
+ )
+ else if (_sessions.isEmpty)
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 48),
+ child: Center(child: Text(l.sessionsNone)),
+ )
+ else
+ ..._sessions.map(
+ (session) => Card(
+ child: AuthSessionTile(
+ session: session,
+ currentLabel: l.sessionsCurrent,
+ unknownDeviceLabel: l.sessionsUnknownDevice,
+ lastActiveLabel: session.updatedAt == null
+ ? null
+ : l.sessionsLastActive(
+ DateFormat.yMMMd().add_jm().format(
+ session.updatedAt!.toLocal(),
+ ),
+ ),
+ removeTooltip: l.sessionsRemove,
+ onRemove: session.current
+ ? null
+ : () => _remove(session),
+ ),
+ ),
+ ),
+ if (_page + 1 < _numPages)
+ TextButton(
+ onPressed: _loadingMore ? null : () => _load(more: true),
+ child: _loadingMore
+ ? const CircularProgressIndicator()
+ : Text(l.sessionsLoadMore),
+ ),
+ if (api?.hasRefreshToken == true &&
+ _status == AuthSessionsStatus.supported) ...[
+ const SizedBox(height: 20),
+ OutlinedButton.icon(
+ onPressed: _signOutAll,
+ icon: const Icon(Icons.logout_rounded),
+ label: Text(l.sessionsSignOutAll),
+ ),
+ ],
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class AuthSessionTile extends StatelessWidget {
+ final AuthSession session;
+ final String currentLabel;
+ final String unknownDeviceLabel;
+ final String? lastActiveLabel;
+ final String removeTooltip;
+ final VoidCallback? onRemove;
+
+ const AuthSessionTile({
+ super.key,
+ required this.session,
+ required this.currentLabel,
+ required this.unknownDeviceLabel,
+ required this.lastActiveLabel,
+ required this.removeTooltip,
+ this.onRemove,
+ });
+
+ String _title() {
+ final userAgent = session.userAgent ?? '';
+ if (userAgent.startsWith('AbsorbWear/')) return 'AbsorbWear';
+ if (userAgent.startsWith('Absorb/')) return 'Absorb';
+ return session.deviceInfo?.deviceLabel ??
+ session.deviceInfo?.browserName ??
+ unknownDeviceLabel;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final details = <String>[
+ if (session.deviceInfo?.softwareLabel != null)
+ session.deviceInfo!.softwareLabel!,
+ if (session.ipAddress?.isNotEmpty == true) session.ipAddress!,
+ if (lastActiveLabel != null) lastActiveLabel!,
+ ];
+ return ListTile(
+ leading: Icon(
+ session.current ? Icons.smartphone_rounded : Icons.devices_rounded,
+ ),
+ title: Row(
+ children: [
+ Flexible(child: Text(_title())),
+ if (session.current) ...[
+ const SizedBox(width: 8),
+ Chip(
+ visualDensity: VisualDensity.compact,
+ label: Text(currentLabel),
+ ),
+ ],
+ ],
+ ),
+ subtitle: details.isEmpty ? null : Text(details.join('\n')),
+ isThreeLine: details.length > 1,
+ trailing: onRemove == null
+ ? null
+ : IconButton(
+ key: Key('removeSession-${session.id}'),
+ tooltip: removeTooltip,
+ onPressed: onRemove,
+ icon: const Icon(Icons.logout_rounded),
+ ),
+ );
+ }
+}
+
+class _NoticeCard extends StatelessWidget {
+ final IconData icon;
+ final String text;
+
+ const _NoticeCard({required this.icon, required this.text});
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = Theme.of(context).colorScheme;
+ return Card(
+ color: colors.surfaceContainerHigh,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Icon(icon, color: colors.primary),
+ const SizedBox(width: 12),
+ Expanded(child: Text(text)),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/screens/bookmarks_screen.dart b/lib/screens/bookmarks_screen.dart
index d8b75127..b57301d1 100644
--- a/lib/screens/bookmarks_screen.dart
+++ b/lib/screens/bookmarks_screen.dart
@@ -77,42 +77,22 @@ class _BookmarksScreenState extends State<BookmarksScreen> {
Future<void> _syncAll() async {
final api = context.read<AuthProvider>().apiService;
if (api == null) return;
- final user = await api.getMe();
- if (user == null || !mounted) return;
+ final userBookmarks = await api.getAllBookmarks();
+ if (userBookmarks == null || !mounted) return;
final itemIds = <String>{};
- // Bookmarks on the user object (keyed by libraryItemId)
- final userBookmarks = user['bookmarks'] as List<dynamic>?;
- if (userBookmarks != null) {
- for (final b in userBookmarks) {
- if (b is Map<String, dynamic>) {
- final itemId = b['libraryItemId'] as String? ?? '';
- if (itemId.isNotEmpty) itemIds.add(itemId);
- }
- }
- }
- // Also check mediaProgress for bookmarks
- final progressList = user['mediaProgress'] as List<dynamic>? ?? [];
- for (final p in progressList) {
- if (p is! Map<String, dynamic>) continue;
- final bookmarks = p['bookmarks'] as List?;
- if (bookmarks != null && bookmarks.isNotEmpty) {
- final itemId = p['libraryItemId'] as String? ?? '';
- if (itemId.isNotEmpty) itemIds.add(itemId);
- }
+ for (final b in userBookmarks) {
+ final itemId = b['libraryItemId'] as String? ?? '';
+ if (itemId.isNotEmpty) itemIds.add(itemId);
}
// Also include items we have local bookmarks for
final local = await BookmarkService().getAllBookmarks();
itemIds.addAll(local.keys);
// Group server bookmarks by itemId for efficient sync
final serverByItem = <String, List<Map<String, dynamic>>>{};
- if (userBookmarks != null) {
- for (final b in userBookmarks) {
- if (b is Map<String, dynamic>) {
- final id = b['libraryItemId'] as String? ?? '';
- if (id.isNotEmpty) {
- serverByItem.putIfAbsent(id, () => []).add(b);
- }
- }
+ for (final b in userBookmarks) {
+ final id = b['libraryItemId'] as String? ?? '';
+ if (id.isNotEmpty) {
+ serverByItem.putIfAbsent(id, () => []).add(b);
}
}
// Sync each item with pre-loaded server data
diff --git a/lib/screens/change_password_screen.dart b/lib/screens/change_password_screen.dart
new file mode 100644
index 00000000..4a1a293a
--- /dev/null
+++ b/lib/screens/change_password_screen.dart
@@ -0,0 +1,149 @@
+import 'package:flutter/material.dart';
+import 'package:provider/provider.dart';
+
+import '../l10n/app_localizations.dart';
+import '../providers/auth_provider.dart';
+import '../services/api_service.dart';
+import '../widgets/overlay_toast.dart';
+
+class ChangePasswordScreen extends StatefulWidget {
+ const ChangePasswordScreen({super.key});
+
+ @override
+ State<ChangePasswordScreen> createState() => _ChangePasswordScreenState();
+}
+
+class _ChangePasswordScreenState extends State<ChangePasswordScreen> {
+ final _currentController = TextEditingController();
+ final _newController = TextEditingController();
+ final _confirmController = TextEditingController();
+ bool _saving = false;
+
+ @override
+ void dispose() {
+ _currentController.dispose();
+ _newController.dispose();
+ _confirmController.dispose();
+ super.dispose();
+ }
+
+ Future<void> _save() async {
+ final l = AppLocalizations.of(context)!;
+ if (_currentController.text.isEmpty ||
+ _newController.text.isEmpty ||
+ _confirmController.text.isEmpty) {
+ showOverlayToast(
+ context,
+ l.passwordFieldsRequired,
+ icon: Icons.error_outline_rounded,
+ );
+ return;
+ }
+ if (_newController.text != _confirmController.text) {
+ showOverlayToast(
+ context,
+ l.passwordsDoNotMatch,
+ icon: Icons.error_outline_rounded,
+ );
+ return;
+ }
+
+ final api = context.read<AuthProvider>().apiService;
+ if (api == null) return;
+ setState(() => _saving = true);
+ final result = await api.changeMyPassword(
+ currentPassword: _currentController.text,
+ newPassword: _newController.text,
+ );
+ if (!mounted) return;
+ setState(() => _saving = false);
+ switch (result.status) {
+ case PasswordChangeStatus.success:
+ showOverlayToast(
+ context,
+ l.passwordChanged,
+ icon: Icons.check_circle_outline_rounded,
+ );
+ Navigator.pop(context, true);
+ break;
+ case PasswordChangeStatus.invalidPassword:
+ showOverlayToast(
+ context,
+ l.passwordInvalid,
+ icon: Icons.error_outline_rounded,
+ );
+ break;
+ case PasswordChangeStatus.unsupported:
+ showOverlayToast(
+ context,
+ l.passwordChangeUnsupported,
+ icon: Icons.info_outline_rounded,
+ );
+ break;
+ case PasswordChangeStatus.failed:
+ showOverlayToast(
+ context,
+ l.passwordChangeFailed,
+ icon: Icons.error_outline_rounded,
+ );
+ break;
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l = AppLocalizations.of(context)!;
+ return Scaffold(
+ appBar: AppBar(title: Text(l.changePasswordTitle)),
+ body: ListView(
+ padding: const EdgeInsets.all(20),
+ children: [
+ Text(
+ l.passwordChangeEffect,
+ style: Theme.of(context).textTheme.bodyMedium?.copyWith(
+ color: Theme.of(context).colorScheme.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 20),
+ TextField(
+ key: const Key('currentPasswordField'),
+ controller: _currentController,
+ obscureText: true,
+ autofillHints: const [AutofillHints.password],
+ decoration: InputDecoration(labelText: l.currentPassword),
+ ),
+ const SizedBox(height: 16),
+ TextField(
+ key: const Key('newPasswordField'),
+ controller: _newController,
+ obscureText: true,
+ autofillHints: const [AutofillHints.newPassword],
+ decoration: InputDecoration(labelText: l.newPassword),
+ ),
+ const SizedBox(height: 16),
+ TextField(
+ key: const Key('confirmPasswordField'),
+ controller: _confirmController,
+ obscureText: true,
+ autofillHints: const [AutofillHints.newPassword],
+ decoration: InputDecoration(labelText: l.confirmNewPassword),
+ onSubmitted: (_) => _saving ? null : _save(),
+ ),
+ const SizedBox(height: 24),
+ FilledButton.icon(
+ key: const Key('changePasswordButton'),
+ onPressed: _saving ? null : _save,
+ icon: _saving
+ ? const SizedBox(
+ width: 18,
+ height: 18,
+ child: CircularProgressIndicator(strokeWidth: 2),
+ )
+ : const Icon(Icons.password_rounded),
+ label: Text(l.changePasswordTitle),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart
index b850411d..814b1dee 100644
--- a/lib/screens/login_screen.dart
+++ b/lib/screens/login_screen.dart
@@ -100,11 +100,13 @@ class _LoginScreenState extends State<LoginScreen>
final auth = context.read<AuthProvider>();
final account = widget.prefillAccount;
if (account != null) {
+ _setInitialHeaders(account.customHeaders);
_prefillLogin(account.serverUrl, account.username);
return;
}
final requestedServer = widget.prefillServerUrl;
if (requestedServer != null && requestedServer.isNotEmpty) {
+ _setInitialHeaders(auth.customHeaders);
_prefillLogin(requestedServer, '');
return;
}
@@ -127,6 +129,22 @@ class _LoginScreenState extends State<LoginScreen>
_usernameController.text = username;
}
+ void _setInitialHeaders(Map<String, String> headers) {
+ for (final (key, value) in _headerControllers) {
+ key.dispose();
+ value.dispose();
+ }
+ _headerControllers
+ ..clear()
+ ..addAll(headers.entries.map(
+ (entry) => (
+ TextEditingController(text: entry.key),
+ TextEditingController(text: entry.value),
+ ),
+ ));
+ if (headers.isNotEmpty) _showAdvanced = true;
+ }
+
Future<void> _loadVersion() async {
try {
final info = await PackageInfo.fromPlatform();
@@ -1072,6 +1090,7 @@ class _LoginScreenState extends State<LoginScreen>
Future<void> _quickSwitch(SavedAccount account) async {
if (account.token.isEmpty) {
+ _setInitialHeaders(account.customHeaders);
_prefillLogin(account.serverUrl, account.username);
_passwordController.clear();
_usernameFocus.unfocus();
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index bfac6fc3..ecc73494 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -28,6 +28,8 @@ import '../widgets/update_dialog.dart';
import '../screens/admin_screen.dart';
import '../screens/downloads_screen.dart';
import '../screens/bookmarks_screen.dart';
+import '../screens/change_password_screen.dart';
+import '../screens/auth_sessions_screen.dart';
import '../main.dart' show applyThemeMode, applyTrustAllCerts, applyFlatBackground, applyColorSource, applyManualSeed, applyGradientIntensity, applyUseColorEverywhere, applyOrientationLock, localeNotifier, flatNotifier, gradientIntensityNotifier, snappyTransitionsNotifier;
import '../services/wording.dart';
import '../widgets/absorb_page_header.dart';
@@ -41,6 +43,7 @@ import '../widgets/tips_sheet.dart';
import '../widgets/feature_hint.dart';
import '../widgets/welcome_sheet.dart';
import '../widgets/rmab_config_sheet.dart';
+import '../widgets/server_connection_editor.dart';
import '../l10n/app_localizations.dart';
class SettingsScreen extends StatefulWidget {
@@ -4233,7 +4236,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
color: cs.onSurfaceVariant.withValues(alpha: 0.5)), maxLines: 1, overflow: TextOverflow.ellipsis)),
if (activeAccount != null)
InkResponse(
- onTap: () { Navigator.pop(ctx); _editServerUrl(context, activeAccount!); },
+ onTap: () { Navigator.pop(ctx); _editServerConnection(context, activeAccount!); },
radius: 22,
child: Padding(padding: const EdgeInsets.all(6),
child: Icon(Icons.edit_rounded, size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.7))),
@@ -4263,6 +4266,47 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
const SizedBox(height: 12),
Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06)),
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ Navigator.of(context).push(MaterialPageRoute(
+ builder: (_) => const ChangePasswordScreen(),
+ ));
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ child: Row(children: [
+ Icon(Icons.password_rounded, size: 20, color: cs.onSurfaceVariant),
+ const SizedBox(width: 14),
+ Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(l.changePasswordTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
+ Text(l.changePasswordSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
+ ])),
+ Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant),
+ ]),
+ ),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.pop(ctx);
+ Navigator.of(context).push(MaterialPageRoute(
+ builder: (_) => const AuthSessionsScreen(),
+ ));
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
+ child: Row(children: [
+ Icon(Icons.devices_rounded, size: 20, color: cs.onSurfaceVariant),
+ const SizedBox(width: 14),
+ Expanded(child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(l.manageSessionsTitle, style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),
+ Text(l.manageSessionsSubtitle, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),
+ ])),
+ Icon(Icons.chevron_right_rounded, size: 18, color: cs.onSurfaceVariant),
+ ]),
+ ),
+ ),
+ Divider(height: 1, indent: 20, endIndent: 20, color: cs.onSurface.withValues(alpha: 0.06)),
// Other accounts
if (otherAccounts.isNotEmpty) ...[
const SizedBox(height: 4),
@@ -4383,7 +4427,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
Navigator.pop(ctx);
await _stopAndSyncPlayback();
if (context.mounted) {
- context.read<AuthProvider>().logout(keepServer: true);
+ await context.read<AuthProvider>().logout(
+ keepServer: true,
+ revokeServerSession: true,
+ );
}
},
style: FilledButton.styleFrom(backgroundColor: cs.error),
@@ -4438,8 +4485,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 8),
ListTile(
leading: Icon(Icons.dns_rounded, color: cs.primary),
- title: Text(l.editServerAddressAction),
- onTap: () { Navigator.pop(ctx); _editServerUrl(context, account); }),
+ title: Text(l.editServerConnectionAction),
+ onTap: () { Navigator.pop(ctx); _editServerConnection(context, account); }),
ListTile(
leading: Icon(Icons.delete_outline_rounded, color: cs.error),
title: Text(l.removeAccountAction, style: TextStyle(color: cs.error)),
@@ -4449,59 +4496,40 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
- /// Edit the server URL of a saved account in place (dynamic-DNS hostname
- /// changed, etc.) without losing the account's data. See
- /// [AuthProvider.editServerUrl].
- void _editServerUrl(BuildContext context, SavedAccount account) {
+ /// Edit the URL and custom proxy headers for one saved account without
+ /// losing its scoped data.
+ Future<void> _editServerConnection(
+ BuildContext context, SavedAccount account) async {
final l = AppLocalizations.of(context)!;
- final ctrl = TextEditingController(text: account.serverUrl);
- showDialog(
+ final result = await showDialog<ServerConnectionSettings>(
context: context,
- builder: (ctx) {
- final cs = Theme.of(ctx).colorScheme;
- return AlertDialog(
- title: Text(l.editServerAddressTitle),
- content: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
- Text(l.editServerAddressSubtitle(account.username),
- style: Theme.of(ctx).textTheme.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- const SizedBox(height: 14),
- TextField(
- controller: ctrl,
- autofocus: true,
- keyboardType: TextInputType.url,
- autocorrect: false,
- decoration: InputDecoration(
- labelText: l.editServerAddressField,
- hintText: 'https://example.com',
- border: const OutlineInputBorder()),
- ),
- ]),
- actions: [
- TextButton(onPressed: () => Navigator.pop(ctx), child: Text(l.cancel)),
- FilledButton(
- onPressed: () async {
- final newUrl = ctrl.text.trim();
- Navigator.pop(ctx);
- if (newUrl.isEmpty) return;
- final auth = context.read<AuthProvider>();
- final wasActive = account.serverUrl == auth.serverUrl && account.username == auth.username;
- final ok = await auth.editServerUrl(account, newUrl);
- if (!context.mounted) return;
- // Re-pull the active library from the new address.
- if (ok && wasActive) context.read<LibraryProvider>().refresh();
- if (context.mounted) setState(() {});
- showOverlayToast(
- context,
- ok ? l.editServerAddressUpdated : l.editServerAddressFailed,
- icon: ok
- ? Icons.check_circle_outline_rounded
- : Icons.error_outline_rounded,
- );
- },
- child: Text(l.save)),
- ],
- );
- },
+ builder: (_) => ServerConnectionEditor(
+ username: account.username,
+ serverUrl: account.serverUrl,
+ customHeaders: account.customHeaders,
+ ),
+ );
+ if (result == null || !context.mounted) return;
+
+ final auth = context.read<AuthProvider>();
+ final wasActive = account.serverUrl == auth.serverUrl &&
+ account.username == auth.username;
+ final ok = await auth.editServerConnection(
+ account,
+ result.serverUrl,
+ result.customHeaders,
+ );
+ if (!context.mounted) return;
+ if (ok && wasActive) context.read<LibraryProvider>().refresh();
+ setState(() {});
+ showOverlayToast(
+ context,
+ ok
+ ? l.editServerConnectionUpdated
+ : l.editServerConnectionFailed,
+ icon: ok
+ ? Icons.check_circle_outline_rounded
+ : Icons.error_outline_rounded,
);
}
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index fbb964d2..90d0878c 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -5,6 +5,7 @@ import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'auth_tokens.dart';
+import '../models/auth_session.dart';
import '../utils/server_url.dart';
/// Outcome of a local-session upsert. [serverTooOld] flags a 404/501 (the
@@ -89,6 +90,20 @@ enum _RefreshOutcome {
transientFailure,
}
+enum PasswordChangeStatus {
+ success,
+ invalidPassword,
+ unsupported,
+ failed,
+}
+
+class PasswordChangeResult {
+ final PasswordChangeStatus status;
+ final String? message;
+
+ const PasswordChangeResult(this.status, {this.message});
+}
+
class ApiService {
static String appVersion = '1.3.0'; // fallback; overwritten by initVersion()
static String appBuild = ''; // build number; set by initVersion()
@@ -140,6 +155,7 @@ class ApiService {
// Concurrency lock for refresh
Completer<_RefreshOutcome>? _refreshCompleter;
+ Completer<void>? _tokenMutationCompleter;
// Device info - set once at app start
static String deviceManufacturer = '';
@@ -178,6 +194,11 @@ class ApiService {
/// Current access token (for external use like cover URLs, socket auth).
String get token => _accessToken;
+ bool get hasRefreshToken => _refreshToken?.isNotEmpty == true;
+ bool get isLegacyToken => _isLegacyToken;
+
+ static String get userAgent => 'Absorb/$appVersionFull';
+
Map<String, String> get _headers => {
...customHeaders,
'Authorization': 'Bearer $_accessToken',
@@ -242,6 +263,47 @@ class ApiService {
}
}
+ Future<Completer<void>> _acquireTokenMutationLock() async {
+ while (_tokenMutationCompleter != null) {
+ await _tokenMutationCompleter!.future;
+ }
+ final lock = Completer<void>();
+ _tokenMutationCompleter = lock;
+ return lock;
+ }
+
+ void _releaseTokenMutationLock(Completer<void> lock) {
+ if (identical(_tokenMutationCompleter, lock)) {
+ _tokenMutationCompleter = null;
+ }
+ if (!lock.isCompleted) lock.complete();
+ }
+
+ Future<bool> _refreshTokenPairOnce() async {
+ final refreshToken = _refreshToken;
+ if (_isLegacyToken || refreshToken == null) return false;
+ try {
+ final response = await _post(
+ Uri.parse('$_cleanBaseUrl/auth/refresh'),
+ headers: {
+ ...customHeaders,
+ 'x-refresh-token': refreshToken,
+ if (!kIsWeb) 'User-Agent': userAgent,
+ },
+ ).timeout(const Duration(seconds: 15));
+ if (response.statusCode != 200) return false;
+ final data = jsonDecode(response.body) as Map<String, dynamic>;
+ final tokens = AuthTokens.fromResponse(data);
+ if (tokens.accessToken == null || tokens.refreshToken == null) return false;
+ _accessToken = tokens.accessToken!;
+ _refreshToken = tokens.refreshToken!;
+ await _notifyTokensRefreshed();
+ return true;
+ } catch (_) {
+ return false;
+ }
+ }
+
/// Attempt to refresh the access token using the refresh token. A rejected
/// refresh is kept distinct from a temporary network/server failure so only
/// an explicit 401/403 can expire the local session.
@@ -255,6 +317,7 @@ class ApiService {
if (_refreshCompleter != null) return _refreshCompleter!.future;
_refreshCompleter = Completer<_RefreshOutcome>();
+ final mutationLock = await _acquireTokenMutationLock();
try {
if (await _adoptPersistedTokens()) {
_refreshCompleter!.complete(_RefreshOutcome.refreshed);
@@ -274,6 +337,7 @@ class ApiService {
headers: {
...customHeaders,
'x-refresh-token': refreshTokenSent,
+ if (!kIsWeb) 'User-Agent': userAgent,
},
).timeout(const Duration(seconds: 15));
@@ -321,6 +385,7 @@ class ApiService {
return _RefreshOutcome.transientFailure;
} finally {
_refreshCompleter = null;
+ _releaseTokenMutationLock(mutationLock);
}
}
@@ -337,6 +402,10 @@ class ApiService {
if (outcome == _RefreshOutcome.refreshed) {
final refreshedHeaders = Map<String, String>.from(h)
..['Authorization'] = 'Bearer $_accessToken';
+ if (refreshedHeaders.containsKey('x-refresh-token') &&
+ _refreshToken != null) {
+ refreshedHeaders['x-refresh-token'] = _refreshToken!;
+ }
response = await _get(url, headers: refreshedHeaders).timeout(timeout);
}
if (outcome == _RefreshOutcome.rejected) onAuthExpired?.call();
@@ -407,7 +476,12 @@ class ApiService {
try {
final response = await http.post(
Uri.parse(url),
- headers: {...customHeaders, 'Content-Type': 'application/json', 'x-return-tokens': 'true'},
+ headers: {
+ ...customHeaders,
+ 'Content-Type': 'application/json',
+ 'x-return-tokens': 'true',
+ if (!kIsWeb) 'User-Agent': userAgent,
+ },
body: jsonEncode({'username': username, 'password': password}),
);
@@ -700,6 +774,178 @@ class ApiService {
return null;
}
+ /// Use the compact v2.36 endpoint, with one `/api/me` fallback for older servers.
+ Future<List<Map<String, dynamic>>?> getAllProgress() async {
+ try {
+ final response = await _authGet(
+ Uri.parse('$_cleanBaseUrl/api/me/progress'),
+ timeout: const Duration(seconds: 10));
+ if (response.statusCode == 200) {
+ final data = jsonDecode(response.body) as Map<String, dynamic>;
+ return (data['mediaProgress'] as List<dynamic>? ?? const [])
+ .whereType<Map<String, dynamic>>()
+ .toList();
+ }
+ if (response.statusCode != 404) return null;
+ final user = await getMe();
+ return (user?['mediaProgress'] as List<dynamic>? ?? const [])
+ .whereType<Map<String, dynamic>>()
+ .toList();
+ } catch (e) {
+ debugPrint('[API] getAllProgress error: $e');
+ return null;
+ }
+ }
+
+ /// Use the compact v2.36 endpoint, with one `/api/me` fallback for older servers.
+ Future<List<Map<String, dynamic>>?> getAllBookmarks() async {
+ try {
+ final response = await _authGet(
+ Uri.parse('$_cleanBaseUrl/api/me/bookmarks'),
+ timeout: const Duration(seconds: 10));
+ if (response.statusCode == 200) {
+ final data = jsonDecode(response.body) as Map<String, dynamic>;
+ return (data['bookmarks'] as List<dynamic>? ?? const [])
+ .whereType<Map<String, dynamic>>()
+ .toList();
+ }
+ if (response.statusCode != 404) return null;
+ final user = await getMe();
+ return (user?['bookmarks'] as List<dynamic>? ?? const [])
+ .whereType<Map<String, dynamic>>()
+ .toList();
+ } catch (e) {
+ debugPrint('[API] getAllBookmarks error: $e');
+ return null;
+ }
+ }
+
+ Future<AuthSessionsResult> getAuthSessions({int page = 0, int itemsPerPage = 20}) async {
+ try {
+ final refreshToken = _refreshToken;
+ final response = await _authGet(
+ Uri.parse('$_cleanBaseUrl/api/me/sessions?page=$page&itemsPerPage=$itemsPerPage'),
+ headers: {
+ ..._headers,
+ if (refreshToken != null) 'x-refresh-token': refreshToken,
+ },
+ timeout: const Duration(seconds: 10));
+ if (response.statusCode == 404) {
+ return const AuthSessionsResult(AuthSessionsStatus.unsupported);
+ }
+ if (response.statusCode != 200) {
+ return const AuthSessionsResult(AuthSessionsStatus.failed);
+ }
+ final data = jsonDecode(response.body) as Map<String, dynamic>;
+ return AuthSessionsResult(
+ AuthSessionsStatus.supported,
+ AuthSessionsPage.fromJson(data));
+ } catch (e) {
+ debugPrint('[API] getAuthSessions error: $e');
+ return const AuthSessionsResult(AuthSessionsStatus.failed);
+ }
+ }
+
+ Future<bool> deleteAuthSession(AuthSession session) async {
+ if (session.current) return false;
+ try {
+ final response = await _authDelete(
+ Uri.parse('$_cleanBaseUrl/api/me/sessions/${session.id}'),
+ timeout: const Duration(seconds: 10));
+ return response.statusCode >= 200 && response.statusCode < 300;
+ } catch (e) {
+ debugPrint('[API] deleteAuthSession error: $e');
+ return false;
+ }
+ }
+
+ Future<bool> revokeServerSession({bool allDevices = false}) async {
+ final refreshToken = _refreshToken;
+ if (refreshToken == null || refreshToken.isEmpty) return false;
+ try {
+ final suffix = allDevices ? '?allDevices=1' : '';
+ final response = await _post(
+ Uri.parse('$_cleanBaseUrl/logout$suffix'),
+ headers: {
+ ...customHeaders,
+ 'x-refresh-token': refreshToken,
+ if (!kIsWeb) 'User-Agent': userAgent,
+ }).timeout(const Duration(seconds: 10));
+ return response.statusCode >= 200 && response.statusCode < 300;
+ } catch (e) {
+ debugPrint('[API] logout error: $e');
+ return false;
+ }
+ }
+
+ Future<PasswordChangeResult> changeMyPassword({
+ required String currentPassword,
+ required String newPassword,
+ }) async {
+ final mutationLock = await _acquireTokenMutationLock();
+ try {
+ await _adoptPersistedTokens();
+ Future<http.Response> sendPasswordChange() => _patch(
+ Uri.parse('$_cleanBaseUrl/api/me/password'),
+ headers: {
+ ..._headers,
+ if (_refreshToken != null) 'x-refresh-token': _refreshToken!,
+ if (!kIsWeb) 'User-Agent': userAgent,
+ },
+ body: jsonEncode({'password': currentPassword, 'newPassword': newPassword})
+ ).timeout(const Duration(seconds: 15));
+
+ var response = await sendPasswordChange();
+ if (response.statusCode == 401 && !_isLegacyToken) {
+ final adopted = await _adoptPersistedTokens();
+ if (adopted || await _refreshTokenPairOnce()) {
+ response = await sendPasswordChange();
+ }
+ }
+
+ if (response.statusCode == 404) {
+ return const PasswordChangeResult(PasswordChangeStatus.unsupported);
+ }
+ if (response.statusCode == 400) {
+ return PasswordChangeResult(
+ PasswordChangeStatus.invalidPassword,
+ message: response.body.trim().isEmpty ? null : response.body.trim());
+ }
+ if (response.statusCode != 200) {
+ return const PasswordChangeResult(PasswordChangeStatus.failed);
+ }
+
+ if (response.body.trim().isNotEmpty) {
+ final decoded = jsonDecode(response.body);
+ if (decoded is! Map<String, dynamic>) {
+ return const PasswordChangeResult(PasswordChangeStatus.failed);
+ }
+ final data = decoded;
+ final error = data['error'];
+ if (error is String && error.trim().isNotEmpty) {
+ return PasswordChangeResult(
+ PasswordChangeStatus.invalidPassword,
+ message: error.trim(),
+ );
+ }
+ final tokens = AuthTokens.fromResponse(data);
+ // The server rotates these together. Never adopt half a pair.
+ if (tokens.accessToken != null && tokens.refreshToken != null) {
+ _accessToken = tokens.accessToken!;
+ _refreshToken = tokens.refreshToken!;
+ await _notifyTokensRefreshed();
+ }
+ }
+ // Older servers return an empty 200 and keep the current pair valid.
+ return const PasswordChangeResult(PasswordChangeStatus.success);
+ } catch (e) {
+ debugPrint('[API] changeMyPassword error: $e');
+ return const PasswordChangeResult(PasswordChangeStatus.failed);
+ } finally {
+ _releaseTokenMutationLock(mutationLock);
+ }
+ }
+
/// Get user's listening stats.
Future<Map<String, dynamic>?> getListeningStats() async {
try {
@@ -1582,18 +1828,19 @@ class ApiService {
// ─── Bookmark Endpoints ───────────────────────────────────
/// Get bookmarks for an item from the server.
- /// Uses GET /api/me/item/:id which includes bookmarks in the response.
Future<List<Map<String, dynamic>>?> getServerBookmarks(String itemId) async {
try {
- // Try mediaProgress first
- final progress = await getItemProgress(itemId);
- if (progress != null) {
- final bookmarks = progress['bookmarks'] as List<dynamic>?;
- if (bookmarks != null && bookmarks.isNotEmpty) {
- return bookmarks.whereType<Map<String, dynamic>>().toList();
- }
+ final response = await _authGet(
+ Uri.parse('$_cleanBaseUrl/api/me/bookmarks/$itemId'),
+ timeout: const Duration(seconds: 10));
+ if (response.statusCode == 200) {
+ final data = jsonDecode(response.body) as Map<String, dynamic>;
+ return (data['bookmarks'] as List<dynamic>? ?? const [])
+ .whereType<Map<String, dynamic>>()
+ .toList();
}
- // Fall back to user object - bookmarks may be stored there
+ if (response.statusCode != 404) return null;
+
final user = await getMe();
if (user != null) {
final bookmarks = user['bookmarks'] as List<dynamic>?;
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index e3dff77b..7b6db7bb 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -20,6 +20,7 @@ import 'android_auto_service.dart';
import 'chromecast_service.dart';
import 'chapter_lookup.dart';
import 'cold_start_play_policy.dart';
+import 'playback_error_policy.dart';
import 'player_settings.dart';
import 'session_cache.dart';
import 'home_widget_service.dart';
@@ -210,11 +211,7 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
Future.delayed(const Duration(seconds: 1), _subscribePlaybackEvents);
} else {
debugPrint('[Player] playbackEvent error - too many rapid failures, stopping re-subscribe: $e');
- final errStr = e.toString();
- if (errStr.contains('MediaCodecAudioRenderer') ||
- errStr.contains('AudioTrack') ||
- errStr.contains('Decoder') ||
- errStr.contains('format_supported')) {
+ if (PlaybackErrorPolicy.shouldRetryWithTranscode(e)) {
AudioPlayerService()._retryWithTranscode();
}
}
@@ -2664,12 +2661,14 @@ class AudioPlayerService extends ChangeNotifier {
// Fall through to normal server path if cache was stale/invalid
if (result == 'cache-miss') {
result = await _playFromServer(api, itemId, title, author, coverUrl,
- totalDuration, chapters, startTime, forceStartTime);
+ totalDuration, chapters, startTime,
+ forceStartTime: forceStartTime);
}
} else {
// No cache - stream from server
result = await _playFromServer(api, itemId, title, author, coverUrl,
- totalDuration, chapters, startTime, forceStartTime);
+ totalDuration, chapters, startTime,
+ forceStartTime: forceStartTime);
}
}
@@ -3012,6 +3011,36 @@ class AudioPlayerService extends ChangeNotifier {
return null;
} catch (e, stack) {
debugPrint('[Player] Local play error: $e\n$stack');
+
+ // A downloaded original can still be unreadable by the device (for
+ // example a very large MP4/M4B that ExoPlayer cannot parse). When the
+ // server is reachable, retry once through ABS transcoding instead of
+ // leaving the user stuck with an unusable local file.
+ if (PlaybackErrorPolicy.shouldRetryWithTranscode(e) &&
+ _api != null &&
+ !manualOffline &&
+ !_knownOffline &&
+ _currentItemId != null) {
+ debugPrint('[Player] Local source failed - retrying with server transcoding');
+ _shortLocalDurationSec = null;
+ _localSessionMode = false;
+ final fallbackResult = await _playFromServer(
+ _api!,
+ _currentItemId!,
+ title,
+ author,
+ coverUrl,
+ totalDuration,
+ chapters,
+ startTime,
+ forceStartTime: forceStartTime,
+ forceTranscode: true,
+ );
+ if (fallbackResult == null) return null;
+ debugPrint('[Player] Transcoded fallback after local failure did not start: $fallbackResult');
+ return fallbackResult;
+ }
+
_clearState();
return 'Playback failed: ${e.toString().split('\n').first}';
}
@@ -3241,16 +3270,21 @@ class AudioPlayerService extends ChangeNotifier {
String? coverUrl,
double totalDuration,
List<dynamic> chapters,
- double startTime, [
+ double startTime, {
bool forceStartTime = false,
- ]) async {
+ bool forceTranscode = false,
+ }) async {
debugPrint('[Player] Streaming from server: $title');
_isOfflineMode = false;
+ _localSessionMode = false;
// Use episode endpoint if this is a podcast episode
final sessionData = _currentEpisodeId != null
- ? await api.startEpisodePlaybackSession(_currentItemId!, _currentEpisodeId!)
- : await api.startPlaybackSession(itemId);
+ ? await api.startEpisodePlaybackSession(
+ _currentItemId!, _currentEpisodeId!,
+ forceTranscode: forceTranscode)
+ : await api.startPlaybackSession(itemId,
+ forceTranscode: forceTranscode);
if (sessionData == null) {
debugPrint('[Player] Failed to start playback session');
_clearState();
@@ -3278,7 +3312,7 @@ class AudioPlayerService extends ChangeNotifier {
// Detect Dolby Atmos / EAC-3 / AC-3 tracks. Samsung has a hardware Dolby
// decoder and iOS AVPlayer handles EAC3 natively, so only force transcode
// on other Android devices where the software codec often fails or outputs silence.
- if (!forceStartTime && Platform.isAndroid &&
+ if (!forceTranscode && Platform.isAndroid &&
!ApiService.deviceManufacturer.toLowerCase().contains('samsung')) {
final needsTranscode = audioTracks.any((t) {
final mime = ((t as Map<String, dynamic>)['mimeType'] as String? ?? '').toLowerCase();
@@ -3459,104 +3493,28 @@ class AudioPlayerService extends ChangeNotifier {
} catch (e, stack) {
debugPrint('[Player] Stream error: $e\n$stack');
- // If this looks like a codec/renderer error, retry with server-side
- // transcoding. Common with Dolby Atmos, EAC-3, multi-channel audio, etc.
- final errStr = e.toString();
- if (!forceStartTime && // avoid infinite retry loops (forceStartTime is reused as retry guard)
- (errStr.contains('MediaCodecAudioRenderer') ||
- errStr.contains('AudioTrack') ||
- errStr.contains('Decoder') ||
- errStr.contains('format_supported'))) {
- debugPrint('[Player] Codec error detected - retrying with server transcoding');
- // Preserve item identity before wiping state so the absorbing card
- // stays visible during the retry and the episode endpoint can be used
- // correctly. _clearState() would null _currentItemId/_currentEpisodeId,
- // making hasBook = false (card vanishes) and breaking podcast retries.
- final retryItemId = _currentItemId;
- final retryEpId = _currentEpisodeId;
- final retryEpTitle = _currentEpisodeTitle;
- final retryTitle = _currentTitle;
- final retryAuthor = _currentAuthor;
- final retryCover = _currentCoverUrl;
- _clearState();
- _currentItemId = retryItemId;
- _currentEpisodeId = retryEpId;
- _currentEpisodeTitle = retryEpTitle;
- _currentTitle = retryTitle;
- _currentAuthor = retryAuthor;
- _currentCoverUrl = retryCover;
- // Close the failed session
+ // Retry source and codec failures through ABS once. A distinct flag from
+ // forceStartTime keeps bookmark/chapter seeks eligible for recovery while
+ // still preventing a transcode loop.
+ if (!forceTranscode &&
+ PlaybackErrorPolicy.shouldRetryWithTranscode(e)) {
+ debugPrint('[Player] Source or codec error detected - retrying with server transcoding');
if (_playbackSessionId != null) {
try { await api.closePlaybackSession(_playbackSessionId!); } catch (_) {}
_playbackSessionId = null;
}
- // Retry with transcode
- final retrySession = _currentEpisodeId != null
- ? await api.startEpisodePlaybackSession(_currentItemId!, _currentEpisodeId!, forceTranscode: true)
- : await api.startPlaybackSession(itemId, forceTranscode: true);
- if (retrySession != null) {
- _playbackSessionId = retrySession['id'] as String?;
- _lastServerSync = DateTime.now();
- final retryTracks = retrySession['audioTracks'] as List<dynamic>?;
- if (retryTracks != null && retryTracks.isNotEmpty) {
- try {
- _currentTrackIndex = 0;
- _buildTrackOffsets(retryTracks);
- AudioSource retrySource;
- final audioHeaders = api.mediaHeaders;
- if (retryTracks.length == 1) {
- final track = retryTracks.first as Map<String, dynamic>;
- final contentUrl = track['contentUrl'] as String? ?? '';
- final fullUrl = api.buildTrackUrl(contentUrl);
- retrySource = AudioSource.uri(Uri.parse(fullUrl), headers: audioHeaders, options: mp3ExtractorOptions());
- } else {
- final sources = <AudioSource>[];
- for (final t in retryTracks) {
- final track = t as Map<String, dynamic>;
- final contentUrl = track['contentUrl'] as String? ?? '';
- final fullUrl = api.buildTrackUrl(contentUrl);
- sources.add(AudioSource.uri(Uri.parse(fullUrl), headers: audioHeaders, options: mp3ExtractorOptions()));
- }
- retrySource = ConcatenatingAudioSource(children: sources);
- }
- await _player!.setAudioSource(retrySource, itemId: _currentItemId);
- if (totalDuration > 0 && startTime >= totalDuration - 1.0) startTime = 0;
- if (startTime > 0) await _seekAbsolute(startTime);
- clearSeekTarget();
- _subscribeTrackIndex();
- final initChapter = _initChapterInfo(startTime);
- // Speed before _pushMediaItem - the pushed duration is speed-adjusted.
- final bookSpeed = await PlayerSettings.getBookSpeed(itemId);
- final speed = bookSpeed ?? await PlayerSettings.getDefaultSpeed();
- await _player!.setSpeed(speed);
- _pushMediaItem(itemId, title, author, coverUrl, totalDuration, chapter: initChapter);
- await EqualizerService().switchItem(itemId);
- debugPrint('[Player] Transcoded playback starting at ${speed}x');
- try { (await AudioSession.instance).setActive(true); } catch (_) {}
- _player!.play();
- _scheduleAudioDiagnostics('transcoded-retry');
- notifyListeners();
- _setupSync();
- Future.delayed(const Duration(milliseconds: 500), () {
- _handler?.refreshPlaybackState();
- });
- final sleepTimer = SleepTimerService();
- sleepTimer.resetDismiss();
- sleepTimer.checkAutoSleep();
- // Cache the transcoded session so next cold start is instant
- SessionCache.save(
- itemId: itemId,
- episodeId: _currentEpisodeId,
- audioTracks: retryTracks,
- chapters: _chapters,
- totalDuration: totalDuration,
- );
- return null;
- } catch (retryError) {
- debugPrint('[Player] Transcoded playback also failed: $retryError');
- }
- }
- }
+ return _playFromServer(
+ api,
+ itemId,
+ title,
+ author,
+ coverUrl,
+ totalDuration,
+ chapters,
+ startTime,
+ forceStartTime: forceStartTime,
+ forceTranscode: true,
+ );
}
_clearState();
@@ -3572,30 +3530,40 @@ class AudioPlayerService extends ChangeNotifier {
try {
final api = _api;
if (api == null || _currentItemId == null) return;
- debugPrint('[Player] Codec error in playback stream - retrying with server transcoding');
+ debugPrint('[Player] Playback error in stream - retrying with server transcoding');
final itemId = _currentItemId!;
final retryEpId = _currentEpisodeId;
final retryEpTitle = _currentEpisodeTitle;
+ final retryLibraryId = _currentLibraryId;
final retryTitle = _currentTitle ?? '';
final retryAuthor = _currentAuthor ?? '';
final retryCover = _currentCoverUrl;
- final startTime = (_player?.position.inMilliseconds ?? 0) / 1000.0;
+ final failedSessionId = _playbackSessionId;
+ final startTime = position.inMilliseconds / 1000.0;
_clearState();
_currentItemId = itemId;
_currentEpisodeId = retryEpId;
_currentEpisodeTitle = retryEpTitle;
+ _currentLibraryId = retryLibraryId;
_currentTitle = retryTitle;
_currentAuthor = retryAuthor;
_currentCoverUrl = retryCover;
- if (_playbackSessionId != null) {
- try { await api.closePlaybackSession(_playbackSessionId!); } catch (_) {}
- _playbackSessionId = null;
+ _shortLocalDurationSec = null;
+ _syncNotifSkipCache();
+ if (failedSessionId != null) {
+ try { await api.closePlaybackSession(failedSessionId); } catch (_) {}
}
final retrySession = retryEpId != null
? await api.startEpisodePlaybackSession(itemId, retryEpId, forceTranscode: true)
: await api.startPlaybackSession(itemId, forceTranscode: true);
if (retrySession == null) return;
_playbackSessionId = retrySession['id'] as String?;
+ final retrySessionLibId = retrySession['libraryId'] as String?;
+ if ((_currentLibraryId == null || _currentLibraryId!.isEmpty) &&
+ retrySessionLibId != null && retrySessionLibId.isNotEmpty) {
+ _currentLibraryId = retrySessionLibId;
+ _syncNotifSkipCache();
+ }
_lastServerSync = DateTime.now();
final retryTracks = retrySession['audioTracks'] as List<dynamic>?;
final totalDuration = (retrySession['duration'] as num?)?.toDouble() ?? _totalDuration;
diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dart
index 0c41ba75..00a67a08 100644
--- a/lib/services/backup_service.dart
+++ b/lib/services/backup_service.dart
@@ -378,18 +378,25 @@ class BackupService {
static Future<void> importSettings(Map<String, dynamic> data) async {
final prefs = await SharedPreferences.getInstance();
+ final customHeaders = data['customHeaders'] as Map<String, dynamic>?;
+ final restoredCustomHeaders = customHeaders == null
+ ? const <String, String>{}
+ : Map<String, String>.from(customHeaders);
+
// Restore accounts FIRST so ScopedPrefs has the right scope
// when we write settings below. saveAccount() sets the active scope key.
final accounts = data['accounts'] as List<dynamic>?;
if (accounts != null) {
for (final a in accounts) {
final map = a as Map<String, dynamic>;
- await UserAccountService().saveAccount(SavedAccount.fromJson(map));
+ await UserAccountService().saveAccount(SavedAccount.fromJson(
+ map,
+ legacyCustomHeaders: restoredCustomHeaders,
+ ));
}
}
// Custom headers (restore early, before any API calls)
- final customHeaders = data['customHeaders'] as Map<String, dynamic>?;
if (customHeaders != null) {
await prefs.setString('custom_headers', jsonEncode(customHeaders));
}
diff --git a/lib/services/home_widget_service.dart b/lib/services/home_widget_service.dart
index 055b21e0..dd6a779a 100644
--- a/lib/services/home_widget_service.dart
+++ b/lib/services/home_widget_service.dart
@@ -821,17 +821,17 @@ class HomeWidgetService {
return;
}
- debugPrint('[StatsWidget] Fetching listening-stats and /me');
+ debugPrint('[StatsWidget] Fetching listening-stats and progress');
final stats = await api.getListeningStats();
- final me = await api.getMe();
+ final progress = await api.getAllProgress();
if (stats == null)
debugPrint('[StatsWidget] listening-stats returned null');
- if (me == null) debugPrint('[StatsWidget] /me returned null');
+ if (progress == null) debugPrint('[StatsWidget] progress returned null');
// Both calls failed - the server is unreachable. Don't blow away the
// widget with zeros; leave whatever it was showing in place.
- if (stats == null && me == null) {
+ if (stats == null && progress == null) {
debugPrint('[StatsWidget] Both fetches failed - keeping last values');
return;
}
@@ -844,7 +844,7 @@ class HomeWidgetService {
final hidden = (await ScopedPrefs.getStringList(
'year_hidden_ids',
)).toSet();
- final booksYear = _countBooksFinishedThisYear(me, hidden);
+ final booksYear = _countBooksFinishedThisYear(progress, hidden);
debugPrint(
'[StatsWidget] Computed: today=${today}s week=${week}s streak=${streak}d booksThisYear=$booksYear (dailyMapKeys=${dailyMap.length})',
@@ -997,16 +997,13 @@ class HomeWidgetService {
}
int _countBooksFinishedThisYear(
- Map<String, dynamic>? me,
+ List<Map<String, dynamic>>? progress,
Set<String> hidden,
) {
- if (me == null) return 0;
- final progress = me['mediaProgress'];
- if (progress is! List) return 0;
+ if (progress == null) return 0;
final year = DateTime.now().year;
var count = 0;
for (final entry in progress) {
- if (entry is! Map) continue;
if (entry['isFinished'] != true) continue;
// episodeId is non-null for podcast entries — exclude so the "books"
// count doesn't inflate with every finished podcast episode.
diff --git a/lib/services/native_ios_audio_player.dart b/lib/services/native_ios_audio_player.dart
index 8895ca86..18a7072d 100644
--- a/lib/services/native_ios_audio_player.dart
+++ b/lib/services/native_ios_audio_player.dart
@@ -87,6 +87,12 @@ class NativeIosAudioPlayer {
final tracks = _flattenSource(source);
if (tracks.isEmpty) return null;
+ // A new source must never inherit the outgoing track's duration. The
+ // native load may legitimately return no duration, and returning the old
+ // cache here made single-file books look truncated after a title switch.
+ _duration = null;
+ _durationController.add(null);
+
final startS = (initialPosition?.inMilliseconds ?? 0) / 1000.0;
final eqEnabled = await ScopedPrefs.getBool('eq_enabled') ?? false;
final result = await _methodChannel.invokeMethod<Map<dynamic, dynamic>>('load', {
@@ -101,12 +107,13 @@ class NativeIosAudioPlayer {
// it adopts the live engine instead of starting a duplicate stream.
if (itemId != null) 'itemId': itemId,
});
- final durS = result?['durationS'] as double?;
- if (durS != null) {
- _duration = Duration(milliseconds: (durS * 1000).round());
- _durationController.add(_duration);
- }
- return _duration;
+ final durS = (result?['durationS'] as num?)?.toDouble();
+ final loadedDuration = durS != null && durS > 0
+ ? Duration(milliseconds: (durS * 1000).round())
+ : null;
+ _duration = loadedDuration;
+ _durationController.add(loadedDuration);
+ return loadedDuration;
}
/// New: pre-buffer the next book so the engine can swap to it gaplessly when
diff --git a/lib/services/playback_error_policy.dart b/lib/services/playback_error_policy.dart
new file mode 100644
index 00000000..0093be8c
--- /dev/null
+++ b/lib/services/playback_error_policy.dart
@@ -0,0 +1,23 @@
+import 'package:flutter/services.dart';
+
+class PlaybackErrorPolicy {
+ PlaybackErrorPolicy._();
+
+ static bool shouldRetryWithTranscode(Object error) {
+ final text = error.toString().toLowerCase();
+
+ if (text.contains('mediacodecaudiorenderer') ||
+ text.contains('audiotrack') ||
+ text.contains('decoder') ||
+ text.contains('format_supported')) {
+ return true;
+ }
+
+ if (error is PlatformException) {
+ final message = error.message?.toLowerCase() ?? '';
+ return error.code == '0' && message.contains('source error');
+ }
+
+ return text.contains('source error') || text.contains('type_source');
+ }
+}
diff --git a/lib/services/socket_service.dart b/lib/services/socket_service.dart
index dbc5a833..531a79f0 100644
--- a/lib/services/socket_service.dart
+++ b/lib/services/socket_service.dart
@@ -2,6 +2,12 @@ import 'package:flutter/foundation.dart';
import 'package:socket_io_client/socket_io_client.dart' as io;
class SocketService {
+ static const authorChangeEvents = <String>[
+ 'author_added',
+ 'author_updated',
+ 'author_removed',
+ 'authors_num_books_updated',
+ ];
static final SocketService _instance = SocketService._();
factory SocketService() => _instance;
SocketService._();
@@ -231,6 +237,12 @@ class SocketService {
}
}
+ void _registerAuthorListeners() {
+ for (final event in authorChangeEvents) {
+ _socket!.on(event, (_) => _emitAuthorsChanged());
+ }
+ }
+
/// Called when ereader devices change. Server emits this both for the
/// per-user update (always) and admin-wide updates (only to admins).
/// Payload shape: { ereaderDevices: [...] } already filtered for this user.
@@ -357,9 +369,7 @@ class SocketService {
});
// Author changes
- _socket!.on('author_added', (_) => _emitAuthorsChanged());
- _socket!.on('author_updated', (_) => _emitAuthorsChanged());
- _socket!.on('author_removed', (_) => _emitAuthorsChanged());
+ _registerAuthorListeners();
// Current user updated
_socket!.on('user_updated', (data) {
@@ -520,9 +530,7 @@ class SocketService {
_socket!.on('playlist_updated', (_) => onPlaylistUpdated?.call());
_socket!.on('playlist_removed', (_) => onPlaylistUpdated?.call());
- _socket!.on('author_added', (_) => _emitAuthorsChanged());
- _socket!.on('author_updated', (_) => _emitAuthorsChanged());
- _socket!.on('author_removed', (_) => _emitAuthorsChanged());
+ _registerAuthorListeners();
_socket!.on('user_updated', (data) {
if (data is Map<String, dynamic>) onUserUpdated?.call(data);
diff --git a/lib/services/user_account_service.dart b/lib/services/user_account_service.dart
index e7336c98..4d121c9a 100644
--- a/lib/services/user_account_service.dart
+++ b/lib/services/user_account_service.dart
@@ -12,6 +12,7 @@ class SavedAccount {
final String? refreshToken;
final String? userId;
final bool isLegacyToken;
+ final Map<String, String> customHeaders;
SavedAccount({
required this.serverUrl,
@@ -20,7 +21,8 @@ class SavedAccount {
this.refreshToken,
this.userId,
this.isLegacyToken = false,
- });
+ Map<String, String> customHeaders = const {},
+ }) : customHeaders = Map.unmodifiable(customHeaders);
/// Unique key for scoping per-user SharedPreferences data.
/// Uses serverUrl + username to uniquely identify an account.
@@ -39,15 +41,23 @@ class SavedAccount {
if (refreshToken != null) 'refreshToken': refreshToken,
'userId': userId,
'isLegacyToken': isLegacyToken,
+ 'customHeaders': customHeaders,
};
- factory SavedAccount.fromJson(Map<String, dynamic> json) => SavedAccount(
+ factory SavedAccount.fromJson(
+ Map<String, dynamic> json, {
+ Map<String, String> legacyCustomHeaders = const {},
+ }) =>
+ SavedAccount(
serverUrl: json['serverUrl'] as String,
username: json['username'] as String,
token: json['token'] as String,
refreshToken: json['refreshToken'] as String?,
userId: json['userId'] as String?,
isLegacyToken: json['isLegacyToken'] as bool? ?? (json['refreshToken'] == null),
+ customHeaders: json.containsKey('customHeaders')
+ ? Map<String, String>.from(json['customHeaders'] as Map? ?? const {})
+ : legacyCustomHeaders,
);
@override
@@ -83,6 +93,14 @@ class UserAccountService {
/// Initialise from SharedPreferences. Call once at app startup.
Future<void> init() async {
final prefs = await SharedPreferences.getInstance();
+ var legacyCustomHeaders = <String, String>{};
+ final headersJson = prefs.getString('custom_headers');
+ if (headersJson != null) {
+ try {
+ legacyCustomHeaders =
+ Map<String, String>.from(jsonDecode(headersJson) as Map);
+ } catch (_) {}
+ }
// Load saved accounts
final json = prefs.getString(_accountsKey);
@@ -90,7 +108,10 @@ class UserAccountService {
try {
final list = jsonDecode(json) as List<dynamic>;
_accounts = list
- .map((e) => SavedAccount.fromJson(e as Map<String, dynamic>))
+ .map((e) => SavedAccount.fromJson(
+ e as Map<String, dynamic>,
+ legacyCustomHeaders: legacyCustomHeaders,
+ ))
.toList();
} catch (e) {
debugPrint('[UserAccount] Failed to load accounts: $e');
@@ -153,6 +174,7 @@ class UserAccountService {
refreshToken: refreshToken ?? old.refreshToken,
userId: old.userId,
isLegacyToken: old.isLegacyToken,
+ customHeaders: old.customHeaders,
);
await _persist();
}
@@ -221,6 +243,7 @@ class UserAccountService {
token: '',
userId: old.userId,
isLegacyToken: old.isLegacyToken,
+ customHeaders: old.customHeaders,
);
await _persist();
}
@@ -231,6 +254,26 @@ class UserAccountService {
/// from the old scope to the new one. Returns true if the account was found.
Future<bool> updateAccountUrl(
String oldServerUrl, String username, String newServerUrl) async {
+ final index = _accounts.indexWhere(
+ (a) => a.serverUrl == oldServerUrl && a.username == username);
+ if (index < 0) return false;
+ return updateAccountConnection(
+ oldServerUrl,
+ username,
+ newServerUrl,
+ _accounts[index].customHeaders,
+ );
+ }
+
+ /// Update the URL and proxy headers for one saved account. If the URL
+ /// changes, scoped per-account data follows it just as it did for the older
+ /// URL-only editor.
+ Future<bool> updateAccountConnection(
+ String oldServerUrl,
+ String username,
+ String newServerUrl,
+ Map<String, String> customHeaders,
+ ) async {
final idx = _accounts.indexWhere(
(a) => a.serverUrl == oldServerUrl && a.username == username);
if (idx < 0) return false;
@@ -243,6 +286,7 @@ class UserAccountService {
refreshToken: old.refreshToken,
userId: old.userId,
isLegacyToken: old.isLegacyToken,
+ customHeaders: customHeaders,
);
final oldScope = old.scopeKey;
diff --git a/lib/services/wear_auth_service.dart b/lib/services/wear_auth_service.dart
index 56943d50..440d2d53 100644
--- a/lib/services/wear_auth_service.dart
+++ b/lib/services/wear_auth_service.dart
@@ -12,8 +12,9 @@ class WearAuthService {
WearAuthService._();
static final WearAuthService instance = WearAuthService._();
- static const MethodChannel _channel =
- MethodChannel('com.barnabas.absorb/wear_auth');
+ static const MethodChannel _channel = MethodChannel(
+ 'com.barnabas.absorb/wear_auth',
+ );
bool get _supported => !kIsWeb && Platform.isAndroid;
@@ -30,6 +31,7 @@ class WearAuthService {
String? userId,
required bool isLegacyToken,
Map<String, String> customHeaders = const {},
+ bool supportsTokenReturn = false,
}) async {
if (!_supported) return;
try {
@@ -41,6 +43,7 @@ class WearAuthService {
'userId': userId,
'isLegacyToken': isLegacyToken,
'customHeaders': customHeaders,
+ 'supportsTokenReturn': supportsTokenReturn,
});
} catch (e) {
// Pure-best-effort: the phone app must work even if Play Services
diff --git a/lib/widgets/server_connection_editor.dart b/lib/widgets/server_connection_editor.dart
new file mode 100644
index 00000000..6d401a38
--- /dev/null
+++ b/lib/widgets/server_connection_editor.dart
@@ -0,0 +1,255 @@
+import 'package:flutter/material.dart';
+
+import '../l10n/app_localizations.dart';
+
+class ServerConnectionSettings {
+ final String serverUrl;
+ final Map<String, String> customHeaders;
+
+ const ServerConnectionSettings({
+ required this.serverUrl,
+ required this.customHeaders,
+ });
+}
+
+class ServerConnectionEditor extends StatefulWidget {
+ final String username;
+ final String serverUrl;
+ final Map<String, String> customHeaders;
+
+ const ServerConnectionEditor({
+ super.key,
+ required this.username,
+ required this.serverUrl,
+ this.customHeaders = const {},
+ });
+
+ @override
+ State<ServerConnectionEditor> createState() => _ServerConnectionEditorState();
+}
+
+class _ServerConnectionEditorState extends State<ServerConnectionEditor> {
+ late final TextEditingController _serverController;
+ final List<(TextEditingController, TextEditingController)>
+ _headerControllers = [];
+ late bool _headersExpanded;
+
+ @override
+ void initState() {
+ super.initState();
+ _serverController = TextEditingController(text: widget.serverUrl);
+ _headerControllers.addAll(
+ widget.customHeaders.entries.map(
+ (entry) => (
+ TextEditingController(text: entry.key),
+ TextEditingController(text: entry.value),
+ ),
+ ),
+ );
+ _headersExpanded = widget.customHeaders.isNotEmpty;
+ }
+
+ @override
+ void dispose() {
+ _serverController.dispose();
+ for (final (key, value) in _headerControllers) {
+ key.dispose();
+ value.dispose();
+ }
+ super.dispose();
+ }
+
+ Map<String, String> _collectHeaders() {
+ final headers = <String, String>{};
+ for (final (keyController, valueController) in _headerControllers) {
+ final key = keyController.text.trim();
+ final value = valueController.text.trim();
+ if (key.isNotEmpty && value.isNotEmpty) headers[key] = value;
+ }
+ return headers;
+ }
+
+ void _addHeader() {
+ setState(() {
+ _headersExpanded = true;
+ _headerControllers.add((
+ TextEditingController(),
+ TextEditingController(),
+ ));
+ });
+ }
+
+ void _removeHeader(int index) {
+ final (key, value) = _headerControllers.removeAt(index);
+ key.dispose();
+ value.dispose();
+ setState(() {});
+ }
+
+ void _save() {
+ final serverUrl = _serverController.text.trim();
+ if (serverUrl.isEmpty) return;
+ Navigator.pop(
+ context,
+ ServerConnectionSettings(
+ serverUrl: serverUrl,
+ customHeaders: _collectHeaders(),
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l = AppLocalizations.of(context)!;
+ final cs = Theme.of(context).colorScheme;
+ final textTheme = Theme.of(context).textTheme;
+
+ return AlertDialog(
+ title: Text(l.editServerConnectionTitle),
+ content: SizedBox(
+ width: 480,
+ child: SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ l.editServerConnectionSubtitle(widget.username),
+ style: textTheme.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 14),
+ TextField(
+ key: const Key('server-connection-url'),
+ controller: _serverController,
+ autofocus: true,
+ keyboardType: TextInputType.url,
+ autocorrect: false,
+ decoration: InputDecoration(
+ labelText: l.editServerAddressField,
+ hintText: 'https://example.com',
+ border: const OutlineInputBorder(),
+ ),
+ ),
+ const SizedBox(height: 12),
+ InkWell(
+ key: const Key('toggle-custom-headers'),
+ borderRadius: BorderRadius.circular(8),
+ onTap: () =>
+ setState(() => _headersExpanded = !_headersExpanded),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8),
+ child: Row(
+ children: [
+ Icon(
+ Icons.vpn_key_rounded,
+ size: 18,
+ color: cs.onSurfaceVariant,
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(
+ l.loginCustomHttpHeaders,
+ style: textTheme.bodyMedium?.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ if (_headerControllers.isNotEmpty)
+ Text(
+ '${_headerControllers.length}',
+ style: textTheme.labelMedium?.copyWith(
+ color: cs.primary,
+ ),
+ ),
+ const SizedBox(width: 4),
+ Icon(
+ _headersExpanded
+ ? Icons.expand_less_rounded
+ : Icons.expand_more_rounded,
+ color: cs.onSurfaceVariant,
+ ),
+ ],
+ ),
+ ),
+ ),
+ if (_headersExpanded) ...[
+ Text(
+ l.editCustomHeadersDescription,
+ style: textTheme.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant,
+ ),
+ ),
+ const SizedBox(height: 10),
+ ..._headerControllers.asMap().entries.map((entry) {
+ final index = entry.key;
+ final (keyController, valueController) = entry.value;
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Row(
+ children: [
+ Expanded(
+ flex: 2,
+ child: TextField(
+ key: Key('custom-header-name-$index'),
+ controller: keyController,
+ autocorrect: false,
+ decoration: InputDecoration(
+ labelText: l.loginHeaderName,
+ border: const OutlineInputBorder(),
+ isDense: true,
+ ),
+ ),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ flex: 3,
+ child: TextField(
+ key: Key('custom-header-value-$index'),
+ controller: valueController,
+ autocorrect: false,
+ enableSuggestions: false,
+ decoration: InputDecoration(
+ labelText: l.loginHeaderValue,
+ border: const OutlineInputBorder(),
+ isDense: true,
+ ),
+ ),
+ ),
+ IconButton(
+ key: Key('remove-custom-header-$index'),
+ tooltip: l.remove,
+ onPressed: () => _removeHeader(index),
+ icon: const Icon(Icons.close_rounded),
+ color: cs.error,
+ ),
+ ],
+ ),
+ );
+ }),
+ TextButton.icon(
+ key: const Key('add-custom-header'),
+ onPressed: _addHeader,
+ icon: const Icon(Icons.add_rounded),
+ label: Text(l.loginAddHeader),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(context),
+ child: Text(l.cancel),
+ ),
+ FilledButton(
+ key: const Key('save-server-connection'),
+ onPressed: _save,
+ child: Text(l.save),
+ ),
+ ],
+ );
+ }
+}
diff --git a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java
index 71e20150..d438e31e 100644
--- a/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java
+++ b/packages/just_audio/android/src/main/java/com/ryanheise/just_audio/AudioPlayer.java
@@ -430,9 +430,17 @@ public class AudioPlayer implements MethodCallHandler, Player.Listener, Metadata
public void onPlayerError(PlaybackException error) {
if (error instanceof ExoPlaybackException) {
final ExoPlaybackException exoError = (ExoPlaybackException)error;
+ String forwardedMessage = exoError.getMessage();
+ String sourceCause = null;
switch (exoError.type) {
case ExoPlaybackException.TYPE_SOURCE:
- Log.e(TAG, "TYPE_SOURCE: " + exoError.getSourceException().getMessage());
+ final Throwable sourceException = exoError.getSourceException();
+ sourceCause = sourceException.getClass().getSimpleName()
+ + (sourceException.getMessage() != null
+ ? ": " + sourceException.getMessage()
+ : "");
+ Log.e(TAG, "TYPE_SOURCE: " + sourceCause);
+ forwardedMessage = "Source error: " + sourceCause;
break;
case ExoPlaybackException.TYPE_RENDERER:
@@ -447,7 +455,9 @@ public class AudioPlayer implements MethodCallHandler, Player.Listener, Metadata
Log.e(TAG, "default ExoPlaybackException: " + exoError.getUnexpectedException().getMessage());
}
// TODO: send both errorCode and type
- sendError(String.valueOf(exoError.type), exoError.getMessage(), mapOf("index", currentIndex));
+ final Map<String, Object> details = mapOf("index", currentIndex);
+ if (sourceCause != null) details.put("cause", sourceCause);
+ sendError(String.valueOf(exoError.type), forwardedMessage, details);
} else {
Log.e(TAG, "default PlaybackException: " + error.getMessage());
sendError(String.valueOf(error.errorCode), error.getMessage(), mapOf("index", currentIndex));
diff --git a/pubspec.yaml b/pubspec.yaml
index e85bde2d..fe2c9e80 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
name: absorb
description: An Audiobookshelf Client
publish_to: 'none'
-version: 1.9.3+223
+version: 1.9.3+224
environment:
sdk: '>=3.10.0 <4.0.0'