mirror of
https://github.com/RGBCube/rgbcube.github.io
synced 2025-05-14 05:54:58 +00:00
Work
This commit is contained in:
parent
dc82b04345
commit
ca27953746
23 changed files with 445 additions and 642 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,13 +1,11 @@
|
|||
*
|
||||
|
||||
!assets/
|
||||
|
||||
!src/
|
||||
!src/cube/
|
||||
!src/minify/
|
||||
!src/page/
|
||||
!src/page/cube/
|
||||
!src/routes/
|
||||
!src/routes/_404/
|
||||
!src/routes/index/
|
||||
!src/routes/not_found/
|
||||
|
||||
!.gitattributes
|
||||
!.gitignore
|
||||
|
|
624
Cargo.lock
generated
624
Cargo.lock
generated
|
@ -48,21 +48,14 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.76"
|
||||
name = "async-trait"
|
||||
version = "0.1.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355"
|
||||
|
||||
[[package]]
|
||||
name = "async-compression"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a"
|
||||
checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -71,6 +64,59 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "202651474fe73c62d9e0a56c6133f7a0ff1dc1c8cf7a5b03381af2a26553ac9d"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"itoa",
|
||||
"matchit",
|
||||
"memchr",
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77cb22c689c44d4c07b0ab44ebc25d69d8ae601a2f28fb8d672d344178fa17aa"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"mime",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"sync_wrapper",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
|
@ -86,12 +132,6 @@ dependencies = [
|
|||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
|
@ -104,33 +144,28 @@ version = "2.4.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
|
||||
[[package]]
|
||||
name = "cargo_toml"
|
||||
version = "0.17.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a969e13a7589e9e3e4207e153bae624ade2b5622fb4684a4923b23ec3d57719"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
|
@ -146,25 +181,6 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "5.5.3"
|
||||
|
@ -178,22 +194,6 @@ dependencies = [
|
|||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embed"
|
||||
version = "0.1.0"
|
||||
|
@ -202,15 +202,6 @@ dependencies = [
|
|||
"include_dir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.1"
|
||||
|
@ -274,7 +265,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -302,32 +292,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -338,9 +305,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
|||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.22"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178"
|
||||
checksum = "e1d308f63daf4181410c242d34c11f928dcb3aa105852019e043c9d1f4e4368a"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -371,30 +338,6 @@ version = "0.14.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
||||
|
||||
[[package]]
|
||||
name = "headers"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
"headers-core",
|
||||
"http",
|
||||
"httpdate",
|
||||
"mime",
|
||||
"sha1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "headers-core"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429"
|
||||
dependencies = [
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.3"
|
||||
|
@ -403,9 +346,9 @@ checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
|
|||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.11"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
|
||||
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
|
@ -414,12 +357,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "0.4.6"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-body-util"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
|
@ -443,13 +398,12 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.28"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||
checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
|
@ -458,21 +412,25 @@ dependencies = [
|
|||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.5.0"
|
||||
name = "hyper-util"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
|
||||
checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -555,11 +513,16 @@ version = "0.4.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
|
||||
[[package]]
|
||||
name = "maud"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0bab19cef8a7fe1c18a43e881793bfc9d4ea984befec3ae5bd0415abf3ecf00"
|
||||
source = "git+https://github.com/vidhanio/maud?branch=patch-1#fb77d399d001a345f3a369eb2c7a12da243376a6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"maud_macros",
|
||||
|
@ -568,13 +531,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "maud_macros"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0be95d66c3024ffce639216058e5bae17a83ecaf266ffc6e4d060ad447c9eed2"
|
||||
source = "git+https://github.com/vidhanio/maud?branch=patch-1#fb77d399d001a345f3a369eb2c7a12da243376a6"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -629,24 +591,6 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multer"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-util",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
"memchr",
|
||||
"mime",
|
||||
"spin",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
|
@ -731,7 +675,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.43",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -746,12 +690,6 @@ version = "0.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
|
@ -761,7 +699,6 @@ dependencies = [
|
|||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
@ -794,36 +731,6 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.4.1"
|
||||
|
@ -882,13 +789,10 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "1.0.4"
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
|
||||
dependencies = [
|
||||
"base64",
|
||||
]
|
||||
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
|
@ -896,12 +800,6 @@ version = "1.0.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
|
@ -925,7 +823,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.43",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -939,6 +837,25 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_path_to_error"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
|
@ -951,17 +868,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.1"
|
||||
|
@ -975,16 +881,18 @@ dependencies = [
|
|||
name = "site"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"axum",
|
||||
"bytes",
|
||||
"cargo_toml",
|
||||
"dashmap",
|
||||
"embed",
|
||||
"env_logger",
|
||||
"log",
|
||||
"maud",
|
||||
"mime_guess",
|
||||
"minify-js",
|
||||
"tar",
|
||||
"tokio",
|
||||
"warp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1012,23 +920,6 @@ dependencies = [
|
|||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.43"
|
||||
|
@ -1040,6 +931,12 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "tar"
|
||||
version = "0.4.40"
|
||||
|
@ -1060,41 +957,6 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.43",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec_macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.35.1"
|
||||
|
@ -1122,30 +984,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.43",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-stream"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tungstenite"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"tokio",
|
||||
"tungstenite",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1162,6 +1001,62 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower-layer"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
|
||||
|
||||
[[package]]
|
||||
name = "tower-service"
|
||||
version = "0.3.2"
|
||||
|
@ -1188,37 +1083,6 @@ dependencies = [
|
|||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "tungstenite"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"data-encoding",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
"rand",
|
||||
"sha1",
|
||||
"thiserror",
|
||||
"url",
|
||||
"utf-8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.7.0"
|
||||
|
@ -1228,91 +1092,18 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||
dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "want"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
|
||||
dependencies = [
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "warp"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1e92e22e03ff1230c03a1a8ee37d2f89cd489e2e541b7550d6afad96faed169"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"headers",
|
||||
"http",
|
||||
"hyper",
|
||||
"log",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"multer",
|
||||
"percent-encoding",
|
||||
"pin-project",
|
||||
"rustls-pemfile",
|
||||
"scoped-tls",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-tungstenite",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
@ -1482,6 +1273,15 @@ version = "0.52.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "1.1.3"
|
||||
|
@ -1510,5 +1310,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
|||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.43",
|
||||
"syn",
|
||||
]
|
||||
|
|
10
Cargo.toml
10
Cargo.toml
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "site"
|
||||
description = "RGBCube's homepage."
|
||||
description = "The official website and link portal of RGBCube and his work."
|
||||
authors = [ "RGBCube" ]
|
||||
license = "GPL"
|
||||
version = "0.1.0"
|
||||
|
@ -9,16 +9,18 @@ repositoty = "https://github.com/RGBCube/rgbcube.github.io"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
axum = "0.7.2"
|
||||
bytes = "1.5.0"
|
||||
cargo_toml = "0.17.2"
|
||||
dashmap = "5.5.3"
|
||||
embed = { git = "https://github.com/RGBCube/embed-rs" }
|
||||
env_logger = "0.10.1"
|
||||
log = "0.4.20"
|
||||
maud = "0.25.0"
|
||||
maud = { git = "https://github.com/vidhanio/maud", branch = "patch-1" }
|
||||
mime_guess = "2.0.4"
|
||||
minify-js = "0.5.6"
|
||||
tar = "0.4.40"
|
||||
tokio = { version = "1.35.1", features = [ "full" ] }
|
||||
warp = { version = "0.3.6", features = [ "async-compression" ] }
|
||||
|
||||
[build]
|
||||
incremental = true
|
||||
|
|
13
build.rs
13
build.rs
|
@ -1,13 +0,0 @@
|
|||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
Command::new("tar")
|
||||
.args(["cf", "assets.tar", "assets"])
|
||||
.output()
|
||||
.expect("Failed to package assets");
|
||||
|
||||
println!("cargo:rerun-if-changed=assets");
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
println!("cargo:rustc-env=ASSETS_PATH=assets.tar");
|
||||
}
|
68
src/asset.rs
Normal file
68
src/asset.rs
Normal file
|
@ -0,0 +1,68 @@
|
|||
use axum::{
|
||||
body::Body,
|
||||
http::header,
|
||||
response::Response,
|
||||
routing,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use minify_js::{
|
||||
Session,
|
||||
TopLevelMode,
|
||||
};
|
||||
|
||||
fn route(path: &'static str, content: Bytes) -> String {
|
||||
crate::route(
|
||||
path,
|
||||
routing::get(async move || {
|
||||
Response::builder()
|
||||
.header(
|
||||
header::CONTENT_TYPE,
|
||||
mime_guess::from_path(path)
|
||||
.first_or_octet_stream()
|
||||
.to_string(),
|
||||
)
|
||||
.body(Body::from(content.clone()))
|
||||
.unwrap()
|
||||
}),
|
||||
);
|
||||
|
||||
format!("/assets/{path}")
|
||||
}
|
||||
|
||||
pub(crate) fn __register_asset(
|
||||
path: &'static str,
|
||||
min_path: &'static str,
|
||||
content: Vec<u8>,
|
||||
) -> String {
|
||||
let (minifiable, minified_content) = match path.rsplit_once(".").unwrap_or_default().1 {
|
||||
"js" => {
|
||||
let mut minified = Vec::new();
|
||||
|
||||
minify_js::minify(
|
||||
&Session::new(),
|
||||
TopLevelMode::Module,
|
||||
&content,
|
||||
&mut minified,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
(true, minified)
|
||||
},
|
||||
_ => (false, content.clone()), // TODO: Minify CSS.
|
||||
};
|
||||
|
||||
if minifiable {
|
||||
route(path, Bytes::from(content));
|
||||
route(min_path, Bytes::from(minified_content))
|
||||
}
|
||||
else {
|
||||
route(path, Bytes::from(content))
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! asset {
|
||||
($path:literal) => {{
|
||||
crate::asset::__register_asset($path, $path, ::embed::bytes!($path).to_vec())
|
||||
}};
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
pub const URL: &str = "https://rgbcube.github.io/";
|
|
@ -1,41 +0,0 @@
|
|||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
PreEscaped,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
minify,
|
||||
page,
|
||||
};
|
||||
|
||||
const FACES: [&str; 6] = ["front", "top", "back", "bottom", "right", "left"];
|
||||
|
||||
pub fn create<S: AsRef<str>>(styling: S, faces: [Markup; 6]) -> Markup {
|
||||
page::create(
|
||||
html! {
|
||||
style {
|
||||
(PreEscaped(minify::css(embed::string!("cube.css"))))
|
||||
}
|
||||
},
|
||||
html! {
|
||||
style {
|
||||
(PreEscaped(&styling))
|
||||
}
|
||||
|
||||
div class="scene" {
|
||||
div class="cube" {
|
||||
@for (name, content) in FACES.iter().zip(faces) {
|
||||
div class=(format!("face {name}")) {
|
||||
(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
script {
|
||||
(PreEscaped(minify::js(embed::string!("cube.js"))))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
63
src/main.rs
63
src/main.rs
|
@ -1,27 +1,58 @@
|
|||
#![feature(lazy_cell)]
|
||||
#![feature(lazy_cell, async_closure)]
|
||||
|
||||
mod constants;
|
||||
mod cube;
|
||||
mod minify;
|
||||
mod asset;
|
||||
mod page;
|
||||
mod routes;
|
||||
|
||||
use constants::*;
|
||||
use env_logger::Target;
|
||||
use log::LevelFilter;
|
||||
use routes::*;
|
||||
use warp::Filter;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use axum::{
|
||||
routing::{
|
||||
self,
|
||||
MethodRouter,
|
||||
},
|
||||
Router,
|
||||
};
|
||||
use tokio::{
|
||||
net::TcpListener,
|
||||
sync::Mutex,
|
||||
};
|
||||
|
||||
pub(crate) static ROUTER: LazyLock<Mutex<Router>> = LazyLock::new(|| Mutex::new(Router::new()));
|
||||
|
||||
pub(crate) fn route(path: &str, handler: MethodRouter<()>) {
|
||||
let mut router = ROUTER.blocking_lock();
|
||||
|
||||
*router = router.clone().route(path, handler);
|
||||
|
||||
log::info!("Registered route {path}.")
|
||||
}
|
||||
|
||||
fn not_found_handler(handler: MethodRouter<()>) {
|
||||
let mut router = ROUTER.blocking_lock();
|
||||
|
||||
*router = router.clone().fallback(handler);
|
||||
|
||||
log::info!("Registered 404 handler.")
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
env_logger::Builder::new()
|
||||
.filter_level(LevelFilter::Info)
|
||||
.target(Target::Stdout)
|
||||
async fn main() {
|
||||
env_logger::builder()
|
||||
.filter_level(log::LevelFilter::Info)
|
||||
.target(env_logger::Target::Stdout)
|
||||
.init();
|
||||
|
||||
let routes = index::filter().or(assets::filter()).or(_404::filter());
|
||||
route("/", routing::get(routes::index::handler));
|
||||
|
||||
warp::serve(routes).run(([0, 0, 0, 0], 80)).await;
|
||||
// not_found_handler({
|
||||
// routes::not_found::init();
|
||||
// routes::not_found::handler.into()
|
||||
// });
|
||||
|
||||
Ok(())
|
||||
let listener = TcpListener::bind("0.0.0.0:80").await.unwrap();
|
||||
|
||||
let app = ROUTER.lock().await;
|
||||
|
||||
axum::serve(listener, app.clone()).await.unwrap();
|
||||
}
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
pub fn css<S: AsRef<str>>(input: S) -> String {
|
||||
// TODO: Actually do something.
|
||||
return input.as_ref().to_string();
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
use minify_js::{
|
||||
Session,
|
||||
TopLevelMode,
|
||||
};
|
||||
|
||||
pub fn js<S: AsRef<str>>(input: S) -> String {
|
||||
let session = Session::new();
|
||||
let mut out = Vec::new();
|
||||
|
||||
minify_js::minify(
|
||||
&session,
|
||||
TopLevelMode::Module,
|
||||
input.as_ref().as_bytes(),
|
||||
&mut out,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
String::from_utf8(out).unwrap()
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
mod css;
|
||||
pub use css::css;
|
||||
|
||||
mod js;
|
||||
pub use js::js;
|
28
src/page/cube/mod.rs
Normal file
28
src/page/cube/mod.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
};
|
||||
|
||||
use crate::asset;
|
||||
|
||||
pub(crate) fn create(asset: &str, faces: [Markup; 6]) -> Markup {
|
||||
crate::page::create(
|
||||
html! {
|
||||
link rel="stylesheet" type="text/css" href=(asset!("cube.css"));
|
||||
link rel="stylesheet" type="text/css" href=(asset);
|
||||
},
|
||||
html! {
|
||||
div class="scene" {
|
||||
div class="cube" {
|
||||
@for (name, content) in ["front", "top", "back", "bottom", "right", "left"].iter().zip(faces) {
|
||||
div class=(format!("face {name}")) {
|
||||
(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
script src=(asset!("cube.js"));
|
||||
},
|
||||
)
|
||||
}
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
|
@ -1,29 +1,32 @@
|
|||
pub mod cube;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use cargo_toml::Manifest;
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
PreEscaped,
|
||||
DOCTYPE,
|
||||
};
|
||||
|
||||
use crate::asset;
|
||||
|
||||
static MANIFEST: LazyLock<Manifest> =
|
||||
LazyLock::new(|| Manifest::from_str(&embed::string!("../../Cargo.toml")).unwrap());
|
||||
|
||||
fn property(name: &str, content: &str) -> Markup {
|
||||
PreEscaped(
|
||||
html! {
|
||||
meta property=(name) content=(content);
|
||||
}
|
||||
.into_string(),
|
||||
)
|
||||
html! {
|
||||
meta property=(name) content=(content);
|
||||
}
|
||||
}
|
||||
|
||||
fn pname(name: &str, content: &str) -> Markup {
|
||||
PreEscaped(
|
||||
html! {
|
||||
meta name=(name) content=(content);
|
||||
}
|
||||
.into_string(),
|
||||
)
|
||||
html! {
|
||||
meta name=(name) content=(content);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create(head: Markup, body: Markup) -> Markup {
|
||||
pub(crate) fn create(head: Markup, body: Markup) -> Markup {
|
||||
html! {
|
||||
(DOCTYPE)
|
||||
|
||||
|
@ -41,25 +44,26 @@ pub fn create(head: Markup, body: Markup) -> Markup {
|
|||
(property("og:site_name", name))
|
||||
(property("og:title", name))
|
||||
|
||||
@let description = "The official website and link portal of RGBCube and his work.";
|
||||
@let description = MANIFEST.package.as_ref().unwrap().description().unwrap();
|
||||
(pname("description", description))
|
||||
(property("og:description", description))
|
||||
|
||||
link rel="icon" href="/assets/icon.gif" type="image/gif";
|
||||
link rel="icon" href=(asset!("icon.gif")) type="image/gif";
|
||||
|
||||
(property("og:image", "thumbnail.png"))
|
||||
(property("og:image:type", "image/png"))
|
||||
(property("og:image:height", "1080"))
|
||||
(property("og:image:width", "600"))
|
||||
|
||||
(property("og:url", crate::URL))
|
||||
link rel="canonical" href=(crate::URL);
|
||||
@let url = MANIFEST.package.as_ref().unwrap().homepage().unwrap();
|
||||
(property("og:url", url))
|
||||
link rel="canonical" href=(url);
|
||||
|
||||
(PreEscaped(head.into_string()))
|
||||
(head)
|
||||
}
|
||||
|
||||
body {
|
||||
(PreEscaped(body.into_string()))
|
||||
(body)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
use std::{
|
||||
array,
|
||||
convert::Infallible,
|
||||
sync::LazyLock,
|
||||
};
|
||||
|
||||
use maud::html;
|
||||
use warp::{
|
||||
reply::{
|
||||
self,
|
||||
Html,
|
||||
},
|
||||
Filter,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
cube,
|
||||
minify,
|
||||
};
|
||||
|
||||
static PAGE: LazyLock<String> = LazyLock::new(|| {
|
||||
cube::create(
|
||||
minify::css(embed::string!("404.css")),
|
||||
array::from_fn(|_| {
|
||||
(html! {
|
||||
div class="frame" { "404" }
|
||||
div class="square black" {}
|
||||
div class="square magenta" {}
|
||||
div class="square magenta" {}
|
||||
div class="square black" {}
|
||||
})
|
||||
.clone()
|
||||
}),
|
||||
)
|
||||
.into_string()
|
||||
});
|
||||
|
||||
pub fn filter() -> impl Filter<Extract = (Html<&'static str>,), Error = Infallible> + Clone {
|
||||
warp::any().map(|| reply::html(PAGE.as_str()))
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
io::{
|
||||
Cursor,
|
||||
Read,
|
||||
},
|
||||
sync::LazyLock,
|
||||
};
|
||||
|
||||
use tar::Archive;
|
||||
use warp::{
|
||||
filters::fs::File,
|
||||
reject::Rejection,
|
||||
Filter,
|
||||
};
|
||||
|
||||
static _ASSETS: LazyLock<HashMap<String, Vec<u8>>> = LazyLock::new(|| {
|
||||
let contents = embed::bytes!("../../assets.tar");
|
||||
|
||||
let mut archive = Archive::new(Cursor::new(contents.as_ref()));
|
||||
let mut assets = HashMap::new();
|
||||
|
||||
for entry in archive.entries().unwrap() {
|
||||
let mut entry = entry.unwrap();
|
||||
|
||||
let path = String::from_utf8(entry.path_bytes().to_vec()).unwrap();
|
||||
|
||||
// Is a directory.
|
||||
if path.ends_with("/") {
|
||||
continue;
|
||||
}
|
||||
|
||||
let mut contents = Vec::new();
|
||||
entry.read_to_end(&mut contents).unwrap();
|
||||
|
||||
assets.insert(path, contents);
|
||||
}
|
||||
|
||||
assets
|
||||
});
|
||||
|
||||
pub fn filter() -> impl Filter<Extract = (File,), Error = Rejection> + Clone {
|
||||
warp::path("assets").and(warp::fs::dir("assets"))
|
||||
}
|
|
@ -1,23 +1,18 @@
|
|||
use std::sync::LazyLock;
|
||||
|
||||
use maud::html;
|
||||
use warp::{
|
||||
reject::Rejection,
|
||||
reply::{
|
||||
self,
|
||||
Html,
|
||||
},
|
||||
Filter,
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
cube,
|
||||
minify,
|
||||
asset,
|
||||
page::cube,
|
||||
};
|
||||
|
||||
static PAGE: LazyLock<String> = LazyLock::new(|| {
|
||||
static PAGE: LazyLock<BoxedFuture<Markup>>> = LazyLock::new(|| {
|
||||
cube::create(
|
||||
minify::css(embed::string!("index.css")),
|
||||
&asset!("index.css"),
|
||||
[
|
||||
html! {
|
||||
a href="/contact" {
|
||||
|
@ -39,9 +34,13 @@ static PAGE: LazyLock<String> = LazyLock::new(|| {
|
|||
html! {},
|
||||
],
|
||||
)
|
||||
.into_string()
|
||||
});
|
||||
|
||||
pub fn filter() -> impl Filter<Extract = (Html<&'static str>,), Error = Rejection> + Clone {
|
||||
warp::path!().map(|| reply::html(PAGE.as_str()))
|
||||
pub fn init() {
|
||||
let _ = &*PAGE;
|
||||
}
|
||||
|
||||
pub async fn handler() -> &'static str {
|
||||
// &*PAGE
|
||||
"asd"
|
||||
}
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
pub mod _404;
|
||||
pub mod assets;
|
||||
pub mod index;
|
||||
pub(crate) mod index;
|
||||
pub(crate) mod not_found;
|
||||
|
|
41
src/routes/not_found/mod.rs
Normal file
41
src/routes/not_found/mod.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
use std::sync::LazyLock;
|
||||
|
||||
use maud::{
|
||||
html,
|
||||
Markup,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
asset,
|
||||
page::cube,
|
||||
};
|
||||
|
||||
static PAGE: LazyLock<Markup> = LazyLock::new(|| {
|
||||
let face = html! {
|
||||
div class="frame" { "404" }
|
||||
div class="square black" {}
|
||||
div class="square magenta" {}
|
||||
div class="square magenta" {}
|
||||
div class="square black" {}
|
||||
};
|
||||
|
||||
cube::create(
|
||||
&asset!("404.css"),
|
||||
[
|
||||
face.clone(),
|
||||
face.clone(),
|
||||
face.clone(),
|
||||
face.clone(),
|
||||
face.clone(),
|
||||
face.clone(),
|
||||
],
|
||||
)
|
||||
});
|
||||
|
||||
pub fn init() {
|
||||
let _ = &*PAGE;
|
||||
}
|
||||
|
||||
pub async fn handler() -> &'static Markup {
|
||||
&*PAGE
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue