Personal access key for the SkySparkle server and first-launch guide

The SkySparkle server no longer has a shared public address: each user
creates a key in their account at skysparkle.cc and the app connects to
https://skysparkle.cc/dns/<key>. The key is entered in Settings under the
server or in the new two-page guide shown on first launch. Without a key
the home screen shows a hint and the service explains why it did not start.
This commit is contained in:
2026-11-16 10:54:48 +02:00
parent 3b4d9b049b
commit 92dfd31faf
13 changed files with 426 additions and 10 deletions
@@ -18,8 +18,9 @@ object Providers {
// Servers ship with the app; new ones arrive with app updates
val builtIn = listOf(
// The address is personal: Prefs.resolve() adds the access key from skysparkle.cc
DohProvider(
"skysparkle", "SkySparkle", "https://skysparkle.cc/dns-query",
"skysparkle", "SkySparkle", SkysparkleKey.BASE_URL,
http3 = true, policy = "https://skysparkle.cc/privacy?lang=en",
),
DohProvider(
@@ -58,6 +59,24 @@ object Providers {
fun byId(id: String): DohProvider = builtIn.firstOrNull { it.id == id } ?: default
}
// Personal access keys for the Skysparkle server. Each account at skysparkle.cc creates its own
// keys; the server answers only /dns/<key>, there is no shared public address.
object SkysparkleKey {
const val BASE_URL = "https://skysparkle.cc/dns/"
const val SIGNUP_URL = "https://skysparkle.cc/login#register"
private val KEY = Regex("^[A-Za-z0-9_-]{24}$")
private val IN_URL = Regex("/dns/([A-Za-z0-9_-]{24})(?:[/?#].*)?$")
// Accepts the key itself or the whole address copied from the account page
fun parse(input: String): String? {
val text = input.trim()
if (KEY.matches(text)) return text
return IN_URL.find(text)?.groupValues?.get(1)
}
fun url(key: String): String = parse(key)?.let { BASE_URL + it } ?: ""
}
fun parseIps(raw: String): List<String> =
raw.split(',', ';', ' ').map { it.trim() }.filter { it.isNotEmpty() }