diff --git a/Cargo.lock b/Cargo.lock index fd525f0..61dbc98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,6 +312,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + [[package]] name = "async-stream" version = "0.3.6" @@ -553,6 +564,12 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.21.7" @@ -606,6 +623,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bit-set" version = "0.8.0" @@ -697,7 +723,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tokio-util", "tower-service", @@ -842,10 +868,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" [[package]] -name = "cc" -version = "1.2.7" +name = "cacache" +version = "13.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" +checksum = "5c5063741c7b2e260bbede781cf4679632dd90e2718e99f7715e46824b65670b" +dependencies = [ + "digest", + "either", + "futures", + "hex 0.4.3", + "libc", + "memmap2", + "miette", + "reflink-copy", + "serde", + "serde_derive", + "serde_json", + "sha1", + "sha2", + "ssri", + "tempfile", + "thiserror 1.0.69", + "tokio", + "tokio-stream", + "walkdir", +] + +[[package]] +name = "cc" +version = "1.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" dependencies = [ "jobserver", "libc", @@ -1268,6 +1321,18 @@ dependencies = [ "regex", ] +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1335,6 +1400,33 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "darling" version = "0.20.10" @@ -1558,6 +1650,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + [[package]] name = "dotenvy" version = "0.15.7" @@ -1600,6 +1698,50 @@ dependencies = [ "duct", ] +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "ego-tree" version = "0.9.0" @@ -1621,6 +1763,27 @@ dependencies = [ "serde", ] +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "email-encoding" version = "0.3.1" @@ -1712,6 +1875,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +dependencies = [ + "event-listener", + "pin-project-lite", +] + [[package]] name = "eyre" version = "0.6.12" @@ -1748,6 +1921,22 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "figment" version = "0.10.19" @@ -2000,6 +2189,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -2082,6 +2272,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "h2" version = "0.4.7" @@ -2376,12 +2577,68 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-cache" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b65cd1687caf2c7fff496741a2f264c26f54e6d6cec03dac8f276fa4e5430e" +dependencies = [ + "async-trait", + "bincode", + "cacache", + "http 1.2.0", + "http-cache-semantics", + "httpdate", + "moka", + "serde", + "url", +] + +[[package]] +name = "http-cache-reqwest" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735586904a5ce0c13877c57cb4eb8195eb7c11ec1ffd64d4db053fb8559ca62e" +dependencies = [ + "anyhow", + "async-trait", + "http 1.2.0", + "http-cache", + "http-cache-semantics", + "reqwest", + "reqwest-middleware", + "serde", + "url", +] + +[[package]] +name = "http-cache-semantics" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92baf25cf0b8c9246baecf3a444546360a97b569168fdf92563ee6a47829920c" +dependencies = [ + "http 1.2.0", + "http-serde", + "serde", + "time", +] + [[package]] name = "http-range-header" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" +[[package]] +name = "http-serde" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f056c8559e3757392c8d091e796416e4649d8e49e88b8d76df6c002f05027fd" +dependencies = [ + "http 1.2.0", + "serde", +] + [[package]] name = "httparse" version = "1.9.5" @@ -2938,7 +3195,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tower-http", "tower-layer", @@ -3298,6 +3555,8 @@ dependencies = [ [[package]] name = "loco-gen" version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef868bd2df99c949018850b36fb700bba01b10001715f94390bcdb81f412f874" dependencies = [ "chrono", "clap", @@ -3316,6 +3575,8 @@ dependencies = [ [[package]] name = "loco-rs" version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2250c89f0f996c3493ec3d2588a2d63e2861a48df7b9585cb28fbf6faf15a1a0" dependencies = [ "argon2", "async-trait", @@ -3482,6 +3743,38 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "miette" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +dependencies = [ + "miette-derive", + "once_cell", + "thiserror 1.0.69", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "mime" version = "0.3.17" @@ -3545,9 +3838,12 @@ version = "0.12.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" dependencies = [ + "async-lock", "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", + "event-listener", + "futures-util", "loom", "parking_lot 0.12.3", "portable-atomic", @@ -3714,6 +4010,26 @@ dependencies = [ "libc", ] +[[package]] +name = "oauth2" +version = "5.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d385da3c602d29036d2f70beed71c36604df7570be17fed4c5b839616785bf" +dependencies = [ + "base64 0.22.1", + "chrono", + "getrandom", + "http 1.2.0", + "rand", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "sha2", + "thiserror 1.0.69", + "url", +] + [[package]] name = "object" version = "0.32.2" @@ -3784,6 +4100,37 @@ dependencies = [ "uuid", ] +[[package]] +name = "openidconnect" +version = "4.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a93a50789d0b649986bfb104cdef97736ca072d579ec88496d5c6f9abed0ea85" +dependencies = [ + "base64 0.21.7", + "chrono", + "dyn-clone", + "ed25519-dalek", + "hmac", + "http 1.2.0", + "itertools 0.10.5", + "log", + "oauth2", + "p256", + "p384", + "rand", + "rsa", + "serde", + "serde-value", + "serde_json", + "serde_path_to_error", + "serde_plain", + "serde_with", + "sha2", + "subtle", + "thiserror 1.0.69", + "url", +] + [[package]] name = "openssl" version = "0.10.68" @@ -3864,9 +4211,9 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67" +checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59" dependencies = [ "aliasable", "ouroboros_macro", @@ -3875,12 +4222,11 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" +checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0" dependencies = [ "heck 0.4.1", - "itertools 0.12.1", "proc-macro2", "proc-macro2-diagnostics", "quote", @@ -3905,6 +4251,30 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parcel_selectors" version = "0.28.1" @@ -4101,7 +4471,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.10", + "thiserror 2.0.11", "ucd-trie", ] @@ -4306,6 +4676,15 @@ dependencies = [ "yansi", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -4339,9 +4718,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -4402,7 +4781,7 @@ dependencies = [ "serde_repr", "serde_with", "tap", - "thiserror 2.0.10", + "thiserror 2.0.11", "tracing", "typed-builder", "url", @@ -4447,7 +4826,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tracing", ] @@ -4466,7 +4845,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.10", + "thiserror 2.0.11", "tinyvec", "tracing", "web-time", @@ -4495,7 +4874,7 @@ dependencies = [ "cfg_rust_features", "nom", "percent-encoding", - "thiserror 2.0.10", + "thiserror 2.0.11", "url", ] @@ -4585,11 +4964,15 @@ dependencies = [ "bytes", "chrono", "color-eyre", + "dotenv", "fancy-regex", "fastrand", "figment", "futures", "html-escape", + "http-cache", + "http-cache-reqwest", + "http-cache-semantics", "insta", "itertools 0.13.0", "jwt-authorizer", @@ -4600,8 +4983,10 @@ dependencies = [ "loco-rs", "log", "maplit", + "moka", "once_cell", "opendal 0.51.0", + "openidconnect", "qbit-rs", "quirks_path", "regex", @@ -4622,7 +5007,7 @@ dependencies = [ "tera", "testcontainers", "testcontainers-modules", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tower 0.5.2", "tower-http", @@ -4691,6 +5076,17 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "reflink-copy" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7aea22fc8204e0f291719120cbcdae4f25f0807d7b00f5b6b27d95a8f1a2ad" +dependencies = [ + "cfg-if", + "rustix", + "windows 0.59.0", +] + [[package]] name = "regex" version = "1.11.1" @@ -4880,6 +5276,16 @@ dependencies = [ "rand", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.8" @@ -5229,9 +5635,9 @@ dependencies = [ [[package]] name = "sea-orm" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dbcf83248860dc632c46c7e81a221e041b50d0006191756cb001d9e8afc60a9" +checksum = "1a93194430b419da0801f404baf3b986399d6a2a4f43bc79bc96dea83f92ca43" dependencies = [ "async-stream", "async-trait", @@ -5257,9 +5663,9 @@ dependencies = [ [[package]] name = "sea-orm-cli" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a8dbef29c7e534a8e9afb49abfa946c7a9df3d85f610dfed9140215ff8bff17" +checksum = "0e6e0e741bfdf434e6f6aadab156ba4d439e78c9449048698d98fa377871224a" dependencies = [ "chrono", "clap", @@ -5274,11 +5680,12 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49ce6f08134f3681b1ca92185b96fac898f26d9b4f5538d13f7032ef243d14b2" +checksum = "d19e8f22fb474a8a622eb516c46885a080535d8d559386188f525977eaad32b3" dependencies = [ "heck 0.4.1", + "proc-macro-crate", "proc-macro2", "quote", "sea-bae", @@ -5288,9 +5695,9 @@ dependencies = [ [[package]] name = "sea-orm-migration" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e53f46fe9874161ba57b15ff45d2589d754d7cbbbaab9470cb79cbada149ca7" +checksum = "c0bb76ba314552ce15e3a24778cf9c116fc1225fa406e48b0a36e5a3cdbc1e21" dependencies = [ "async-trait", "clap", @@ -5381,18 +5788,33 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "seaography" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bca7168531927846a9da73b20e65aa36cc258b377035286e70ebb34874097b1" +checksum = "654abfe38ded4b3dc80a4025894a3b9ce687b543d6f2b4c487c40835ac53effa" dependencies = [ "async-graphql", "fnv", "heck 0.4.1", "itertools 0.12.1", + "lazy_static", "sea-orm", "thiserror 1.0.69", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -5517,6 +5939,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + [[package]] name = "serde_regex" version = "1.1.0" @@ -5645,6 +6076,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha1" version = "0.10.6" @@ -5898,7 +6340,7 @@ dependencies = [ "serde_json", "sha2", "smallvec", - "thiserror 2.0.10", + "thiserror 2.0.11", "time", "tokio", "tokio-stream", @@ -5987,7 +6429,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.10", + "thiserror 2.0.11", "time", "tracing", "uuid", @@ -6030,7 +6472,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.10", + "thiserror 2.0.11", "time", "tracing", "uuid", @@ -6063,6 +6505,23 @@ dependencies = [ "uuid", ] +[[package]] +name = "ssri" +version = "9.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7a2b3c2bc9693bcb40870c4e9b5bf0d79f9cb46273321bf855ec513e919082" +dependencies = [ + "base64 0.21.7", + "digest", + "hex 0.4.3", + "miette", + "serde", + "sha-1", + "sha2", + "thiserror 1.0.69", + "xxhash-rust", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -6345,7 +6804,7 @@ dependencies = [ "serde_json", "serde_with", "signal-hook", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tokio-stream", "tokio-tar", @@ -6374,11 +6833,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ac7f54ca534db81081ef1c1e7f6ea8a3ef428d2fc069097c079443d24124d3" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.10", + "thiserror-impl 2.0.11", ] [[package]] @@ -6394,9 +6853,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9465d30713b56a37ede7185763c3492a91be2f5fa68d958c44e41ab9248beb" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", @@ -6809,7 +7268,7 @@ dependencies = [ "log", "rand", "sha1", - "thiserror 2.0.10", + "thiserror 2.0.11", "utf-8", ] @@ -7300,6 +7759,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f919aee0a93304be7f62e8e5027811bbba96bcb1de84d6618be56e43f8a32a1" +dependencies = [ + "windows-core 0.59.0", + "windows-targets 0.53.0", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -7315,13 +7784,26 @@ version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", - "windows-strings", + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce" +dependencies = [ + "windows-implement 0.59.0", + "windows-interface 0.59.0", + "windows-result 0.3.0", + "windows-strings 0.3.0", + "windows-targets 0.53.0", +] + [[package]] name = "windows-implement" version = "0.58.0" @@ -7333,6 +7815,17 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "windows-implement" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83577b051e2f49a058c308f17f273b570a6a758386fc291b5f6a934dd84e48c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "windows-interface" version = "0.58.0" @@ -7344,14 +7837,25 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "windows-interface" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26fd936d991781ea39e87c3a27285081e3c0da5ca0fcbc02d368cc6f52ff01" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "windows-registry" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" dependencies = [ - "windows-result", - "windows-strings", + "windows-result 0.2.0", + "windows-strings 0.1.0", "windows-targets 0.52.6", ] @@ -7364,16 +7868,34 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-result" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08106ce80268c4067c0571ca55a9b4e9516518eaa1a1fe9b37ca403ae1d1a34" +dependencies = [ + "windows-targets 0.53.0", +] + [[package]] name = "windows-strings" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ - "windows-result", + "windows-result 0.2.0", "windows-targets 0.52.6", ] +[[package]] +name = "windows-strings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b888f919960b42ea4e11c2f408fadb55f78a9f236d5eef084103c8ce52893491" +dependencies = [ + "windows-targets 0.53.0", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7425,13 +7947,29 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7444,6 +7982,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7456,6 +8000,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7468,12 +8018,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7486,6 +8048,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7498,6 +8066,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7510,6 +8084,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7523,10 +8103,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winnow" -version = "0.6.22" +name = "windows_x86_64_msvc" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "winnow" +version = "0.6.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] @@ -7573,6 +8159,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "xxhash-rust" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" + [[package]] name = "yansi" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 0034f94..7e2b16a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ resolver = "2" testcontainers = { git = "https://github.com/testcontainers/testcontainers-rs.git", rev = "af21727" } # loco-rs = { git = "https://github.com/lonelyhentxi/loco.git", rev = "beb890e" } # loco-rs = { git = "https://github.com/loco-rs/loco.git" } -loco-rs = { path = "./patches/loco" } +# loco-rs = { path = "./patches/loco" } async-graphql = { git = "https://github.com/aumetra/async-graphql.git", rev = "690ece7" } async-graphql-axum = { git = "https://github.com/aumetra/async-graphql.git", rev = "690ece7" } jwt-authorizer = { git = "https://github.com/blablacio/jwt-authorizer.git", rev = "e956774" } diff --git a/README.md b/README.md index 387ea6d..489e0c6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ -# KONOBUNGU +
Kono bangumi?
\ No newline at end of file diff --git a/apps/app/.env.development b/apps/app/.env.development index 9ced364..d0abda2 100644 --- a/apps/app/.env.development +++ b/apps/app/.env.development @@ -7,8 +7,8 @@ BASIC_PASSWORD="konobangu" OIDC_PROVIDER_ENDPOINT="https://some-oidc-auth.com/oidc/.well-known/openid-configuration" OIDC_CLIENT_ID="" OIDC_CLIENT_SECRET="" -OIDC_API_ISSUER="https://some-oidc-auth.com/oidc" -OIDC_API_AUDIENCE="https://konobangu.com/api" +OIDC_ISSUER="https://some-oidc-auth.com/oidc" +OIDC_AUDIENCE="https://konobangu.com/api" OIDC_ICON_URL="" OIDC_EXTRA_SCOPE_REGEX="" OIDC_EXTRA_CLAIM_KEY="" diff --git a/apps/app/.env.example b/apps/app/.env.example index 3144d50..059e679 100644 --- a/apps/app/.env.example +++ b/apps/app/.env.example @@ -5,8 +5,8 @@ NEXT_PUBLIC_OIDC_PROVIDER_ENDPOINT="https://some-oidc-auth.com/oidc/.well-known/ NEXT_PUBLIC_OIDC_CLIENT_ID="" NEXT_PUBLIC_OIDC_CLIENT_SECRET="" NEXT_PUBLIC_OIDC_ICON_URL="" -OIDC_API_ISSUER="https://some-oidc-auth.com/oidc" -OIDC_API_AUDIENCE="https://konobangu.com/api" +OIDC_ISSUER="https://some-oidc-auth.com/oidc" +OIDC_AUDIENCE="https://konobangu.com/api" OIDC_EXTRA_SCOPES="" # 如 "read:konobangu,write:konobangu" OIDC_EXTRA_CLAIM_KEY="" OIDC_EXTRA_CLAIM_VALUE="" diff --git a/apps/proxy/.whistle/rules/files/0.konobangu b/apps/proxy/.whistle/rules/files/0.konobangu new file mode 100644 index 0000000..dc04a88 --- /dev/null +++ b/apps/proxy/.whistle/rules/files/0.konobangu @@ -0,0 +1,12 @@ +```x-forwarded.json +{ + "X-Forwarded-Host": "konobangu.com", + "X-Forwarded-Proto": "https" +} +``` + +^https://konobangu.com/api/playground*** reqHeaders://{x-forwarded.json} http://127.0.0.1:5002/api/playground$1 +^wss://konobangu.com/api/playground*** reqHeaders://{x-forwarded.json} ws://127.0.0.1:5002/api/playground$1 +^https://konobangu.com/api*** reqHeaders://{x-forwarded.json} http://127.0.0.1:5001/api$1 excludeFilter://^^https://konobangu.com/api/playground*** +^https://konobangu.com*** reqHeaders://{x-forwarded.json} http://127.0.0.1:5000$1 excludeFilter://^https://konobangu.com/api*** + diff --git a/apps/proxy/.whistle/rules/files/0.webui b/apps/proxy/.whistle/rules/files/0.webui deleted file mode 100644 index 18f51f8..0000000 --- a/apps/proxy/.whistle/rules/files/0.webui +++ /dev/null @@ -1,2 +0,0 @@ -^https://konobangu.com/*** http://127.0.0.1:5000/$1 excludeFilter://^https://konobangu.com/api/*** -^wss://konobangu.com/*** ws://127.0.0.1:5000/$1 ^excludeFilter://^wss://konobangu.com/api/*** \ No newline at end of file diff --git a/apps/proxy/.whistle/rules/files/2.recorder b/apps/proxy/.whistle/rules/files/2.recorder deleted file mode 100644 index f9998e7..0000000 --- a/apps/proxy/.whistle/rules/files/2.recorder +++ /dev/null @@ -1 +0,0 @@ -^https://konobangu.com/api/*** http://127.0.0.1:5001/api/$1 \ No newline at end of file diff --git a/apps/proxy/.whistle/rules/properties b/apps/proxy/.whistle/rules/properties index 8528bff..6cf4660 100644 --- a/apps/proxy/.whistle/rules/properties +++ b/apps/proxy/.whistle/rules/properties @@ -1 +1 @@ -{"filesOrder":["webui","recorder"],"selectedList":["webui","recorder"],"disabledDefalutRules":true} +{"filesOrder":["konobangu"],"selectedList":["konobangu"],"disabledDefalutRules":true} diff --git a/apps/proxy/.whistle/values/properties b/apps/proxy/.whistle/values/properties index e69de29..960e778 100644 --- a/apps/proxy/.whistle/values/properties +++ b/apps/proxy/.whistle/values/properties @@ -0,0 +1 @@ +{"filesOrder":[]} diff --git a/apps/proxy/package.json b/apps/proxy/package.json index 18bc1c5..495c299 100644 --- a/apps/proxy/package.json +++ b/apps/proxy/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "start": "cross-env WHISTLE_MODE=\"prod|capture|keepXFF\" whistle run -p 8899 -t 30000 -D . --no-global-plugins", + "start": "cross-env WHISTLE_MODE=\"prod|capture|keepXFF|x-forwarded-host|x-forwarded-proto\" whistle run -p 8899 -t 30000 -D .", "dev": "pnpm run start" }, "keywords": [], @@ -12,4 +12,4 @@ "whistle": "^2.9.61", "cross-env": "^7.0.3" } -} \ No newline at end of file +} diff --git a/apps/recorder/.gitignore b/apps/recorder/.gitignore index 3a6a884..cacf1e1 100644 --- a/apps/recorder/.gitignore +++ b/apps/recorder/.gitignore @@ -25,8 +25,3 @@ Cargo.lock # Dist node_modules dist/ - -# IDE -.vscode/* -!.vscode/extensions.json -.idea diff --git a/apps/recorder/Cargo.toml b/apps/recorder/Cargo.toml index 3075aa1..e556635 100644 --- a/apps/recorder/Cargo.toml +++ b/apps/recorder/Cargo.toml @@ -84,10 +84,7 @@ testcontainers = { version = "0.23.1", features = [ "reusable-containers", ], optional = true } testcontainers-modules = { version = "0.11.4", optional = true } - color-eyre = "0.6" - - log = "0.4.22" anyhow = "1.0.95" bollard = { version = "0.18", optional = true } @@ -102,6 +99,19 @@ axum-extra = "0.10.0" tower-http = "0.6.2" serde_yaml = "0.9.34" tera = "1.20.0" +openidconnect = "4.0.0-rc.1" +http-cache-reqwest = { version = "0.15", features = [ + "manager-cacache", + "manager-moka", +] } +moka = "0.12.10" +http-cache = { version = "0.20.0", features = [ + "cacache-tokio", + "manager-cacache", + "manager-moka", +], default-features = false } +http-cache-semantics = "2.1.0" +dotenv = "0.15.0" [dev-dependencies] serial_test = "3" diff --git a/apps/recorder/config/development.yaml b/apps/recorder/config/development.yaml index 2932a9b..ef30ae4 100644 --- a/apps/recorder/config/development.yaml +++ b/apps/recorder/config/development.yaml @@ -18,8 +18,9 @@ logger: server: # Port on which the server will listen. the server binding is 0.0.0.0:{PORT} port: 5001 + binding: "0.0.0.0" # The UI hostname or IP address that mailers will point to. - host: http://webui.konobangu.com + host: '{{ get_env(name="HOST", default="localhost") }}' # Out of the box middleware configuration. to disable middleware you can changed the `enable` field to `false` of comment the middleware block middlewares: # Enable Etag cache header middleware @@ -68,7 +69,7 @@ workers: # - BackgroundQueue - Workers operate asynchronously in the background, processing queued. # - ForegroundBlocking - Workers operate in the foreground and block until tasks are completed. # - BackgroundAsync - Workers operate asynchronously in the background, processing tasks with async capabilities. - mode: BackgroundQueue + mode: BackgroundAsync # Mailer Configuration. mailer: @@ -89,7 +90,7 @@ mailer: # Database Configuration database: # Database connection URI - uri: '{{ get_env(name="DATABASE_URL", default="postgres://konobangu:konobangu@127.0.0.1:5432/konobangu") }}' + uri: '{{ get_env(name="DATABASE_URL", default="postgres://konobangu:konobangu@localhost:5432/konobangu") }}' # When enabled, the sql query will be logged. enable_logging: true # Set the timeout duration when acquiring a connection. @@ -110,13 +111,13 @@ database: # Redis Configuration redis: # Redis connection URI - uri: '{{ get_env(name="REDIS_URL", default="redis://127.0.0.1:6379") }}' + uri: '{{ get_env(name="REDIS_URL", default="redis://localhost:6379") }}' # Dangerously flush all data in Redis on startup. dangerous operation, make sure that you using this flag only on dev environments or test mode dangerously_flush: false settings: dal: - data_dir: ./data + data_dir: '{{ get_env(name="DAL_DATA_DIR", default="./data") }}' mikan: base_url: "https://mikanani.me/" @@ -128,11 +129,17 @@ settings: leaky_bucket_refill_interval: 500 auth: - auth_type: "oidc" # or "basic" - basic_user: "konobangu" - basic_password: "konobangu" - oidc_api_issuer: "https://some-oidc-auth.com/oidc" - oidc_api_audience: "https://konobangu.com/api" - oidc_extra_scopes: "read:konobangu,write:konobangu" - oidc_extra_claim_key: "" - oidc_extra_claim_value: "" + auth_type: '{{ get_env(name="AUTH_TYPE", default = "basic") }}' + basic_user: '{{ get_env(name="BASIC_USER", default = "konobangu") }}' + basic_password: '{{ get_env(name="BASIC_PASSWORD", default = "konobangu") }}' + oidc_issuer: '{{ get_env(name="OIDC_ISSUER", default = "") }}' + oidc_audience: '{{ get_env(name="OIDC_AUDIENCE", default = "") }}' + oidc_client_id: '{{ get_env(name="OIDC_CLIENT_ID", default = "") }}' + oidc_client_secret: '{{ get_env(name="OIDC_CLIENT_SECRET", default = "") }}' + oidc_extra_scopes: '{{ get_env(name="OIDC_EXTRA_SCOPES", default = "") }}' + oidc_extra_claim_key: '{{ get_env(name="OIDC_EXTRA_CLAIM_KEY", default = "") }}' + oidc_extra_claim_value: '{{ get_env(name="OIDC_EXTRA_CLAIM_VALUE", default = "") }}' + + graphql: + depth_limit: null + complexity_limit: null diff --git a/apps/recorder/package.json b/apps/recorder/package.json index 8c53afb..57f6716 100644 --- a/apps/recorder/package.json +++ b/apps/recorder/package.json @@ -1,7 +1,28 @@ { "name": "recorder", "version": "1.0.0", + "scripts": { + "dev": "rsbuild dev", + "build": "rsbuild build", + "preview": "rsbuild preview" + }, "dependencies": { - "altair-static": "^8.1.3" + "@graphiql/react": "^0.28.2", + "@graphiql/toolkit": "^0.11.1", + "@tanstack/react-router": "^1.95.5", + "@tanstack/router-devtools": "^1.95.5", + "graphql-ws": "^5.16.2", + "oidc-client-ts": "^3.1.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-oidc-context": "^3.2.0" + }, + "devDependencies": { + "@rsbuild/core": "^1.1.8", + "@rsbuild/plugin-react": "^1.0.7", + "@tanstack/router-plugin": "^1.95.5", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "typescript": "^5.7.2" } } diff --git a/apps/recorder/assets/.gitkeep b/apps/recorder/public/.gitkeep similarity index 100% rename from apps/recorder/assets/.gitkeep rename to apps/recorder/public/.gitkeep diff --git a/apps/recorder/assets/static/404.html b/apps/recorder/public/assets/404.html similarity index 100% rename from apps/recorder/assets/static/404.html rename to apps/recorder/public/assets/404.html diff --git a/apps/recorder/public/assets/favicon.ico b/apps/recorder/public/assets/favicon.ico new file mode 100644 index 0000000..a314325 Binary files /dev/null and b/apps/recorder/public/assets/favicon.ico differ diff --git a/apps/recorder/rsbuild.config.ts b/apps/recorder/rsbuild.config.ts new file mode 100644 index 0000000..2aacdf0 --- /dev/null +++ b/apps/recorder/rsbuild.config.ts @@ -0,0 +1,72 @@ +import { defineConfig } from '@rsbuild/core'; +import { pluginReact } from '@rsbuild/plugin-react'; +import { TanStackRouterRspack } from '@tanstack/router-plugin/rspack'; + +export default defineConfig({ + plugins: [pluginReact()], + html: { + favicon: './public/assets/favicon.ico', + tags: [ + { + tag: 'script', + attrs: { src: 'https://cdn.tailwindcss.com' }, + }, + ], + }, + tools: { + rspack: { + plugins: [TanStackRouterRspack()], + }, + }, + source: { + define: { + 'process.env.AUTH_TYPE': JSON.stringify(process.env.AUTH_TYPE), + 'process.env.OIDC_CLIENT_ID': JSON.stringify(process.env.OIDC_CLIENT_ID), + 'process.env.OIDC_CLIENT_SECRET': JSON.stringify( + process.env.OIDC_CLIENT_SECRET + ), + 'process.env.OIDC_ISSUER': JSON.stringify(process.env.OIDC_ISSUER), + 'process.env.OIDC_AUDIENCE': JSON.stringify(process.env.OIDC_AUDIENCE), + 'process.env.OIDC_EXTRA_SCOPES': JSON.stringify( + process.env.OIDC_EXTRA_SCOPES + ), + }, + }, + dev: { + client: { + path: '/api/playground/rsbuild-hmr', + }, + setupMiddlewares: [ + (middlewares) => { + middlewares.unshift((req, res, next) => { + if (process.env.AUTH_TYPE === 'basic') { + res.setHeader('WWW-Authenticate', 'Basic realm="konobangu"'); + + const authorization = + (req.headers.authorization || '').split(' ')[1] || ''; + const [user, password] = Buffer.from(authorization, 'base64') + .toString() + .split(':'); + + if ( + user !== process.env.BASIC_USER || + password !== process.env.BASIC_PASSWORD + ) { + res.statusCode = 401; + res.write('Unauthorized'); + res.end(); + return; + } + } + next(); + }); + return middlewares; + }, + ], + }, + server: { + base: '/api/playground/', + host: '0.0.0.0', + port: 5002, + }, +}); diff --git a/apps/recorder/src/app/ext.rs b/apps/recorder/src/app/ext.rs index 0057abd..31b2c5b 100644 --- a/apps/recorder/src/app/ext.rs +++ b/apps/recorder/src/app/ext.rs @@ -1,4 +1,4 @@ -use loco_rs::app::AppContext; +use loco_rs::{app::AppContext, environment::Environment}; use crate::{ auth::service::AppAuthService, dal::AppDalClient, extract::mikan::AppMikanClient, @@ -21,6 +21,14 @@ pub trait AppContextExt { fn get_graphql_service(&self) -> &AppGraphQLService { AppGraphQLService::app_instance() } + + fn get_node_env(&self) -> Environment { + let node_env = std::env::var("NODE_ENV"); + match node_env.as_deref() { + Ok("production") => Environment::Production, + _ => Environment::Development, + } + } } impl AppContextExt for AppContext {} diff --git a/apps/recorder/src/app/index.tsx b/apps/recorder/src/app/index.tsx new file mode 100644 index 0000000..97e7434 --- /dev/null +++ b/apps/recorder/src/app/index.tsx @@ -0,0 +1,53 @@ +import { RouterProvider, createRouter } from '@tanstack/react-router'; +import type { UserManager } from 'oidc-client-ts'; +import { useMemo } from 'react'; +import { AuthProvider, useAuth } from 'react-oidc-context'; +import { buildUserManager } from '../auth/config'; +import { routeTree } from '../routeTree.gen'; + +// Set up a Router instance +const router = createRouter({ + routeTree, + basepath: '/api/playground', + defaultPreload: 'intent', + context: { + isAuthenticated: process.env.AUTH_TYPE === 'basic', + auth: undefined!, + userManager: undefined!, + }, +}); + +// Register things for typesafety +declare module '@tanstack/react-router' { + interface Register { + router: typeof router; + } +} + +const AppWithBasicAuth = () => { + return