2 Commits

Author SHA1 Message Date
e221419b83 Merge branch 'master' into rocket
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-18 11:08:19 +03:00
b598f71e1e Merge branch 'master' into rocket
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-29 09:38:14 +03:00
6 changed files with 135 additions and 248 deletions

224
Cargo.lock generated
View File

@@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.0.4" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -74,18 +74,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.73" version = "0.1.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -148,9 +148,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.4.0" version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
@@ -228,9 +228,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.82" version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -401,11 +401,11 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.3.3",
"proc-macro2", "proc-macro2",
"proc-macro2-diagnostics", "proc-macro2-diagnostics",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -442,7 +442,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -554,7 +554,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"rustix 0.38.8", "rustix 0.38.6",
"tokio", "tokio",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@@ -624,7 +624,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -794,9 +794,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]] [[package]]
name = "httpdate" name = "httpdate"
version = "1.0.3" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]] [[package]]
name = "humansize" name = "humansize"
@@ -824,7 +824,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2 0.4.9", "socket2",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@@ -931,7 +931,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi",
"rustix 0.38.8", "rustix 0.38.6",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@@ -961,9 +961,9 @@ dependencies = [
[[package]] [[package]]
name = "kqueue" name = "kqueue"
version = "1.0.8" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98"
dependencies = [ dependencies = [
"kqueue-sys", "kqueue-sys",
"libc", "libc",
@@ -971,9 +971,9 @@ dependencies = [
[[package]] [[package]]
name = "kqueue-sys" name = "kqueue-sys"
version = "1.0.4" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"libc", "libc",
@@ -1021,9 +1021,9 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.20" version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
[[package]] [[package]]
name = "loom" name = "loom"
@@ -1072,9 +1072,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]] [[package]]
name = "mini-moka" name = "mini-moka"
version = "0.10.2" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" checksum = "452ebc1428a585e31e637b928b76355ef2fd72d765b2530d72fe475e514cd1eb"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"crossbeam-utils", "crossbeam-utils",
@@ -1223,7 +1223,7 @@ dependencies = [
"libc", "libc",
"redox_syscall", "redox_syscall",
"smallvec", "smallvec",
"windows-targets 0.48.3", "windows-targets 0.48.1",
] ]
[[package]] [[package]]
@@ -1269,7 +1269,7 @@ checksum = "61a386cd715229d399604b50d1361683fe687066f42d56f54be995bc6868f71c"
dependencies = [ dependencies = [
"inlinable_string", "inlinable_string",
"pear_codegen", "pear_codegen",
"yansi 1.0.0-rc.1", "yansi 1.0.0-rc",
] ]
[[package]] [[package]]
@@ -1281,7 +1281,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"proc-macro2-diagnostics", "proc-macro2-diagnostics",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -1320,7 +1320,7 @@ dependencies = [
"pest_meta", "pest_meta",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -1390,14 +1390,14 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.12" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@@ -1434,9 +1434,9 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
"version_check", "version_check",
"yansi 1.0.0-rc.1", "yansi 1.0.0-rc",
] ]
[[package]] [[package]]
@@ -1452,10 +1452,9 @@ dependencies = [
[[package]] [[package]]
name = "qchgk_web" name = "qchgk_web"
version = "0.2.0" version = "0.1.1"
dependencies = [ dependencies = [
"chgk_ledb_lib", "chgk_ledb_lib",
"lazy_static",
"mini-moka", "mini-moka",
"rand", "rand",
"rocket", "rocket",
@@ -1464,9 +1463,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.33" version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -1512,33 +1511,33 @@ dependencies = [
[[package]] [[package]]
name = "ref-cast" name = "ref-cast"
version = "1.0.20" version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" checksum = "61ef7e18e8841942ddb1cf845054f8008410030a3997875d9e49b7a363063df1"
dependencies = [ dependencies = [
"ref-cast-impl", "ref-cast-impl",
] ]
[[package]] [[package]]
name = "ref-cast-impl" name = "ref-cast-impl"
version = "1.0.20" version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" checksum = "2dfaf0c85b766276c797f3791f5bc6d5bd116b41d53049af2789666b0c0bc9fa"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.9.3" version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
"regex-automata 0.3.6", "regex-automata 0.3.4",
"regex-syntax 0.7.4", "regex-syntax 0.7.4",
] ]
@@ -1553,9 +1552,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-automata" name = "regex-automata"
version = "0.3.6" version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -1625,7 +1624,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rocket_http", "rocket_http",
"syn 2.0.29", "syn 2.0.28",
"unicode-xid", "unicode-xid",
] ]
@@ -1691,11 +1690,11 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.8" version = "0.38.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.3.3",
"errno 0.3.2", "errno 0.3.2",
"libc", "libc",
"linux-raw-sys 0.4.5", "linux-raw-sys 0.4.5",
@@ -1746,29 +1745,29 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.183" version = "1.0.181"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" checksum = "6d3e73c93c3240c0bda063c239298e633114c69a888c3e37ca8bb33f343e9890"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.183" version = "1.0.181"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" checksum = "be02f6cb0cd3a5ec20bbcfbcbd749f57daddb1a0882dc2e46a6c236c90b977ed"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.105" version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -1868,16 +1867,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "socket2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@@ -1938,9 +1927,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.29" version = "2.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1955,14 +1944,14 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.7.1" version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",
"redox_syscall", "redox_syscall",
"rustix 0.38.8", "rustix 0.38.6",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@@ -1991,22 +1980,22 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.47" version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.47" version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -2048,10 +2037,11 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.32.0" version = "1.29.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da"
dependencies = [ dependencies = [
"autocfg",
"backtrace", "backtrace",
"bytes", "bytes",
"libc", "libc",
@@ -2059,7 +2049,7 @@ dependencies = [
"num_cpus", "num_cpus",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2 0.5.3", "socket2",
"tokio-macros", "tokio-macros",
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
@@ -2072,7 +2062,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -2160,7 +2150,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
] ]
[[package]] [[package]]
@@ -2380,7 +2370,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -2402,7 +2392,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.28",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@@ -2450,7 +2440,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [ dependencies = [
"windows-targets 0.48.3", "windows-targets 0.48.1",
] ]
[[package]] [[package]]
@@ -2483,7 +2473,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [ dependencies = [
"windows-targets 0.48.3", "windows-targets 0.48.1",
] ]
[[package]] [[package]]
@@ -2503,17 +2493,17 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.48.3" version = "0.48.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27f51fb4c64f8b770a823c043c7fad036323e1c48f55287b7bbb7987b2fcdf3b" checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm 0.48.3", "windows_aarch64_gnullvm 0.48.0",
"windows_aarch64_msvc 0.48.3", "windows_aarch64_msvc 0.48.0",
"windows_i686_gnu 0.48.3", "windows_i686_gnu 0.48.0",
"windows_i686_msvc 0.48.3", "windows_i686_msvc 0.48.0",
"windows_x86_64_gnu 0.48.3", "windows_x86_64_gnu 0.48.0",
"windows_x86_64_gnullvm 0.48.3", "windows_x86_64_gnullvm 0.48.0",
"windows_x86_64_msvc 0.48.3", "windows_x86_64_msvc 0.48.0",
] ]
[[package]] [[package]]
@@ -2524,9 +2514,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fde1bb55ae4ce76a597a8566d82c57432bc69c039449d61572a7a353da28f68c" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
@@ -2536,9 +2526,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1513e8d48365a78adad7322fd6b5e4c4e99d92a69db8df2d435b25b1f1f286d4" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
@@ -2548,9 +2538,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60587c0265d2b842298f5858e1a5d79d146f9ee0c37be5782e92a6eb5e1d7a83" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
@@ -2560,9 +2550,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224fe0e0ffff5d2ea6a29f82026c8f43870038a0ffc247aa95a52b47df381ac4" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
@@ -2572,9 +2562,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62fc52a0f50a088de499712cbc012df7ebd94e2d6eb948435449d76a6287e7ad" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
@@ -2584,9 +2574,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2093925509d91ea3d69bcd20238f4c2ecdb1a29d3c281d026a09705d0dd35f3d" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
@@ -2596,15 +2586,15 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.48.3" version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6ade45bc8bf02ae2aa34a9d54ba660a1a58204da34ba793c00d83ca3730b5f1" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.5.14" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@@ -2617,9 +2607,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
[[package]] [[package]]
name = "yansi" name = "yansi"
version = "1.0.0-rc.1" version = "1.0.0-rc"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" checksum = "9ee746ad3851dd3bc40e4a028ab3b00b99278d929e48957bcb2d111874a7e43e"
[[package]] [[package]]
name = "zstd" name = "zstd"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "qchgk_web" name = "qchgk_web"
version = "0.2.0" version = "0.1.1"
authors = ["Dmitry <b4tm4n@mail.ru>"] authors = ["Dmitry <b4tm4n@mail.ru>"]
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
@@ -15,7 +15,6 @@ rocket = { version = "=0.5.0-rc.3", features = ["json"] }
rocket_dyn_templates = { version = "=0.1.0-rc.3", features = ["tera"] } rocket_dyn_templates = { version = "=0.1.0-rc.3", features = ["tera"] }
chgk_ledb_lib = {git = "https://gitea.b4tman.ru/b4tman/chgk_ledb.git", rev="699478f85e", package="chgk_ledb_lib", features=["async"]} chgk_ledb_lib = {git = "https://gitea.b4tman.ru/b4tman/chgk_ledb.git", rev="699478f85e", package="chgk_ledb_lib", features=["async"]}
mini-moka = "0.10.0" mini-moka = "0.10.0"
lazy_static = "1.4.0"
[profile.release] [profile.release]
opt-level = 3 opt-level = 3

View File

@@ -2,11 +2,7 @@
extern crate rocket; extern crate rocket;
use rocket::fs::FileServer; use rocket::fs::FileServer;
use rocket::fs::Options;
use rocket::http::ContentType;
use rocket::request::Request;
use rocket::response::Redirect; use rocket::response::Redirect;
use rocket::response::{self, Responder, Response};
use rocket::State; use rocket::State;
use rocket_dyn_templates::tera; use rocket_dyn_templates::tera;
use rocket_dyn_templates::Template; use rocket_dyn_templates::Template;
@@ -14,8 +10,6 @@ use rocket_dyn_templates::Template;
use rand::distributions::Uniform; use rand::distributions::Uniform;
use rand::Rng; use rand::Rng;
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::ops::Deref; use std::ops::Deref;
use std::sync::Arc; use std::sync::Arc;
@@ -27,10 +21,6 @@ use std::time::Duration;
const DB_FILENAME: &str = "db.dat"; const DB_FILENAME: &str = "db.dat";
lazy_static! {
static ref EMPTY_MAP: HashMap<String, String> = HashMap::new();
}
trait ErrorEmpty { trait ErrorEmpty {
type Output; type Output;
fn err_empty(self) -> Result<Self::Output, ()>; fn err_empty(self) -> Result<Self::Output, ()>;
@@ -43,38 +33,11 @@ impl<T, E> ErrorEmpty for Result<T, E> {
} }
} }
#[derive(Debug, Responder)]
enum WebError {
#[response(status = 404)]
NotFound(Template),
#[response(status = 500)]
ServerError(Template),
}
impl WebError {
fn not_found() -> Self {
WebError::NotFound(Template::render("404", EMPTY_MAP.deref()))
}
fn server_error() -> Self {
WebError::ServerError(Template::render("500", EMPTY_MAP.deref()))
}
}
/// wrapper for terra:Value (json, context), to cache values by ref
/// implements Responder as json content type
#[derive(Clone)] #[derive(Clone)]
struct ArcTemplateData { struct ArcTemplateData {
value: Arc<tera::Value>, value: Arc<tera::Value>,
} }
impl Deref for ArcTemplateData {
type Target = tera::Value;
fn deref(&self) -> &Self::Target {
self.value.deref()
}
}
impl ArcTemplateData { impl ArcTemplateData {
fn new(value: tera::Value) -> ArcTemplateData { fn new(value: tera::Value) -> ArcTemplateData {
ArcTemplateData { ArcTemplateData {
@@ -82,15 +45,7 @@ impl ArcTemplateData {
} }
} }
fn render(&self, name: &'static str) -> Template { fn render(&self, name: &'static str) -> Template {
Template::render(name, self.deref()) Template::render(name, self.value.deref())
}
}
impl<'r> Responder<'r, 'static> for ArcTemplateData {
fn respond_to(self, req: &'r Request<'_>) -> response::Result<'static> {
Response::build_from(self.to_string().respond_to(req)?)
.header(ContentType::JSON)
.ok()
} }
} }
@@ -125,13 +80,14 @@ async fn get_question(db: &DataBase, id: usize) -> Result<Question, ()> {
db.get(id - 1).await.err_empty() db.get(id - 1).await.err_empty()
} }
async fn get_question_data( async fn show_question_details(
template_name: &'static str,
data: &AppState, data: &AppState,
cache: &TemplateCache, cache: &TemplateCache,
id: usize, id: usize,
) -> Option<ArcTemplateData> { ) -> Template {
if let Some(value) = cache.get(&id) { if let Some(value) = cache.get(&id) {
return Some(value); return value.render(template_name);
} }
match get_question(&data.db, id).await { match get_question(&data.db, id).await {
@@ -142,49 +98,31 @@ async fn get_question_data(
context["next"] = tera::to_value(next_id).expect("question id serialize"); context["next"] = tera::to_value(next_id).expect("question id serialize");
} }
let data = ArcTemplateData::new(context); let value = ArcTemplateData::new(context);
cache.insert(id, data.clone()); let result = value.render(template_name);
Some(data) cache.insert(id, value);
result
}
Err(_) => {
use std::collections::HashMap;
let context: HashMap<String, String> = HashMap::new();
Template::render("404", context)
} }
Err(_) => None,
} }
} }
async fn show_question_details(
template_name: &'static str,
data: &AppState,
cache: &TemplateCache,
id: usize,
) -> Option<Template> {
get_question_data(data, cache, id)
.await
.map(|data| data.render(template_name))
}
#[get("/q/<id>/json")]
async fn json_question(
data: &State<AppState>,
cache: &State<TemplateCache>,
id: usize,
) -> Option<ArcTemplateData> {
get_question_data(data.inner(), cache.inner(), id).await
}
#[get("/q/<id>")] #[get("/q/<id>")]
async fn show_question( async fn show_question(
data: &State<AppState>, data: &State<AppState>,
cache: &State<TemplateCache>, cache: &State<TemplateCache>,
id: usize, id: usize,
) -> Option<Template> { ) -> Template {
show_question_details("question", data.inner(), cache.inner(), id).await show_question_details("question", data.inner(), cache.inner(), id).await
} }
#[get("/q/<id>/a")] #[get("/q/<id>/a")]
async fn show_answer( async fn show_answer(data: &State<AppState>, cache: &State<TemplateCache>, id: usize) -> Template {
data: &State<AppState>,
cache: &State<TemplateCache>,
id: usize,
) -> Option<Template> {
show_question_details("answer", data.inner(), cache.inner(), id).await show_question_details("answer", data.inner(), cache.inner(), id).await
} }
@@ -198,12 +136,6 @@ fn answer0() -> Redirect {
Redirect::to("/") Redirect::to("/")
} }
#[get("/q/0/json")]
fn json0(data: &State<AppState>) -> Redirect {
let id = random_question_id(&data.database_distribution);
Redirect::temporary(format!("/q/{}/json", id))
}
#[get("/")] #[get("/")]
fn index(data: &State<AppState>) -> Redirect { fn index(data: &State<AppState>) -> Redirect {
let id = random_question_id(&data.database_distribution); let id = random_question_id(&data.database_distribution);
@@ -211,13 +143,10 @@ fn index(data: &State<AppState>) -> Redirect {
} }
#[catch(404)] #[catch(404)]
fn not_found(_req: &rocket::Request) -> WebError { fn not_found(_req: &rocket::Request) -> Template {
WebError::not_found() use std::collections::HashMap;
} let context: HashMap<String, String> = HashMap::new();
Template::render("404", context)
#[catch(500)]
fn server_error(_req: &rocket::Request) -> WebError {
WebError::server_error()
} }
#[launch] #[launch]
@@ -234,20 +163,12 @@ async fn rocket() -> _ {
rocket::build() rocket::build()
.manage(state) .manage(state)
.manage(cache) .manage(cache)
.register("/", catchers![not_found, server_error]) .register("/", catchers![not_found])
.mount( .mount(
"/", "/",
routes![ routes![index, show_question, show_answer, question0, answer0],
index,
json_question,
show_question,
show_answer,
question0,
answer0,
json0
],
) )
.mount("/q", routes![index]) .mount("/q", routes![index])
.mount("/q/static", FileServer::new("static/", Options::None)) .mount("/q/static", FileServer::from("static/"))
.attach(Template::fairing()) .attach(Template::fairing())
} }

View File

@@ -1,13 +1,5 @@
{% extends "base" %} {% extends "base" %}
{% block title %}404{% endblock title %} {% block title %}404{% endblock title %}
{% block nav %}
{% endblock nav %}
{% block content %} {% block content %}
<div class="content-block"> <h1>404 - Could not find that page</h1>
<div class="content-block-inner mt-4 px-4 py-2 fs-1 top-50 start-50 translate-middle">
<h1 class="display-4 d-flex justify-content-center text-center fw-bold">404</h1>
<br/>
<p>Нет такой страницы &#128532;</p>
</div>
</div>
{% endblock content %} {% endblock content %}

View File

@@ -1,13 +0,0 @@
{% extends "base" %}
{% block title %}500{% endblock title %}
{% block nav %}
{% endblock nav %}
{% block content %}
<div class="content-block">
<div class="content-block-inner mt-4 px-4 py-2 fs-1 top-50 start-50 translate-middle">
<h1 class="display-4 d-flex justify-content-center text-center fw-bold">500</h1>
<br/>
<p>&#128558; Ой, кажется у нас тут что то сломалось...</p>
</div>
</div>
{% endblock content %}

View File

@@ -42,7 +42,7 @@
<p><span>Тема: </span> {{ theme }}</p> <p><span>Тема: </span> {{ theme }}</p>
{% endif %} {% endif %}
{% if rating | length %} {% if rating | length %}
<p><span>Рейтинг: </span> {{ rating }}</p> <p><span>Рейтинг: </span> {{ author }}</p>
{% endif %} {% endif %}
{% if batch_info.description | length %} {% if batch_info.description | length %}
<p><span>Чемпионат: </span> {{ batch_info.description }}</p> <p><span>Чемпионат: </span> {{ batch_info.description }}</p>
@@ -53,8 +53,6 @@
{% if id | length %} {% if id | length %}
<p><span>Номер: </span> {{ id }}</p> <p><span>Номер: </span> {{ id }}</p>
{% endif %} {% endif %}
<br/>
<p class="text-muted"> Показать как <a href="/q/{{ num }}/json">json</a></p>
</div></details> </div></details>
</div> </div>
<br /> <br />