From 8b747c1c40876c6668191594eddcb260199cdb7f Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 21 Mar 2022 20:14:14 -0400 Subject: [PATCH] Rewrite the site routing with Axum (#441) * broken state Signed-off-by: Xe Iaso * fix??? Signed-off-by: Xe Iaso * Port everything else to axum Signed-off-by: Xe * headers Signed-off-by: Xe Iaso * site update post Signed-off-by: Christine Dodrill * fix headers Signed-off-by: Xe Iaso * remove warp example Signed-off-by: Xe Iaso * 80c wrap Signed-off-by: Xe Iaso * bump version Signed-off-by: Xe Iaso --- Cargo.lock | 1135 ++++++++++------- Cargo.toml | 20 +- blog/site-update-axum-2022-03-21.markdown | 81 ++ examples/warp.rs | 14 - lib/go_vanity/Cargo.toml | 15 - lib/go_vanity/src/build.rs | 5 - lib/go_vanity/src/lib.rs | 12 - lib/go_vanity/templates/github.rs.html | 14 - lib/mi/src/lib.rs | 4 +- src/domainsocket.rs | 94 ++ src/handlers/blog.rs | 57 +- src/handlers/feeds.rs | 95 +- src/handlers/gallery.rs | 30 +- src/handlers/mod.rs | 175 ++- src/handlers/talks.rs | 30 +- src/main.rs | 407 +++--- src/post/mod.rs | 6 +- .../templates => templates}/gitea.rs.html | 0 18 files changed, 1272 insertions(+), 922 deletions(-) create mode 100644 blog/site-update-axum-2022-03-21.markdown delete mode 100644 examples/warp.rs delete mode 100644 lib/go_vanity/Cargo.toml delete mode 100644 lib/go_vanity/src/build.rs delete mode 100644 lib/go_vanity/src/lib.rs delete mode 100644 lib/go_vanity/templates/github.rs.html create mode 100644 src/domainsocket.rs rename {lib/go_vanity/templates => templates}/gitea.rs.html (100%) diff --git a/Cargo.lock b/Cargo.lock index 3780d81..3266255 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.15.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] @@ -40,13 +40,28 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "annotate-snippets" version = "0.9.1" @@ -56,15 +71,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - [[package]] name = "ansi_term" version = "0.12.1" @@ -80,6 +86,31 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "async-compression" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bf394cfbbe876f0ac67b13b6ca819f9c9f2fb9ec67223cceb1555fbab1c31a" +dependencies = [ + "brotli", + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "async-trait" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atty" version = "0.2.14" @@ -93,15 +124,88 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "axum" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9f346c92c1e9a71d14fe4aaf7c2a5d9932cc4e5e48d8fb6641524416eb79ddd" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbcda393bef9c87572779cb8ef916f12d77750b27535dd6819fa86591627a51" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", +] + +[[package]] +name = "axum-extra" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b6d79bc9c2975821d39c7df31ea766026beb9efe28c076a48cfd7d50f34f18" +dependencies = [ + "axum", + "bytes", + "http", + "mime", + "pin-project-lite", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5b2a9133b2658e684c8ea04157a8bd48dac7906a2eb884ffebfb051af123394" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "backtrace" -version = "0.3.59" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744" +checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" dependencies = [ "addr2line", "cc", @@ -135,9 +239,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitvec" -version = "0.19.5" +version = "0.19.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321" +checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33" dependencies = [ "funty", "radium", @@ -163,7 +267,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", ] [[package]] @@ -176,20 +280,31 @@ dependencies = [ ] [[package]] -name = "buf_redux" -version = "0.8.4" +name = "brotli" +version = "3.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +checksum = "f838e47a451d5a8fa552371f80024dd6ace9b7acdf25c4c3d0f9bc6816fb1c39" dependencies = [ - "memchr", - "safemem", + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", ] [[package]] name = "bumpalo" -version = "3.7.1" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "byte-tools" @@ -217,9 +332,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.70" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" [[package]] name = "cfcache" @@ -252,7 +367,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time", + "time 0.1.43", "winapi", ] @@ -267,11 +382,11 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term 0.11.0", + "ansi_term", "atty", "bitflags", "strsim", @@ -282,9 +397,9 @@ dependencies = [ [[package]] name = "color-eyre" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6ec7641ff3474b7593009c809db602c414cd97c7d47a78ed004162b74ff96c" +checksum = "8ebf286c900a6d5867aeff75cfee3192857bb7f24b547d4f0df2ed6baa812c90" dependencies = [ "backtrace", "color-spantrace", @@ -321,17 +436,23 @@ dependencies = [ "regex", "shell-words", "syntect", - "twoway 0.2.2", + "twoway", "typed-arena", "unicode_categories", "xdg", ] [[package]] -name = "core-foundation" -version = "0.9.1" +name = "convert_case" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -339,28 +460,61 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +dependencies = [ + "cfg-if", + "lazy_static", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn", +] + [[package]] name = "dhall" version = "0.11.0" @@ -413,7 +567,27 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array 0.14.5", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", ] [[package]] @@ -422,12 +596,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" -[[package]] -name = "dtoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" - [[package]] name = "either" version = "1.6.1" @@ -436,18 +604,18 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elsa" -version = "1.4.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848344296205756adc00ab3bec02658da0f72eaa1461474aa2d51d64311876a5" +checksum = "2b4b5d23ed6b6948d68240aafa4ac98e568c9a020efd9d4201a6288bc3006e09" dependencies = [ "stable_deref_trait", ] [[package]] name = "encoding_rs" -version = "0.8.28" +version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ "cfg-if", ] @@ -498,9 +666,9 @@ checksum = "649cfd341410b1f8906e8ca1b39e5534be9312fda9182edd770cec34dfbce8d7" [[package]] name = "eyre" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc225d8f637923fe585089fcf03e705c222131232d2c1fb622e84ecf725d0eb8" +checksum = "9289ed2c0440a6536e65119725cf91fc2c6b5e513bfd2e36e1134d7cca6ca12f" dependencies = [ "indenter", "once_cell", @@ -512,6 +680,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "fastrand" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +dependencies = [ + "instant", +] + [[package]] name = "flate2" version = "1.0.22" @@ -563,9 +740,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" +checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" dependencies = [ "futures-channel", "futures-core", @@ -578,9 +755,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" dependencies = [ "futures-core", "futures-sink", @@ -588,15 +765,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" [[package]] name = "futures-executor" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" dependencies = [ "futures-core", "futures-task", @@ -605,18 +782,16 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" +checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" [[package]] name = "futures-macro" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" +checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "autocfg", - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -624,23 +799,22 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" [[package]] name = "futures-task" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" [[package]] name = "futures-util" -version = "0.3.17" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" dependencies = [ - "autocfg", "futures-channel", "futures-core", "futures-io", @@ -650,8 +824,6 @@ dependencies = [ "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -666,9 +838,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" dependencies = [ "typenum", "version_check", @@ -676,20 +848,20 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] name = "gimli" -version = "0.24.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "glob" @@ -697,20 +869,11 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -[[package]] -name = "go_vanity" -version = "0.2.0" -dependencies = [ - "mime", - "ructe", - "warp", -] - [[package]] name = "h2" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" +checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b" dependencies = [ "bytes", "fnv", @@ -721,15 +884,15 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util", + "tokio-util 0.6.9", "tracing", ] [[package]] name = "half" -version = "1.7.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" @@ -738,29 +901,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] -name = "headers" -version = "0.3.4" +name = "hdrhistogram" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" +checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0" dependencies = [ "base64", - "bitflags", - "bytes", - "headers-core", - "http", - "mime", - "sha-1 0.9.8", - "time", + "byteorder", + "crossbeam-channel", + "flate2", + "nom 7.1.1", + "num-traits", ] [[package]] -name = "headers-core" -version = "0.2.0" +name = "heck" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -788,9 +946,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" +checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" dependencies = [ "bytes", "fnv", @@ -799,9 +957,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes", "http", @@ -809,16 +967,22 @@ dependencies = [ ] [[package]] -name = "httparse" -version = "1.5.1" +name = "http-range-header" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + +[[package]] +name = "httparse" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" [[package]] name = "httpdate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -831,9 +995,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.13" +version = "0.14.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" +checksum = "043f0e083e9901b6cc658a77d1eb86f4fc650bbb977a4337dd63192826aa85dd" dependencies = [ "bytes", "futures-channel", @@ -885,9 +1049,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" dependencies = [ "autocfg", "hashbrown", @@ -895,18 +1059,27 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716d3d89f35ac6a34fd0eed635395f4c3b76fa889338a4632e5231a8684216bd" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] [[package]] name = "ipnet" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" +checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" + +[[package]] +name = "iri-string" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0f7638c1e223529f1bfdc48c8b133b9e0b434094d1d28473161ee48b235f78" +dependencies = [ + "nom 7.1.1", +] [[package]] name = "itertools" @@ -919,24 +1092,24 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] [[package]] name = "itoa" -version = "0.4.8" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "js-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" dependencies = [ "wasm-bindgen", ] @@ -984,9 +1157,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.102" +version = "0.2.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103" +checksum = "ad5c14e80759d0939d013e6ca49930e59fc53dd8e5009132f76240c179380c09" [[package]] name = "line-wrap" @@ -1005,9 +1178,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" dependencies = [ "scopeguard", ] @@ -1033,6 +1206,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "matchit" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9376a4f0340565ad675d11fc1419227faf5f60cd7ac9cb2e7185a471f30af833" + [[package]] name = "md5" version = "0.7.0" @@ -1041,9 +1220,9 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.3.4" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mi" @@ -1070,14 +1249,20 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mime_guess" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ "mime", "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.4.4" @@ -1090,14 +1275,15 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.13" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" dependencies = [ "libc", "log", "miow", "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", "winapi", ] @@ -1110,24 +1296,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "multipart" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" -dependencies = [ - "buf_redux", - "httparse", - "log", - "mime", - "mime_guess", - "quick-error", - "rand", - "safemem", - "tempfile", - "twoway 0.1.8", -] - [[package]] name = "native-tls" version = "0.2.8" @@ -1159,9 +1327,9 @@ dependencies = [ [[package]] name = "nom" -version = "6.2.1" +version = "6.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c5c51b9083a3c620fa67a2a635d1ce7d95b897e957d6b28ff9a5da960a103a6" +checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" dependencies = [ "bitvec", "funty", @@ -1171,10 +1339,20 @@ dependencies = [ ] [[package]] -name = "ntapi" -version = "0.3.6" +name = "nom" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi", ] @@ -1200,31 +1378,43 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", ] [[package]] -name = "object" -version = "0.24.0" +name = "num_threads" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" +checksum = "aba1801fb138d8e85e11d0fc70baf4fe1cdfffda7c6cd34a854905df588e5ed0" +dependencies = [ + "libc", +] + +[[package]] +name = "object" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +dependencies = [ + "memchr", +] [[package]] name = "once_cell" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" [[package]] name = "onig" -version = "6.2.0" +version = "6.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16fd3c0e73b516af509c13c4ba76ec0c987ce20d78b38cff356b8d01fc6a6c0" +checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225" dependencies = [ "bitflags", "lazy_static", @@ -1234,9 +1424,9 @@ dependencies = [ [[package]] name = "onig_sys" -version = "69.7.0" +version = "69.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd9442a09e4fbd08d196ddf419b2c79a43c3a46c800320cc841d45c2449a240" +checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e" dependencies = [ "cc", "pkg-config", @@ -1256,9 +1446,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.36" +version = "0.10.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", "cfg-if", @@ -1270,15 +1460,15 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.67" +version = "0.9.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" +checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" dependencies = [ "autocfg", "cc", @@ -1301,7 +1491,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.1", ] [[package]] @@ -1318,6 +1518,19 @@ dependencies = [ "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "patreon" version = "0.1.0" @@ -1402,7 +1615,7 @@ checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" dependencies = [ "maplit", "pest", - "sha-1 0.8.2", + "sha-1", ] [[package]] @@ -1419,18 +1632,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ "proc-macro2", "quote", @@ -1439,9 +1652,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "pin-utils" @@ -1451,29 +1664,29 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "plist" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38d026d73eeaf2ade76309d0c65db5a35ecf649e3cec428db316243ea9d6711" +checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" dependencies = [ "base64", - "chrono", "indexmap", "line-wrap", "serde", + "time 0.3.7", "xml-rs", ] [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "pretty" @@ -1494,23 +1707,11 @@ dependencies = [ "log", ] -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.29" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] @@ -1540,7 +1741,7 @@ dependencies = [ "lazy_static", "libc", "memchr", - "parking_lot", + "parking_lot 0.11.2", "procfs", "thiserror", ] @@ -1553,9 +1754,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.9" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" dependencies = [ "proc-macro2", ] @@ -1568,14 +1769,13 @@ checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" [[package]] name = "rand" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", "rand_core", - "rand_hc", ] [[package]] @@ -1597,29 +1797,31 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rand_hc" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" -dependencies = [ - "rand_core", -] - [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" dependencies = [ "bitflags", ] [[package]] -name = "regex" -version = "1.4.6" +name = "redox_users" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" +checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55" +dependencies = [ + "getrandom", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", @@ -1643,9 +1845,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.9" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" +checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" dependencies = [ "base64", "bytes", @@ -1685,10 +1887,10 @@ checksum = "c6fd2f3b927021cc8586d365c36d16d82d91fdae0a3839819c12c8e86e0f929e" dependencies = [ "base64", "bytecount", - "itertools 0.10.1", + "itertools 0.10.3", "md5", "mime", - "nom 6.2.1", + "nom 6.1.2", ] [[package]] @@ -1698,10 +1900,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] -name = "ryu" -version = "1.0.5" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "safemem" @@ -1728,12 +1939,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1748,9 +1953,9 @@ checksum = "1ad78c5d206dedabda370ab0b669c40623a446699ed4604829d0c600420c8d7c" [[package]] name = "security-framework" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" dependencies = [ "bitflags", "core-foundation", @@ -1761,19 +1966,25 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.4.2" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" dependencies = [ "core-foundation-sys", "libc", ] [[package]] -name = "serde" -version = "1.0.130" +name = "semver" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d" + +[[package]] +name = "serde" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] @@ -1790,9 +2001,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -1814,9 +2025,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.68" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" dependencies = [ "itoa", "ryu", @@ -1825,9 +2036,9 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", "itoa", @@ -1837,12 +2048,12 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.21" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af" +checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" dependencies = [ - "dtoa", "indexmap", + "ryu", "serde", "yaml-rust", ] @@ -1859,24 +2070,11 @@ dependencies = [ "opaque-debug 0.2.3", ] -[[package]] -name = "sha-1" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.0", -] - [[package]] name = "sha2" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", @@ -1887,18 +2085,18 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740223c51853f3145fe7c90360d2d4232f2b62e3449489c207eccde818979982" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" dependencies = [ "lazy_static", ] [[package]] name = "shell-words" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "signal-hook-registry" @@ -1923,21 +2121,21 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "socket2" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" dependencies = [ "libc", "winapi", @@ -1963,15 +2161,21 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.77" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5239bc68e0fef57495900cfea4e8dc75596d9a319d7e16b1e0a440d24e6fe0a0" +checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] +[[package]] +name = "sync_wrapper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" + [[package]] name = "syntect" version = "4.6.0" @@ -2002,13 +2206,13 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ "cfg-if", + "fastrand", "libc", - "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -2016,9 +2220,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] @@ -2034,18 +2238,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.29" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.29" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", @@ -2072,10 +2276,21 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.4.0" +name = "time" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5241dd6f21443a3606b432718b166d3cedc962fd4b8bea54a8bc7f514ebda986" +checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d" +dependencies = [ + "itoa", + "libc", + "num_threads", +] + +[[package]] +name = "tinyvec" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ "tinyvec_macros", ] @@ -2088,29 +2303,29 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.12.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" dependencies = [ - "autocfg", "bytes", "libc", "memchr", "mio", "num_cpus", "once_cell", - "parking_lot", + "parking_lot 0.12.0", "pin-project-lite", "signal-hook-registry", + "socket2", "tokio-macros", "winapi", ] [[package]] name = "tokio-macros" -version = "1.3.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", @@ -2138,24 +2353,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "511de3f85caf1c98983545490c3d09685fa8eb634e57eec22bb4db271f46cbd8" -dependencies = [ - "futures-util", - "log", - "pin-project", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" +checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ "bytes", "futures-core", @@ -2165,6 +2367,76 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" +dependencies = [ + "futures-core", + "futures-util", + "hdrhistogram", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util 0.7.0", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" +dependencies = [ + "async-compression", + "base64", + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "httpdate", + "iri-string", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util 0.7.0", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" + [[package]] name = "tower-service" version = "0.3.1" @@ -2173,9 +2445,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.28" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" +checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", "log", @@ -2186,9 +2458,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.16" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98863d0dd09fa59a1b79c6750ad80dbda6b75f4e71c437a6a1a8cb91a8bcbd77" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" dependencies = [ "proc-macro2", "quote", @@ -2197,11 +2469,12 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" dependencies = [ "lazy_static", + "valuable", ] [[package]] @@ -2237,11 +2510,11 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22" +checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce" dependencies = [ - "ansi_term 0.12.1", + "ansi_term", "sharded-slab", "smallvec", "thread_local", @@ -2255,34 +2528,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "tungstenite" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5" -dependencies = [ - "base64", - "byteorder", - "bytes", - "http", - "httparse", - "log", - "rand", - "sha-1 0.9.8", - "thiserror", - "url", - "utf-8", -] - -[[package]] -name = "twoway" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" -dependencies = [ - "memchr", -] - [[package]] name = "twoway" version = "0.2.2" @@ -2301,9 +2546,9 @@ checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" [[package]] name = "typenum" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" @@ -2328,9 +2573,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" @@ -2371,12 +2616,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "uuid" version = "0.8.2" @@ -2387,6 +2626,12 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -2401,9 +2646,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" @@ -2426,36 +2671,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "warp" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cef4e1e9114a4b7f1ac799f16ce71c14de5778500c5450ec6b7b920c55b587e" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "headers", - "http", - "hyper", - "log", - "mime", - "mime_guess", - "multipart", - "percent-encoding", - "pin-project", - "scoped-tls", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-stream", - "tokio-tungstenite", - "tokio-util", - "tower-service", - "tracing", -] - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -2463,10 +2678,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] -name = "wasm-bindgen" -version = "0.2.78" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2474,9 +2695,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" dependencies = [ "bumpalo", "lazy_static", @@ -2489,9 +2710,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" dependencies = [ "cfg-if", "js-sys", @@ -2501,9 +2722,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2511,9 +2732,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" dependencies = [ "proc-macro2", "quote", @@ -2524,15 +2745,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" [[package]] name = "web-sys" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" dependencies = [ "js-sys", "wasm-bindgen", @@ -2570,10 +2791,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "winreg" -version = "0.7.0" +name = "windows-sys" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" + +[[package]] +name = "windows_i686_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" + +[[package]] +name = "windows_i686_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ "winapi", ] @@ -2586,24 +2850,32 @@ checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] name = "xdg" -version = "2.2.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" +checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6" +dependencies = [ + "dirs", +] [[package]] name = "xesite" -version = "2.3.0" +version = "2.4.0" dependencies = [ + "axum", + "axum-extra", + "axum-macros", "cfcache", "chrono", "color-eyre", "comrak", + "derive_more", "envy", "estimated_read_time", "eyre", "futures", "glob", - "go_vanity", + "http", + "http-body", "hyper", "jsonfeed", "kankyo", @@ -2627,12 +2899,13 @@ dependencies = [ "thiserror", "tokio", "tokio-stream", + "tower", + "tower-http", "tracing", "tracing-futures", "tracing-subscriber", "url", "uuid", - "warp", "xml-rs", ] diff --git a/Cargo.toml b/Cargo.toml index 8c6eb60..006f66b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xesite" -version = "2.3.0" +version = "2.4.0" authors = ["Xe Iaso "] edition = "2018" build = "src/build.rs" @@ -9,13 +9,19 @@ repository = "https://github.com/Xe/site" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +axum = "0.4" +axum-macros = "0.1" +axum-extra = "0.1" color-eyre = "0.6" chrono = "0.4" comrak = "0.12.1" +derive_more = "0.99" envy = "0.4" estimated_read_time = "1" futures = "0.3" glob = "0.3" +http = "0.2" +http-body = "0.4" hyper = "0.14" kankyo = "0.3" lazy_static = "1.4" @@ -34,24 +40,30 @@ tokio-stream = { version = "0.1", features = ["net"] } tracing = "0.1" tracing-futures = "0.2" tracing-subscriber = { version = "0.3", features = ["fmt"] } -warp = "0.3" xml-rs = "0.8" url = "2" uuid = { version = "0.8", features = ["serde", "v4"] } # workspace dependencies cfcache = { path = "./lib/cfcache" } -go_vanity = { path = "./lib/go_vanity" } jsonfeed = { path = "./lib/jsonfeed" } mi = { path = "./lib/mi" } patreon = { path = "./lib/patreon" } +[dependencies.tower] +version = "0.4" +features = [ "full" ] + +[dependencies.tower-http] +version = "0.2" +features = [ "full" ] + # os-specific dependencies [target.'cfg(target_os = "linux")'.dependencies] sdnotify = { version = "0.2", default-features = false } [build-dependencies] -ructe = { version = "0.13", features = ["warp02"] } +ructe = { version = "0.13", features = [ "mime03" ] } [dev-dependencies] pfacts = "0" diff --git a/blog/site-update-axum-2022-03-21.markdown b/blog/site-update-axum-2022-03-21.markdown new file mode 100644 index 0000000..5cbcecb --- /dev/null +++ b/blog/site-update-axum-2022-03-21.markdown @@ -0,0 +1,81 @@ +--- +title: "Site Update: Axum" +date: 2022-03-21 +--- + +I have made a bunch of huge changes to my website that hopefully you won't +notice unless you read this post that points them out to you. I have redone how +the website's URL routing works to use +[axum](https://tokio.rs/blog/2021-07-announcing-axum) instead of +[warp](https://docs.rs/warp/latest/warp/). + +I chose warp fairly arbitrarily when I was getting into the swing of Rust. This +choice turned out to be a bit of a mistake. Don't get me wrong, warp is a +fantastic framework, but overall I've not been happy with how it impacts compile +times. Warp works by pushing a lot of the complexities with HTTP routing into +the type system. This can lead to undebuggable inscruitable types that make it +really hard to understand what is wrong. Here is the autogenerated type for the +`/blog/:name` route: + +``` +warp::filter::and::And + warp::Filter + std::marker::Copy, Exact>>, warp::filter::and_then::AndThen + warp::Filter + std::marker::Copy, impl warp::filter::FilterBase + warp::Filter + std::marker::Copy>, impl warp::filter::FilterBase + warp::Filter + std::marker::Copy>, impl warp::filter::FilterBase,), Error = Infallible> + warp::Filter + Clone>, impl warp::filter::FilterBase + warp::Filter + std::marker::Copy>, fn(std::string::String, Arc) -> impl warp::Future> {blog::post_view}>> +``` + +[What the heck is that? Is that a binary tree?](conversation://Numa/delet) + +[Yep. It's insufferable to try and debug too.](conversation://Cadey/coffee) + +Yeah, it's really hard to understand what's going on in error messages because +of this. This also means that the routes are put into a binary tree in the type +system, which means if your tree is unbalanced then you get slower compile times +and a slight hit at runtime as the framework traverses your binary tree to +figure out what to do. This has also made it difficult for me to add features +such as [historical views of my RSS feed](https://github.com/Xe/site/issues/419) +or other things I want to add like the April Fools day feature I've been working +on. + +When I went out framework shopping, I tried a few things and got reccomendations +from a trusted friend before I finally settled on axum as the heart of this +website. Axum has a few major advantages that bbrought me "in the door": + +- It's maintained by the tokio team +- It leverages the type system of Rust to make writing handlers easier +- It uses extractors (think lenses) to help you pick out the subset of data you + need, not blindly giving you everything and hoping you figure it out +- It has sub-routers which can have different middleware stacks than the main + one (useful for things like API authentication) + +And it has these disadvantages: + +- Writing middleware is kinda weird (though this may be because I'm not used to + working with tower), but easy once you get the general flow of things +- I can't find a way to have the template data get continuously piped to client + connections instead of rendering it to a buffer and then writing that buffer + to the client +- It doesn't have the biggest mindshare and one of the best ways to get unstuck + at the time of writing this article is to ask on their Discord server + +Overall, I've been happy with the experience of porting over my site to using +Axum. I did [a stream on Twitch](https://www.twitch.tv/videos/1429533858) where +I ported it all over if you want to watch the process and hear my thought +processes as I was figuring things out. + +As users, nothing should have changed about this site. However I'm almost +certain that I did forget to port _something_ over, so if I missed something you +rely on, [get in contact](/contact). I have not gotten the Patreon API +interoperability code fixed yet, so that is the next major issue. I am going to +figure out how refresh tokens work the hard way and make the patrons page +auto-updating instead of having to [manually get a new API key every +month](https://github.com/Xe/site/blob/main/docs/patron-page.org). I am also +looking into having that patrons page be updated by a cronjob that emits json to +the disk and have my site load from that instead of just hoping that the patreon +API credentials are up to date. We'll see how that goes, but you can track that +[here](https://github.com/Xe/site/issues/442). I will likely do a livestream for +this. + +I have also contacted a copyeditor for my blog. I am so happy with the results +so far. [My Devops post](/blog/social-quandry-devops-2022-03-17) was the first +thing that the editor reviewed and they absolutely tore my first draft in half +and helped me put the parts back together into something more palateable. I am +beyond satisfied with this and will continue to use this editor in the future. I +wish I had gotten a copyeditor sooner. diff --git a/examples/warp.rs b/examples/warp.rs deleted file mode 100644 index c705b47..0000000 --- a/examples/warp.rs +++ /dev/null @@ -1,14 +0,0 @@ -use warp::Filter; - -#[tokio::main] -async fn main() { - let hello = warp::path!("hello" / String) - .map(|name| format!("Hello, {}!", name)); - let health = warp::path!(".within" / "health") - .map(|| "OK"); - let routes = hello.or(health); - - warp::serve(routes) - .run(([0, 0, 0, 0], 3030)) - .await; -} diff --git a/lib/go_vanity/Cargo.toml b/lib/go_vanity/Cargo.toml deleted file mode 100644 index e6bcf6d..0000000 --- a/lib/go_vanity/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "go_vanity" -version = "0.2.0" -authors = ["Xe Iaso "] -edition = "2018" -build = "src/build.rs" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -mime = "0.3" -warp = "0.3" - -[build-dependencies] -ructe = { version = "0.13", features = ["warp02"] } diff --git a/lib/go_vanity/src/build.rs b/lib/go_vanity/src/build.rs deleted file mode 100644 index f36737c..0000000 --- a/lib/go_vanity/src/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -use ructe::{Result, Ructe}; - -fn main() -> Result<()> { - Ructe::from_env()?.compile_templates("templates") -} diff --git a/lib/go_vanity/src/lib.rs b/lib/go_vanity/src/lib.rs deleted file mode 100644 index 756c555..0000000 --- a/lib/go_vanity/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -use crate::templates::RenderRucte; -use warp::{http::Response, Rejection, Reply}; - -include!(concat!(env!("OUT_DIR"), "/templates.rs")); - -pub async fn gitea(pkg_name: &str, git_repo: &str, branch: &str) -> Result { - Response::builder().html(|o| templates::gitea_html(o, pkg_name, git_repo, branch)) -} - -pub async fn github(pkg_name: &str, git_repo: &str, branch: &str) -> Result { - Response::builder().html(|o| templates::github_html(o, pkg_name, git_repo, branch)) -} diff --git a/lib/go_vanity/templates/github.rs.html b/lib/go_vanity/templates/github.rs.html deleted file mode 100644 index 9782b1c..0000000 --- a/lib/go_vanity/templates/github.rs.html +++ /dev/null @@ -1,14 +0,0 @@ -@(pkg_name: &str, git_repo: &str, branch: &str) - - - - - - - - - - - Please see here for documentation on this package. - - diff --git a/lib/mi/src/lib.rs b/lib/mi/src/lib.rs index 0e19bec..4263970 100644 --- a/lib/mi/src/lib.rs +++ b/lib/mi/src/lib.rs @@ -1,6 +1,6 @@ use color_eyre::eyre::Result; use reqwest::header; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use tracing::instrument; const USER_AGENT_BASE: &str = concat!( @@ -58,7 +58,7 @@ impl Client { } } -#[derive(Debug, Deserialize, Eq, PartialEq, Clone)] +#[derive(Debug, Deserialize, Eq, PartialEq, Clone, Serialize)] pub struct WebMention { pub source: String, pub title: Option, diff --git a/src/domainsocket.rs b/src/domainsocket.rs new file mode 100644 index 0000000..ef731f5 --- /dev/null +++ b/src/domainsocket.rs @@ -0,0 +1,94 @@ +use axum::extract::connect_info; +use futures::ready; +use hyper::{ + client::connect::{Connected, Connection}, + server::accept::Accept, +}; +use std::{ + io, + pin::Pin, + sync::Arc, + task::{Context, Poll}, +}; +use tokio::{ + io::{AsyncRead, AsyncWrite}, + net::{unix::UCred, UnixListener, UnixStream}, +}; +use tower::BoxError; + +pub struct ServerAccept { + pub uds: UnixListener, +} + +impl Accept for ServerAccept { + type Conn = UnixStream; + type Error = BoxError; + + fn poll_accept( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll>> { + let (stream, _addr) = ready!(self.uds.poll_accept(cx))?; + Poll::Ready(Some(Ok(stream))) + } +} + +pub struct ClientConnection { + pub stream: UnixStream, +} + +impl AsyncWrite for ClientConnection { + fn poll_write( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &[u8], + ) -> Poll> { + Pin::new(&mut self.stream).poll_write(cx, buf) + } + + fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + Pin::new(&mut self.stream).poll_flush(cx) + } + + fn poll_shutdown( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> Poll> { + Pin::new(&mut self.stream).poll_shutdown(cx) + } +} + +impl AsyncRead for ClientConnection { + fn poll_read( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &mut tokio::io::ReadBuf<'_>, + ) -> Poll> { + Pin::new(&mut self.stream).poll_read(cx, buf) + } +} + +impl Connection for ClientConnection { + fn connected(&self) -> Connected { + Connected::new() + } +} + +#[derive(Clone, Debug)] +#[allow(dead_code)] +pub struct UdsConnectInfo { + pub peer_addr: Arc, + pub peer_cred: UCred, +} + +impl connect_info::Connected<&UnixStream> for UdsConnectInfo { + fn connect_info(target: &UnixStream) -> Self { + let peer_addr = target.peer_addr().unwrap(); + let peer_cred = target.peer_cred().unwrap(); + + Self { + peer_addr: Arc::new(peer_addr), + peer_cred, + } + } +} diff --git a/src/handlers/blog.rs b/src/handlers/blog.rs index 007b8e0..f6aae06 100644 --- a/src/handlers/blog.rs +++ b/src/handlers/blog.rs @@ -1,14 +1,13 @@ -use super::{PostNotFound, SeriesNotFound, LAST_MODIFIED}; -use crate::{ - app::State, - post::Post, - templates::{self, Html, RenderRucte}, +use super::Result; +use crate::{app::State, post::Post, templates}; +use axum::{ + extract::{Extension, Path}, + response::Html, }; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; use std::sync::Arc; use tracing::{error, instrument}; -use warp::{http::Response, Rejection, Reply}; lazy_static! { static ref HIT_COUNTER: IntCounterVec = register_int_counter_vec!( @@ -19,17 +18,18 @@ lazy_static! { } #[instrument(skip(state))] -pub async fn index(state: Arc) -> Result { +pub async fn index(Extension(state): Extension>) -> Result { let state = state.clone(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::blogindex_html(o, state.blog.clone())) + let mut result: Vec = vec![]; + templates::blogindex_html(&mut result, state.blog.clone())?; + Ok(Html(result)) } #[instrument(skip(state))] -pub async fn series(state: Arc) -> Result { +pub async fn series(Extension(state): Extension>) -> Result { let state = state.clone(); let mut series: Vec = vec![]; + let mut result: Vec = vec![]; for post in &state.blog { if post.front_matter.series.is_some() { @@ -40,15 +40,18 @@ pub async fn series(state: Arc) -> Result { series.sort(); series.dedup(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::series_html(o, series)) + templates::series_html(&mut result, series)?; + Ok(Html(result)) } #[instrument(skip(state))] -pub async fn series_view(series: String, state: Arc) -> Result { +pub async fn series_view( + Path(series): Path, + Extension(state): Extension>, +) -> Result { let state = state.clone(); let mut posts: Vec = vec![]; + let mut result: Vec = vec![]; for post in &state.blog { if post.front_matter.series.is_none() { @@ -62,16 +65,18 @@ pub async fn series_view(series: String, state: Arc) -> Result) -> Result { +pub async fn post_view( + Path(name): Path, + Extension(state): Extension>, +) -> Result { let mut want: Option = None; for post in &state.blog { @@ -81,15 +86,15 @@ pub async fn post_view(name: String, state: Arc) -> Result Err(PostNotFound("blog".into(), name).into()), + None => Err(super::Error::PostNotFound(name)), Some(post) => { HIT_COUNTER .with_label_values(&[name.clone().as_str()]) .inc(); - let body = Html(post.body_html.clone()); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::blogpost_html(o, post, body)) + let body = templates::Html(post.body_html.clone()); + let mut result: Vec = vec![]; + templates::blogpost_html(&mut result, post, body)?; + Ok(Html(result)) } } } diff --git a/src/handlers/feeds.rs b/src/handlers/feeds.rs index 3d540f6..c69e2f0 100644 --- a/src/handlers/feeds.rs +++ b/src/handlers/feeds.rs @@ -1,10 +1,14 @@ -use super::LAST_MODIFIED; -use crate::{app::State, post::Post, templates}; +use super::{Result, LAST_MODIFIED}; +use crate::{ + app::State, + post::{NewPost, Post}, + templates, +}; +use axum::{body, extract::Extension, response::Response, Json}; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; -use std::{io, sync::Arc}; +use std::sync::Arc; use tracing::instrument; -use warp::{http::Response, Rejection, Reply}; lazy_static! { pub static ref HIT_COUNTER: IntCounterVec = register_int_counter_vec!( @@ -16,103 +20,56 @@ lazy_static! { } #[instrument(skip(state))] -pub async fn jsonfeed(state: Arc, since: Option) -> Result { +pub async fn jsonfeed(Extension(state): Extension>) -> Json { HIT_COUNTER.with_label_values(&["json"]).inc(); let state = state.clone(); - Ok(warp::reply::json(&state.jf)) + Json(state.jf.clone()) } #[instrument(skip(state))] -pub async fn new_post(state: Arc) -> Result { +#[axum_macros::debug_handler] +pub async fn new_post(Extension(state): Extension>) -> Result> { let state = state.clone(); - let everything = state.everything.clone(); - let p: &Post = everything.iter().next().unwrap(); - Ok(warp::reply::json(&p.new_post)) + let p: Post = state.everything.iter().next().unwrap().clone(); + Ok(Json(p.new_post)) } -#[derive(Debug)] -pub enum RenderError { - Build(warp::http::Error), - IO(io::Error), -} - -impl warp::reject::Reject for RenderError {} - #[instrument(skip(state))] -pub async fn atom(state: Arc, since: Option) -> Result { - if let Some(etag) = since { - if etag == ETAG.clone() { - return Response::builder() - .status(304) - .header("Content-Type", "text/plain") - .body( - "You already have the newest version of this feed." - .to_string() - .into_bytes(), - ) - .map_err(RenderError::Build) - .map_err(warp::reject::custom); - } - } - +pub async fn atom(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["atom"]).inc(); let state = state.clone(); let mut buf = Vec::new(); - templates::blog_atom_xml(&mut buf, state.everything.clone()) - .map_err(RenderError::IO) - .map_err(warp::reject::custom)?; - Response::builder() + templates::blog_atom_xml(&mut buf, state.everything.clone())?; + Ok(Response::builder() .status(200) .header("Content-Type", "application/atom+xml") .header("ETag", ETAG.clone()) .header("Last-Modified", &*LAST_MODIFIED) - .body(buf) - .map_err(RenderError::Build) - .map_err(warp::reject::custom) + .body(body::boxed(body::Full::from(buf)))?) } #[instrument(skip(state))] -pub async fn rss(state: Arc, since: Option) -> Result { - if let Some(etag) = since { - if etag == ETAG.clone() { - return Response::builder() - .status(304) - .header("Content-Type", "text/plain") - .body( - "You already have the newest version of this feed." - .to_string() - .into_bytes(), - ) - .map_err(RenderError::Build) - .map_err(warp::reject::custom); - } - } - +pub async fn rss(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["rss"]).inc(); let state = state.clone(); let mut buf = Vec::new(); - templates::blog_rss_xml(&mut buf, state.everything.clone()) - .map_err(RenderError::IO) - .map_err(warp::reject::custom)?; - Response::builder() + templates::blog_rss_xml(&mut buf, state.everything.clone())?; + Ok(Response::builder() .status(200) .header("Content-Type", "application/rss+xml") .header("ETag", ETAG.clone()) .header("Last-Modified", &*LAST_MODIFIED) - .body(buf) - .map_err(RenderError::Build) - .map_err(warp::reject::custom) + .body(body::boxed(body::Full::from(buf)))?) } #[instrument(skip(state))] -pub async fn sitemap(state: Arc) -> Result { +#[axum_macros::debug_handler] +pub async fn sitemap(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["sitemap"]).inc(); let state = state.clone(); - Response::builder() + Ok(Response::builder() .status(200) .header("Content-Type", "application/xml") .header("Last-Modified", &*LAST_MODIFIED) - .body(state.sitemap.clone()) - .map_err(RenderError::Build) - .map_err(warp::reject::custom) + .body(body::boxed(body::Full::from(state.sitemap.clone())))?) } diff --git a/src/handlers/gallery.rs b/src/handlers/gallery.rs index 02bc01b..ae6c411 100644 --- a/src/handlers/gallery.rs +++ b/src/handlers/gallery.rs @@ -1,14 +1,13 @@ -use super::PostNotFound; -use crate::{ - app::State, - post::Post, - templates::{self, Html, RenderRucte}, +use super::{Error::*, Result}; +use crate::{app::State, post::Post, templates}; +use axum::{ + extract::{Extension, Path}, + response::Html, }; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; use std::sync::Arc; use tracing::instrument; -use warp::{http::Response, Rejection, Reply}; lazy_static! { static ref HIT_COUNTER: IntCounterVec = register_int_counter_vec!( @@ -19,13 +18,18 @@ lazy_static! { } #[instrument(skip(state))] -pub async fn index(state: Arc) -> Result { +pub async fn index(Extension(state): Extension>) -> Result { let state = state.clone(); - Response::builder().html(|o| templates::galleryindex_html(o, state.gallery.clone())) + let mut result: Vec = vec![]; + templates::galleryindex_html(&mut result, state.gallery.clone())?; + Ok(Html(result)) } #[instrument(skip(state))] -pub async fn post_view(name: String, state: Arc) -> Result { +pub async fn post_view( + Path(name): Path, + Extension(state): Extension>, +) -> Result { let mut want: Option = None; for post in &state.gallery { @@ -35,13 +39,15 @@ pub async fn post_view(name: String, state: Arc) -> Result Err(PostNotFound("gallery".into(), name).into()), + None => Err(PostNotFound(name)), Some(post) => { HIT_COUNTER .with_label_values(&[name.clone().as_str()]) .inc(); - let body = Html(post.body_html.clone()); - Response::builder().html(|o| templates::gallerypost_html(o, post, body)) + let body = templates::Html(post.body_html.clone()); + let mut result: Vec = vec![]; + templates::gallerypost_html(&mut result, post, body)?; + Ok(Html(result)) } } } diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 798a911..07c4d52 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -1,16 +1,20 @@ -use crate::{ - app::State, - templates::{self, Html, RenderRucte}, +use crate::{app::State, templates}; +use axum::{ + body, + extract::Extension, + http::StatusCode, + response::{Html, IntoResponse, Response}, }; use chrono::{Datelike, Timelike, Utc}; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; -use std::{convert::Infallible, fmt, sync::Arc}; +use std::sync::Arc; use tracing::instrument; -use warp::{ - http::{Response, StatusCode}, - Rejection, Reply, -}; + +pub mod blog; +pub mod feeds; +pub mod gallery; +pub mod talks; lazy_static! { static ref HIT_COUNTER: IntCounterVec = @@ -32,139 +36,104 @@ lazy_static! { } #[instrument] -pub async fn index() -> Result { +pub async fn index() -> Result { HIT_COUNTER.with_label_values(&["index"]).inc(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::index_html(o)) + let mut result: Vec = vec![]; + templates::index_html(&mut result)?; + Ok(Html(result)) } #[instrument] -pub async fn contact() -> Result { +pub async fn contact() -> Result { HIT_COUNTER.with_label_values(&["contact"]).inc(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::contact_html(o)) + let mut result: Vec = vec![]; + templates::contact_html(&mut result)?; + Ok(Html(result)) } #[instrument] -pub async fn feeds() -> Result { +pub async fn feeds() -> Result { HIT_COUNTER.with_label_values(&["feeds"]).inc(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::feeds_html(o)) + let mut result: Vec = vec![]; + templates::feeds_html(&mut result)?; + Ok(Html(result)) } +#[axum_macros::debug_handler] #[instrument(skip(state))] -pub async fn resume(state: Arc) -> Result { +pub async fn resume(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["resume"]).inc(); let state = state.clone(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::resume_html(o, Html(state.resume.clone()))) + let mut result: Vec = vec![]; + templates::resume_html(&mut result, templates::Html(state.resume.clone()))?; + Ok(Html(result)) } #[instrument(skip(state))] -pub async fn patrons(state: Arc) -> Result { +pub async fn patrons(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["patrons"]).inc(); let state = state.clone(); + let mut result: Vec = vec![]; match &state.patrons { - None => Response::builder().status(500).html(|o| { - templates::error_html( - o, - "Could not load patrons, let me know the API token expired again".to_string(), - ) - }), - Some(patrons) => Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::patrons_html(o, patrons.clone())), + None => Err(Error::NoPatrons), + Some(patrons) => { + templates::patrons_html(&mut result, patrons.clone())?; + Ok(Html(result)) + } } } +#[axum_macros::debug_handler] #[instrument(skip(state))] -pub async fn signalboost(state: Arc) -> Result { +pub async fn signalboost(Extension(state): Extension>) -> Result { HIT_COUNTER.with_label_values(&["signalboost"]).inc(); let state = state.clone(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::signalboost_html(o, state.signalboost.clone())) + let mut result: Vec = vec![]; + templates::signalboost_html(&mut result, state.signalboost.clone())?; + Ok(Html(result)) } #[instrument] -pub async fn not_found() -> Result { +pub async fn not_found() -> Result { HIT_COUNTER.with_label_values(&["not_found"]).inc(); - Response::builder() - .header("Last-Modified", &*LAST_MODIFIED) - .html(|o| templates::notfound_html(o, "some path".into())) + let mut result: Vec = vec![]; + templates::notfound_html(&mut result, "some path".into())?; + Ok(Html(result)) } -pub mod blog; -pub mod feeds; -pub mod gallery; -pub mod talks; - #[derive(Debug, thiserror::Error)] -struct PostNotFound(String, String); +pub enum Error { + #[error("series not found: {0}")] + SeriesNotFound(String), -impl fmt::Display for PostNotFound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "not found: {}/{}", self.0, self.1) - } + #[error("post not found: {0}")] + PostNotFound(String), + + #[error("patreon key not working, poke me to get this fixed")] + NoPatrons, + + #[error("io error: {0}")] + IO(#[from] std::io::Error), + + #[error("axum http error: {0}")] + AxumHTTP(#[from] axum::http::Error), } -impl warp::reject::Reject for PostNotFound {} +pub type Result>> = std::result::Result; -#[derive(Debug, thiserror::Error)] -struct SeriesNotFound(String); +impl IntoResponse for Error { + fn into_response(self) -> Response { + let mut result: Vec = vec![]; + templates::error_html(&mut result, format!("{}", self)).unwrap(); -impl fmt::Display for SeriesNotFound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0) - } -} + let body = body::boxed(body::Full::from(result)); -impl warp::reject::Reject for SeriesNotFound {} - -lazy_static! { - static ref REJECTION_COUNTER: IntCounterVec = register_int_counter_vec!( - opts!("rejections", "Number of rejections by kind"), - &["kind"] - ) - .unwrap(); -} - -#[instrument] -pub async fn rejection(err: Rejection) -> Result { - let path: String; - let code; - - if err.is_not_found() { - REJECTION_COUNTER.with_label_values(&["404"]).inc(); - path = "".into(); - code = StatusCode::NOT_FOUND; - } else if let Some(SeriesNotFound(series)) = err.find() { - REJECTION_COUNTER - .with_label_values(&["SeriesNotFound"]) - .inc(); - log::error!("invalid series {}", series); - path = format!("/blog/series/{}", series); - code = StatusCode::NOT_FOUND; - } else if let Some(PostNotFound(kind, name)) = err.find() { - REJECTION_COUNTER.with_label_values(&["PostNotFound"]).inc(); - log::error!("unknown post {}/{}", kind, name); - path = format!("/{}/{}", kind, name); - code = StatusCode::NOT_FOUND; - } else { - REJECTION_COUNTER.with_label_values(&["Other"]).inc(); - log::error!("unhandled rejection: {:?}", err); - path = format!("weird rejection: {:?}", err); - code = StatusCode::INTERNAL_SERVER_ERROR; - } - - Ok(warp::reply::with_status( Response::builder() - .html(|o| templates::notfound_html(o, path)) - .unwrap(), - code, - )) + .status(match self { + Error::SeriesNotFound(_) | Error::PostNotFound(_) => StatusCode::NOT_FOUND, + _ => StatusCode::INTERNAL_SERVER_ERROR, + }) + .body(body) + .unwrap() + } } diff --git a/src/handlers/talks.rs b/src/handlers/talks.rs index 8db5c9e..22ee3cf 100644 --- a/src/handlers/talks.rs +++ b/src/handlers/talks.rs @@ -1,14 +1,13 @@ -use super::PostNotFound; -use crate::{ - app::State, - post::Post, - templates::{self, Html, RenderRucte}, +use super::{Error::*, Result}; +use crate::{app::State, post::Post, templates}; +use axum::{ + extract::{Extension, Path}, + response::Html, }; use lazy_static::lazy_static; use prometheus::{opts, register_int_counter_vec, IntCounterVec}; use std::sync::Arc; use tracing::instrument; -use warp::{http::Response, Rejection, Reply}; lazy_static! { static ref HIT_COUNTER: IntCounterVec = register_int_counter_vec!( @@ -19,13 +18,18 @@ lazy_static! { } #[instrument(skip(state))] -pub async fn index(state: Arc) -> Result { +pub async fn index(Extension(state): Extension>) -> Result { let state = state.clone(); - Response::builder().html(|o| templates::talkindex_html(o, state.talks.clone())) + let mut result: Vec = vec![]; + templates::talkindex_html(&mut result, state.talks.clone())?; + Ok(Html(result)) } #[instrument(skip(state))] -pub async fn post_view(name: String, state: Arc) -> Result { +pub async fn post_view( + Path(name): Path, + Extension(state): Extension>, +) -> Result { let mut want: Option = None; for post in &state.talks { @@ -35,13 +39,15 @@ pub async fn post_view(name: String, state: Arc) -> Result Err(PostNotFound("talks".into(), name).into()), + None => Err(PostNotFound(name).into()), Some(post) => { HIT_COUNTER .with_label_values(&[name.clone().as_str()]) .inc(); - let body = Html(post.body_html.clone()); - Response::builder().html(|o| templates::talkpost_html(o, post, body)) + let body = templates::Html(post.body_html.clone()); + let mut result: Vec = vec![]; + templates::talkpost_html(&mut result, post, body)?; + Ok(Html(result)) } } } diff --git a/src/main.rs b/src/main.rs index bbe5658..c6dc33f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,29 +1,64 @@ #[macro_use] extern crate tracing; +use axum::{ + body, + extract::Extension, + http::header::{self, HeaderValue, CACHE_CONTROL, CONTENT_TYPE}, + response::{Html, Response}, + routing::get, + Router, +}; use color_eyre::eyre::Result; -use hyper::{header::CONTENT_TYPE, Body, Response}; +use hyper::StatusCode; use prometheus::{Encoder, TextEncoder}; -use std::net::IpAddr; -use std::str::FromStr; -use std::sync::Arc; +use std::{ + env, + net::{IpAddr, SocketAddr}, + str::FromStr, + sync::Arc, +}; use tokio::net::UnixListener; -use tokio_stream::wrappers::UnixListenerStream; -use warp::{path, Filter}; +use tower_http::{ + services::{ServeDir, ServeFile}, + set_header::SetResponseHeaderLayer, + trace::TraceLayer, +}; pub mod app; pub mod handlers; pub mod post; pub mod signalboost; -use app::State; +mod domainsocket; +use domainsocket::*; const APPLICATION_NAME: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); -fn with_state( - state: Arc, -) -> impl Filter,), Error = std::convert::Infallible> + Clone { - warp::any().map(move || state.clone()) +async fn healthcheck() -> &'static str { + "OK" +} + +fn cache_header(_: &Response) -> Option { + Some(header::HeaderValue::from_static( + "public, max-age=3600, stale-if-error=60", + )) +} + +fn webmention_header(_: &Response) -> Option { + Some(header::HeaderValue::from_static( + r#"; rel="webmention""#, + )) +} + +fn clacks_header(_: &Response) -> Option { + Some(HeaderValue::from_static("Ashlynn")) +} + +fn hacker_header(_: &Response) -> Option { + Some(header::HeaderValue::from_static( + "If you are reading this, check out /signalboost to find people for your team", + )) } #[tokio::main] @@ -35,7 +70,7 @@ async fn main() -> Result<()> { let state = Arc::new( app::init( - std::env::var("CONFIG_FNAME") + env::var("CONFIG_FNAME") .unwrap_or("./config.dhall".into()) .as_str() .into(), @@ -43,178 +78,129 @@ async fn main() -> Result<()> { .await?, ); - let healthcheck = warp::get().and(warp::path(".within").and(warp::path("health")).map(|| "OK")); - let new_post = warp::path!(".within" / "website.within.xesite" / "new_post") - .and(with_state(state.clone())) - .and_then(handlers::feeds::new_post); + let middleware = tower::ServiceBuilder::new() + .layer(TraceLayer::new_for_http()) + .layer(Extension(state.clone())) + .layer(SetResponseHeaderLayer::overriding( + header::CACHE_CONTROL, + cache_header, + )) + .layer(SetResponseHeaderLayer::appending( + header::LINK, + webmention_header, + )) + .layer(SetResponseHeaderLayer::appending( + header::HeaderName::from_static("x-clacks-overhead"), + clacks_header, + )) + .layer(SetResponseHeaderLayer::overriding( + header::HeaderName::from_static("x-hacker"), + hacker_header, + )); - let base = warp::path!("blog" / ..); - let blog_index = base - .and(warp::path::end()) - .and(with_state(state.clone())) - .and_then(handlers::blog::index); - let series = base - .and(warp::path!("series").and(with_state(state.clone()).and_then(handlers::blog::series))); - let series_view = base.and( - warp::path!("series" / String) - .and(with_state(state.clone())) - .and(warp::get()) - .and_then(handlers::blog::series_view), - ); - let post_view = base.and( - warp::path!(String) - .and(with_state(state.clone())) - .and(warp::get()) - .and_then(handlers::blog::post_view), - ); - - let gallery_base = warp::path!("gallery" / ..); - let gallery_index = gallery_base - .and(warp::path::end()) - .and(with_state(state.clone())) - .and_then(handlers::gallery::index); - let gallery_post_view = gallery_base.and( - warp::path!(String) - .and(with_state(state.clone())) - .and(warp::get()) - .and_then(handlers::gallery::post_view), - ); - - let talk_base = warp::path!("talks" / ..); - let talk_index = talk_base - .and(warp::path::end()) - .and(with_state(state.clone())) - .and_then(handlers::talks::index); - let talk_post_view = talk_base.and( - warp::path!(String) - .and(with_state(state.clone())) - .and(warp::get()) - .and_then(handlers::talks::post_view), - ); - - let index = warp::get().and(path::end().and_then(handlers::index)); - let contact = warp::path!("contact").and_then(handlers::contact); - let feeds = warp::path!("feeds").and_then(handlers::feeds); - let resume = warp::path!("resume") - .and(with_state(state.clone())) - .and_then(handlers::resume); - let signalboost = warp::path!("signalboost") - .and(with_state(state.clone())) - .and_then(handlers::signalboost); - let patrons = warp::path!("patrons") - .and(with_state(state.clone())) - .and_then(handlers::patrons); - - let files = warp::path("static") - .and(warp::fs::dir("./static")) - .map(|reply| { - warp::reply::with_header( - reply, - "Cache-Control", - "public, max-age=86400, stale-if-error=60", - ) - }); - - let css = warp::path("css").and(warp::fs::dir("./css")).map(|reply| { - warp::reply::with_header( - reply, - "Cache-Control", - "public, max-age=86400, stale-if-error=60", + let app = Router::new() + // meta + .route("/.within/health", get(healthcheck)) + .route( + "/.within/website.within.xesite/new_post", + get(handlers::feeds::new_post), ) - }); - - let sw = warp::path("sw.js").and(warp::fs::file("./static/js/sw.js")); - let robots = warp::path("robots.txt").and(warp::fs::file("./static/robots.txt")); - let favicon = warp::path("favicon.ico").and(warp::fs::file("./static/favicon/favicon.ico")); - - let jsonfeed = warp::path("blog.json") - .and(with_state(state.clone())) - .and(warp::header::optional("if-none-match")) - .and_then(handlers::feeds::jsonfeed); - let atom = warp::path("blog.atom") - .and(with_state(state.clone())) - .and(warp::header::optional("if-none-match")) - .and_then(handlers::feeds::atom); - let rss = warp::path("blog.rss") - .and(with_state(state.clone())) - .and(warp::header::optional("if-none-match")) - .and_then(handlers::feeds::rss); - let sitemap = warp::path("sitemap.xml") - .and(with_state(state.clone())) - .and_then(handlers::feeds::sitemap); - let asset_links = warp::path!(".well-known" / "assetlinks.json") - .and(warp::fs::file("./static/assetlinks.json")); - - let go_vanity_jsonfeed = warp::path("jsonfeed") - .and(warp::any().map(move || "christine.website/jsonfeed")) - .and(warp::any().map(move || "https://tulpa.dev/Xe/jsonfeed")) - .and(warp::any().map(move || "master")) - .and_then(go_vanity::gitea); - - let metrics_endpoint = warp::path("metrics").and(warp::path::end()).map(move || { - let encoder = TextEncoder::new(); - let metric_families = prometheus::gather(); - let mut buffer = vec![]; - encoder.encode(&metric_families, &mut buffer).unwrap(); - Response::builder() - .status(200) - .header(CONTENT_TYPE, encoder.format_type()) - .body(Body::from(buffer)) - .unwrap() - }); - - let static_pages = index - .or(feeds.or(asset_links)) - .or(resume.or(signalboost)) - .or(patrons) - .or(jsonfeed.or(atom.or(sitemap)).or(rss)) - .or(favicon.or(robots).or(sw)) - .or(contact.or(new_post)) - .map(|reply| { - warp::reply::with_header( - reply, - "Cache-Control", - "public, max-age=86400, stale-if-error=60", - ) - }); - - let dynamic_pages = blog_index - .or(series.or(series_view).or(post_view)) - .or(gallery_index.or(gallery_post_view)) - .or(talk_index.or(talk_post_view)) - .map(|reply| { - warp::reply::with_header( - reply, - "Cache-Control", - "public, max-age=600, stale-if-error=60", - ) - }); - - let site = static_pages - .or(dynamic_pages) - .or(healthcheck.or(metrics_endpoint).or(go_vanity_jsonfeed)) - .or(files.or(css)) - .map(|reply| { - warp::reply::with_header( - reply, - "X-Hacker", - "If you are reading this, check out /signalboost to find people for your team", - ) - }) - .map(|reply| warp::reply::with_header(reply, "X-Clacks-Overhead", "GNU Ashlynn")) - .map(|reply| { - warp::reply::with_header( - reply, - "Link", - format!( - r#"<{}>; rel="webmention""#, - std::env::var("WEBMENTION_URL") - .unwrap_or("https://mi.within.website/api/webmention/accept".to_string()) - ), - ) - }) - .with(warp::log(APPLICATION_NAME)) - .recover(handlers::rejection); + .route("/jsonfeed", get(go_vanity)) + .route("/metrics", get(metrics)) + .route( + "/sw.js", + axum::routing::get_service(ServeFile::new("./static/js/sw.js")).handle_error( + |err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }, + ), + ) + .route( + "/.well-known/assetlinks.json", + axum::routing::get_service(ServeFile::new("./static/assetlinks.json")).handle_error( + |err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }, + ), + ) + .route( + "/robots.txt", + axum::routing::get_service(ServeFile::new("./static/robots.txt")).handle_error( + |err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }, + ), + ) + .route( + "/favicon.ico", + axum::routing::get_service(ServeFile::new("./static/favicon/favicon.ico")) + .handle_error(|err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }), + ) + // static pages + .route("/", get(handlers::index)) + .route("/contact", get(handlers::contact)) + .route("/feeds", get(handlers::feeds)) + .route("/resume", get(handlers::resume)) + .route("/patrons", get(handlers::patrons)) + .route("/signalboost", get(handlers::signalboost)) + // feeds + .route("/blog.json", get(handlers::feeds::jsonfeed)) + .route("/blog.atom", get(handlers::feeds::atom)) + .route("/blog.rss", get(handlers::feeds::rss)) + // blog + .route("/blog", get(handlers::blog::index)) + .route("/blog/", get(handlers::blog::index)) + .route("/blog/:name", get(handlers::blog::post_view)) + .route("/blog/series", get(handlers::blog::series)) + .route("/blog/series/:series", get(handlers::blog::series_view)) + // gallery + .route("/gallery", get(handlers::gallery::index)) + .route("/gallery/", get(handlers::gallery::index)) + .route("/gallery/:name", get(handlers::gallery::post_view)) + // talks + .route("/talks", get(handlers::talks::index)) + .route("/talks/", get(handlers::talks::index)) + .route("/talks/:name", get(handlers::talks::post_view)) + // junk google wants + .route("/sitemap.xml", get(handlers::feeds::sitemap)) + // static files + .nest( + "/css", + axum::routing::get_service(ServeDir::new("./css")).handle_error( + |err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }, + ), + ) + .nest( + "/static", + axum::routing::get_service(ServeDir::new("./static")).handle_error( + |err: std::io::Error| async move { + ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("unhandled internal server error: {}", err), + ) + }, + ), + ) + .layer(middleware); #[cfg(target_os = "linux")] { @@ -241,30 +227,51 @@ async fn main() -> Result<()> { } } - let server = warp::serve(site); - match std::env::var("SOCKPATH") { Ok(sockpath) => { - let _ = std::fs::remove_file(&sockpath); - let listener = UnixListener::bind(sockpath)?; - let incoming = UnixListenerStream::new(listener); - server.run_incoming(incoming).await; - - Ok(()) + let uds = UnixListener::bind(&sockpath)?; + axum::Server::builder(ServerAccept { uds }) + .serve(app.into_make_service_with_connect_info::()) + .await?; } Err(_) => { - server - .run(( - IpAddr::from_str(&std::env::var("HOST").unwrap_or("::".into()))?, - std::env::var("PORT") - .unwrap_or("3030".into()) - .parse::()?, - )) - .await; - - Ok(()) + let addr: SocketAddr = ( + IpAddr::from_str(&env::var("HOST").unwrap_or("::".into()))?, + env::var("PORT").unwrap_or("3030".into()).parse::()?, + ) + .into(); + info!("listening on {}", addr); + axum::Server::bind(&addr) + .serve(app.into_make_service()) + .await?; } } + + Ok(()) +} + +async fn metrics() -> Response { + let encoder = TextEncoder::new(); + let metric_families = prometheus::gather(); + let mut buffer = vec![]; + encoder.encode(&metric_families, &mut buffer).unwrap(); + Response::builder() + .status(200) + .header(CONTENT_TYPE, encoder.format_type()) + .body(body::boxed(body::Full::from(buffer))) + .unwrap() +} + +async fn go_vanity() -> Html> { + let mut buffer: Vec = vec![]; + templates::gitea_html( + &mut buffer, + "christine.website/jsonfeed", + "https://christine.website/metrics", + "master", + ) + .unwrap(); + Html(buffer) } include!(concat!(env!("OUT_DIR"), "/templates.rs")); diff --git a/src/post/mod.rs b/src/post/mod.rs index 750d022..1cd7f92 100644 --- a/src/post/mod.rs +++ b/src/post/mod.rs @@ -1,13 +1,13 @@ use chrono::prelude::*; use color_eyre::eyre::{eyre, Result, WrapErr}; use glob::glob; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use std::{borrow::Borrow, cmp::Ordering, path::PathBuf}; use tokio::fs; pub mod frontmatter; -#[derive(Eq, PartialEq, Debug, Clone)] +#[derive(Eq, PartialEq, Debug, Clone, Serialize, Deserialize)] pub struct Post { pub front_matter: frontmatter::Data, pub link: String, @@ -19,7 +19,7 @@ pub struct Post { } /// Used with the Android app to show information in a widget. -#[derive(Eq, PartialEq, Debug, Clone, Serialize)] +#[derive(Eq, PartialEq, Debug, Clone, Serialize, Deserialize)] pub struct NewPost { pub title: String, pub summary: String, diff --git a/lib/go_vanity/templates/gitea.rs.html b/templates/gitea.rs.html similarity index 100% rename from lib/go_vanity/templates/gitea.rs.html rename to templates/gitea.rs.html