diff --git a/.gitea/ISSUE_TEMPLATE/doh_server_or_blocklist.md b/.gitea/ISSUE_TEMPLATE/doh_server_or_blocklist.md index 140782f..b6ad3d6 100644 --- a/.gitea/ISSUE_TEMPLATE/doh_server_or_blocklist.md +++ b/.gitea/ISSUE_TEMPLATE/doh_server_or_blocklist.md @@ -9,6 +9,7 @@ title: "[Preset] " - URL: - Homepage or documentation: - Privacy policy (DoH servers) or license (blocklists): +- Donation page (DoH servers, optional): - [ ] DoH server: public and supports RFC 8484 - [ ] Blocklist: public and actively maintained diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 222d994..1e46f59 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,18 +43,21 @@ The server list lives in [`servers/servers.txt`](servers/servers.txt). The app d To add a server, open the file on Gitea, click **Edit**, add one line at the end and send it as a pull request: ``` -Name | DoH URL | Privacy policy | h3 +Name | DoH URL | Privacy policy | h3 | Donation page ``` - **Name** — how the server appears in the app, up to 40 characters. - **DoH URL** — the full `https://` address of the DoH endpoint. - **Privacy policy** — an `https://` link to the operator's privacy policy. Lines without one are ignored. - **h3** — optional. Add it only if the server supports HTTP/3. +- **Donation page** — optional. An `https://` link to the operator's own page for donations or support. The app shows it as a coin button next to the privacy policy. Only link to a page the operator runs or names on its website — no affiliate or third-party fundraising links. -Example: +Leave out any optional column you don't need; the app recognises them by their content. Examples: ``` -Example DNS | https://dns.example.org/dns-query | https://example.org/privacy | h3 +Example DNS | https://dns.example.org/dns-query | https://example.org/privacy | h3 | https://example.org/donate +Example DNS | https://dns.example.org/dns-query | https://example.org/privacy | https://example.org/donate +Example DNS | https://dns.example.org/dns-query | https://example.org/privacy ``` The server must: @@ -66,7 +69,7 @@ The server must: Before sending, check that it works: in the app choose **Custom server**, enter the URL and tap **Test server**. -Please don't change the lines of the servers that ship with the app (SkySparkle, Quad9, Digitale Gesellschaft, UncensoredDNS, Freifunk München): the app always keeps their built-in addresses. If you are unsure whether a server fits, open an issue with the *DoH server or blocklist* template instead. +Please don't change the lines of the servers that ship with the app (SkySparkle, Quad9, Digitale Gesellschaft, UncensoredDNS, Freifunk München): the app always keeps their built-in addresses and links. To fix one of their links, open an issue instead. If you are unsure whether a server fits, open an issue with the *DoH server or blocklist* template instead. ## Blocklists diff --git a/app/src/main/java/cc/skysparkle/sparkledns/MainActivity.kt b/app/src/main/java/cc/skysparkle/sparkledns/MainActivity.kt index ba05c15..a1e837d 100644 --- a/app/src/main/java/cc/skysparkle/sparkledns/MainActivity.kt +++ b/app/src/main/java/cc/skysparkle/sparkledns/MainActivity.kt @@ -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( diff --git a/app/src/main/java/cc/skysparkle/sparkledns/Providers.kt b/app/src/main/java/cc/skysparkle/sparkledns/Providers.kt index 883c9e8..03a31f8 100644 --- a/app/src/main/java/cc/skysparkle/sparkledns/Providers.kt +++ b/app/src/main/java/cc/skysparkle/sparkledns/Providers.kt @@ -17,6 +17,7 @@ data class DohProvider( val bootstrap: List = 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 { val builtInByHost = Providers.builtIn.associateBy { it.url.toHttpUrlOrNull()?.host } val seen = HashSet() @@ -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 diff --git a/app/src/main/res/drawable/ic_donate.xml b/app/src/main/res/drawable/ic_donate.xml new file mode 100644 index 0000000..32e2a69 --- /dev/null +++ b/app/src/main/res/drawable/ic_donate.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ffc0e9f..ba9f18e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -84,6 +84,7 @@ System %1$d von %2$d über DNS Datenschutzerklärung + Spenden Open-Source-Lizenzen SparkleDNS basiert auf diesen Open-Source-Projekten. Tippe auf ein Projekt, um seine Seite zu öffnen. Sperrlisten-Daten (bei Bedarf geladen, nicht enthalten) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 02674df..2c19ab0 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -84,6 +84,7 @@ システム %2$d 件中 %1$d 件が DNS 経由 プライバシーポリシー + 寄付する オープンソースライセンス SparkleDNS は以下のオープンソースプロジェクトで作られています。タップするとプロジェクトのページを開きます。 ブロックリストのデータ(必要なときにダウンロード、同梱なし) diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 3664c15..180585d 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -84,6 +84,7 @@ Sistema %1$d iš %2$d per DNS Privatumo politika + Paaukoti Atvirojo kodo licencijos SparkleDNS sukurta naudojant šiuos atvirojo kodo projektus. Palieskite projektą, kad atidarytumėte jo puslapį. Blokavimo sąrašų duomenys (atsisiunčiami pagal poreikį, neįtraukti) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 7b320c4..7cb8432 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -84,6 +84,7 @@ Системные %1$d из %2$d через DNS Политика конфиденциальности + Пожертвовать Лицензии открытого ПО SparkleDNS построен на этих проектах с открытым кодом. Нажмите на проект, чтобы открыть его страницу. Данные блоклистов (загружаются по запросу, не входят в приложение) diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 665a6a5..5f92465 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -84,6 +84,7 @@ 系统 %2$d 个中有 %1$d 个经过 DNS 隐私政策 + 捐赠 开源许可 SparkleDNS 使用了以下开源项目。点按项目可打开其页面。 屏蔽列表数据(按需下载,未内置) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a7f65d1..2c3df51 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -85,6 +85,7 @@ System %1$d of %2$d via DNS Privacy policy + Donate Open-source licenses SparkleDNS is built with these open-source projects. Tap a project to open its page. Blocklist data (downloaded on demand, not bundled) diff --git a/servers/servers.txt b/servers/servers.txt index 45fff86..0a92fcc 100644 --- a/servers/servers.txt +++ b/servers/servers.txt @@ -1,8 +1,8 @@ # SparkleDNS server list. How to add a server: see CONTRIBUTING.md -# Name | DoH URL | Privacy policy | h3 (optional) +# Name | DoH URL | Privacy policy | h3 (optional) | Donation page (optional) SkySparkle | https://blog.skysparkle.cc/dns-query | https://skysparkle.cc/privacy?lang=en | h3 -Quad9 | https://dns.quad9.net/dns-query | https://quad9.net/service/privacy/ -Digitale Gesellschaft | https://dns.digitale-gesellschaft.ch/dns-query | https://www.digitale-gesellschaft.ch/dns/ | h3 +Quad9 | https://dns.quad9.net/dns-query | https://quad9.net/service/privacy/ | https://quad9.net/donate/ +Digitale Gesellschaft | https://dns.digitale-gesellschaft.ch/dns-query | https://www.digitale-gesellschaft.ch/dns/ | h3 | https://www.digitale-gesellschaft.ch/uber-uns/unterstuetzer-werden/ UncensoredDNS | https://anycast.uncensoreddns.org/dns-query | https://blog.uncensoreddns.org/faq/ -Freifunk München | https://doh.ffmuc.net/dns-query | https://ffmuc.net/dns-privacy/ | h3 +Freifunk München | https://doh.ffmuc.net/dns-query | https://ffmuc.net/dns-privacy/ | h3 | https://spende.ffmuc.net/