]> git.puffer.fish Git - matthieu/nova.git/commitdiff
webhook base implementation
authorMatthieu <matthieu@developershouse.xyz>
Fri, 17 Sep 2021 09:14:24 +0000 (13:14 +0400)
committerMatthieu <matthieu@developershouse.xyz>
Fri, 17 Sep 2021 09:14:24 +0000 (13:14 +0400)
16 files changed:
Cargo.lock
cargo/crates.bzl
cargo/remote/BUILD.chrono-0.4.19.bazel [new file with mode: 0644]
cargo/remote/BUILD.getrandom-0.2.3.bazel
cargo/remote/BUILD.nats-0.15.2.bazel [new file with mode: 0644]
cargo/remote/BUILD.num-integer-0.1.44.bazel [new file with mode: 0644]
cargo/remote/BUILD.time-0.1.44.bazel [new file with mode: 0644]
cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel [new file with mode: 0644]
cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel [deleted file]
cargo/remote/BUILD.winapi-0.3.9.bazel
docker-compose.yaml
webhook/Cargo.toml
webhook/cargo/BUILD.bazel
webhook/config/default.yaml
webhook/src/handle.rs
webhook/src/main.rs

index 405147049610ab82651259197cc81ed50322ddca..24d74058c17e2ed5cd713a15b41be79bc94badf9 100644 (file)
@@ -47,7 +47,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3dae854440faecce70f0664f41f09a588de1e7a4366931ec3962ded3d8f903c5"
 dependencies = [
  "blocking",
- "nats",
+ "nats 0.10.1",
 ]
 
 [[package]]
@@ -207,6 +207,20 @@ version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
+[[package]]
+name = "chrono"
+version = "0.4.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
+dependencies = [
+ "libc",
+ "num-integer",
+ "num-traits 0.2.14",
+ "serde 1.0.130",
+ "time",
+ "winapi 0.3.9",
+]
+
 [[package]]
 name = "cloudabi"
 version = "0.0.3"
@@ -678,7 +692,7 @@ checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
 dependencies = [
  "cfg-if 1.0.0",
  "libc",
- "wasi 0.10.2+wasi-snapshot-preview1",
+ "wasi 0.10.0+wasi-snapshot-preview1",
 ]
 
 [[package]]
@@ -1091,6 +1105,36 @@ dependencies = [
  "winapi 0.3.9",
 ]
 
+[[package]]
+name = "nats"
+version = "0.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a3097b182107db2cf690280d61f23f17ee31d49f3994ad152ee6a10261f77c3"
+dependencies = [
+ "base64",
+ "base64-url",
+ "blocking",
+ "chrono",
+ "crossbeam-channel",
+ "fastrand",
+ "itoa",
+ "json",
+ "libc",
+ "log",
+ "memchr",
+ "nkeys",
+ "nuid",
+ "once_cell",
+ "parking_lot 0.11.2",
+ "regex",
+ "rustls",
+ "rustls-native-certs",
+ "serde 1.0.130",
+ "serde_json",
+ "webpki",
+ "winapi 0.3.9",
+]
+
 [[package]]
 name = "net2"
 version = "0.2.37"
@@ -1153,6 +1197,16 @@ dependencies = [
  "rand 0.8.4",
 ]
 
+[[package]]
+name = "num-integer"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
+dependencies = [
+ "autocfg",
+ "num-traits 0.2.14",
+]
+
 [[package]]
 name = "num-traits"
 version = "0.1.43"
@@ -1937,6 +1991,17 @@ dependencies = [
  "syn",
 ]
 
+[[package]]
+name = "time"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
+dependencies = [
+ "libc",
+ "wasi 0.10.0+wasi-snapshot-preview1",
+ "winapi 0.3.9",
+]
+
 [[package]]
 name = "tinyvec"
 version = "1.3.1"
@@ -2491,9 +2556,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
 
 [[package]]
 name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
+version = "0.10.0+wasi-snapshot-preview1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
 
 [[package]]
 name = "wasm-bindgen"
@@ -2569,6 +2634,7 @@ dependencies = [
  "hyper",
  "libsodium-sys",
  "log",
+ "nats 0.15.2",
  "pretty_env_logger",
  "serde 1.0.130",
  "serde_json",
index f47302935937278c794df06848d780dbde13ffd2..f51e66eac92221cbffbe64c40e50924a29bd6c48 100644 (file)
@@ -17,6 +17,7 @@ _DEPENDENCIES = {
         "hyper": "@raze__hyper__0_14_12//:hyper",
         "libsodium-sys": "@raze__libsodium_sys__0_2_7//:libsodium_sys",
         "log": "@raze__log__0_4_14//:log",
+        "nats": "@raze__nats__0_15_2//:nats",
         "pretty_env_logger": "@raze__pretty_env_logger__0_4_0//:pretty_env_logger",
         "serde": "@raze__serde__1_0_130//:serde",
         "serde_json": "@raze__serde_json__1_0_67//:serde_json",
@@ -498,6 +499,16 @@ def raze_fetch_remote_crates():
         build_file = Label("//cargo/remote:BUILD.cfg-if-1.0.0.bazel"),
     )
 
+    maybe(
+        http_archive,
+        name = "raze__chrono__0_4_19",
+        url = "https://crates.io/api/v1/crates/chrono/0.4.19/download",
+        type = "tar.gz",
+        sha256 = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73",
+        strip_prefix = "chrono-0.4.19",
+        build_file = Label("//cargo/remote:BUILD.chrono-0.4.19.bazel"),
+    )
+
     maybe(
         http_archive,
         name = "raze__cloudabi__0_0_3",
@@ -1348,6 +1359,16 @@ def raze_fetch_remote_crates():
         build_file = Label("//cargo/remote:BUILD.nats-0.10.1.bazel"),
     )
 
+    maybe(
+        http_archive,
+        name = "raze__nats__0_15_2",
+        url = "https://crates.io/api/v1/crates/nats/0.15.2/download",
+        type = "tar.gz",
+        sha256 = "2a3097b182107db2cf690280d61f23f17ee31d49f3994ad152ee6a10261f77c3",
+        strip_prefix = "nats-0.15.2",
+        build_file = Label("//cargo/remote:BUILD.nats-0.15.2.bazel"),
+    )
+
     maybe(
         http_archive,
         name = "raze__net2__0_2_37",
@@ -1398,6 +1419,16 @@ def raze_fetch_remote_crates():
         build_file = Label("//cargo/remote:BUILD.nuid-0.3.0.bazel"),
     )
 
+    maybe(
+        http_archive,
+        name = "raze__num_integer__0_1_44",
+        url = "https://crates.io/api/v1/crates/num-integer/0.1.44/download",
+        type = "tar.gz",
+        sha256 = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db",
+        strip_prefix = "num-integer-0.1.44",
+        build_file = Label("//cargo/remote:BUILD.num-integer-0.1.44.bazel"),
+    )
+
     maybe(
         http_archive,
         name = "raze__num_traits__0_1_43",
@@ -2228,6 +2259,16 @@ def raze_fetch_remote_crates():
         build_file = Label("//cargo/remote:BUILD.thiserror-impl-1.0.29.bazel"),
     )
 
+    maybe(
+        http_archive,
+        name = "raze__time__0_1_44",
+        url = "https://crates.io/api/v1/crates/time/0.1.44/download",
+        type = "tar.gz",
+        sha256 = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255",
+        strip_prefix = "time-0.1.44",
+        build_file = Label("//cargo/remote:BUILD.time-0.1.44.bazel"),
+    )
+
     maybe(
         http_archive,
         name = "raze__tinyvec__1_3_1",
@@ -2700,12 +2741,12 @@ def raze_fetch_remote_crates():
 
     maybe(
         http_archive,
-        name = "raze__wasi__0_10_2_wasi_snapshot_preview1",
-        url = "https://crates.io/api/v1/crates/wasi/0.10.2+wasi-snapshot-preview1/download",
+        name = "raze__wasi__0_10_0_wasi_snapshot_preview1",
+        url = "https://crates.io/api/v1/crates/wasi/0.10.0+wasi-snapshot-preview1/download",
         type = "tar.gz",
-        sha256 = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6",
-        strip_prefix = "wasi-0.10.2+wasi-snapshot-preview1",
-        build_file = Label("//cargo/remote:BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel"),
+        sha256 = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f",
+        strip_prefix = "wasi-0.10.0+wasi-snapshot-preview1",
+        build_file = Label("//cargo/remote:BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel"),
     )
 
     maybe(
diff --git a/cargo/remote/BUILD.chrono-0.4.19.bazel b/cargo/remote/BUILD.chrono-0.4.19.bazel
new file mode 100644 (file)
index 0000000..487a0e6
--- /dev/null
@@ -0,0 +1,90 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+    "@rules_rust//rust:rust.bzl",
+    "rust_binary",
+    "rust_library",
+    "rust_test",
+)
+
+package(default_visibility = [
+    # Public for visibility by "@raze__crate__version//" targets.
+    #
+    # Prefer access through "//cargo", which limits external
+    # visibility to explicit Cargo.toml dependencies.
+    "//visibility:public",
+])
+
+licenses([
+    "notice",  # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "chrono" with type "bench" omitted
+
+# Unsupported target "serde" with type "bench" omitted
+
+rust_library(
+    name = "chrono",
+    srcs = glob(["**/*.rs"]),
+    aliases = {
+    },
+    crate_features = [
+        "clock",
+        "default",
+        "libc",
+        "oldtime",
+        "serde",
+        "std",
+        "time",
+        "winapi",
+    ],
+    crate_root = "src/lib.rs",
+    crate_type = "lib",
+    data = [],
+    edition = "2015",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.4.19",
+    # buildifier: leave-alone
+    deps = [
+        "@raze__libc__0_2_101//:libc",
+        "@raze__num_integer__0_1_44//:num_integer",
+        "@raze__num_traits__0_2_14//:num_traits",
+        "@raze__serde__1_0_130//:serde",
+        "@raze__time__0_1_44//:time",
+    ] + selects.with_or({
+        # cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))
+        (
+            "@rules_rust//rust/platform:wasm32-unknown-unknown",
+        ): [
+        ],
+        "//conditions:default": [],
+    }) + selects.with_or({
+        # cfg(windows)
+        (
+            "@rules_rust//rust/platform:i686-pc-windows-msvc",
+            "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+        ): [
+            "@raze__winapi__0_3_9//:winapi",
+        ],
+        "//conditions:default": [],
+    }),
+)
+
+# Unsupported target "wasm" with type "test" omitted
index 2e8e74c3e53e4baf010f2d108398c45f7d28a45b..ac6f855efe17b6a25a2f51a6686615d746998bf5 100644 (file)
@@ -67,7 +67,7 @@ rust_library(
         (
             "@rules_rust//rust/platform:wasm32-wasi",
         ): [
-            "@raze__wasi__0_10_2_wasi_snapshot_preview1//:wasi",
+            "@raze__wasi__0_10_0_wasi_snapshot_preview1//:wasi",
         ],
         "//conditions:default": [],
     }) + selects.with_or({
diff --git a/cargo/remote/BUILD.nats-0.15.2.bazel b/cargo/remote/BUILD.nats-0.15.2.bazel
new file mode 100644 (file)
index 0000000..2012fac
--- /dev/null
@@ -0,0 +1,131 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+    "@rules_rust//rust:rust.bzl",
+    "rust_binary",
+    "rust_library",
+    "rust_test",
+)
+
+package(default_visibility = [
+    # Public for visibility by "@raze__crate__version//" targets.
+    #
+    # Prefer access through "//cargo", which limits external
+    # visibility to explicit Cargo.toml dependencies.
+    "//visibility:public",
+])
+
+licenses([
+    "notice",  # Apache-2.0 from expression "Apache-2.0"
+])
+
+# Generated Targets
+
+# Unsupported target "nats_bench" with type "bench" omitted
+
+# Unsupported target "async_nats_bench" with type "example" omitted
+
+# Unsupported target "nats-box" with type "example" omitted
+
+# Unsupported target "nats_bench" with type "example" omitted
+
+# Unsupported target "serde-json" with type "example" omitted
+
+rust_library(
+    name = "nats",
+    srcs = glob(["**/*.rs"]),
+    aliases = {
+    },
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    crate_type = "lib",
+    data = [],
+    edition = "2018",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.15.2",
+    # buildifier: leave-alone
+    deps = [
+        "@raze__base64__0_13_0//:base64",
+        "@raze__base64_url__1_4_10//:base64_url",
+        "@raze__blocking__1_0_2//:blocking",
+        "@raze__chrono__0_4_19//:chrono",
+        "@raze__crossbeam_channel__0_5_1//:crossbeam_channel",
+        "@raze__fastrand__1_5_0//:fastrand",
+        "@raze__itoa__0_4_8//:itoa",
+        "@raze__json__0_12_4//:json",
+        "@raze__log__0_4_14//:log",
+        "@raze__memchr__2_4_1//:memchr",
+        "@raze__nkeys__0_1_0//:nkeys",
+        "@raze__nuid__0_3_0//:nuid",
+        "@raze__once_cell__1_8_0//:once_cell",
+        "@raze__parking_lot__0_11_2//:parking_lot",
+        "@raze__regex__1_5_4//:regex",
+        "@raze__rustls__0_19_1//:rustls",
+        "@raze__rustls_native_certs__0_5_0//:rustls_native_certs",
+        "@raze__serde__1_0_130//:serde",
+        "@raze__serde_json__1_0_67//:serde_json",
+        "@raze__webpki__0_21_4//:webpki",
+    ] + selects.with_or({
+        # cfg(unix)
+        (
+            "@rules_rust//rust/platform:aarch64-apple-darwin",
+            "@rules_rust//rust/platform:aarch64-apple-ios",
+            "@rules_rust//rust/platform:aarch64-linux-android",
+            "@rules_rust//rust/platform:aarch64-unknown-linux-gnu",
+            "@rules_rust//rust/platform:arm-unknown-linux-gnueabi",
+            "@rules_rust//rust/platform:i686-apple-darwin",
+            "@rules_rust//rust/platform:i686-linux-android",
+            "@rules_rust//rust/platform:i686-unknown-freebsd",
+            "@rules_rust//rust/platform:i686-unknown-linux-gnu",
+            "@rules_rust//rust/platform:powerpc-unknown-linux-gnu",
+            "@rules_rust//rust/platform:s390x-unknown-linux-gnu",
+            "@rules_rust//rust/platform:x86_64-apple-darwin",
+            "@rules_rust//rust/platform:x86_64-apple-ios",
+            "@rules_rust//rust/platform:x86_64-linux-android",
+            "@rules_rust//rust/platform:x86_64-unknown-freebsd",
+            "@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
+        ): [
+            "@raze__libc__0_2_101//:libc",
+        ],
+        "//conditions:default": [],
+    }) + selects.with_or({
+        # cfg(windows)
+        (
+            "@rules_rust//rust/platform:i686-pc-windows-msvc",
+            "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+        ): [
+            "@raze__winapi__0_3_9//:winapi",
+        ],
+        "//conditions:default": [],
+    }),
+)
+
+# Unsupported target "auth_nkey" with type "test" omitted
+
+# Unsupported target "auth_tls" with type "test" omitted
+
+# Unsupported target "auth_user_pass" with type "test" omitted
+
+# Unsupported target "connect" with type "test" omitted
+
+# Unsupported target "drop" with type "test" omitted
+
+# Unsupported target "jetstream" with type "test" omitted
+
+# Unsupported target "reconnection" with type "test" omitted
diff --git a/cargo/remote/BUILD.num-integer-0.1.44.bazel b/cargo/remote/BUILD.num-integer-0.1.44.bazel
new file mode 100644 (file)
index 0000000..51f2ad6
--- /dev/null
@@ -0,0 +1,95 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+    "@rules_rust//rust:rust.bzl",
+    "rust_binary",
+    "rust_library",
+    "rust_test",
+)
+
+package(default_visibility = [
+    # Public for visibility by "@raze__crate__version//" targets.
+    #
+    # Prefer access through "//cargo", which limits external
+    # visibility to explicit Cargo.toml dependencies.
+    "//visibility:public",
+])
+
+licenses([
+    "notice",  # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+# buildifier: disable=out-of-order-load
+# buildifier: disable=load-on-top
+load(
+    "@rules_rust//cargo:cargo_build_script.bzl",
+    "cargo_build_script",
+)
+
+cargo_build_script(
+    name = "num_integer_build_script",
+    srcs = glob(["**/*.rs"]),
+    build_script_env = {
+    },
+    crate_features = [
+    ],
+    crate_root = "build.rs",
+    data = glob(["**"]),
+    edition = "2015",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.1.44",
+    visibility = ["//visibility:private"],
+    deps = [
+        "@raze__autocfg__1_0_1//:autocfg",
+    ],
+)
+
+# Unsupported target "average" with type "bench" omitted
+
+# Unsupported target "gcd" with type "bench" omitted
+
+# Unsupported target "roots" with type "bench" omitted
+
+rust_library(
+    name = "num_integer",
+    srcs = glob(["**/*.rs"]),
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    crate_type = "lib",
+    data = [],
+    edition = "2015",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.1.44",
+    # buildifier: leave-alone
+    deps = [
+        ":num_integer_build_script",
+        "@raze__num_traits__0_2_14//:num_traits",
+    ],
+)
+
+# Unsupported target "average" with type "test" omitted
+
+# Unsupported target "roots" with type "test" omitted
diff --git a/cargo/remote/BUILD.time-0.1.44.bazel b/cargo/remote/BUILD.time-0.1.44.bazel
new file mode 100644 (file)
index 0000000..980ab5f
--- /dev/null
@@ -0,0 +1,73 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+    "@rules_rust//rust:rust.bzl",
+    "rust_binary",
+    "rust_library",
+    "rust_test",
+)
+
+package(default_visibility = [
+    # Public for visibility by "@raze__crate__version//" targets.
+    #
+    # Prefer access through "//cargo", which limits external
+    # visibility to explicit Cargo.toml dependencies.
+    "//visibility:public",
+])
+
+licenses([
+    "notice",  # MIT from expression "MIT OR Apache-2.0"
+])
+
+# Generated Targets
+
+rust_library(
+    name = "time",
+    srcs = glob(["**/*.rs"]),
+    aliases = {
+    },
+    crate_features = [
+    ],
+    crate_root = "src/lib.rs",
+    crate_type = "lib",
+    data = [],
+    edition = "2015",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.1.44",
+    # buildifier: leave-alone
+    deps = [
+        "@raze__libc__0_2_101//:libc",
+    ] + selects.with_or({
+        # cfg(target_os = "wasi")
+        (
+            "@rules_rust//rust/platform:wasm32-wasi",
+        ): [
+            "@raze__wasi__0_10_0_wasi_snapshot_preview1//:wasi",
+        ],
+        "//conditions:default": [],
+    }) + selects.with_or({
+        # cfg(windows)
+        (
+            "@rules_rust//rust/platform:i686-pc-windows-msvc",
+            "@rules_rust//rust/platform:x86_64-pc-windows-msvc",
+        ): [
+            "@raze__winapi__0_3_9//:winapi",
+        ],
+        "//conditions:default": [],
+    }),
+)
diff --git a/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel b/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel
new file mode 100644 (file)
index 0000000..d1e5906
--- /dev/null
@@ -0,0 +1,55 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+    "@rules_rust//rust:rust.bzl",
+    "rust_binary",
+    "rust_library",
+    "rust_test",
+)
+
+package(default_visibility = [
+    # Public for visibility by "@raze__crate__version//" targets.
+    #
+    # Prefer access through "//cargo", which limits external
+    # visibility to explicit Cargo.toml dependencies.
+    "//visibility:public",
+])
+
+licenses([
+    "notice",  # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)"
+])
+
+# Generated Targets
+
+rust_library(
+    name = "wasi",
+    srcs = glob(["**/*.rs"]),
+    crate_features = [
+        "default",
+        "std",
+    ],
+    crate_root = "src/lib.rs",
+    crate_type = "lib",
+    data = [],
+    edition = "2018",
+    rustc_flags = [
+        "--cap-lints=allow",
+    ],
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+    version = "0.10.0+wasi-snapshot-preview1",
+    # buildifier: leave-alone
+    deps = [
+    ],
+)
diff --git a/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel b/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel
deleted file mode 100644 (file)
index 49e605d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-"""
-@generated
-cargo-raze crate build file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-# buildifier: disable=load
-load("@bazel_skylib//lib:selects.bzl", "selects")
-
-# buildifier: disable=load
-load(
-    "@rules_rust//rust:rust.bzl",
-    "rust_binary",
-    "rust_library",
-    "rust_test",
-)
-
-package(default_visibility = [
-    # Public for visibility by "@raze__crate__version//" targets.
-    #
-    # Prefer access through "//cargo", which limits external
-    # visibility to explicit Cargo.toml dependencies.
-    "//visibility:public",
-])
-
-licenses([
-    "notice",  # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)"
-])
-
-# Generated Targets
-
-rust_library(
-    name = "wasi",
-    srcs = glob(["**/*.rs"]),
-    crate_features = [
-        "default",
-        "std",
-    ],
-    crate_root = "src/lib.rs",
-    crate_type = "lib",
-    data = [],
-    edition = "2018",
-    rustc_flags = [
-        "--cap-lints=allow",
-    ],
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-    version = "0.10.2+wasi-snapshot-preview1",
-    # buildifier: leave-alone
-    deps = [
-    ],
-)
index 675fd78703faea98fa57ddd5bb5de186b1e5a9a1..55afd20afa13f0da88f8d1b2d8d3a1d09af6b71e 100644 (file)
@@ -62,6 +62,7 @@ cargo_build_script(
         "ntsecapi",
         "ntstatus",
         "processenv",
+        "profileapi",
         "schannel",
         "securitybaseapi",
         "sspi",
@@ -123,6 +124,7 @@ rust_library(
         "ntsecapi",
         "ntstatus",
         "processenv",
+        "profileapi",
         "schannel",
         "securitybaseapi",
         "sspi",
index a0bb20fe1c00485694a7003624786f67c70e4b17..790c5b02b82b29694a97818e85a5c7dce93522f4 100644 (file)
@@ -7,9 +7,4 @@ services:
       ports:
         - "8222:8222"
         - "4222:4222"
-      hostname: nats-server
-  registry:
-    restart: always
-    image: registry:2
-    ports:
-      - 5000:5000
\ No newline at end of file
+      hostname: nats-server
\ No newline at end of file
index fb3da5101e209dee2e1ad15cda8ebed21918c548..f2c278e2d24294b3f8655dddb7d0da9e7d2b4ceb 100644 (file)
@@ -14,6 +14,7 @@ hex = "0.4.3"
 pretty_env_logger = "0.4"
 serde_json = { version = "1.0" }
 common = { path = "../common/rust" }
+nats = "0.15.2"
 
 [[bin]]
 name = "webhook"
index cb1c9cd5149c43bf0e9a3912171534653e3761bc..e698ae398a82ca7c5e595ce83ca7a8a0b5e2901d 100644 (file)
@@ -57,6 +57,15 @@ alias(
     ],
 )
 
+alias(
+    name = "nats",
+    actual = "@raze__nats__0_15_2//:nats",
+    tags = [
+        "cargo-raze",
+        "manual",
+    ],
+)
+
 alias(
     name = "pretty_env_logger",
     actual = "@raze__pretty_env_logger__0_4_0//:pretty_env_logger",
index 80cf77a00eee38b9f306e275f8c4da347a19cf40..770d67f3c2de95112cbac7000e5dd208bd9d837f 100644 (file)
@@ -10,5 +10,5 @@ webhook:
     port: 8000\r
   discord:\r
     client_id: 738817757650485300\r
-    public_key: "475bed67e20fb1e2d9b9007607f08d7b25b5a0aa936ef2d4ddaf7d592c993860"\r
+    public_key: "2dc5873bb9e603dbf70e6abc217768b9d7dfacef9e74ddaefcca6a9aed41f30d"\r
 \r
index b60889e1581a30a4d7de1fd7f0220ee3533619f0..b87d9a5cc5a9f5c2d009e35aa227c6018aeb9cde 100644 (file)
@@ -11,6 +11,7 @@ use std::str::from_utf8;
 use std::task::{Context, Poll};\r
 use serde::{Deserialize, Serialize};\r
 use crate::config::Config;\r
+use nats::{Connection, connect};\r
 \r
 pub fn validate_signature(b64_public_key: &str, data: &Vec<u8>, b64_signature: &str) -> bool {\r
     // First, we need to check if the signature & private key is valid base64.\r
@@ -56,6 +57,7 @@ fn get_signature(headers: &HeaderMap) -> Option<(&str, &str)> {
 \r
 pub struct HandlerService {\r
     pub config: Config,\r
+    pub nats: Box<Connection>\r
 }\r
 \r
 #[derive(Debug, Serialize, Deserialize)]\r
@@ -76,6 +78,7 @@ impl Service<Request<Body>> for HandlerService {
     fn call(&mut self, req: Request<Body>) -> Self::Future {\r
         if req.method() == Method::POST {\r
             let public_key = self.config.discord.public_key.clone();\r
+            let nats = self.nats.clone();\r
             return Box::pin(async move {\r
                 let headers = req.headers().clone();\r
                 if let Some((signature, timestamp)) = get_signature(&headers) {\r
@@ -83,18 +86,19 @@ impl Service<Request<Body>> for HandlerService {
                         let contatenated_data = [timestamp.as_bytes().to_vec(), data.to_vec()].concat();\r
 \r
                         if validate_signature(public_key.as_str(), &contatenated_data, signature) {\r
-                            let data: Value = serde_json::from_str(from_utf8(&data).unwrap()).unwrap();\r
-                            let t = data.get("type").unwrap().as_i64().unwrap();\r
+                            let d: Value = serde_json::from_str(from_utf8(&data).unwrap()).unwrap();\r
+                            let t = d.get("type").unwrap().as_i64().unwrap();\r
 \r
                             if t == 1 {\r
-                                info!("success!");\r
-\r
                                 return Ok(Response::builder().header("Content-Type", "application/json").body(serde_json::to_string(&Ping {\r
                                     t: 1\r
                                 }).unwrap().into()).unwrap());\r
-                                \r
                             } else {\r
-                                Ok(Response::builder().status(StatusCode::UNAUTHORIZED).body("invalid operation".into()).unwrap())\r
+                                info!("Handled event");\r
+                                nats.publish(&format!("nova.dispatch.interaction_raw"), data).unwrap();\r
+                                return Ok(Response::builder().header("Content-Type", "application/json").body(serde_json::to_string(&Ping {\r
+                                    t: 5\r
+                                }).unwrap().into()).unwrap());\r
                             }\r
                         } else {\r
                             Ok(Response::builder().status(StatusCode::UNAUTHORIZED).body("signature verification failed".into()).unwrap())\r
@@ -116,6 +120,7 @@ impl Service<Request<Body>> for HandlerService {
 \r
 pub struct MakeSvc {\r
     pub settings: Config,\r
+    pub nats: Box<Connection>,\r
 }\r
 \r
 impl<T> Service<T> for MakeSvc {\r
@@ -130,6 +135,7 @@ impl<T> Service<T> for MakeSvc {
     fn call(&mut self, _: T) -> Self::Future {\r
         future::ready(Ok(HandlerService {\r
             config: self.settings.clone(),\r
+            nats: self.nats.clone(),\r
         }))\r
     }\r
 }\r
index 312537380dcd9ce0370456282eff664c9ce3abd7..b9fefc5651a3d9a58e192e6a2b210681eb2b364b 100644 (file)
@@ -22,8 +22,10 @@ async fn main() {
         "Starting server on {}:{}",\r
         settings.config.server.address, settings.config.server.port\r
     );\r
+    let nats = Box::new(nats::connect("localhost").unwrap());\r
     let server = Server::bind(&addr).serve(MakeSvc {\r
         settings: settings.config.clone(),\r
+        nats\r
     });\r
 \r
     if let Err(e) = server.await {\r