Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/aienos.com/blob/main/crates/site-builder/src/components/support.rs
# aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`aienos.com / crates / site-builder / src / components / support.rs`
73 lines · 3937 bytes Raw Blame History
1 //! The support page and its CSS are authored in seeded Omega. The only
2 //! invitation elsewhere is the small header link added by [`enrich`].
3 use maud::{html, Markup, PreEscaped};
4
5 pub const TITLE: &str = "Support my open source work | AienOS";
6 pub const DESCRIPTION: &str = "Help Drake Stapleton keep building free and open source software with Bitcoin: the address, a wallet link and a QR code.";
7 pub const URL: &str = "https://www.aienos.com/support/";
8 pub const PAGE: &str = include_str!("../../../../om/support-page/main.html");
9
10 pub fn render_page() -> Markup { html! { (PreEscaped(PAGE)) } }
11
12 /// All document types get the same plain support link and local CSS.
13 pub fn enrich(mut page: String) -> String {
14 let header_end = page.find("").expect("support needs the shared header");
15 if !page[..header_end].contains("href=\"/support/\"") {
16 let nav_end = page[..header_end].rfind("").expect("support needs the shared nav");
17 page.insert_str(nav_end, "Support");
18 }
19 if !page.contains("href=\"/assets/support.css\"") {
20 let end = page.find("").expect("support needs a document head");
21 page.insert_str(end, "");
22 }
23 page
24 }
25
26 #[cfg(test)]
27 mod tests {
28 use super::*;
29 use sha2::{Digest, Sha256};
30 #[test]
31 fn support_artifacts_match_recorded_hashes() {
32 for (bytes, receipt) in [
33 (PAGE.as_bytes(), include_str!("../../../../om/support-page/main.html.sha256")),
34 (include_bytes!("../../../../public/assets/support.css").as_slice(), include_str!("../../../../om/support-page/support.css.sha256")),
35 ] {
36 assert_eq!(format!("{:x}", Sha256::digest(bytes)), receipt.split_whitespace().next().unwrap());
37 }
38 }
39 #[test]
40 fn support_is_one_bitcoin_action_with_no_x_money() {
41 assert!(PAGE.contains("Send Bitcoin"));
42 assert!(PAGE.contains("id=\"bitcoin\""));
43 for text in ["Bitcoin is the one way to give", "running low on funds"] {
44 assert!(PAGE.contains(text), "missing {text}");
45 }
46 for gone in ["X Money", "Send Money", "x.com/drakestapleton", "money.x.com", "github.com/sponsors"] {
47 assert!(!PAGE.contains(gone), "retired or absent payment rail {gone} is rendered");
48 }
49 assert_eq!(PAGE.matches("class=\"support-button\"").count(), 1, "one primary action");
50 assert!(PAGE.find("support-button").unwrap() < PAGE.find("support-card").unwrap(), "action before the steps");
51 assert!(!PAGE.contains("