Refactoring Workers
The worker was getting quite beefy and can be split up into a web and queue consumer worker, especially now that R2 can produce messages for us.
This commit is contained in:
parent
71fbe25111
commit
38736c70a0
|
@ -1,6 +1,7 @@
|
|||
/.direnv
|
||||
/result
|
||||
/target
|
||||
result
|
||||
target/
|
||||
node_modules/
|
||||
wrangler/
|
||||
.wrangler/
|
||||
result/
|
|
@ -50,9 +50,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -74,13 +74,13 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.77"
|
||||
version = "0.1.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
|
||||
checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -98,15 +98,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
version = "0.3.71"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
|
||||
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
|
@ -128,9 +128,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.14.0"
|
||||
version = "3.15.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||
checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa"
|
||||
|
||||
[[package]]
|
||||
name = "bytecount"
|
||||
|
@ -140,18 +140,15 @@ checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
|
|||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -161,9 +158,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.33"
|
||||
version = "0.4.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb"
|
||||
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
|
@ -172,9 +169,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chrono-tz"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91d7b79e99bfaa0d47da0687c43aa3b7381938a62ad3a6498599039321f660b7"
|
||||
checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz-build",
|
||||
|
@ -310,9 +307,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
version = "1.4.2"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ae2a35373c5c74340b79ae6780b498b2b183915ec5dacf263aac5a099bf485a"
|
||||
checksum = "b6e854126756c496b8c81dec88f9a706b15b875c5849d4097a3854476b9fdf94"
|
||||
|
||||
[[package]]
|
||||
name = "dhall"
|
||||
|
@ -323,7 +320,7 @@ dependencies = [
|
|||
"abnf_to_pest",
|
||||
"annotate-snippets",
|
||||
"elsa",
|
||||
"half 2.3.1",
|
||||
"half 2.4.0",
|
||||
"hex",
|
||||
"home",
|
||||
"itertools",
|
||||
|
@ -377,9 +374,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
|||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
|
||||
|
||||
[[package]]
|
||||
name = "elsa"
|
||||
|
@ -458,7 +455,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -490,22 +487,6 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gabrielsimmercom"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"comrak",
|
||||
"frontmatter",
|
||||
"include_dir",
|
||||
"maud",
|
||||
"orgize",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_dhall",
|
||||
"time",
|
||||
"worker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
|
@ -524,15 +505,15 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
|||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "1.8.2"
|
||||
version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
||||
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.3.1"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872"
|
||||
checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
|
@ -561,9 +542,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
|
||||
checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -617,9 +598,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indextree"
|
||||
version = "4.6.0"
|
||||
version = "4.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c40411d0e5c63ef1323c3d09ce5ec6d84d71531e18daed0743fccea279d7deb6"
|
||||
checksum = "3a6f7e29c1619ec492f411b021ac9f30649d5f522ca6f287f2467ee48c8dfe10"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
|
@ -632,9 +613,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.10"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "jetscii"
|
||||
|
@ -659,9 +640,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.152"
|
||||
version = "0.2.153"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
|
@ -671,9 +652,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
|
@ -700,14 +681,14 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.1"
|
||||
version = "2.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
|
||||
[[package]]
|
||||
name = "minicbor"
|
||||
|
@ -715,7 +696,7 @@ version = "0.18.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a20020e8e2d1881d8736f64011bb5ff99f1db9947ce3089706945c8915695cb"
|
||||
dependencies = [
|
||||
"half 1.8.2",
|
||||
"half 1.8.3",
|
||||
"minicbor-derive",
|
||||
]
|
||||
|
||||
|
@ -738,9 +719,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
@ -762,10 +743,16 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.17"
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
|
||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
@ -815,9 +802,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
|||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.7.6"
|
||||
version = "2.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06"
|
||||
checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"thiserror",
|
||||
|
@ -848,9 +835,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pest_derive"
|
||||
version = "2.7.6"
|
||||
version = "2.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde"
|
||||
checksum = "f73541b156d32197eecda1a4014d7f868fd2bcb3c550d5386087cfba442bf69c"
|
||||
dependencies = [
|
||||
"pest",
|
||||
"pest_generator",
|
||||
|
@ -858,22 +845,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pest_generator"
|
||||
version = "2.7.6"
|
||||
version = "2.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275"
|
||||
checksum = "c35eeed0a3fab112f75165fdc026b3913f4183133f19b49be773ac9ea966e8bd"
|
||||
dependencies = [
|
||||
"pest",
|
||||
"pest_meta",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pest_meta"
|
||||
version = "2.7.6"
|
||||
version = "2.7.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d"
|
||||
checksum = "2adbf29bb9776f28caece835398781ab24435585fe0d4dc1374a61db5accedca"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"pest",
|
||||
|
@ -920,29 +907,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
@ -993,13 +980,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.78"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
||||
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "queues"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"comrak",
|
||||
"frontmatter",
|
||||
"include_dir",
|
||||
"maud",
|
||||
"orgize",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_dhall",
|
||||
"time",
|
||||
"worker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.30.0"
|
||||
|
@ -1036,9 +1039,9 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.3"
|
||||
version = "1.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -1048,9 +1051,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
|
@ -1059,9 +1062,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
|
||||
[[package]]
|
||||
name = "rss"
|
||||
|
@ -1083,15 +1086,15 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
|||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.16"
|
||||
version = "1.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
|
||||
checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.196"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
|
||||
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1109,13 +1112,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.196"
|
||||
version = "1.0.197"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
|
||||
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1133,9 +1136,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.112"
|
||||
version = "1.0.115"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed"
|
||||
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -1153,6 +1156,22 @@ dependencies = [
|
|||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shared"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"comrak",
|
||||
"frontmatter",
|
||||
"include_dir",
|
||||
"maud",
|
||||
"orgize",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_dhall",
|
||||
"time",
|
||||
"worker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.11"
|
||||
|
@ -1203,9 +1222,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.48"
|
||||
version = "2.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
|
||||
checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1214,33 +1233,34 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.56"
|
||||
version = "1.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
|
||||
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.56"
|
||||
version = "1.0.58"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
|
||||
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.31"
|
||||
version = "0.3.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
|
||||
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
"js-sys",
|
||||
"num-conv",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
|
@ -1255,10 +1275,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
|||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
|
||||
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
|
||||
dependencies = [
|
||||
"num-conv",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
|
@ -1279,9 +1300,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
version = "1.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
|
||||
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"pin-project-lite",
|
||||
|
@ -1319,18 +1340,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.22"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.10.1"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
|
@ -1382,7 +1403,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -1416,7 +1437,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -1440,6 +1461,23 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"comrak",
|
||||
"frontmatter",
|
||||
"include_dir",
|
||||
"maud",
|
||||
"orgize",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_dhall",
|
||||
"shared",
|
||||
"time",
|
||||
"worker",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.63"
|
||||
|
@ -1461,9 +1499,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
|
@ -1476,45 +1514,45 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
version = "0.52.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
|
||||
|
||||
[[package]]
|
||||
name = "worker"
|
||||
|
@ -1569,7 +1607,7 @@ dependencies = [
|
|||
"async-trait",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
"syn 2.0.58",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-macro-support",
|
||||
|
|
30
Cargo.toml
30
Cargo.toml
|
@ -1,28 +1,2 @@
|
|||
[package]
|
||||
name = "gabrielsimmercom"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
worker = { version = "0.0.18", features = ["queue", "d1"] }
|
||||
maud = { version = "*" }
|
||||
serde_dhall = { version = "0.12.1", default-features = false }
|
||||
serde = { version = "1.0.167", features = ["derive"] }
|
||||
include_dir = "0.7.3"
|
||||
frontmatter = "0.4.0"
|
||||
comrak = { version = "0.21.0", default-features = false }
|
||||
orgize = { git = "https://git.gmem.ca/arch/orgize.git", branch = "org-images", default-features = false }
|
||||
rss = { version = "2.0.6" }
|
||||
time = { version = "0.3.31", features = ["parsing", "formatting", "macros", "wasm-bindgen"] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
opt-level = 's'
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
wasm-opt = false
|
||||
[workspace]
|
||||
members = ["queues", "web"]
|
||||
|
|
23
flake.lock
23
flake.lock
|
@ -44,11 +44,11 @@
|
|||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -70,15 +70,16 @@
|
|||
"workers-rs": "workers-rs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1698438955,
|
||||
"narHash": "sha256-6AUmcWUGblB4heOx1Rq541mj3oPICq68QVq8ixSKKKo=",
|
||||
"owner": "ivan770",
|
||||
"lastModified": 1712188891,
|
||||
"narHash": "sha256-0uu6DNFqw+gPouVbelzvRs7/dmKywpQ0h2z3eU5in6E=",
|
||||
"owner": "gmemstr",
|
||||
"repo": "freight",
|
||||
"rev": "059a4656cb0c45972e4e8184c1f035877a5053ab",
|
||||
"rev": "22202c6e74fc92bb1392e014502a23838ae4a991",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ivan770",
|
||||
"owner": "gmemstr",
|
||||
"ref": "patch-1",
|
||||
"repo": "freight",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -101,11 +102,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1706191920,
|
||||
"narHash": "sha256-eLihrZAPZX0R6RyM5fYAWeKVNuQPYjAkCUBr+JNvtdE=",
|
||||
"lastModified": 1712122226,
|
||||
"narHash": "sha256-pmgwKs8Thu1WETMqCrWUm0CkN1nmCKX3b51+EXsAZyY=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ae5c332cbb5827f6b1f02572496b141021de335f",
|
||||
"rev": "08b9151ed40350725eb40b1fe96b0b86304a654b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
25
flake.nix
25
flake.nix
|
@ -3,7 +3,7 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
freight = {
|
||||
url = "github:ivan770/freight";
|
||||
url = "github:gmemstr/freight/patch-1";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
|
@ -21,14 +21,24 @@
|
|||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
inherit (pkgs) lib; in
|
||||
{
|
||||
packages.default = freight.lib.${system}.mkWorker {
|
||||
pname = "gabrielsimmercom-workers";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
packages = rec {
|
||||
web = freight.lib.${system}.mkWorker {
|
||||
pname = "web";
|
||||
version = "0.1.0";
|
||||
strictDeps = true;
|
||||
workspace = true;
|
||||
src = ./.;
|
||||
};
|
||||
queues = freight.lib.${system}.mkWorker {
|
||||
pname = "queues";
|
||||
version = "0.1.0";
|
||||
strictDeps = true;
|
||||
workspace = true;
|
||||
src = ./.;
|
||||
};
|
||||
default = web;
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
|
@ -39,6 +49,7 @@
|
|||
openssl
|
||||
pkg-config
|
||||
cargo-bloat
|
||||
cargo-binutils
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
|||
[package]
|
||||
name = "queues"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
worker = { version = "0.0.18", features = ["queue", "d1"] }
|
||||
maud = { version = "*" }
|
||||
serde_dhall = { version = "0.12.1", default-features = false }
|
||||
serde = { version = "1.0.167", features = ["derive"] }
|
||||
include_dir = "0.7.3"
|
||||
frontmatter = "0.4.0"
|
||||
comrak = { version = "0.21.0", default-features = false }
|
||||
orgize = { git = "https://git.gmem.ca/arch/orgize.git", branch = "org-images", default-features = false }
|
||||
rss = { version = "2.0.6" }
|
||||
time = { version = "0.3.31", features = ["parsing", "formatting", "macros", "wasm-bindgen"] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
opt-level = 's'
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
wasm-opt = false
|
|
@ -0,0 +1,52 @@
|
|||
use posts::PostContent;
|
||||
use worker::*;
|
||||
use maud::{html, Markup, Render, DOCTYPE};
|
||||
use serde::Deserialize;
|
||||
use include_dir::{include_dir, Dir};
|
||||
use time::{self, macros::format_description, format_description::well_known::Rfc2822};
|
||||
|
||||
mod posts;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct R2Object {
|
||||
key: String,
|
||||
size: u64,
|
||||
#[serde(rename = "eTag")]
|
||||
e_tag: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct R2Message {
|
||||
account: String,
|
||||
action: String,
|
||||
bucket: String,
|
||||
object: R2Object,
|
||||
}
|
||||
|
||||
#[event(queue)]
|
||||
async fn queue(message_batch: MessageBatch<R2Message>, env: Env, _ctx: Context) -> Result<()> {
|
||||
let index = env.d1("INDEX")?;
|
||||
let bucket = env.bucket("GABRIELSIMMERCOM_BUCKET")?;
|
||||
let messages = message_batch.messages()?;
|
||||
for message in messages {
|
||||
let fname = message.body.object.key;
|
||||
let dir: Vec<&str> = fname.split("/").collect();
|
||||
if dir[0] != "posts" {
|
||||
continue
|
||||
}
|
||||
console_log!("got {} to render and index", &fname);
|
||||
let file = bucket.get(&fname).execute().await?;
|
||||
if file.is_none() {
|
||||
console_warn!("did not find a file in bucket for {}", fname)
|
||||
}
|
||||
let rendered = posts::blog_post(fname.clone(), file.unwrap().body().unwrap().text().await?).unwrap();
|
||||
|
||||
let statement = index.prepare("INSERT INTO posts (slug, title, html, date) VALUES (?1, ?2, ?3, ?4) ON CONFLICT(slug) DO UPDATE SET html=?3;");
|
||||
let query = statement.bind(&[
|
||||
rendered.slug.into(), rendered.title.into(), rendered.html.into(), rendered.date.into()
|
||||
]).unwrap();
|
||||
let _result = query.run().await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
name = "gabrielsimmercom-queues"
|
||||
main = "result/shim.mjs"
|
||||
compatibility_date = "2023-10-22"
|
||||
|
||||
account_id = "7dc420732ea679a530aee304ea49a63c"
|
||||
workers_dev = true
|
||||
|
||||
[limits]
|
||||
cpu_ms = 100
|
||||
|
||||
[build]
|
||||
command = "nix build .#queues"
|
||||
|
||||
[[r2_buckets]]
|
||||
binding = 'GABRIELSIMMERCOM_BUCKET'
|
||||
bucket_name = 'gabrielsimmer-com'
|
||||
preview_bucket_name = 'gabrielsimmer-com-dev'
|
||||
|
||||
[[d1_databases]]
|
||||
binding = "INDEX"
|
||||
database_name = "gabrielsimmercom"
|
||||
database_id = "53acce7f-f529-4392-aa41-14084c445af0"
|
||||
|
||||
[[queues.consumers]]
|
||||
queue = "gabrielsimmercom-indexing"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
|||
[package]
|
||||
name = "shared"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
worker = { version = "0.0.18", features = ["d1"] }
|
||||
maud = { version = "*" }
|
||||
serde_dhall = { version = "0.12.1", default-features = false }
|
||||
serde = { version = "1.0.167", features = ["derive"] }
|
||||
include_dir = "0.7.3"
|
||||
frontmatter = "0.4.0"
|
||||
comrak = { version = "0.21.0", default-features = false }
|
||||
orgize = { git = "https://git.gmem.ca/arch/orgize.git", branch = "org-images", default-features = false }
|
||||
rss = { version = "2.0.6" }
|
||||
time = { version = "0.3.31", features = ["parsing", "formatting", "macros", "wasm-bindgen"] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
opt-level = 's'
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
wasm-opt = false
|
|
@ -0,0 +1,69 @@
|
|||
use maud::{html, Markup, Render};
|
||||
use orgize::Org;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use std::{path::Path, ffi::OsStr};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PostMetadata {
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub date: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PostContent {
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub date: String,
|
||||
pub html: String,
|
||||
}
|
||||
|
||||
impl Render for PostMetadata {
|
||||
fn render(&self) -> Markup {
|
||||
html! {
|
||||
li { (self.date) " - " a href=(format!("/blog/{}", self.slug)) { (self.title) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render the actual blog post as HTML.
|
||||
pub fn blog_post(fname: String, post: String) -> Result<PostContent, bool> {
|
||||
// Search through /posts directory and find the post with either .md or .org extension
|
||||
// If the post is not found, return 404
|
||||
|
||||
let ext = Path::new(&fname).extension().and_then(OsStr::to_str).unwrap();
|
||||
let ext_name = format!(".{}", ext);
|
||||
let slug = fname.replace("posts/", "").replace( &ext_name, "");
|
||||
let mut html = "".to_owned();
|
||||
let mut date = "".to_owned();
|
||||
let mut title = "".to_owned();
|
||||
if ext == "md" {
|
||||
let (parsed, content) = frontmatter::parse_and_find_content(&post).unwrap();
|
||||
let metadata = parsed.unwrap();
|
||||
date = metadata["date"].as_str().unwrap().to_owned();
|
||||
title = metadata["title"].as_str().unwrap().to_owned();
|
||||
html = comrak::markdown_to_html(&content, &comrak::ComrakOptions::default());
|
||||
} else if ext == "org" {
|
||||
let mut writer = Vec::new();
|
||||
|
||||
let parsed = Org::parse(&post);
|
||||
let keywords = parsed.keywords();
|
||||
// Get date and title from keywords iterator
|
||||
|
||||
for keyword in keywords {
|
||||
if keyword.key == "date" {
|
||||
date = keyword.value.to_string();
|
||||
} else if keyword.key == "title" {
|
||||
title = keyword.value.to_string();
|
||||
}
|
||||
}
|
||||
parsed.write_html(&mut writer).unwrap();
|
||||
html = String::from_utf8(writer).unwrap();
|
||||
}
|
||||
Ok(PostContent {
|
||||
slug,
|
||||
title,
|
||||
date,
|
||||
html,
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
[package]
|
||||
name = "web"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
shared = { path = "../shared" }
|
||||
worker = { version = "0.0.18", features = ["d1"] }
|
||||
maud = { version = "*" }
|
||||
serde_dhall = { version = "0.12.1", default-features = false }
|
||||
serde = { version = "1.0.167", features = ["derive"] }
|
||||
include_dir = "0.7.3"
|
||||
rss = { version = "2.0.6" }
|
||||
time = { version = "0.3.31", features = ["parsing", "formatting", "macros", "wasm-bindgen"] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
opt-level = 's'
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
wasm-opt = false
|
|
@ -0,0 +1,128 @@
|
|||
let Url : Type =
|
||||
{ display_text : Text
|
||||
, link : Text
|
||||
}
|
||||
|
||||
let Project : Type =
|
||||
{ name : Text
|
||||
, description : Text
|
||||
, link : Url
|
||||
, languages : List Text
|
||||
}
|
||||
|
||||
let projects : List Project =
|
||||
[ { name = "GabrielSimmer.com"
|
||||
, description = "Overengineered personal site with on the fly page generation and tiered caching"
|
||||
, link = { display_text = "git.gmem.ca/arch/gabrielsimmer.com", link = "https://git.gmem.ca/arch/gabrielsimmer.com" }
|
||||
, languages = [ "Rust" ]
|
||||
}
|
||||
, { name = "My infrastructure"
|
||||
, description = "A mix of Terraform and Nix configurations keeping my lights on"
|
||||
, link = { display_text = "git.gmem.ca/arch/inra", link = "https://git.gmem.ca/arch/infra" }
|
||||
, languages = [ "Terraform", "Nix" ]
|
||||
}
|
||||
, { name = "Minecraft Server Invites"
|
||||
, description = "Small service that generates links to Minecraft servers, whitelisting players"
|
||||
, link = { display_text = "gmem/minecraft-server-invites", link = "https://sr.ht/~gmem/minecraft-server-invites/" }
|
||||
, languages = [ "Go", "Svelte" ]
|
||||
}
|
||||
, { name = "artbybecki.com"
|
||||
, description = "A website for my significant other to showcase her art work and more."
|
||||
, link = { display_text = "artbybecki.com", link = "https://artbybecki.com" }
|
||||
, languages = [ "Svelte", "CouchDB" ]
|
||||
}
|
||||
, { name = "nvidia-driver-update-tool"
|
||||
, description = "Minimal application for checking for NVIDIA GPU driver updates."
|
||||
, link = { display_text = "gmemstr/nvidia-driver-update-tool", link = "https://github.com/gmemstr/nvidia-driver-update-tool" }
|
||||
, languages = [ "C#", ".NET" ]
|
||||
}
|
||||
, { name = "Platypus"
|
||||
, description = "Large-scale server usage monitoring leveraging websockets."
|
||||
, link = { display_text = "gmemstr/platypus", link = "https://github.com/gmemstr/platypus" }
|
||||
, languages = [ "Go" ]
|
||||
}
|
||||
, { name = "pogo"
|
||||
, description = "Self-hosted podcast content manager and RSS feed generator."
|
||||
, link = { display_text = "gmemstr/pogo", link = "https://github.com/gmemstr/pogo" }
|
||||
, languages = [ "Go" ]
|
||||
}
|
||||
, { name = "sliproad"
|
||||
, description = "Tie together file storage providers in a single unified interface and API."
|
||||
, link = { display_text = "gmemstr/sliproad", link = "https://github.com/gmemstr/sliproad" }
|
||||
, languages = [ "Go" ]
|
||||
}
|
||||
, { name = "Deploy"
|
||||
, description = "CircleCI mobile client."
|
||||
, link = { display_text = "gmemstr/deploy-app", link = "https://github.com/gmemstr/deploy-app" }
|
||||
, languages = [ "Flutter", "Dart" ]
|
||||
}
|
||||
, { name = "Database Janitor"
|
||||
, description = "Create sanitized database dumps."
|
||||
, link = { display_text = "gmemstr/database-janitor", link = "https://github.com/gmemstr/database-janitor" }
|
||||
, languages = [ "PHP" ]
|
||||
}
|
||||
, { name = "Drupal modules"
|
||||
, description = "Various Drupal modules created both for client sites and personal use."
|
||||
, link = { display_text = "/u/gmem", link = "https://www.drupal.org/u/gmem" }
|
||||
, languages = [ "PHP" ]
|
||||
}
|
||||
]
|
||||
|
||||
let experiments : List Project =
|
||||
[ { name = "hue-webapp"
|
||||
, description = "Small web frontend and proxy for interacting with Hue lighting."
|
||||
, link = { display_text = "gmemstr/hue-webapp", link = "https://github.com/gmemstr/hue-webapp" }
|
||||
, languages = [ "Python" ]
|
||||
}
|
||||
, { name = "eink-dashboard"
|
||||
, description = "Lightweight eink dashboard/display using a Raspberry Pi."
|
||||
, link = { display_text = "gmemstr/eink-dashboard", link = "https://github.com/gmemstr/eink-dashboard" }
|
||||
, languages = [ "Python" ]
|
||||
}
|
||||
, { name = "dotfiles"
|
||||
, description = "Configuration files for Linux installations."
|
||||
, link = { display_text = "gmemstr/dotfiles", link = "https://github.com/gmemstr/dotfiles" }
|
||||
, languages = [ "Shell" ]
|
||||
}
|
||||
, { name = "REPLNote"
|
||||
, description = "Notepad with embeded Clojure REPL."
|
||||
, link = { display_text = "gmemstr/replnote", link = "https://github.com/gmemstr/replnote" }
|
||||
, languages = [ "Clojure" ]
|
||||
}
|
||||
, { name = "banana-clj"
|
||||
, description = "Encode your data as the word \"banana\"."
|
||||
, link = { display_text = "gmemstr/banana-clj", link = "https://github.com/gmemstr/banana-clj" }
|
||||
, languages = [ "Clojure" ]
|
||||
}
|
||||
, { name = "whalepod"
|
||||
, description = "Quicky generate Dockerfiles based on a template."
|
||||
, link = { display_text = "gmemstr/whalepod", link = "https://github.com/gmemstr/whalepod" }
|
||||
, languages = [ "Rust" ]
|
||||
}
|
||||
, { name = "gmem.ca"
|
||||
, description = "Random HTML/JS/CSS experiements using Vercel functions."
|
||||
, link = { display_text = "gmemstr/gmem.ca", link = "https://github.com/gmemstr/gmem.ca" }
|
||||
, languages = [ "HTML", "JavaScript", "CSS" ]
|
||||
}
|
||||
, { name = "circleci-api-scripts"
|
||||
, description = "Collection of scripts for interacting with the CircleCI APIs and collecting data."
|
||||
, link = { display_text = "gmemstr/circleci-api-scripts", link = "https://github.com/gmemstr/circleci-api-scripts" }
|
||||
, languages = [ "Python" ]
|
||||
}
|
||||
, { name = "no-swears"
|
||||
, description = "Small module for removing swear words from strings."
|
||||
, link = { display_text = "gmemstr/no-swears", link = "https://github.com/gmemstr/no-swears" }
|
||||
, languages = [ "JavaScript" ]
|
||||
}
|
||||
, { name = "GTFO Terminal OCR"
|
||||
, description = "Analyze terminals from the \"GTFO\" game and extract information."
|
||||
, link = { display_text = "gmemstr/gtfo-terminal-ocr", link = "https://github.com/gmemstr/gtfo-terminal-ocr" }
|
||||
, languages = [ "Python" ]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
in
|
||||
{ projects
|
||||
, experiments
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
use posts::PostContent;
|
||||
use shared::*;
|
||||
use worker::*;
|
||||
use maud::{html, Markup, Render, DOCTYPE};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::Deserialize;
|
||||
use include_dir::{include_dir, Dir};
|
||||
use time::{self, macros::format_description, format_description::well_known::Rfc2822};
|
||||
|
||||
mod posts;
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct Project {
|
||||
name: String,
|
||||
|
@ -106,7 +104,7 @@ async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||
|
||||
let index = ctx.env.d1("INDEX")?;
|
||||
let statement = index.prepare("SELECT * FROM posts ORDER BY date DESC");
|
||||
let posts: Vec<posts::PostMetadata> = statement.all().await?.results()?;
|
||||
let posts: Vec<PostMetadata> = statement.all().await?.results()?;
|
||||
|
||||
let html = html! {
|
||||
(header("/blog"))
|
||||
|
@ -141,7 +139,7 @@ async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||
let slug = ctx.param("slug").unwrap();
|
||||
let statement = index.prepare("SELECT * FROM posts WHERE slug=?1");
|
||||
let query = statement.bind(&[slug.into()])?;
|
||||
let post = query.first::<PostContent>(None).await?;
|
||||
let post = query.first::<shared::PostContent>(None).await?;
|
||||
|
||||
let p = post.unwrap();
|
||||
let html_maud = maud::PreEscaped(p.html);
|
||||
|
@ -174,7 +172,7 @@ async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||
|
||||
let index = ctx.env.d1("INDEX")?;
|
||||
let statement = index.prepare("SELECT * FROM posts ORDER BY date DESC");
|
||||
let posts: Vec<posts::PostMetadata> = statement.all().await?.results()?;
|
||||
let posts: Vec<PostMetadata> = statement.all().await?.results()?;
|
||||
let rss_posts: Vec<rss::Item> = posts.into_iter().map(|p| {
|
||||
let date = format!("{} 00:00:00 +00:00:00", p.date);
|
||||
let format = format_description!("[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour sign:mandatory]:[offset_minute]:[offset_second]");
|
||||
|
@ -245,31 +243,3 @@ fn header(page_title: &str) -> Markup {
|
|||
link rel="alternate" type="application/rss+xml" title="Gabriel Simmer's Blog" href="/rss";
|
||||
}
|
||||
}
|
||||
|
||||
#[event(queue)]
|
||||
async fn queue(message_batch: MessageBatch<R2Message>, env: Env, _ctx: Context) -> Result<()> {
|
||||
let index = env.d1("INDEX")?;
|
||||
let bucket = env.bucket("GABRIELSIMMERCOM_BUCKET")?;
|
||||
let messages = message_batch.messages()?;
|
||||
for message in messages {
|
||||
let fname = message.body.object.key;
|
||||
let dir: Vec<&str> = fname.split("/").collect();
|
||||
if dir[0] != "posts" {
|
||||
continue
|
||||
}
|
||||
console_log!("got {} to render and index", &fname);
|
||||
let file = bucket.get(&fname).execute().await?;
|
||||
if file.is_none() {
|
||||
console_warn!("did not find a file in bucket for {}", fname)
|
||||
}
|
||||
let rendered = posts::blog_post(fname.clone(), file.unwrap().body().unwrap().text().await?).unwrap();
|
||||
|
||||
let statement = index.prepare("INSERT INTO posts (slug, title, html, date) VALUES (?1, ?2, ?3, ?4) ON CONFLICT(slug) DO UPDATE SET html=?3;");
|
||||
let query = statement.bind(&[
|
||||
rendered.slug.into(), rendered.title.into(), rendered.html.into(), rendered.date.into()
|
||||
]).unwrap();
|
||||
let _result = query.run().await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -9,7 +9,7 @@ workers_dev = true
|
|||
cpu_ms = 100
|
||||
|
||||
[build]
|
||||
command = "nix build"
|
||||
command = "nix build .#web"
|
||||
|
||||
[[r2_buckets]]
|
||||
binding = 'GABRIELSIMMERCOM_BUCKET' # <~ valid JavaScript variable name
|
||||
|
@ -20,10 +20,3 @@ preview_bucket_name = 'gabrielsimmer-com-dev'
|
|||
binding = "INDEX"
|
||||
database_name = "gabrielsimmercom"
|
||||
database_id = "53acce7f-f529-4392-aa41-14084c445af0"
|
||||
|
||||
[[queues.producers]]
|
||||
binding = "INDEXING"
|
||||
queue = "gabrielsimmercom-indexing"
|
||||
|
||||
[[queues.consumers]]
|
||||
queue = "gabrielsimmercom-indexing"
|
Loading…
Reference in New Issue