From 4571e203180afbf0b9ad412c08109bba013b08a8 Mon Sep 17 00:00:00 2001 From: u <@> Date: Tue, 10 Mar 2026 08:23:57 +0200 Subject: a --- .gitignore | 3 + Cargo.lock | 897 ++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 27 ++ assets/_/about.html | 5 + assets/_/diary | 283 +++++++++++++++ assets/_/dollar.svg | 6 + assets/_/dollardark.svg | 17 + assets/_/header.html | 93 +++++ assets/_/home.html | 5 + assets/_/iansui.woff2 | Bin 0 -> 15368 bytes assets/_/menu.html | 5 + assets/favicon.ico | Bin 0 -> 270622 bytes package-lock.json | 6 + rustfmt.toml | 1 + src/lib.rs | 211 ++++++++++++ src/solar.rs | 314 +++++++++++++++++ wrangler.toml | 14 + 17 files changed, 1887 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 assets/_/about.html create mode 100644 assets/_/diary create mode 100644 assets/_/dollar.svg create mode 100644 assets/_/dollardark.svg create mode 100644 assets/_/header.html create mode 100644 assets/_/home.html create mode 100644 assets/_/iansui.woff2 create mode 100644 assets/_/menu.html create mode 100644 assets/favicon.ico create mode 100644 package-lock.json create mode 100644 rustfmt.toml create mode 100644 src/lib.rs create mode 100644 src/solar.rs create mode 100644 wrangler.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d27315f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +target +node_modules +.wrangler diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..7a07e59 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,897 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ataxia-rs" +version = "0.1.0" +dependencies = [ + "lazy_static", + "maud", + "num", + "regex", + "worker", + "worker-macros", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "js-sys", + "num-traits", + "wasm-bindgen", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "js-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "maud" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8156733e27020ea5c684db5beac5d1d611e1272ab17901a49466294b84fc217e" +dependencies = [ + "itoa", + "maud_macros", +] + +[[package]] +name = "maud_macros" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7261b00f3952f617899bc012e3dbd56e4f0110a038175929fa5d18e5a19913ca" +dependencies = [ + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasm-bindgen" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "worker" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7267f3baa986254a8dace6f6a7c6ab88aef59f00c03aaad6749e048b5faaf6f6" +dependencies = [ + "async-trait", + "bytes", + "chrono", + "futures-channel", + "futures-util", + "http", + "http-body", + "js-sys", + "matchit", + "pin-project", + "serde", + "serde-wasm-bindgen", + "serde_json", + "serde_urlencoded", + "tokio", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "worker-macros", + "worker-sys", +] + +[[package]] +name = "worker-macros" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7410081121531ec2fa111ab17b911efc601d7b6d590c0a92b847874ebeff0030" +dependencies = [ + "async-trait", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-macro-support", + "worker-sys", +] + +[[package]] +name = "worker-sys" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4777582bf8a04174a034cb336f3702eb0e5cb444a67fdaa4fd44454ff7e2dd95" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..fa568ae --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "ataxia-rs" +version = "0.1.0" +edition = "2021" +authors = ["user"] + +[lib] +crate-type = ["cdylib"] + +[dependencies] +worker = { version = "0.7" } +worker-macros = { version = "0.7" } +maud = { version = "0.27.0" } +lazy_static = "1.5.0" +num = { version = "0.4.3", default-features = false } +regex = "1.12.3" + +[profile.release] +lto = true +strip = true +codegen-units = 1 +overflow-checks = false + + +[profile.dev] +overflow-checks = false + diff --git a/assets/_/about.html b/assets/_/about.html new file mode 100644 index 0000000..e46ece1 --- /dev/null +++ b/assets/_/about.html @@ -0,0 +1,5 @@ +
+Ataxia is a nervous system dysfunction consisting of poor coördination of muscle movements such as gait abnormalities, slurring of speech, and eye movement issues.
+
+Hosted on Cloudflare Workers. Source available once I sort the mess out.
+
+No. Stop.
+
+Check out the shitpit in the meantime.
+
"))
+ }
+ } else {
+ html! { (PreEscaped(l)) "\n" }
+ }
+ }) {
+ (x)
+ }
+ }
+ })
+ })
+ .get("/", |_, _| {
+ bone("home", "ataxia.moe: like i heard a transmission from Apollo 13", html! {
+ p style="padding: 1vw" {
+ "No. Stop." br; br; "Check out "
+ a href="/shitpit" { "the shitpit" }
+ " in the meantime."
+ }
+ })
+ })
+ .get("/about", |_, _| {
+ bone("about", "And they completely goddamn disrespected me! Little idiots! Idiots!", html! {
+ p style="padding: 1vw" {
+ "Ataxia is a nervous system dysfunction consisting of poor coördination of muscle movements such as gait abnormalities, slurring of speech, and eye movement issues."
+ br; br;
+ "Hosted on "
+ a href="https://developers.cloudflare.com/workers/" { "Cloudflare Workers" }
+ ". Source available once I sort the mess out."
+ }
+ })
+ })
+ .or_else_any_method("/*catchall", |_, _| {
+ Ok(bone("", "404 Not Found", html! {
+ p style="padding: 1vw" { "what?" }
+ })?.with_status(404))
+ })
+ .run(req, env)
+ .await
+}
+
+fn header() -> Markup {
+ let css = r#"/* i dont know css im so fucking sorry ill fix it l8r */
+pre {
+ white-space: pre-wrap;
+ white-space: -moz-pre-wrap;
+ white-space: -pre-wrap;
+ white-space: -o-pre-wrap;
+ word-wrap: break-word;
+}
+.remark {
+ box-sizing: content-box;
+ border-top: 0px solid #000;
+ border-left: 0px solid #000;
+ border-right: 0px solid #000;
+ border-bottom: 1px solid #000;
+ padding: 1vw;
+ padding-top: 0;
+}
+.nav {
+ border-bottom: 1px solid #000;
+ padding: 1vw;
+ padding-top: 0;
+}
+main {
+ border: 1px #000 solid;
+}
+body {
+ background-color: #eee;
+}
+
+@media only screen and (min-width: 800px) {
+
+ p, a.sec, pre {
+ padding: 0 4vw;
+/*align: center;
+display:flex;
+align-items: center;
+justify-content: center;*/
+ }
+}
+pre {
+ font-size: 12pt;
+}
+a, p { font-size: 14pt; }
+a.splink { color: #005953; font-size: inherit; }
+a.sec, a.menu, a.menuon {
+ color: #005953;
+ font-family: 'Iansui', serif;
+ font-size: 1.5em;
+}
+a.sec:link, a.sec:visited, a.sec:active {
+ text-decoration: none;
+}
+a.sec:hover, a.sec:focus {
+ text-decoration: underline;
+}
+a.menu:link, a.menu:visited, a.menu:active {
+ text-decoration: none;
+}
+a.menu:hover, a.menu:focus {
+ text-decoration: underline;
+}
+@media (prefers-color-scheme: dark) {
+ body {
+ background-color: #222;
+ color: #dcdccc;
+ }
+ .nav, .remark {
+ border-bottom: 1px solid #dcdccc;
+ }
+ main {
+ border: 1px #dcdccc solid;
+ }
+ a.splink, a.sec, a.menu, a.menuon { color: #51bd96; }
+}
+@font-face {
+ font-family: 'Iansui';
+ font-style: normal;
+ font-display: swap;
+ font-weight: 400;
+ src: url(/_/iansui.woff2) format('woff2');
+ unicode-range: U+3000-303F,U+3105-312F,U+4E00-9FFF;
+}
+body {
+ max-width: 960px;
+ margin-left: auto;
+ margin-right: auto;
+}"#;
+ html! {
+ (DOCTYPE)
+ style { (PreEscaped(css)) }
+ (PreEscaped(r#""#))
+ }
+}
+
+fn menu(nav: &str) -> Markup {
+ html! {
+ div class="nav" {
+ @let navs = ["home", "shitpit", "about"];
+ @for (i, &n) in navs.iter().enumerate() {
+ a class=({if n == nav { "menuon" } else { "menu" }}) href={"/" (n)} {
+ (n)
+ }
+ @if i != navs.len() - 1 {
+ " / "
+ }
+ }
+ }
+ }
+}
+
+fn bone(wh: &str, rm: &str, b: Markup) -> Result {
+ Response::from_html(
+ (html! {
+ (header())
+ main id="content" {
+ h2 class="remark" { (rm) }
+ (menu(wh))
+ (b)
+ }
+ })
+ .into_string(),
+ )
+}
diff --git a/src/solar.rs b/src/solar.rs
new file mode 100644
index 0000000..af52afc
--- /dev/null
+++ b/src/solar.rs
@@ -0,0 +1,314 @@
+#![allow(non_upper_case_globals)]
+#![allow(invalid_value)]
+#![allow(non_snake_case)]
+#![allow(dead_code)]
+
+// based on https://prospertimes.neocities.org/solarterms.js
+use lazy_static::lazy_static;
+use num::{cast, traits::AsPrimitive};
+use std::num::Wrapping as W;
+use std::{
+ f64::consts::PI,
+ mem::MaybeUninit,
+ ops::{Div, Rem},
+};
+
+// this is so stupid. i should not have to put pub every single line
+pub struct Term {
+ pub solar_term: &'static str,
+ pub ang: usize,
+ pub month: usize,
+ pub earliest_day: usize,
+ pub latest_day: usize,
+}
+
+#[cfg_attr(not(target_family = "wasm"), derive(Debug))]
+pub struct SexagenaryDate {
+ pub year: &'static str,
+ pub month: &'static str,
+ pub day: &'static str,
+ pub term: Option<(&'static str, usize)>,
+}
+
+const UNIT_YR: usize = 1984;
+
+// cant use [].map(|(...)| Term {}) on consts
+// this sucks, i should not have2 write design8ed initializers each&everytime
+macro_rules! terms {
+ ($({ $s: expr, $a: expr, $m: expr, $e: expr, $l: expr }),* $(,)?) => {
+ [
+ $(Term {
+ solar_term: $s,
+ ang: $a,
+ month: $m,
+ earliest_day: $e,
+ latest_day: $l,
+ }),*
+ ]
+ };
+}
+
+pub const TERMS: [Term; 24] = terms![
+ {"小寒", 285, 1, 3, 7},
+ {"大寒", 300, 1, 18, 22},
+ {"立春", 315, 2, 2, 6},
+ {"雨水", 330, 2, 16, 20},
+ {"驚蟄", 345, 3, 3, 7},
+ {"春分", 360, 3, 18, 22},
+ {"淸明", 15, 4, 2, 6},
+ {"穀雨", 30, 4, 18, 22},
+ {"立夏", 45, 5, 3, 7},
+ {"小滿", 60, 5, 19, 23},
+ {"芒種", 75, 6, 3, 7},
+ {"夏至", 90, 6, 19, 23},
+ {"小暑", 105, 7, 5, 9},
+ {"大暑", 120, 7, 20, 24},
+ {"立秋", 135, 8, 5, 9},
+ {"處暑", 150, 8, 21, 25},
+ {"白露", 165, 9, 5, 9},
+ {"秋分", 180, 9, 21, 25},
+ {"寒露", 195, 10, 6, 10},
+ {"霜降", 210, 10, 21, 25},
+ {"立冬", 225, 11, 5, 9},
+ {"小雪", 240, 11, 20, 24},
+ {"大雪", 255, 12, 5, 9},
+ {"冬至", 270, 12, 19, 23},
+];
+
+fn compute_JD(mut y: f64, mut m: f64, d: f64) -> f64 {
+ if m <= 2. {
+ y -= 1.;
+ m += 12.;
+ }
+ (365.25 * (y + 4716.)).floor() + (30.6001 * (m + 1.)).floor() + d
+ - 13.
+ - 1524.5
+}
+
+macro_rules! JD {
+ ($y: expr, $m: expr, $d: expr) => {
+ compute_JD($y as f64, $m as f64, $d as f64)
+ };
+}
+
+// dont ask me how this works
+fn compute_ang(jd: f64) -> f64 {
+ let T = (jd - 2451545.) / 36525.;
+ let Lmean = (280.46646 + (36000.76983 * T) + (0.0003032 * T * T)) % 360.;
+ let M = (357.52911 + (35999.05029 * T) - (0.0001537 * T * T)) % 360.;
+ let C = ((1.914602 - (0.004817 * T) - (0.000014 * T * T))
+ * (M * PI / 180.).sin())
+ + ((0.019993 - (0.000101 * T)) * (2. * M * PI / 180.).sin())
+ + (0.000289 * (3. * M * PI / 180.).sin());
+ let Ltrue = Lmean + C;
+ let Lapp = Ltrue
+ - 0.00569
+ - (0.00478 * ((125.04 - 1934.136 * T) * PI / 180.).sin());
+ Lapp
+}
+
+fn bisect(
+ lo: &mut f64,
+ hi: &mut f64,
+ base: T,
+ scale: T,
+ target: f64,
+ y: usize,
+ m: f64,
+) where
+ T: Into + Copy,
+{
+ while lo <= hi {
+ let mid = ((*lo + *hi) / 2.).floor();
+ if compute_ang(JD!(y, m, base.into() + mid * scale.into())) < target {
+ *lo = mid + 1.;
+ } else {
+ *hi = mid - 1.;
+ }
+ }
+}
+
+fn compute_solarterm_day(i: usize, y: usize) -> f64 {
+ //double solarterm_day, test_day, test_hour, test_minute, test_long;
+ let mut solarterm_day;
+ let m: f64 = TERMS[i].month as f64;
+ let mut epd: f64 = TERMS[i].earliest_day as f64; // earliest possible day
+ let mut lpd: f64 = TERMS[i].latest_day as f64; // latest possible day
+ let mut eph: f64 = 0.; // earliest possible hour
+ let mut lph: f64 = 23.; // latest possible hour
+ let mut epm: f64 = 0.; // earliest possible minute
+ let mut lpm: f64 = 59.; // latest possible minute
+ let target_long: f64 = TERMS[i].ang as f64;
+ bisect(&mut epd, &mut lpd, 0, 1, target_long, y, m);
+ solarterm_day = lpd;
+ bisect(
+ &mut eph,
+ &mut lph,
+ solarterm_day,
+ 1. / 24.,
+ target_long,
+ y,
+ m,
+ );
+ solarterm_day += lph / 24.;
+ bisect(
+ &mut epm,
+ &mut lpm,
+ solarterm_day,
+ 1. / 1440.,
+ target_long,
+ y,
+ m,
+ );
+ solarterm_day + (lpm + 1.) / 1440.
+}
+
+#[inline(always)]
+fn align(a: T, to: T, zero: T) -> usize
+where
+ T: cast::AsPrimitive,
+{
+ let (a, to, zero) = (a.as_(), to.as_(), zero.as_());
+ let tmp = a + (to - zero);
+ (tmp - to * (tmp >= to) as isize) as usize
+}
+
+#[inline(always)]
+fn mod2ganzhi(g: T, z: T) -> usize
+where
+ T: cast::AsPrimitive,
+{
+ let (g, z) = (g.as_(), z.as_());
+ // chinese remainder theorem
+ // x ≡ g (mod 10)
+ // x ≡ z (mod 12)
+ // 10x + 12y = gcd(10,12) = 2
+ // x=-1, y=1
+ // X=(g-z)/gcd(10,12)=(g-z)/2
+ // 10xX + 12yX = 2X
+ // => -10X + 12X = 2X
+ // => -5(g-z) + 6(g-z) = g-z
+ // x = g-(-5(g-z)) (case 1) = 6(g-z)+z (case 2)
+ // x = g+5(g-z) = 6g-5z
+ // dont ask me how the math works idk
+ align(6 * g - 5 * z, 60, 0)
+}
+
+fn stday(i: usize, y: usize) -> f64 {
+ const YEARS: usize = 200;
+ // rust doesnt have (*a)[n], | @ least ill have2 use a cr8 4 it
+ // also lazy_static doesnt work with mutables (im not using mutex)
+ assert!(y < UNIT_YR + YEARS && UNIT_YR <= y);
+ static mut STDAYS: Vec = vec![];
+ static mut INIT: bool = false;
+ unsafe {
+ if !INIT {
+ STDAYS = vec![0.; YEARS * TERMS.len()];
+ INIT = true;
+ }
+ let idx = y - UNIT_YR;
+ let ret = &mut STDAYS[idx * TERMS.len() + i];
+ (if int(*ret) != 0 {
+ *ret
+ } else {
+ let d = compute_solarterm_day(i, y);
+ *ret = d;
+ d
+ })
+ .floor()
+ }
+}
+
+lazy_static! {
+ static ref GANZHIS: Vec = {
+ let mut tmp: Vec = vec![];
+ tmp.reserve(60);
+ (0..60).for_each(|i| {
+ // looks so much worse than using format!()
+ // cant be bothered to benchmark
+ let mut s = gan[i % 10].to_string();
+ s.push(zhi[i % 12]);
+ tmp.push(s);
+ });
+ tmp
+ };
+}
+const gan: [char; 10] =
+ ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'];
+const zhi: [char; 12] = [
+ '子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥',
+];
+pub fn ganzhi(i: usize) -> &'static str {
+ &GANZHIS[i]
+}
+
+#[inline(always)]
+fn int(x: f64) -> usize {
+ x as usize
+}
+
+lazy_static! {
+ static ref JIAZI: usize = int(JD!(UNIT_YR, 1, 31));
+}
+pub fn solar(y: usize, m: usize, d: usize) -> SexagenaryDate {
+ let jdf = JD!(y, m, d);
+ let jd = int(jdf);
+ let a = compute_ang(jdf);
+ let ygz = (y
+ - UNIT_YR
+ - ((m <= 2 && a < 316.) && (m < 2 || d < int(stday(2, y)))) as usize)
+ % 60;
+ let rem = a % 15.;
+ let div = int(a.div(15.).floor());
+ let mut dz = align((div + 1) / 2, 12, 9);
+ let mut termb = rem > 14.;
+ let mut term: usize = unsafe { MaybeUninit::uninit().assume_init() };
+ if termb {
+ term = align(div, 24, 18);
+ let termday = stday(term, y);
+ termb = d == int(termday);
+ if (div & 1) == 0 {
+ dz += termb as usize;
+ dz = align(dz, 12, 12);
+ }
+ }
+ let mut tmp = ygz.rem(5);
+ tmp = tmp * 2 + 2;
+ tmp -= 10 * (tmp == 10) as usize;
+ let mgz = mod2ganzhi(tmp + align(dz, 12, 2).rem(10), dz);
+ let dgz = (jd - *JIAZI).rem(60);
+ SexagenaryDate {
+ year: ganzhi(ygz),
+ month: ganzhi(mgz),
+ day: ganzhi(dgz),
+ term: termb.then(|| (TERMS[term].solar_term, term)),
+ }
+}
+
+// https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week#Disparate_variation
+pub fn dow(y: usize, mut m: usize, d: usize) -> (&'static str, &'static str) {
+ let Y = y - (m <= 2) as usize;
+ let y2 = Y % 100;
+ let c = Y / 100;
+ m += 9;
+ m -= 12 * (m >= 12) as usize;
+ let a = (d + (26 * (m + 1) - 2) / 10 + y2 + y2 / 4 + c / 4 - 2 * c) % 7;
+ [
+ ("日", "Sun"),
+ ("月", "Mon"),
+ ("火", "Tue"),
+ ("水", "Wed"),
+ ("木", "Thu"),
+ ("金", "Fri"),
+ ("土", "Sat"),
+ ][a]
+}
+
+#[cfg(not(target_family = "wasm"))]
+fn main() {
+ (1..=12).for_each(|m| {
+ (1..28).for_each(|d| {
+ println!("{:?}", solar(2026, m, d));
+ });
+ });
+}
diff --git a/wrangler.toml b/wrangler.toml
new file mode 100644
index 0000000..b5d670b
--- /dev/null
+++ b/wrangler.toml
@@ -0,0 +1,14 @@
+name = "ataxia-rs"
+main = "build/index.js"
+compatibility_date = "2026-03-01"
+
+[build]
+command = "cargo install -q \"worker-build@^0.7\" && worker-build --release"
+
+[assets]
+directory = "./assets"
+binding = "ASSETS"
+
+[[kv_namespaces]]
+binding = "ataxia"
+id = "828dc8eb6d514054a382c3070dc94e8c"
--
cgit v1.2.3