Settings → About: version, website, release notes, sources, support, donations
Some checks are pending
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run

The About tab shows the version and links to the website (in the interface language),
the release notes of this version, the source code and the support contacts; "Support
the project" opens chess.vrubel.xyz/donate, which the website server sends on to
DONATE_URL (the support section while it is not set), so the donation service can change
without a new release. Links open in the browser (eframe "links": webbrowser, MIT OR
Apache-2.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-19 15:11:25 +03:00
parent 530f801ae9
commit 507e44b6ae
8 changed files with 452 additions and 6 deletions

View file

@ -58,6 +58,9 @@ struct Config {
stats_password: String,
/// Take the client address from `X-Forwarded-For` / `X-Real-IP` (behind nginx).
trust_proxy: bool,
/// Where `/donate` (the program's "Support the project") leads; the support
/// section of the page while it is empty.
donate_url: String,
}
impl Config {
@ -78,6 +81,7 @@ impl Config {
stats_user: var("STATS_USER", "admin"),
stats_password: var("STATS_PASSWORD", ""),
trust_proxy: var("TRUST_PROXY", "1") != "0",
donate_url: var("DONATE_URL", ""),
}
}
}
@ -207,6 +211,7 @@ async fn main() {
.route("/api/release", get(api_release))
.route("/download/{platform}", get(download))
.route("/hit", post(hit))
.route("/donate", get(donate))
.route("/stats", get(stats))
.route("/stats.csv", get(stats_csv))
.route("/healthz", get(|| async { "ok" }))
@ -405,6 +410,15 @@ async fn hit(
StatusCode::NO_CONTENT
}
/// `/donate`: the current donation page, so the program's link never has to change.
async fn donate(State(state): State<Shared>) -> Redirect {
if state.config.donate_url.is_empty() {
Redirect::temporary("/#support")
} else {
Redirect::temporary(&state.config.donate_url)
}
}
/// `/`: English, or `?lang=xx` → `/xx/`.
async fn home(state: State<Shared>, Query(q): Query<HashMap<String, String>>) -> Response {
if let Some(lang) = q.get("lang")