Default Seerr login to Jellyfin and prefill the Wolfskin Seerr URL #19

Merged
justinzeus merged 1 commit from fm/wolfskin-6-seerr-default into main 2026-10-22 16:00:24 +02:00
4 changed files with 33 additions and 6 deletions

View file

@ -0,0 +1,9 @@
package com.github.damontecres.wholphin
/** Wolfskin-specific defaults kept in one place to keep upstream diffs small. */
object WolfskinDefaults {
const val SEERR_URL = "https://seerr.justinvisser.org"
}
/** Returns [url] when it has content, otherwise the Wolfskin Seerr URL so the user can still edit it. */
fun seerrUrlPrefill(url: String = ""): String = if (url.isBlank()) WolfskinDefaults.SEERR_URL else url

View file

@ -30,6 +30,7 @@ import androidx.compose.ui.unit.dp
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.github.damontecres.wholphin.R
import com.github.damontecres.wholphin.seerrUrlPrefill
import com.github.damontecres.wholphin.ui.PreviewTvSpec
import com.github.damontecres.wholphin.ui.components.Button
import com.github.damontecres.wholphin.ui.components.EditTextBox
@ -54,7 +55,7 @@ fun AddSeerrServerApiKey(
.padding(16.dp)
.wrapContentSize(),
) {
var url by remember { mutableStateOf("") }
var url by remember { mutableStateOf(seerrUrlPrefill()) }
var apiKey by remember { mutableStateOf("") }
val focusRequester = remember { FocusRequester() }
@ -166,7 +167,7 @@ fun AddSeerrServerUsername(
.padding(16.dp)
.wrapContentSize(),
) {
var url by remember { mutableStateOf("") }
var url by remember { mutableStateOf(seerrUrlPrefill()) }
var username by remember { mutableStateOf(username) }
var password by remember { mutableStateOf("") }

View file

@ -89,10 +89,6 @@ fun ChooseSeerrLoginType(
title = stringResource(R.string.seerr_login),
items =
listOf(
DialogItem(
text = stringResource(R.string.api_key),
onClick = { onChoose.invoke(SeerrAuthMethod.API_KEY) },
),
DialogItem(
text = stringResource(R.string.seerr_jellyfin_user),
onClick = { onChoose.invoke(SeerrAuthMethod.JELLYFIN) },
@ -101,6 +97,10 @@ fun ChooseSeerrLoginType(
text = stringResource(R.string.seerr_local_user),
onClick = { onChoose.invoke(SeerrAuthMethod.LOCAL) },
),
DialogItem(
text = stringResource(R.string.api_key),
onClick = { onChoose.invoke(SeerrAuthMethod.API_KEY) },
),
),
)

View file

@ -0,0 +1,17 @@
package com.github.damontecres.wholphin
import org.junit.Assert.assertEquals
import org.junit.Test
class WolfskinDefaultsTest {
@Test
fun emptyUrlIsPrefilledWithWolfskinSeerrUrl() {
assertEquals(WolfskinDefaults.SEERR_URL, seerrUrlPrefill())
assertEquals(WolfskinDefaults.SEERR_URL, seerrUrlPrefill(" "))
}
@Test
fun enteredUrlIsKept() {
assertEquals("https://seerr.example.org", seerrUrlPrefill("https://seerr.example.org"))
}
}