From 5d3f64f558ff1c23a102e844fb756a2137222104 Mon Sep 17 00:00:00 2001 From: code002lover Date: Sat, 29 Nov 2025 12:00:58 +0100 Subject: [PATCH] test page --- backend/Cargo.lock | 681 ++++++++++++++++++++++++++++++++----- backend/Cargo.toml | 2 +- backend/build.rs | 11 + backend/src/main.rs | 32 +- frontend/items.ts | 443 ++++++++++++++++++++++++ frontend/package.json | 7 +- frontend/pnpm-lock.yaml | 56 +++ frontend/src/App.tsx | 48 +-- frontend/tsconfig.app.json | 20 +- protobuf/items.proto | 28 +- 10 files changed, 1195 insertions(+), 133 deletions(-) create mode 100644 frontend/items.ts diff --git a/backend/Cargo.lock b/backend/Cargo.lock index e95606b..de82e28 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -11,6 +11,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "anyhow" version = "1.0.100" @@ -50,12 +56,6 @@ dependencies = [ "syn", ] -[[package]] -name = "atomic" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" - [[package]] name = "atomic" version = "0.6.1" @@ -65,6 +65,41 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5ce75405893cd713f9ab8e297d8e438f624dde7d706108285f7e17a25a180f" +dependencies = [ + "aws-lc-sys", + "untrusted 0.7.1", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "179c3777a8b5e70e90ea426114ffc565b2c1a9f82f6c4a0c5a34aa6ef5e781b6" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "backend" version = "0.1.0" @@ -95,6 +130,12 @@ version = "1.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.11.0" @@ -108,6 +149,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -117,6 +160,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + [[package]] name = "cookie" version = "0.18.1" @@ -128,6 +180,23 @@ dependencies = [ "version_check", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "cuckoofilter" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" +dependencies = [ + "byteorder", + "fnv", + "rand 0.7.3", +] + [[package]] name = "deranged" version = "0.5.5" @@ -170,6 +239,12 @@ dependencies = [ "syn", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "either" version = "1.15.0" @@ -213,7 +288,7 @@ version = "0.10.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cb01cd46b0cf372153850f4c6c272d9cbea2da513e07538405148f95bd789f3" dependencies = [ - "atomic 0.6.1", + "atomic", "pear", "serde", "toml", @@ -239,6 +314,18 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.31" @@ -275,6 +362,17 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.31" @@ -296,6 +394,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -317,6 +416,17 @@ dependencies = [ "windows", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.16" @@ -325,7 +435,7 @@ checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] @@ -348,16 +458,16 @@ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "h2" -version = "0.3.27" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", - "http 0.2.12", + "http", "indexmap", "slab", "tokio", @@ -365,11 +475,36 @@ dependencies = [ "tracing", ] +[[package]] +name = "h3" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e7675a0963b47a6d12fe44c279918b4ffb19baee838ac37f48d2722ad5bc6ab" +dependencies = [ + "bytes", + "fastrand", + "futures-util", + "http", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "hash_hasher" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b4b9ebce26001bad2e6366295f64e381c1e9c479109202149b9e15e154973e9" + [[package]] name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "heck" @@ -384,15 +519,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] -name = "http" -version = "0.2.12" +name = "hex-literal" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "http" @@ -406,13 +536,12 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 0.2.12", - "pin-project-lite", + "http", ] [[package]] @@ -429,26 +558,39 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.32" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", "futures-core", - "futures-util", "h2", - "http 0.2.12", + "http", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.10", + "pin-utils", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "hyper", + "pin-project-lite", "tokio", - "tower-service", - "tracing", - "want", ] [[package]] @@ -469,6 +611,15 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + [[package]] name = "is-terminal" version = "0.4.17" @@ -495,6 +646,16 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -507,6 +668,12 @@ version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + [[package]] name = "linux-raw-sys" version = "0.11.0" @@ -558,6 +725,15 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" @@ -571,7 +747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", "windows-sys 0.61.2", ] @@ -584,8 +760,9 @@ dependencies = [ "bytes", "encoding_rs", "futures-util", - "http 1.4.0", + "http", "httparse", + "log", "memchr", "mime", "spin", @@ -615,6 +792,35 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + [[package]] name = "num_cpus" version = "1.17.0" @@ -819,6 +1025,19 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -826,8 +1045,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -837,7 +1076,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -849,6 +1107,24 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -878,6 +1154,12 @@ dependencies = [ "syn", ] +[[package]] +name = "ref-swap" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c30c54dffee5b40af088d5d50aa3455c91a0127164b51f0215efc4cb28fb3c" + [[package]] name = "regex" version = "1.12.2" @@ -908,37 +1190,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] -name = "rocket" -version = "0.5.1" +name = "ring" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a516907296a31df7dc04310e7043b61d71954d703b603cc6867a026d7e72d73f" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "rocket" +version = "0.6.0-dev" +source = "git+https://github.com/rwf2/Rocket?rev=504efef179622df82ba1dbd37f2e0d9ed2b7c9e4#504efef179622df82ba1dbd37f2e0d9ed2b7c9e4" dependencies = [ "async-stream", "async-trait", - "atomic 0.5.3", "binascii", "bytes", + "cookie", "either", "figment", "futures", + "http", + "hyper", + "hyper-util", "indexmap", - "log", + "libc", "memchr", "multer", "num_cpus", "parking_lot", "pin-project-lite", - "rand", + "rand 0.8.5", "ref-cast", + "ref-swap", "rocket_codegen", "rocket_http", + "rustls", + "s2n-quic-h3", "serde", "state", "tempfile", + "thread_local", "time", + "tinyvec", "tokio", + "tokio-rustls", "tokio-stream", "tokio-util", + "tracing", + "tracing-subscriber", "ubyte", "version_check", "yansi", @@ -946,9 +1252,8 @@ dependencies = [ [[package]] name = "rocket_codegen" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "575d32d7ec1a9770108c879fc7c47815a80073f96ca07ff9525a94fcede1dd46" +version = "0.6.0-dev" +source = "git+https://github.com/rwf2/Rocket?rev=504efef179622df82ba1dbd37f2e0d9ed2b7c9e4#504efef179622df82ba1dbd37f2e0d9ed2b7c9e4" dependencies = [ "devise", "glob", @@ -963,28 +1268,21 @@ dependencies = [ [[package]] name = "rocket_http" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e274915a20ee3065f611c044bd63c40757396b6dbc057d6046aec27f14f882b9" +version = "0.6.0-dev" +source = "git+https://github.com/rwf2/Rocket?rev=504efef179622df82ba1dbd37f2e0d9ed2b7c9e4#504efef179622df82ba1dbd37f2e0d9ed2b7c9e4" dependencies = [ "cookie", "either", - "futures", - "http 0.2.12", - "hyper", "indexmap", - "log", "memchr", "pear", "percent-encoding", - "pin-project-lite", "ref-cast", "serde", - "smallvec", "stable-pattern", "state", "time", - "tokio", + "tinyvec", "uncased", ] @@ -1010,6 +1308,43 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1022,6 +1357,136 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "s2n-codec" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ce62ab2534380ee20a32ce169c733df8462ef9821489ae8df8603c1d9e89574" +dependencies = [ + "byteorder", + "bytes", + "zerocopy", +] + +[[package]] +name = "s2n-quic" +version = "1.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cfd37e7de6e7d73a8c55996a1389d27d6bbe377e565440ef4980252062bf09" +dependencies = [ + "bytes", + "cfg-if", + "cuckoofilter", + "futures", + "hash_hasher", + "rand 0.9.2", + "rand_chacha 0.9.0", + "s2n-codec", + "s2n-quic-core", + "s2n-quic-crypto", + "s2n-quic-platform", + "s2n-quic-rustls", + "s2n-quic-transport", + "tokio", + "zerocopy", + "zeroize", +] + +[[package]] +name = "s2n-quic-core" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d36dc08b73cea81834036fa54ba9cf4ad91ede5a31543d0ad64a63f7e99d15db" +dependencies = [ + "atomic-waker", + "byteorder", + "bytes", + "cfg-if", + "crossbeam-utils", + "hex-literal", + "num-rational", + "num-traits", + "once_cell", + "pin-project-lite", + "s2n-codec", + "subtle", + "tracing", + "zerocopy", +] + +[[package]] +name = "s2n-quic-crypto" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da8e47e0db3b85012cdcb7a95490639893fa60ea0d680730424839d2c268e23c" +dependencies = [ + "aws-lc-rs", + "cfg-if", + "lazy_static", + "s2n-codec", + "s2n-quic-core", + "zeroize", +] + +[[package]] +name = "s2n-quic-h3" +version = "0.1.0" +source = "git+https://github.com/SergioBenitez/s2n-quic-h3.git?rev=f832471#f83247128132c968d57a99fa5e76ac7f1528ea10" +dependencies = [ + "bytes", + "futures", + "h3", + "s2n-quic", + "tracing", +] + +[[package]] +name = "s2n-quic-platform" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "218ddcd7677c8dee8fc48e6f4daaeecb63c7c5b28b21d2429a53fcbf326b55ce" +dependencies = [ + "cfg-if", + "futures", + "lazy_static", + "libc", + "s2n-quic-core", + "socket2", + "tokio", +] + +[[package]] +name = "s2n-quic-rustls" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc59fae30cffc275a6e798c00996f3e56dc74371bd685e112e66a231ced86c4a" +dependencies = [ + "bytes", + "rustls", + "rustls-pki-types", + "s2n-codec", + "s2n-quic-core", + "s2n-quic-crypto", +] + +[[package]] +name = "s2n-quic-transport" +version = "0.69.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbd2465236f7ce448f082a33bdc2e85ef62a7ce68c7eef79e4d90dc1b3eec0c" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "hashbrown", + "intrusive-collections", + "once_cell", + "s2n-codec", + "s2n-quic-core", + "siphasher", + "smallvec", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -1110,6 +1575,12 @@ dependencies = [ "libc", ] +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.11" @@ -1122,16 +1593,6 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.1" @@ -1166,6 +1627,12 @@ dependencies = [ "loom", ] +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.111" @@ -1230,6 +1697,21 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +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.48.0" @@ -1239,9 +1721,10 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.1", + "socket2", "tokio-macros", "windows-sys 0.61.2", ] @@ -1257,6 +1740,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.17" @@ -1322,12 +1815,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - [[package]] name = "tracing" version = "0.1.43" @@ -1380,6 +1867,7 @@ dependencies = [ "matchers", "nu-ansi-term", "once_cell", + "parking_lot", "regex-automata", "sharded-slab", "smallvec", @@ -1389,12 +1877,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - [[package]] name = "ubyte" version = "0.10.4" @@ -1426,6 +1908,18 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "valuable" version = "0.1.1" @@ -1439,13 +1933,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "want" -version = "0.3.1" +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasi" @@ -1733,3 +2224,23 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 0670027..c639655 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -6,7 +6,7 @@ edition = "2024" [dependencies] prost = "0.14.1" prost-types = "0.14.1" -rocket = "0.5.1" +rocket = { git = "https://github.com/rwf2/Rocket", rev = "504efef179622df82ba1dbd37f2e0d9ed2b7c9e4" } bytes = "1" rocket_prost_responder_derive = { path = "rocket_prost_responder_derive" } diff --git a/backend/build.rs b/backend/build.rs index 36b9d75..5428137 100644 --- a/backend/build.rs +++ b/backend/build.rs @@ -1,3 +1,5 @@ +use std::process::Command; + extern crate prost_build; fn main() -> Result<(), std::io::Error> { @@ -11,5 +13,14 @@ fn main() -> Result<(), std::io::Error> { ); cfg.compile_protos(&["../protobuf/items.proto"], &["../protobuf"])?; + + Command::new("pnpm") + .arg("run") + .arg("build") + .current_dir("../frontend") + .spawn() + .unwrap() + .wait() + .unwrap(); Ok(()) } diff --git a/backend/src/main.rs b/backend/src/main.rs index 1ec0784..e427d51 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -1,3 +1,11 @@ +use rocket::{ + Request, + fs::{ + FileServer, + rewrite::{File, Rewrite}, + }, +}; + #[macro_use] extern crate rocket; @@ -11,8 +19,22 @@ fn get_user(user_list: &rocket::State>, name: String) -> Opti } #[get("/")] -fn index(user_list: &rocket::State>) -> String { - format!("Hello, user amount: {}", user_list.len()) +fn get_users(user_list: &rocket::State>) -> items::PersonList { + items::PersonList { + person: user_list + .inner() + .to_vec() + .iter_mut() + .map(|x| { + x.opinion.clear(); + x.clone() + }) + .collect(), + } +} + +fn redir_missing<'r>(p: Option>, _req: &Request<'_>) -> Option> { + Some(p.unwrap_or_else(|| Rewrite::File(File::checked("../frontend/dist/index.html")))) } #[launch] @@ -36,5 +58,9 @@ fn rocket() -> _ { rocket::build() .manage(user_list) - .mount("/", routes![index, get_user]) + .mount("/api", routes![get_users, get_user]) + .mount( + "/", + FileServer::new("../frontend/dist").rewrite(redir_missing), + ) } diff --git a/frontend/items.ts b/frontend/items.ts new file mode 100644 index 0000000..361fcc0 --- /dev/null +++ b/frontend/items.ts @@ -0,0 +1,443 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.8.3 +// protoc v6.33.1 +// source: items.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "items"; + +export enum Source { + STEAM = 0, + ROBLOX = 1, + UNRECOGNIZED = -1, +} + +export function sourceFromJSON(object: any): Source { + switch (object) { + case 0: + case "STEAM": + return Source.STEAM; + case 1: + case "ROBLOX": + return Source.ROBLOX; + case -1: + case "UNRECOGNIZED": + default: + return Source.UNRECOGNIZED; + } +} + +export function sourceToJSON(object: Source): string { + switch (object) { + case Source.STEAM: + return "STEAM"; + case Source.ROBLOX: + return "ROBLOX"; + case Source.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Person { + name: string; + opinion: Opinion[]; +} + +export interface Opinion { + game: Game | undefined; + wouldPlay: boolean; +} + +export interface Game { + title: string; + source: Source; + multiplayer: boolean; + minPlayers: number; + maxPlayers: number; + price: number; +} + +export interface PersonList { + person: Person[]; +} + +function createBasePerson(): Person { + return { name: "", opinion: [] }; +} + +export const Person: MessageFns = { + encode(message: Person, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.opinion) { + Opinion.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Person { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePerson(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.opinion.push(Opinion.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Person { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + opinion: globalThis.Array.isArray(object?.opinion) ? object.opinion.map((e: any) => Opinion.fromJSON(e)) : [], + }; + }, + + toJSON(message: Person): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.opinion?.length) { + obj.opinion = message.opinion.map((e) => Opinion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Person { + return Person.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Person { + const message = createBasePerson(); + message.name = object.name ?? ""; + message.opinion = object.opinion?.map((e) => Opinion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOpinion(): Opinion { + return { game: undefined, wouldPlay: false }; +} + +export const Opinion: MessageFns = { + encode(message: Opinion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.game !== undefined) { + Game.encode(message.game, writer.uint32(10).fork()).join(); + } + if (message.wouldPlay !== false) { + writer.uint32(16).bool(message.wouldPlay); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Opinion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOpinion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.game = Game.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.wouldPlay = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Opinion { + return { + game: isSet(object.game) ? Game.fromJSON(object.game) : undefined, + wouldPlay: isSet(object.wouldPlay) ? globalThis.Boolean(object.wouldPlay) : false, + }; + }, + + toJSON(message: Opinion): unknown { + const obj: any = {}; + if (message.game !== undefined) { + obj.game = Game.toJSON(message.game); + } + if (message.wouldPlay !== false) { + obj.wouldPlay = message.wouldPlay; + } + return obj; + }, + + create, I>>(base?: I): Opinion { + return Opinion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Opinion { + const message = createBaseOpinion(); + message.game = (object.game !== undefined && object.game !== null) ? Game.fromPartial(object.game) : undefined; + message.wouldPlay = object.wouldPlay ?? false; + return message; + }, +}; + +function createBaseGame(): Game { + return { title: "", source: 0, multiplayer: false, minPlayers: 0, maxPlayers: 0, price: 0 }; +} + +export const Game: MessageFns = { + encode(message: Game, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.source !== 0) { + writer.uint32(16).int32(message.source); + } + if (message.multiplayer !== false) { + writer.uint32(24).bool(message.multiplayer); + } + if (message.minPlayers !== 0) { + writer.uint32(32).uint32(message.minPlayers); + } + if (message.maxPlayers !== 0) { + writer.uint32(40).uint32(message.maxPlayers); + } + if (message.price !== 0) { + writer.uint32(48).uint32(message.price); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Game { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGame(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.source = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.multiplayer = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minPlayers = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxPlayers = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.price = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Game { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + source: isSet(object.source) ? sourceFromJSON(object.source) : 0, + multiplayer: isSet(object.multiplayer) ? globalThis.Boolean(object.multiplayer) : false, + minPlayers: isSet(object.minPlayers) ? globalThis.Number(object.minPlayers) : 0, + maxPlayers: isSet(object.maxPlayers) ? globalThis.Number(object.maxPlayers) : 0, + price: isSet(object.price) ? globalThis.Number(object.price) : 0, + }; + }, + + toJSON(message: Game): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.source !== 0) { + obj.source = sourceToJSON(message.source); + } + if (message.multiplayer !== false) { + obj.multiplayer = message.multiplayer; + } + if (message.minPlayers !== 0) { + obj.minPlayers = Math.round(message.minPlayers); + } + if (message.maxPlayers !== 0) { + obj.maxPlayers = Math.round(message.maxPlayers); + } + if (message.price !== 0) { + obj.price = Math.round(message.price); + } + return obj; + }, + + create, I>>(base?: I): Game { + return Game.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Game { + const message = createBaseGame(); + message.title = object.title ?? ""; + message.source = object.source ?? 0; + message.multiplayer = object.multiplayer ?? false; + message.minPlayers = object.minPlayers ?? 0; + message.maxPlayers = object.maxPlayers ?? 0; + message.price = object.price ?? 0; + return message; + }, +}; + +function createBasePersonList(): PersonList { + return { person: [] }; +} + +export const PersonList: MessageFns = { + encode(message: PersonList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.person) { + Person.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PersonList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePersonList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.person.push(Person.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PersonList { + return { + person: globalThis.Array.isArray(object?.person) ? object.person.map((e: any) => Person.fromJSON(e)) : [], + }; + }, + + toJSON(message: PersonList): unknown { + const obj: any = {}; + if (message.person?.length) { + obj.person = message.person.map((e) => Person.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PersonList { + return PersonList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PersonList { + const message = createBasePersonList(); + message.person = object.person?.map((e) => Person.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/frontend/package.json b/frontend/package.json index c2c577a..7ef2959 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,9 +7,11 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", - "preview": "vite preview" + "preview": "vite preview", + "gen:proto": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=. -I ../protobuf items.proto" }, "dependencies": { + "@bufbuild/protobuf": "^2.10.1", "react": "^19.2.0", "react-dom": "^19.2.0" }, @@ -23,6 +25,7 @@ "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", "globals": "^16.5.0", + "ts-proto": "^2.8.3", "typescript": "~5.9.3", "typescript-eslint": "^8.46.4", "vite": "npm:rolldown-vite@7.2.5" @@ -32,4 +35,4 @@ "vite": "npm:rolldown-vite@7.2.5" } } -} +} \ No newline at end of file diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index fc8aad2..fff5b9a 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: .: dependencies: + '@bufbuild/protobuf': + specifier: ^2.10.1 + version: 2.10.1 react: specifier: ^19.2.0 version: 19.2.0 @@ -45,6 +48,9 @@ importers: globals: specifier: ^16.5.0 version: 16.5.0 + ts-proto: + specifier: ^2.8.3 + version: 2.8.3 typescript: specifier: ~5.9.3 version: 5.9.3 @@ -140,6 +146,9 @@ packages: resolution: {integrity: sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==} engines: {node: '>=6.9.0'} + '@bufbuild/protobuf@2.10.1': + resolution: {integrity: sha512-ckS3+vyJb5qGpEYv/s1OebUHDi/xSNtfgw1wqKZo7MR9F2z+qXr0q5XagafAG/9O0QPVIUfST0smluYSTpYFkg==} + '@emnapi/core@1.7.1': resolution: {integrity: sha512-o1uhUASyo921r2XtHYOHy7gdkGLge8ghBEQHMWmyJFoXlpU58kIrhhN3w26lpQb6dspetweapMn2CSNwQ8I4wg==} @@ -460,6 +469,10 @@ packages: caniuse-lite@1.0.30001757: resolution: {integrity: sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==} + case-anything@2.1.13: + resolution: {integrity: sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==} + engines: {node: '>=12.13'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -496,10 +509,18 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + detect-libc@1.0.3: + resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==} + engines: {node: '>=0.10'} + hasBin: true + detect-libc@2.1.2: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + dprint-node@1.0.8: + resolution: {integrity: sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==} + electron-to-chromium@1.5.262: resolution: {integrity: sha512-NlAsMteRHek05jRUxUR0a5jpjYq9ykk6+kO0yRaMi5moe7u0fVIOeQ3Y30A8dIiWFBNUoQGi1ljb1i5VtS9WQQ==} @@ -939,6 +960,16 @@ packages: peerDependencies: typescript: '>=4.8.4' + ts-poet@6.12.0: + resolution: {integrity: sha512-xo+iRNMWqyvXpFTaOAvLPA5QAWO6TZrSUs5s4Odaya3epqofBu/fMLHEWl8jPmjhA0s9sgj9sNvF1BmaQlmQkA==} + + ts-proto-descriptors@2.0.0: + resolution: {integrity: sha512-wHcTH3xIv11jxgkX5OyCSFfw27agpInAd6yh89hKG6zqIXnjW9SYqSER2CVQxdPj4czeOhGagNvZBEbJPy7qkw==} + + ts-proto@2.8.3: + resolution: {integrity: sha512-TdXInqG+61pj/TvORqITWjvjTTsL1EZxwX49iEj89+xFAcqPT8tjChpAGQXzfcF4MJwvNiuoCEbBOKqVf3ds3g==} + hasBin: true + tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -1109,6 +1140,8 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 + '@bufbuild/protobuf@2.10.1': {} + '@emnapi/core@1.7.1': dependencies: '@emnapi/wasi-threads': 1.1.0 @@ -1450,6 +1483,8 @@ snapshots: caniuse-lite@1.0.30001757: {} + case-anything@2.1.13: {} + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -1479,8 +1514,14 @@ snapshots: deep-is@0.1.4: {} + detect-libc@1.0.3: {} + detect-libc@2.1.2: {} + dprint-node@1.0.8: + dependencies: + detect-libc: 1.0.3 + electron-to-chromium@1.5.262: {} escalade@3.2.0: {} @@ -1848,6 +1889,21 @@ snapshots: dependencies: typescript: 5.9.3 + ts-poet@6.12.0: + dependencies: + dprint-node: 1.0.8 + + ts-proto-descriptors@2.0.0: + dependencies: + '@bufbuild/protobuf': 2.10.1 + + ts-proto@2.8.3: + dependencies: + '@bufbuild/protobuf': 2.10.1 + case-anything: 2.1.13 + ts-poet: 6.12.0 + ts-proto-descriptors: 2.0.0 + tslib@2.8.1: optional: true diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3d7ded3..252ffad 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,33 +1,37 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' +import { useState, useEffect } from 'react' +import { Person, PersonList } from '../items' import './App.css' function App() { - const [count, setCount] = useState(0) + const [people, setPeople] = useState([]) + + useEffect(() => { + fetch('/api') + .then((res) => res.arrayBuffer()) + .then((buffer) => { + const list = PersonList.decode(new Uint8Array(buffer)) + setPeople(list.person) + }) + .catch((err) => console.error('Failed to fetch people:', err)) + }, []) return ( <> - -

Vite + React

- -

- Edit src/App.tsx and save to test HMR -

+

People List

+ {people.map((person, index) => ( +
+

{person.name}

+
    + {person.opinion.map((op, i) => ( +
  • + {op.game?.title} - {op.wouldPlay ? 'Would Play' : 'Would Not Play'} +
  • + ))} +
+
+ ))}
-

- Click on the Vite and React logos to learn more -

) } diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json index a9b5a59..4cd86eb 100644 --- a/frontend/tsconfig.app.json +++ b/frontend/tsconfig.app.json @@ -3,11 +3,16 @@ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "target": "ES2022", "useDefineForClassFields": true, - "lib": ["ES2022", "DOM", "DOM.Iterable"], + "lib": [ + "ES2022", + "DOM", + "DOM.Iterable" + ], "module": "ESNext", - "types": ["vite/client"], + "types": [ + "vite/client" + ], "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -15,14 +20,15 @@ "moduleDetection": "force", "noEmit": true, "jsx": "react-jsx", - /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "erasableSyntaxOnly": true, + "erasableSyntaxOnly": false, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, - "include": ["src"] -} + "include": [ + "src" + ] +} \ No newline at end of file diff --git a/protobuf/items.proto b/protobuf/items.proto index 13b04d3..7e3d165 100644 --- a/protobuf/items.proto +++ b/protobuf/items.proto @@ -3,25 +3,27 @@ syntax = "proto3"; package items; message Person { - string name = 1; - repeated Opinion opinion = 2; + string name = 1; + repeated Opinion opinion = 2; } message Opinion { - Game game = 1; - bool would_play = 2; + Game game = 1; + bool would_play = 2; } message Game { - string title = 1; - Source source = 2; - bool multiplayer = 3; - uint32 min_players = 4; - uint32 max_players = 5; - uint32 price = 6; + string title = 1; + Source source = 2; + bool multiplayer = 3; + uint32 min_players = 4; + uint32 max_players = 5; + uint32 price = 6; } enum Source { - STEAM = 0; - ROBLOX = 1; -} \ No newline at end of file + STEAM = 0; + ROBLOX = 1; +} + +message PersonList { repeated Person person = 1; } \ No newline at end of file