From 26f9dc3ea3f90c23067a96381bba37b28c2a0871 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 17 Jan 2023 02:31:48 +0000 Subject: implement skweet widget --- Cargo.lock | 442 +++++++++++++++++++++++++++++++++++--- Cargo.toml | 1 + src/main.rs | 32 ++- static/style.css | 24 ++- templates/latestskweets.html.tera | 26 +-- 5 files changed, 477 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c2e24d8..7f78512 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,7 +114,7 @@ dependencies = [ "native-tls", "serde", "serde_json", - "url", + "url 2.3.1", ] [[package]] @@ -134,6 +134,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" +dependencies = [ + "byteorder", + "safemem", +] + [[package]] name = "base64" version = "0.13.1" @@ -183,12 +193,65 @@ version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +[[package]] +name = "bytecount" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +[[package]] +name = "camino" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + [[package]] name = "cc" version = "1.0.78" @@ -214,8 +277,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "iana-time-zone", + "js-sys", "num-integer", "num-traits", + "serde", + "time 0.1.45", + "wasm-bindgen", "winapi 0.3.9", ] @@ -227,7 +294,7 @@ checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" dependencies = [ "chrono", "chrono-tz-build", - "phf", + "phf 0.11.1", ] [[package]] @@ -237,7 +304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" dependencies = [ "parse-zoneinfo", - "phf", + "phf 0.11.1", "phf_codegen", ] @@ -271,11 +338,11 @@ dependencies = [ "base64 0.20.0", "hkdf", "hmac", - "percent-encoding", + "percent-encoding 2.2.0", "rand", "sha2", "subtle", - "time", + "time 0.3.17", "version_check", ] @@ -324,6 +391,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctor" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "ctr" version = "0.9.2" @@ -427,6 +504,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "either" version = "1.8.0" @@ -442,6 +525,24 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "erased-serde" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ca605381c017ec7a5fef5e548f1cfaa419ed0f6df6367339300db74c92aa7d" +dependencies = [ + "serde", +] + +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -514,7 +615,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "percent-encoding", + "percent-encoding 2.2.0", ] [[package]] @@ -560,6 +661,7 @@ checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -582,12 +684,34 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +[[package]] +name = "futures-executor" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +[[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.25" @@ -609,6 +733,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -648,7 +773,7 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -697,7 +822,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ - "bytes", + "bytes 1.3.0", "fnv", "futures-core", "futures-sink", @@ -758,7 +883,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes", + "bytes 1.3.0", "fnv", "itoa", ] @@ -769,7 +894,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes", + "bytes 1.3.0", "http", "pin-project-lite", ] @@ -798,7 +923,7 @@ version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ - "bytes", + "bytes 1.3.0", "futures-channel", "futures-core", "futures-util", @@ -816,13 +941,30 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-old-types" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6896be51ecf3966c0fa14ff2da3233dbb9aef57ccea1be1afe55f105f4d4c9c4" +dependencies = [ + "base64 0.9.3", + "bytes 0.4.12", + "httparse", + "language-tags", + "log", + "mime", + "percent-encoding 1.0.1", + "time 0.1.45", + "unicase", +] + [[package]] name = "hyper-tls" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes", + "bytes 1.3.0", "hyper", "native-tls", "tokio", @@ -853,6 +995,17 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.3.0" @@ -950,6 +1103,16 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +[[package]] +name = "isolang" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64fd6448ee8a45ce6e4365c58e4fa7d8740cba2ed70db3e9ab4879ebd93eaaa" +dependencies = [ + "phf 0.10.1", + "serde", +] + [[package]] name = "itoa" version = "1.0.5" @@ -975,6 +1138,12 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + [[package]] name = "lazy_static" version = "1.4.0" @@ -1030,6 +1199,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", + "serde", + "value-bag", ] [[package]] @@ -1047,6 +1218,34 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "mastodon-async" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5961affee0e9241470ca0223bbf1f415f9836cce312f77391e1961d64d5cca" +dependencies = [ + "chrono", + "doc-comment", + "futures", + "futures-util", + "hyper-old-types", + "isolang", + "log", + "percent-encoding 2.2.0", + "reqwest", + "serde", + "serde_json", + "serde_qs", + "serde_urlencoded", + "skeptic", + "static_assertions", + "tap-reader", + "tokio", + "tokio-util", + "url 1.7.2", + "uuid", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1056,6 +1255,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + [[package]] name = "memchr" version = "2.5.0" @@ -1068,6 +1273,16 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -1104,7 +1319,7 @@ checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -1138,7 +1353,7 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" dependencies = [ - "bytes", + "bytes 1.3.0", "encoding_rs", "futures-util", "http", @@ -1365,6 +1580,12 @@ dependencies = [ "syn", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + [[package]] name = "percent-encoding" version = "2.2.0" @@ -1415,13 +1636,22 @@ dependencies = [ "sha2", ] +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + [[package]] name = "phf" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ - "phf_shared", + "phf_shared 0.11.1", ] [[package]] @@ -1431,7 +1661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" dependencies = [ "phf_generator", - "phf_shared", + "phf_shared 0.11.1", ] [[package]] @@ -1440,10 +1670,19 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ - "phf_shared", + "phf_shared 0.11.1", "rand", ] +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + [[package]] name = "phf_shared" version = "0.11.1" @@ -1512,6 +1751,17 @@ dependencies = [ "yansi", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + [[package]] name = "quote" version = "1.0.23" @@ -1622,7 +1872,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64 0.13.1", - "bytes", + "bytes 1.3.0", "encoding_rs", "futures-core", "futures-util", @@ -1635,17 +1885,19 @@ dependencies = [ "js-sys", "log", "mime", + "mime_guess", "native-tls", "once_cell", - "percent-encoding", + "percent-encoding 2.2.0", "pin-project-lite", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", + "tokio-util", "tower-service", - "url", + "url 2.3.1", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1663,7 +1915,7 @@ dependencies = [ "atomic", "atty", "binascii", - "bytes", + "bytes 1.3.0", "either", "figment", "futures", @@ -1682,7 +1934,7 @@ dependencies = [ "serde_json", "state", "tempfile", - "time", + "time 0.3.17", "tokio", "tokio-stream", "tokio-util", @@ -1735,14 +1987,14 @@ dependencies = [ "log", "memchr", "pear", - "percent-encoding", + "percent-encoding 2.2.0", "pin-project-lite", "ref-cast", "serde", "smallvec", "stable-pattern", "state", - "time", + "time 0.3.17", "tokio", "uncased", ] @@ -1759,6 +2011,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "same-file" version = "1.0.6" @@ -1818,6 +2076,15 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +dependencies = [ + "serde", +] + [[package]] name = "serde" version = "1.0.152" @@ -1838,6 +2105,15 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_fmt" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2963a69a2b3918c1dc75a45a18bd3fcd1120e31d3f59deb1b2f9b5d5ffb8baa4" +dependencies = [ + "serde", +] + [[package]] name = "serde_json" version = "1.0.91" @@ -1849,6 +2125,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_qs" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cac3f1e2ca2fe333923a1ae72caca910b98ed0630bb35ef6f8c8517d6e81afa" +dependencies = [ + "percent-encoding 2.2.0", + "serde", + "thiserror", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1901,6 +2188,7 @@ name = "site" version = "0.1.0" dependencies = [ "listenbrainz", + "mastodon-async", "reqwest", "rocket", "rocket_dyn_templates", @@ -1908,6 +2196,21 @@ dependencies = [ "tokio", ] +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + [[package]] name = "slab" version = "0.4.7" @@ -1966,12 +2269,27 @@ dependencies = [ "loom", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "subtle" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "sval" +version = "1.0.0-alpha.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45f6ee7c7b87caf59549e9fe45d6a69c75c8019e79e212a835c5da0e92f0ba08" +dependencies = [ + "serde", +] + [[package]] name = "syn" version = "1.0.107" @@ -1983,6 +2301,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tap-reader" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f13fc301d415a8cd4529ba679720c59f07369bcff573618a6e8d5afebefb6f3" + [[package]] name = "tempfile" version = "3.3.0" @@ -2008,7 +2332,7 @@ dependencies = [ "globwalk", "humansize", "lazy_static", - "percent-encoding", + "percent-encoding 2.2.0", "pest", "pest_derive", "rand", @@ -2057,6 +2381,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi 0.3.9", +] + [[package]] name = "time" version = "0.3.17" @@ -2106,7 +2441,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" dependencies = [ "autocfg", - "bytes", + "bytes 1.3.0", "libc", "memchr", "mio 0.8.5", @@ -2157,7 +2492,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes", + "bytes 1.3.0", "futures-core", "futures-sink", "pin-project-lite", @@ -2329,6 +2664,15 @@ dependencies = [ "unic-common", ] +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -2372,6 +2716,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + [[package]] name = "url" version = "2.3.1" @@ -2379,8 +2734,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna", - "percent-encoding", + "idna 0.3.0", + "percent-encoding 2.2.0", +] + +[[package]] +name = "uuid" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +dependencies = [ + "getrandom", ] [[package]] @@ -2389,6 +2753,20 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.0.0-alpha.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" +dependencies = [ + "ctor", + "erased-serde", + "serde", + "serde_fmt", + "sval", + "version_check", +] + [[package]] name = "vcpkg" version = "0.2.15" @@ -2422,6 +2800,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index c05bd31..4c4c49a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] rocket = { version = "0.5.0-rc.2", features = ["json"] } reqwest = { version = "0.11", features = ["json"] } +mastodon-async = "1.0" tokio = { version = "1", features = ["full"] } serde = { version = "1.0", features = ["derive"] } rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] } diff --git a/src/main.rs b/src/main.rs index 6efade0..1a2aab7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,7 @@ +use std::borrow::Cow; + use listenbrainz::raw::response::UserPlayingNowResponse; +use mastodon_async::{Data, Mastodon}; use rocket::fs::{relative, FileServer}; use rocket::http::Status; use rocket::response::Responder; @@ -58,11 +61,21 @@ async fn home() -> Template { let listenbrainz = listenbrainz::raw::Client::new(); let playingnow = listenbrainz.user_playing_now("celblossom").unwrap(); let listenbrainz_data = ScrobbleData::new(playingnow); - println!("{}", listenbrainz_data.is_scrobbling); + + let mut skinny_data = Data::default(); + skinny_data.base = Cow::from("https://skinnyver.se"); + let skinny_client = Mastodon::from(skinny_data); + let mut skweets = skinny_client + .statuses("cel", Default::default()) + .await + .unwrap() + .initial_items; + + skweets.truncate(6); Template::render( "home", - context! { is_live: false, listenbrainz: listenbrainz_data }, + context! { is_live: false, listenbrainz: listenbrainz_data, skweets: skweets }, ) } @@ -71,10 +84,17 @@ async fn contact() -> Template { Template::render("contact", context! {}) } +#[get("/plants")] +async fn plants() -> Result { + todo!() +} + // #[get("/test")] // async fn test() -> Result { -// let posts = reqwest::get("https://skinnyver.se/api/v1/accounts/cel/statuses").await; -// posts +// let posts = reqwest::get("https://skinnyver.se/api/v1/accounts/cel/statuses") +// .await? +// .json() +// .await?; // } #[catch(default)] @@ -99,7 +119,9 @@ fn error(status: Status, req: &Request) -> Template { #[tokio::main] async fn main() -> Result<(), rocket::Error> { let _rocket = rocket::build() - .attach(Template::fairing()) + .attach(Template::custom(|engines| { + engines.tera.autoescape_on(vec![]); + })) .mount("/", routes![home, contact]) .register("/", catchers![error]) .mount("/", FileServer::from(relative!("static"))) diff --git a/static/style.css b/static/style.css index 658197c..a8ce1c6 100644 --- a/static/style.css +++ b/static/style.css @@ -18,6 +18,7 @@ body { font-family: 'Go Mono'; padding: 0; margin: 0; + font-size: 14pt; } #page { @@ -227,6 +228,11 @@ iframe { z-index: -1; } +#skinnyverse h5 { + margin: 0; + padding: 0; +} + #latest-skweets { font-family: 'Cherry Bomb' !important; background-color: #0000; @@ -242,10 +248,19 @@ iframe { margin: 2em 0; } +.skweet a { + padding: 0; + border: 0; + margin: 0; + border-radius: 0; + background-color: #0000; + color: #bf42a0; + font-family: Karrik; +} + .skweet h2, .skweet h3, -.skweet h4, -.skweet h5 { +.skweet h4 { font-family: 'Cherry Bomb' !important; margin: 0; padding: 0; @@ -266,6 +281,11 @@ iframe { justify-content: space-between; } +.skweet-text { + margin-top: 0.8em; + margin-bottom: 0.8em; +} + .skweet-gallery { display: flex; max-width: 100%; diff --git a/templates/latestskweets.html.tera b/templates/latestskweets.html.tera index bcdc2fa..b2e8979 100644 --- a/templates/latestskweets.html.tera +++ b/templates/latestskweets.html.tera @@ -1,19 +1,21 @@

latest skweets

+ {% for skweet in skweets %} + {% if not skweet.reblog %}
- +
-

@cel

2h ago
-

@nyx @lain ikr? omg we have no choice but to stan our skinny legend

- -
-
-
- -
-

@cel

2h ago
-

@nyx @lain ikr? omg we have no choice but to stan our skinny legend

- + +
{{ skweet.content }}
+ {% if skweet.media_attachments[0] %} + + {% endif %}
+ {% endif %} + {% endfor %}
\ No newline at end of file -- cgit