Moved RaaS handling to its own service
This commit is contained in:
parent
2000d536ff
commit
6c69737d76
357
Cargo.lock
generated
357
Cargo.lock
generated
@ -75,6 +75,28 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
|
||||
dependencies = [
|
||||
"async-stream-impl",
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-stream-impl"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.74"
|
||||
@ -123,6 +145,34 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.6.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core 0.3.4",
|
||||
"bitflags 1.3.2",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.5",
|
||||
"hyper 0.14.27",
|
||||
"itoa",
|
||||
"matchit",
|
||||
"memchr",
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"serde",
|
||||
"sync_wrapper 0.1.2",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.4"
|
||||
@ -130,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"axum-core 0.4.3",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
@ -149,7 +199,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"sync_wrapper 0.1.2",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
@ -157,6 +207,23 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.5",
|
||||
"mime",
|
||||
"rustversion",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.3"
|
||||
@ -172,7 +239,7 @@ dependencies = [
|
||||
"mime",
|
||||
"pin-project-lite",
|
||||
"rustversion",
|
||||
"sync_wrapper",
|
||||
"sync_wrapper 0.1.2",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@ -801,7 +868,7 @@ dependencies = [
|
||||
name = "fren"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"axum 0.7.4",
|
||||
"axum-macros",
|
||||
"base64 0.22.0",
|
||||
"chrono",
|
||||
@ -816,7 +883,7 @@ dependencies = [
|
||||
"raas_types",
|
||||
"rand",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"reqwest 0.12.5",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serenity",
|
||||
@ -826,6 +893,7 @@ dependencies = [
|
||||
"tera",
|
||||
"tokio",
|
||||
"toml",
|
||||
"tonic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1011,9 +1079,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.22"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178"
|
||||
checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
@ -1021,7 +1089,7 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http 0.2.11",
|
||||
"indexmap",
|
||||
"indexmap 2.1.0",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
@ -1040,13 +1108,19 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"indexmap",
|
||||
"indexmap 2.1.0",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.13.2"
|
||||
@ -1185,7 +1259,7 @@ dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2 0.3.22",
|
||||
"h2 0.3.26",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.5",
|
||||
"httparse",
|
||||
@ -1217,6 +1291,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"want",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1234,16 +1309,48 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.5.0"
|
||||
name = "hyper-rustls"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
|
||||
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"hyper 1.2.0",
|
||||
"hyper-util",
|
||||
"rustls 0.23.10",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls 0.26.0",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-timeout"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
|
||||
dependencies = [
|
||||
"hyper 0.14.27",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tokio-io-timeout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper-tls"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"hyper 0.14.27",
|
||||
"http-body-util",
|
||||
"hyper 1.2.0",
|
||||
"hyper-util",
|
||||
"native-tls",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1253,6 +1360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"http 1.1.0",
|
||||
"http-body 1.0.0",
|
||||
@ -1260,6 +1368,9 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"socket2 0.5.5",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1311,6 +1422,16 @@ dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.1.0"
|
||||
@ -1918,7 +2039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"indexmap",
|
||||
"indexmap 2.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2177,13 +2298,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "raas_types"
|
||||
version = "0.0.2"
|
||||
version = "0.0.9"
|
||||
source = "registry+https://git.jojodev.com/joeyahines/_cargo-index.git"
|
||||
checksum = "6104c0c441473bc9c0817f9958a1c1e0db9ea7c72a7fee826b84a1d9d1baea62"
|
||||
checksum = "c88a524341fb166750c86cd97e0b225d472cc4e243943a30b6488c7a44c3d18e"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost",
|
||||
"prost-build",
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2298,30 +2420,27 @@ dependencies = [
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2 0.3.22",
|
||||
"h2 0.3.26",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.5",
|
||||
"hyper 0.14.27",
|
||||
"hyper-rustls",
|
||||
"hyper-tls",
|
||||
"hyper-rustls 0.24.2",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"native-tls",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls 0.21.9",
|
||||
"rustls-pemfile",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"sync_wrapper 0.1.2",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tokio-rustls 0.24.1",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
@ -2331,7 +2450,51 @@ dependencies = [
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
"winreg",
|
||||
"winreg 0.50.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37"
|
||||
dependencies = [
|
||||
"base64 0.22.0",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2 0.4.2",
|
||||
"http 1.1.0",
|
||||
"http-body 1.0.0",
|
||||
"http-body-util",
|
||||
"hyper 1.2.0",
|
||||
"hyper-rustls 0.27.2",
|
||||
"hyper-tls",
|
||||
"hyper-util",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"native-tls",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls-pemfile 2.1.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper 1.0.1",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"winreg 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2466,10 +2629,23 @@ checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ring 0.17.6",
|
||||
"rustls-webpki",
|
||||
"rustls-webpki 0.101.7",
|
||||
"sct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki 0.102.4",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.6.3"
|
||||
@ -2477,7 +2653,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
|
||||
dependencies = [
|
||||
"openssl-probe",
|
||||
"rustls-pemfile",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
]
|
||||
@ -2491,6 +2667,22 @@ dependencies = [
|
||||
"base64 0.21.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
|
||||
dependencies = [
|
||||
"base64 0.22.0",
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.101.7"
|
||||
@ -2501,6 +2693,17 @@ dependencies = [
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-webpki"
|
||||
version = "0.102.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e"
|
||||
dependencies = [
|
||||
"ring 0.17.6",
|
||||
"rustls-pki-types",
|
||||
"untrusted 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
@ -2732,7 +2935,7 @@ dependencies = [
|
||||
"mime_guess",
|
||||
"parking_lot 0.12.1",
|
||||
"percent-encoding",
|
||||
"reqwest",
|
||||
"reqwest 0.11.24",
|
||||
"secrecy",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -2918,7 +3121,7 @@ dependencies = [
|
||||
"parking_lot 0.12.1",
|
||||
"pin-project",
|
||||
"rand",
|
||||
"reqwest",
|
||||
"reqwest 0.11.24",
|
||||
"ringbuf",
|
||||
"rubato",
|
||||
"rusty_pool",
|
||||
@ -3080,6 +3283,12 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
||||
|
||||
[[package]]
|
||||
name = "sync_wrapper"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
@ -3252,6 +3461,16 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-io-timeout"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.2.0"
|
||||
@ -3294,6 +3513,28 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-rustls"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
|
||||
dependencies = [
|
||||
"rustls 0.23.10",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-stream"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tungstenite"
|
||||
version = "0.18.0"
|
||||
@ -3366,13 +3607,53 @@ version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"indexmap 2.1.0",
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tonic"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13"
|
||||
dependencies = [
|
||||
"async-stream",
|
||||
"async-trait",
|
||||
"axum 0.6.20",
|
||||
"base64 0.21.7",
|
||||
"bytes",
|
||||
"h2 0.3.26",
|
||||
"http 0.2.11",
|
||||
"http-body 0.4.5",
|
||||
"hyper 0.14.27",
|
||||
"hyper-timeout",
|
||||
"percent-encoding",
|
||||
"pin-project",
|
||||
"prost",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tower",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tonic-build"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2"
|
||||
dependencies = [
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"prost-build",
|
||||
"quote",
|
||||
"syn 2.0.48",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
version = "0.4.13"
|
||||
@ -3381,9 +3662,13 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"indexmap 1.9.3",
|
||||
"pin-project",
|
||||
"pin-project-lite",
|
||||
"rand",
|
||||
"slab",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-layer",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@ -4139,6 +4424,16 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winreg"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.5"
|
||||
|
||||
@ -8,7 +8,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
config = "0.14.0"
|
||||
structopt = "0.3.26"
|
||||
reqwest = { version = "0.11.24", features = ["json"] }
|
||||
reqwest = { version = "0.12.5", features = ["json", "multipart"] }
|
||||
serde = "1.0.195"
|
||||
toml = "0.8.8"
|
||||
rand = "0.8.5"
|
||||
@ -27,8 +27,9 @@ chrono = { version = "0.4.31", features = ["serde"] }
|
||||
chrono-tz = "0.8.5"
|
||||
log = "0.4.20"
|
||||
serde_json = "1.0.113"
|
||||
raas_types = { version = "0.0.2", registry = "jojo-dev"}
|
||||
raas_types = { version = "0.0.9", registry = "jojo-dev"}
|
||||
prost = "0.12.6"
|
||||
tonic = "0.11.0"
|
||||
|
||||
[dependencies.serenity]
|
||||
version = "0.12.0"
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use crate::album_manager::AlbumManager;
|
||||
use crate::error::Error;
|
||||
use crate::migrations::{CURRENT_DB_VERSION, do_migration};
|
||||
use crate::rass::RaaSHandler;
|
||||
use config::{Config, File};
|
||||
use j_db::database::Database;
|
||||
use reqwest::Url;
|
||||
@ -44,6 +43,7 @@ pub struct BotConfig {
|
||||
pub announcement_channel: ChannelId,
|
||||
pub toys: Vec<String>,
|
||||
pub effect_role_duration: i64,
|
||||
pub raas_server: String,
|
||||
pub picox: PicOxConfig,
|
||||
}
|
||||
|
||||
@ -60,18 +60,14 @@ impl BotConfig {
|
||||
#[derive(Debug)]
|
||||
pub struct BotState {
|
||||
pub accepted_nsfw: Option<UserId>,
|
||||
pub bad_apple_running: bool,
|
||||
pub speak_lock: Mutex<()>,
|
||||
pub raas_handler: Option<RaaSHandler>,
|
||||
}
|
||||
|
||||
impl BotState {
|
||||
pub async fn new() -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
accepted_nsfw: None,
|
||||
bad_apple_running: false,
|
||||
speak_lock: Mutex::new(()),
|
||||
raas_handler: None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ use crate::album_manager::{Album, AlbumQuery, ImageQuery, ImageSort};
|
||||
use crate::error::Error;
|
||||
use crate::models::insult_compliment::{RandomResponseTemplate, ResponseType};
|
||||
use crate::models::random::{Random, RandomConfig};
|
||||
use crate::rass::RaaSCmd;
|
||||
use crate::{command, group, GlobalData, BAD_APPLE};
|
||||
use reqwest::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -15,6 +14,10 @@ use serenity::model::channel::Message;
|
||||
use serenity::utils::MessageBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
use chrono::Utc;
|
||||
use raas_types::raas::bot::roll::{Roll, roll_response, RollCmd};
|
||||
use raas_types::raas::resp::response::Resp;
|
||||
use raas_types::raas::service::raas_client::RaasClient;
|
||||
|
||||
#[group]
|
||||
#[commands(dad_joke, roll, real_roll, bad_apple, insult, add_random, list_random)]
|
||||
@ -244,32 +247,49 @@ async fn roll(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
|
||||
#[aliases("real_roll")]
|
||||
#[description("Roll a real die!")]
|
||||
async fn real_roll(ctx: &Context, msg: &Message, _args: Args) -> CommandResult {
|
||||
let mut data = ctx.data.write().await;
|
||||
let global = data.get_mut::<GlobalData>().unwrap();
|
||||
let data = ctx.data.read().await;
|
||||
let global = data.get::<GlobalData>().unwrap();
|
||||
|
||||
if let Some(raas_handler) = &mut global.bot_state.raas_handler {
|
||||
raas_handler.send_msg_queue.send(RaaSCmd::Roll(3)).await?;
|
||||
msg.reply(&ctx.http, "Sent request to Roll Bot...").await?;
|
||||
if let Some(img) = raas_handler.recv_msg_queue.recv().await {
|
||||
match img {
|
||||
RaaSCmd::Roll(_) => {}
|
||||
RaaSCmd::Img(img_data) => {
|
||||
msg.channel_id
|
||||
.send_message(
|
||||
&ctx.http,
|
||||
CreateMessage::new()
|
||||
.content("Your roll my friend, hope its good I can't read!")
|
||||
.add_file(CreateAttachment::bytes(img_data, "roll.jpg")),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
let addr = global.cfg.raas_server.clone();
|
||||
|
||||
let mut client = RaasClient::connect(addr).await?;
|
||||
|
||||
let rolls = 3;
|
||||
|
||||
let roll_request = raas_types::raas::cmd::Request {
|
||||
timestamp: Utc::now().timestamp() as u64,
|
||||
cmd: Some(raas_types::raas::cmd::request::Cmd::RollCmd(RollCmd {
|
||||
cmd: Some(raas_types::raas::bot::roll::roll_cmd::Cmd::Roll(Roll {
|
||||
rotations: rolls,
|
||||
})),
|
||||
})),
|
||||
};
|
||||
|
||||
let grpc_request = tonic::Request::new(roll_request);
|
||||
|
||||
|
||||
let response = client.send_request(grpc_request).await?;
|
||||
|
||||
let raas_response = response.into_inner();
|
||||
|
||||
println!("Got resp: {} @ {}",raas_response.id, raas_response.timestamp);
|
||||
|
||||
match raas_response.resp.unwrap() {
|
||||
Resp::RollResp(roll_resp) => {
|
||||
if let roll_response::Response::RollImage(img) = roll_resp.response.unwrap() {
|
||||
msg.channel_id
|
||||
.send_message(
|
||||
&ctx.http,
|
||||
CreateMessage::new()
|
||||
.content("Your roll my friend, hope its good I can't read!")
|
||||
.add_file(CreateAttachment::bytes(img.img, "roll.jpg")),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
} else {
|
||||
msg.reply(&ctx.http, "Roll Bot is gone... oh god!").await?;
|
||||
}
|
||||
} else {
|
||||
msg.reply(&ctx.http, "Looks like I can't reach my real flesh")
|
||||
.await?;
|
||||
Resp::Error(err) => {
|
||||
msg.reply(&ctx.http, format!("My real flesh encountered an error. Get Dad to fix it. `{}`", err.msg)).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -17,7 +17,6 @@ use crate::discord::fren_coin::give_coin;
|
||||
use crate::discord::joke::random;
|
||||
use crate::models::lil_fren::lil_fren_task;
|
||||
use crate::models::task::Task;
|
||||
use crate::rass::{RaaS, RaaSCmd, RaaSHandler};
|
||||
use crate::{help, hook, GlobalData};
|
||||
use rand::prelude::IteratorRandom;
|
||||
use rand::thread_rng;
|
||||
@ -49,29 +48,6 @@ impl EventHandler for Handler {
|
||||
lil_fren_task(&ctx1).await;
|
||||
}
|
||||
});
|
||||
let ctx2 = ctx.clone();
|
||||
tokio::spawn(async move {
|
||||
let (tx_client, rx_server) = tokio::sync::mpsc::channel::<RaaSCmd>(10);
|
||||
let (tx_server, rx_client) = tokio::sync::mpsc::channel::<RaaSCmd>(10);
|
||||
|
||||
let handler = RaaSHandler {
|
||||
recv_msg_queue: rx_client,
|
||||
send_msg_queue: tx_client,
|
||||
};
|
||||
|
||||
let mut raas = RaaS {
|
||||
recv_msg_queue: rx_server,
|
||||
send_msg_queue: tx_server,
|
||||
};
|
||||
|
||||
{
|
||||
let mut data = ctx2.data.write().await;
|
||||
let global_data = data.get_mut::<GlobalData>().unwrap();
|
||||
global_data.bot_state.raas_handler = Some(handler);
|
||||
}
|
||||
|
||||
raas.worker("0.0.0.0:50000").await.unwrap();
|
||||
});
|
||||
|
||||
tokio::spawn(async move {
|
||||
Task::create_reoccurring_tasks(&ctx).await.unwrap();
|
||||
|
||||
@ -6,7 +6,6 @@ mod error;
|
||||
mod inventory;
|
||||
mod migrations;
|
||||
mod models;
|
||||
mod rass;
|
||||
mod user;
|
||||
|
||||
use crate::config::{Args, BotConfig, Channel, GlobalData};
|
||||
|
||||
128
src/rass.rs
128
src/rass.rs
@ -1,128 +0,0 @@
|
||||
use prost::Message;
|
||||
use raas_types::raas;
|
||||
use raas_types::raas::bot::roll::Roll;
|
||||
use raas_types::raas::cmd::Command;
|
||||
use raas_types::raas::register::{Register, RegisterResponse};
|
||||
use raas_types::raas::resp::response::Resp;
|
||||
use raas_types::raas::resp::Response;
|
||||
use raas_types::raas::RaasMessage;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RaaSCmd {
|
||||
Roll(u32),
|
||||
Img(Vec<u8>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RaaSHandler {
|
||||
pub recv_msg_queue: tokio::sync::mpsc::Receiver<RaaSCmd>,
|
||||
pub send_msg_queue: tokio::sync::mpsc::Sender<RaaSCmd>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RaaS {
|
||||
pub recv_msg_queue: tokio::sync::mpsc::Receiver<RaaSCmd>,
|
||||
pub send_msg_queue: tokio::sync::mpsc::Sender<RaaSCmd>,
|
||||
}
|
||||
|
||||
impl RaaS {
|
||||
async fn receive_packet(socket: &mut TcpStream) -> Result<RaasMessage, std::io::Error> {
|
||||
let mut message_len_bytes = [0u8; 4];
|
||||
socket.read_exact(&mut message_len_bytes).await?;
|
||||
|
||||
let len = u32::from_be_bytes(message_len_bytes);
|
||||
|
||||
let mut message = vec![0u8; len as usize];
|
||||
|
||||
socket.read_exact(&mut message).await?;
|
||||
|
||||
Ok(RaasMessage { len, msg: message })
|
||||
}
|
||||
|
||||
async fn send_packet(socket: &mut TcpStream, data: Vec<u8>) -> Result<(), std::io::Error> {
|
||||
let msg = RaasMessage::new(data);
|
||||
|
||||
socket.write_all(&msg.into_bytes()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_register(
|
||||
&self,
|
||||
tcp_listener: TcpListener,
|
||||
) -> Result<TcpStream, std::io::Error> {
|
||||
let (mut socket, _) = tcp_listener.accept().await?;
|
||||
|
||||
let register_msg = Self::receive_packet(&mut socket).await?;
|
||||
|
||||
let register = Register::decode(&*register_msg.msg).unwrap();
|
||||
|
||||
let register_resp = RegisterResponse {
|
||||
name: register.name.to_string(),
|
||||
r#type: register.bot_type,
|
||||
id: 0,
|
||||
};
|
||||
|
||||
let mut msg = Vec::new();
|
||||
|
||||
register_resp.encode(&mut msg).unwrap();
|
||||
|
||||
Self::send_packet(&mut socket, msg).await?;
|
||||
|
||||
Ok(socket)
|
||||
}
|
||||
|
||||
pub async fn worker(&mut self, addr: &str) -> Result<(), std::io::Error> {
|
||||
let tcp_listener = TcpListener::bind(addr).await.unwrap();
|
||||
println!("Waiting for Rollbot to connect to {}...", addr);
|
||||
let mut stream = self.handle_register(tcp_listener).await?;
|
||||
println!("Rollbot has entered the chat!");
|
||||
|
||||
loop {
|
||||
if self.recv_msg_queue.recv().await.is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let timestamp = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs();
|
||||
|
||||
let roll = Roll { rotations: 3 };
|
||||
|
||||
let cmd = Command {
|
||||
id: 0,
|
||||
timestamp,
|
||||
cmd: Some(raas::cmd::command::Cmd::RollCmd(raas::bot::roll::RollCmd {
|
||||
cmd: Some(raas::bot::roll::roll_cmd::Cmd::Roll(roll)),
|
||||
})),
|
||||
};
|
||||
|
||||
let mut msg = Vec::new();
|
||||
|
||||
cmd.encode(&mut msg).unwrap();
|
||||
Self::send_packet(&mut stream, msg).await?;
|
||||
|
||||
let recv = Self::receive_packet(&mut stream).await?;
|
||||
|
||||
let resp = Response::decode(&*recv.msg).unwrap();
|
||||
|
||||
println!("Got {} {}", resp.id, resp.timestamp);
|
||||
|
||||
match resp.resp.unwrap() {
|
||||
Resp::RollResp(roll) => match roll.response.unwrap() {
|
||||
raas::bot::roll::roll_response::Response::Pong(_) => {}
|
||||
raas::bot::roll::roll_response::Response::RollImage(img) => {
|
||||
println!("Got img!");
|
||||
self.send_msg_queue
|
||||
.send(RaaSCmd::Img(img.img))
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user