Add donation links to servers next to the privacy policy

This commit is contained in:
2026-10-16 17:02:29 +00:00
parent 5f2dbccebf
commit b13adc5340
12 changed files with 62 additions and 11 deletions
@@ -290,6 +290,7 @@ fun HomeScreen(modifier: Modifier = Modifier) {
subtitle = hostOf(p.url),
selected = selected == p.id,
onPolicy = p.policy?.let { url -> { openUrl(context, url) } },
onDonate = p.donate?.let { url -> { openUrl(context, url) } },
) { select(p.id) }
}
RowDivider()
@@ -571,6 +572,7 @@ private fun ProviderRow(
subtitle: String,
selected: Boolean,
onPolicy: (() -> Unit)? = null,
onDonate: (() -> Unit)? = null,
onClick: () -> Unit,
) {
val highlight by animateColorAsState(
@@ -598,6 +600,16 @@ private fun ProviderRow(
overflow = TextOverflow.Ellipsis,
)
}
if (onDonate != null) {
IconButton(onClick = onDonate, modifier = Modifier.size(40.dp)) {
Icon(
painterResource(R.drawable.ic_donate),
contentDescription = stringResource(R.string.donate),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(18.dp),
)
}
}
if (onPolicy != null) {
IconButton(onClick = onPolicy, modifier = Modifier.size(40.dp)) {
Icon(
@@ -17,6 +17,7 @@ data class DohProvider(
val bootstrap: List<String> = emptyList(),
val http3: Boolean = false,
val policy: String? = null,
val donate: String? = null,
)
object Providers {
@@ -32,11 +33,13 @@ object Providers {
DohProvider(
"quad9", "Quad9", "https://dns.quad9.net/dns-query", listOf("9.9.9.9", "149.112.112.112"),
policy = "https://quad9.net/service/privacy/",
donate = "https://quad9.net/donate/",
),
DohProvider(
"digitale-gesellschaft", "Digitale Gesellschaft", "https://dns.digitale-gesellschaft.ch/dns-query",
listOf("185.95.218.42", "185.95.218.43"), http3 = true,
policy = "https://www.digitale-gesellschaft.ch/dns/",
donate = "https://www.digitale-gesellschaft.ch/uber-uns/unterstuetzer-werden/",
),
DohProvider(
"uncensoreddns", "UncensoredDNS", "https://anycast.uncensoreddns.org/dns-query", listOf("91.239.100.100"),
@@ -46,6 +49,7 @@ object Providers {
"ffmuc", "Freifunk München", "https://doh.ffmuc.net/dns-query",
listOf("5.1.66.255", "185.150.99.255"), http3 = true,
policy = "https://ffmuc.net/dns-privacy/",
donate = "https://spende.ffmuc.net/",
),
)
@@ -111,7 +115,8 @@ object ServerList {
return parsed.size
}
// Format per line: Name | DoH URL | privacy policy URL | h3 (optional). See CONTRIBUTING.md.
// Format per line: Name | DoH URL | privacy policy URL | h3 (optional) | donation URL (optional).
// The optional columns are recognised by content, so either can be left out. See CONTRIBUTING.md.
fun parse(text: String): List<DohProvider> {
val builtInByHost = Providers.builtIn.associateBy { it.url.toHttpUrlOrNull()?.host }
val seen = HashSet<String>()
@@ -125,11 +130,14 @@ object ServerList {
val url = cols[1].toHttpUrlOrNull()
val policy = cols[2].takeIf { it.toHttpUrlOrNull()?.isHttps == true }
if (name.isEmpty() || url == null || !url.isHttps) continue
// Shipped servers keep their address and id, so an edited list cannot redirect them
val extras = cols.drop(3)
val http3 = extras.any { it.equals("h3", ignoreCase = true) }
val donate = extras.firstOrNull { it.toHttpUrlOrNull()?.isHttps == true }
// Shipped servers keep their address, id and links, so an edited list cannot redirect them
val pinned = builtInByHost[url.host]
val server = pinned
?: if (policy == null) continue
else DohProvider(url.host, name, cols[1], http3 = cols.getOrElse(3) { "" }.equals("h3", ignoreCase = true), policy = policy)
else DohProvider(url.host, name, cols[1], http3 = http3, policy = policy, donate = donate)
if (!seen.add(server.id)) continue
result += server
if (result.size >= MAX_SERVERS) break
+21
View File
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="M128,38 A90,90 0 1,1 128,218 A90,90 0 1,1 128,38 Z"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="11" />
<path
android:pathData="M156,99 C151,88 141,82 128,82 C112,82 100,91 100,105 C100,120 113,125 128,128 C144,131 158,137 158,153 C158,167 145,175 128,175 C113,175 101,168 97,156"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="11"
android:strokeLineCap="round"
android:strokeLineJoin="round" />
<path
android:pathData="M128,64 L128,82 M128,175 L128,193"
android:strokeColor="#FFFFFFFF"
android:strokeWidth="11"
android:strokeLineCap="round" />
</vector>
+1
View File
@@ -84,6 +84,7 @@
<string name="group_system">System</string>
<string name="group_count">%1$d von %2$d über DNS</string>
<string name="about_privacy_policy">Datenschutzerklärung</string>
<string name="donate">Spenden</string>
<string name="licenses_title">Open-Source-Lizenzen</string>
<string name="licenses_hint">SparkleDNS basiert auf diesen Open-Source-Projekten. Tippe auf ein Projekt, um seine Seite zu öffnen.</string>
<string name="licenses_data">Sperrlisten-Daten (bei Bedarf geladen, nicht enthalten)</string>
+1
View File
@@ -84,6 +84,7 @@
<string name="group_system">システム</string>
<string name="group_count">%2$d 件中 %1$d 件が DNS 経由</string>
<string name="about_privacy_policy">プライバシーポリシー</string>
<string name="donate">寄付する</string>
<string name="licenses_title">オープンソースライセンス</string>
<string name="licenses_hint">SparkleDNS は以下のオープンソースプロジェクトで作られています。タップするとプロジェクトのページを開きます。</string>
<string name="licenses_data">ブロックリストのデータ(必要なときにダウンロード、同梱なし)</string>
+1
View File
@@ -84,6 +84,7 @@
<string name="group_system">Sistema</string>
<string name="group_count">%1$d iš %2$d per DNS</string>
<string name="about_privacy_policy">Privatumo politika</string>
<string name="donate">Paaukoti</string>
<string name="licenses_title">Atvirojo kodo licencijos</string>
<string name="licenses_hint">SparkleDNS sukurta naudojant šiuos atvirojo kodo projektus. Palieskite projektą, kad atidarytumėte jo puslapį.</string>
<string name="licenses_data">Blokavimo sąrašų duomenys (atsisiunčiami pagal poreikį, neįtraukti)</string>
+1
View File
@@ -84,6 +84,7 @@
<string name="group_system">Системные</string>
<string name="group_count">%1$d из %2$d через DNS</string>
<string name="about_privacy_policy">Политика конфиденциальности</string>
<string name="donate">Пожертвовать</string>
<string name="licenses_title">Лицензии открытого ПО</string>
<string name="licenses_hint">SparkleDNS построен на этих проектах с открытым кодом. Нажмите на проект, чтобы открыть его страницу.</string>
<string name="licenses_data">Данные блоклистов (загружаются по запросу, не входят в приложение)</string>
+1
View File
@@ -84,6 +84,7 @@
<string name="group_system">系统</string>
<string name="group_count">%2$d 个中有 %1$d 个经过 DNS</string>
<string name="about_privacy_policy">隐私政策</string>
<string name="donate">捐赠</string>
<string name="licenses_title">开源许可</string>
<string name="licenses_hint">SparkleDNS 使用了以下开源项目。点按项目可打开其页面。</string>
<string name="licenses_data">屏蔽列表数据(按需下载,未内置)</string>
+1
View File
@@ -85,6 +85,7 @@
<string name="group_system">System</string>
<string name="group_count">%1$d of %2$d via DNS</string>
<string name="about_privacy_policy">Privacy policy</string>
<string name="donate">Donate</string>
<string name="licenses_title">Open-source licenses</string>
<string name="licenses_hint">SparkleDNS is built with these open-source projects. Tap a project to open its page.</string>
<string name="licenses_data">Blocklist data (downloaded on demand, not bundled)</string>