diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 7960cd0a..00000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-stages:
- - build
-
-# Rocket does not currently compile on stable Rust.
-# Once it does, we can uncomment this, and instead
-# put `allow-failure: true` on the nightly build.
-#
-# rust-latest:
-# stage: build
-# image: rust:latest
-# script:
-# - cargo build --verbose
-# - cargo test --verbose
-
-rust-nightly:
- stage: build
- image: rustlang/rust:nightly
- script:
- - cargo build --verbose
- - cargo test --verbose
diff --git a/Cargo.lock b/Cargo.lock
index 4ca2d84f..a5e620db 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -65,8 +65,8 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
dependencies = [
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -195,6 +195,20 @@ dependencies = [
"wasm-bindgen-futures",
]
+[[package]]
+name = "async-std-resolver"
+version = "0.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed4e2c3da14d8ad45acb1e3191db7a918e9505b6f155b218e70a7c9a1a48c638"
+dependencies = [
+ "async-std",
+ "async-trait",
+ "futures-io",
+ "futures-util",
+ "pin-utils",
+ "trust-dns-resolver 0.20.3",
+]
+
[[package]]
name = "async-stream"
version = "0.3.2"
@@ -212,8 +226,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -229,8 +243,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -442,6 +456,25 @@ dependencies = [
"uuid",
]
+[[package]]
+name = "bson"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41539b5c502b7c4e7b8af8ef07e5c442fe79ceba62a2aad8e62bd589b9454745"
+dependencies = [
+ "ahash",
+ "base64 0.13.0",
+ "chrono",
+ "hex",
+ "indexmap",
+ "lazy_static",
+ "rand 0.8.4",
+ "serde",
+ "serde_bytes",
+ "serde_json",
+ "uuid",
+]
+
[[package]]
name = "bumpalo"
version = "3.7.0"
@@ -592,6 +625,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "crc32fast"
+version = "1.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3"
+dependencies = [
+ "cfg-if 1.0.0",
+]
+
[[package]]
name = "crossbeam-utils"
version = "0.8.5"
@@ -618,8 +660,8 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
dependencies = [
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -661,9 +703,9 @@ dependencies = [
"fnv",
"ident_case",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"strsim 0.9.3",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -675,9 +717,9 @@ dependencies = [
"fnv",
"ident_case",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"strsim 0.10.0",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -687,8 +729,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
dependencies = [
"darling_core 0.10.2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -698,10 +740,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc"
dependencies = [
"darling_core 0.13.0",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
+[[package]]
+name = "data-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57"
+
[[package]]
name = "derivative"
version = "2.2.0"
@@ -709,8 +757,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -730,7 +778,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "123c73e7a6e51b05c75fe1a1b2f4e241399ea5740ed810b0e3e6cacd9db5e7b2"
dependencies = [
"devise_core",
- "quote",
+ "quote 1.0.9",
]
[[package]]
@@ -742,8 +790,8 @@ dependencies = [
"bitflags",
"proc-macro2",
"proc-macro2-diagnostics",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -805,8 +853,8 @@ checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595"
dependencies = [
"heck",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -839,9 +887,9 @@ checksum = "22deed3a8124cff5fa835713fa105621e43bbdc46690c3a6b68328a012d350d4"
dependencies = [
"proc-macro-error",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"rustversion",
- "syn",
+ "syn 1.0.76",
"synstructure",
]
@@ -880,6 +928,18 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "flate2"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
+dependencies = [
+ "cfg-if 1.0.0",
+ "crc32fast",
+ "libc",
+ "miniz_oxide",
+]
+
[[package]]
name = "fnv"
version = "1.0.7"
@@ -1011,8 +1071,8 @@ dependencies = [
"autocfg 1.0.1",
"proc-macro-hack",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -1796,7 +1856,7 @@ dependencies = [
"async-trait",
"base64 0.11.0",
"bitflags",
- "bson",
+ "bson 1.2.3",
"chrono",
"derivative",
"err-derive",
@@ -1823,9 +1883,58 @@ dependencies = [
"time 0.1.44",
"tokio 0.2.25",
"tokio-rustls 0.13.1",
- "trust-dns-proto",
- "trust-dns-resolver",
- "typed-builder",
+ "trust-dns-proto 0.19.7",
+ "trust-dns-resolver 0.19.7",
+ "typed-builder 0.4.1",
+ "uuid",
+ "version_check",
+ "webpki",
+ "webpki-roots 0.21.1",
+]
+
+[[package]]
+name = "mongodb"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bacb6f8cee6bf010d7bc57550d859f6a4ffe255eb8c9a7014637fe988eaece64"
+dependencies = [
+ "async-std",
+ "async-std-resolver",
+ "async-trait",
+ "base64 0.13.0",
+ "bitflags",
+ "bson 2.1.0",
+ "chrono",
+ "derivative",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-util",
+ "hex",
+ "hmac",
+ "lazy_static",
+ "md-5",
+ "os_info",
+ "pbkdf2",
+ "percent-encoding",
+ "rand 0.8.4",
+ "rustls 0.19.1",
+ "rustls-pemfile",
+ "serde",
+ "serde_with",
+ "sha-1 0.9.8",
+ "sha2",
+ "socket2 0.4.2",
+ "stringprep",
+ "strsim 0.10.0",
+ "take_mut",
+ "thiserror",
+ "tokio 1.11.0",
+ "tokio-rustls 0.22.0",
+ "tokio-util 0.6.8",
+ "trust-dns-proto 0.20.3",
+ "trust-dns-resolver 0.20.3",
+ "typed-builder 0.9.1",
"uuid",
"version_check",
"webpki",
@@ -1955,24 +2064,23 @@ dependencies = [
[[package]]
name = "num_enum"
-version = "0.5.4"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f"
+checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
dependencies = [
- "derivative",
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
-version = "0.5.4"
+version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9"
+checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
dependencies = [
"proc-macro-crate",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2035,6 +2143,38 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "ops"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84d3c0b53fdad4ac53b19afbf296402d4ba0c9e99ddc28cbb5201f37ecce217a"
+dependencies = [
+ "futures-util",
+ "hyper 0.14.12",
+ "once_cell",
+ "ops-core",
+ "prometheus",
+ "serde_json",
+]
+
+[[package]]
+name = "ops-core"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d57465be38a13e24528c3c821514029e9b6171b8e86cb04cfa481c78bc7af57"
+dependencies = [
+ "async-trait",
+]
+
+[[package]]
+name = "optional_struct"
+version = "0.2.0"
+source = "git+https://github.com/insertish/OptionalStruct?rev=2011de17db6ecb210fddabe3d79ade865efaf4ee#2011de17db6ecb210fddabe3d79ade865efaf4ee"
+dependencies = [
+ "quote 0.3.15",
+ "syn 0.11.11",
+]
+
[[package]]
name = "os_info"
version = "3.0.7"
@@ -2104,8 +2244,8 @@ checksum = "82a5ca643c2303ecb740d506539deba189e16f2754040a42901cd8105d0282d0"
dependencies = [
"proc-macro2",
"proc-macro2-diagnostics",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2142,8 +2282,8 @@ dependencies = [
"pest",
"pest_meta",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2188,8 +2328,8 @@ dependencies = [
"phf_shared",
"proc-macro-hack",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2217,8 +2357,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2282,8 +2422,8 @@ checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
"version_check",
]
@@ -2294,7 +2434,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"version_check",
]
@@ -2316,7 +2456,7 @@ version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d"
dependencies = [
- "unicode-xid",
+ "unicode-xid 0.2.2",
]
[[package]]
@@ -2326,12 +2466,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
"version_check",
"yansi",
]
+[[package]]
+name = "procfs"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab8809e0c18450a2db0f236d2a44ec0b4c1412d0eb936233579f0990faa5d5cd"
+dependencies = [
+ "bitflags",
+ "byteorder",
+ "flate2",
+ "hex",
+ "lazy_static",
+ "libc",
+]
+
+[[package]]
+name = "prometheus"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8425533e7122f0c3cc7a37e6244b16ad3a2cc32ae7ac6276e2a75da0d9c200d"
+dependencies = [
+ "cfg-if 1.0.0",
+ "fnv",
+ "lazy_static",
+ "libc",
+ "parking_lot",
+ "procfs",
+ "regex",
+ "thiserror",
+]
+
[[package]]
name = "quick-error"
version = "1.2.3"
@@ -2344,6 +2514,12 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
+[[package]]
+name = "quote"
+version = "0.3.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+
[[package]]
name = "quote"
version = "1.0.9"
@@ -2587,7 +2763,7 @@ dependencies = [
"json",
"lazy_static",
"lettre",
- "mongodb",
+ "mongodb 1.2.3",
"nanoid",
"rand 0.8.4",
"regex",
@@ -2678,8 +2854,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -2814,7 +2990,7 @@ dependencies = [
"many-to-many",
"mobc",
"mobc-redis",
- "mongodb",
+ "mongodb 1.2.3",
"nanoid",
"num_enum",
"once_cell",
@@ -2823,6 +2999,7 @@ dependencies = [
"redis 0.21.2",
"regex",
"reqwest 0.11.4",
+ "revolt-quark",
"rmp-serde",
"rocket",
"rocket_cors",
@@ -2834,6 +3011,24 @@ dependencies = [
"web-push",
]
+[[package]]
+name = "revolt-quark"
+version = "0.1.0"
+dependencies = [
+ "async-std",
+ "async-trait",
+ "impl_ops",
+ "lazy_static",
+ "log",
+ "mongodb 2.1.0",
+ "num_enum",
+ "ops",
+ "optional_struct",
+ "rocket",
+ "serde",
+ "validator 0.14.0",
+]
+
[[package]]
name = "ring"
version = "0.16.20"
@@ -2917,10 +3112,10 @@ dependencies = [
"glob",
"indexmap",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"rocket_http",
- "syn",
- "unicode-xid",
+ "syn 1.0.76",
+ "unicode-xid 0.2.2",
]
[[package]]
@@ -3019,6 +3214,28 @@ dependencies = [
"webpki",
]
+[[package]]
+name = "rustls"
+version = "0.19.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7"
+dependencies = [
+ "base64 0.13.0",
+ "log",
+ "ring",
+ "sct",
+ "webpki",
+]
+
+[[package]]
+name = "rustls-pemfile"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9"
+dependencies = [
+ "base64 0.13.0",
+]
+
[[package]]
name = "rustversion"
version = "1.0.5"
@@ -3141,8 +3358,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3188,8 +3405,8 @@ checksum = "98c1fcca18d55d1763e1c16873c4bde0ac3ef75179a28c7b372917e0494625be"
dependencies = [
"darling 0.13.0",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3354,10 +3571,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"serde",
"serde_derive",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -3368,12 +3585,12 @@ checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
"base-x",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"serde",
"serde_derive",
"serde_json",
"sha1",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -3410,6 +3627,17 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
+[[package]]
+name = "syn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
+dependencies = [
+ "quote 0.3.15",
+ "synom",
+ "unicode-xid 0.0.4",
+]
+
[[package]]
name = "syn"
version = "1.0.76"
@@ -3417,8 +3645,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
dependencies = [
"proc-macro2",
- "quote",
- "unicode-xid",
+ "quote 1.0.9",
+ "unicode-xid 0.2.2",
+]
+
+[[package]]
+name = "synom"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
+dependencies = [
+ "unicode-xid 0.0.4",
]
[[package]]
@@ -3428,9 +3665,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
- "unicode-xid",
+ "quote 1.0.9",
+ "syn 1.0.76",
+ "unicode-xid 0.2.2",
]
[[package]]
@@ -3484,8 +3721,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3532,9 +3769,9 @@ checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f"
dependencies = [
"proc-macro-hack",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"standback",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -3597,8 +3834,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3608,8 +3845,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3646,6 +3883,17 @@ dependencies = [
"webpki",
]
+[[package]]
+name = "tokio-rustls"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"
+dependencies = [
+ "rustls 0.19.1",
+ "tokio 1.11.0",
+ "webpki",
+]
+
[[package]]
name = "tokio-stream"
version = "0.1.7"
@@ -3689,6 +3937,7 @@ checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd"
dependencies = [
"bytes 1.1.0",
"futures-core",
+ "futures-io",
"futures-sink",
"log",
"pin-project-lite 0.2.7",
@@ -3774,6 +4023,31 @@ dependencies = [
"url",
]
+[[package]]
+name = "trust-dns-proto"
+version = "0.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4"
+dependencies = [
+ "async-trait",
+ "cfg-if 1.0.0",
+ "data-encoding",
+ "enum-as-inner",
+ "futures-channel",
+ "futures-io",
+ "futures-util",
+ "idna",
+ "ipnet",
+ "lazy_static",
+ "log",
+ "rand 0.8.4",
+ "smallvec",
+ "thiserror",
+ "tinyvec",
+ "tokio 1.11.0",
+ "url",
+]
+
[[package]]
name = "trust-dns-resolver"
version = "0.19.7"
@@ -3790,7 +4064,27 @@ dependencies = [
"smallvec",
"thiserror",
"tokio 0.2.25",
- "trust-dns-proto",
+ "trust-dns-proto 0.19.7",
+]
+
+[[package]]
+name = "trust-dns-resolver"
+version = "0.20.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770"
+dependencies = [
+ "cfg-if 1.0.0",
+ "futures-util",
+ "ipconfig",
+ "lazy_static",
+ "log",
+ "lru-cache",
+ "parking_lot",
+ "resolv-conf",
+ "smallvec",
+ "thiserror",
+ "tokio 1.11.0",
+ "trust-dns-proto 0.20.3",
]
[[package]]
@@ -3835,8 +4129,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfc955f27acc7a547f328f52f4a5a568986a31efec2fc6de865279f3995787b9"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
+]
+
+[[package]]
+name = "typed-builder"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a46ee5bd706ff79131be9c94e7edcb82b703c487766a114434e5790361cf08c5"
+dependencies = [
+ "proc-macro2",
+ "quote 1.0.9",
+ "syn 1.0.76",
]
[[package]]
@@ -3927,6 +4232,12 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
+[[package]]
+name = "unicode-xid"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
+
[[package]]
name = "unicode-xid"
version = "0.2.2"
@@ -3970,6 +4281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
"getrandom 0.2.3",
+ "serde",
]
[[package]]
@@ -3985,7 +4297,7 @@ dependencies = [
"serde_derive",
"serde_json",
"url",
- "validator_derive",
+ "validator_derive 0.11.0",
"validator_types 0.11.0",
]
@@ -4002,6 +4314,7 @@ dependencies = [
"serde_derive",
"serde_json",
"url",
+ "validator_derive 0.14.0",
"validator_types 0.14.0",
]
@@ -4015,12 +4328,28 @@ dependencies = [
"lazy_static",
"proc-macro-error",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"regex",
- "syn",
+ "syn 1.0.76",
"validator_types 0.11.0",
]
+[[package]]
+name = "validator_derive"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d85135714dba11a1bd0b3eb1744169266f1a38977bf4e3ff5e2e1acb8c2b7eee"
+dependencies = [
+ "if_chain",
+ "lazy_static",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote 1.0.9",
+ "regex",
+ "syn 1.0.76",
+ "validator_types 0.14.0",
+]
+
[[package]]
name = "validator_types"
version = "0.11.0"
@@ -4034,7 +4363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded9d97e1d42327632f5f3bae6403c04886e2de3036261ef42deebd931a6a291"
dependencies = [
"proc-macro2",
- "syn",
+ "syn 1.0.76",
]
[[package]]
@@ -4109,8 +4438,8 @@ dependencies = [
"lazy_static",
"log",
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
"wasm-bindgen-shared",
]
@@ -4132,7 +4461,7 @@ version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
dependencies = [
- "quote",
+ "quote 1.0.9",
"wasm-bindgen-macro-support",
]
@@ -4143,8 +4472,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [
"proc-macro2",
- "quote",
- "syn",
+ "quote 1.0.9",
+ "syn 1.0.76",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -4303,7 +4632,7 @@ dependencies = [
"chrono",
"futures",
"log",
- "mongodb",
+ "mongodb 1.2.3",
"serde",
"thiserror",
"ulid",
@@ -4320,9 +4649,9 @@ dependencies = [
"darling 0.10.2",
"proc-macro-error",
"proc-macro2",
- "quote",
+ "quote 1.0.9",
"serde",
- "syn",
+ "syn 1.0.76",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 749a9b82..abbfbdb5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -63,3 +63,6 @@ async-tungstenite = { version = "0.10.0", features = ["async-std-runtime"] }
rocket = { version = "0.5.0-rc.1", default-features = false, features = ["json"] }
mongodb = { version = "1.2.2", features = ["tokio-runtime"], default-features = false }
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", rev = "5843861a88958c16bfaa0b40f0d8910772bcd2f6" }
+
+# quark
+revolt-quark = { path = "/run/media/mink/2b4927e2-fad4-4b12-b6ea-cdf7e0ab0339/revolt/quark/" }
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index ad4d11ee..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- Server
- Copyright (C) 2021 REVOLT
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
diff --git a/deny.toml b/deny.toml
new file mode 100644
index 00000000..3bfd2858
--- /dev/null
+++ b/deny.toml
@@ -0,0 +1,210 @@
+# This template contains all of the possible sections and their default values
+
+# Note that all fields that take a lint level have these possible values:
+# * deny - An error will be produced and the check will fail
+# * warn - A warning will be produced, but the check will not fail
+# * allow - No warning or error will be produced, though in some cases a note
+# will be
+
+# The values provided in this template are the default values that will be used
+# when any section or field is not specified in your own configuration
+
+# If 1 or more target triples (and optionally, target_features) are specified,
+# only the specified targets will be checked when running `cargo deny check`.
+# This means, if a particular package is only ever used as a target specific
+# dependency, such as, for example, the `nix` crate only being used via the
+# `target_family = "unix"` configuration, that only having windows targets in
+# this list would mean the nix crate, as well as any of its exclusive
+# dependencies not shared by any other crates, would be ignored, as the target
+# list here is effectively saying which targets you are building for.
+targets = [
+ # The triple can be any string, but only the target triples built in to
+ # rustc (as of 1.40) can be checked against actual config expressions
+ #{ triple = "x86_64-unknown-linux-musl" },
+ # You can also specify which target_features you promise are enabled for a
+ # particular target. target_features are currently not validated against
+ # the actual valid features supported by the target architecture.
+ #{ triple = "wasm32-unknown-unknown", features = ["atomics"] },
+]
+
+# This section is considered when running `cargo deny check advisories`
+# More documentation for the advisories section can be found here:
+# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
+[advisories]
+# The path where the advisory database is cloned/fetched into
+db-path = "~/.cargo/advisory-db"
+# The url(s) of the advisory databases to use
+db-urls = ["https://github.com/rustsec/advisory-db"]
+# The lint level for security vulnerabilities
+vulnerability = "deny"
+# The lint level for unmaintained crates
+unmaintained = "warn"
+# The lint level for crates that have been yanked from their source registry
+yanked = "warn"
+# The lint level for crates with security notices. Note that as of
+# 2019-12-17 there are no security notice advisories in
+# https://github.com/rustsec/advisory-db
+notice = "warn"
+# A list of advisory IDs to ignore. Note that ignored advisories will still
+# output a note when they are encountered.
+ignore = [
+ #"RUSTSEC-0000-0000",
+]
+# Threshold for security vulnerabilities, any vulnerability with a CVSS score
+# lower than the range specified will be ignored. Note that ignored advisories
+# will still output a note when they are encountered.
+# * None - CVSS Score 0.0
+# * Low - CVSS Score 0.1 - 3.9
+# * Medium - CVSS Score 4.0 - 6.9
+# * High - CVSS Score 7.0 - 8.9
+# * Critical - CVSS Score 9.0 - 10.0
+#severity-threshold =
+
+# This section is considered when running `cargo deny check licenses`
+# More documentation for the licenses section can be found here:
+# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
+[licenses]
+# The lint level for crates which do not have a detectable license
+unlicensed = "warn"
+# List of explicitly allowed licenses
+# See https://spdx.org/licenses/ for list of possible licenses
+# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
+allow = [
+ "MIT",
+ "ISC",
+ "0BSD",
+ "CC0-1.0",
+ "Apache-2.0",
+ "BSD-2-Clause",
+ "BSD-3-Clause",
+ #"Apache-2.0 WITH LLVM-exception",
+]
+# List of explicitly disallowed licenses
+# See https://spdx.org/licenses/ for list of possible licenses
+# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
+deny = [
+ #"Nokia",
+]
+# Lint level for licenses considered copyleft
+copyleft = "warn"
+# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
+# * both - The license will be approved if it is both OSI-approved *AND* FSF
+# * either - The license will be approved if it is either OSI-approved *OR* FSF
+# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
+# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
+# * neither - This predicate is ignored and the default lint level is used
+allow-osi-fsf-free = "neither"
+# Lint level used when no other predicates are matched
+# 1. License isn't in the allow or deny lists
+# 2. License isn't copyleft
+# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
+default = "deny"
+# The confidence threshold for detecting a license from license text.
+# The higher the value, the more closely the license text must be to the
+# canonical license text of a valid SPDX license file.
+# [possible values: any between 0.0 and 1.0].
+confidence-threshold = 0.8
+# Allow 1 or more licenses on a per-crate basis, so that particular licenses
+# aren't accepted for every possible crate as with the normal allow list
+exceptions = [
+ # Each entry is the crate and version constraint, and its specific allow
+ # list
+ #{ allow = ["Zlib"], name = "adler32", version = "*" },
+]
+
+# Some crates don't have (easily) machine readable licensing information,
+# adding a clarification entry for it allows you to manually specify the
+# licensing information
+#[[licenses.clarify]]
+# The name of the crate the clarification applies to
+#name = "ring"
+# The optional version constraint for the crate
+#version = "*"
+# The SPDX expression for the license requirements of the crate
+#expression = "MIT AND ISC AND OpenSSL"
+# One or more files in the crate's source used as the "source of truth" for
+# the license expression. If the contents match, the clarification will be used
+# when running the license check, otherwise the clarification will be ignored
+# and the crate will be checked normally, which may produce warnings or errors
+# depending on the rest of your configuration
+#license-files = [
+ # Each entry is a crate relative path, and the (opaque) hash of its contents
+ #{ path = "LICENSE", hash = 0xbd0eed23 }
+#]
+
+[licenses.private]
+# If true, ignores workspace crates that aren't published, or are only
+# published to private registries.
+# To see how to mark a crate as unpublished (to the official registry),
+# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field.
+ignore = false
+# One or more private registries that you might publish crates to, if a crate
+# is only published to private registries, and ignore is true, the crate will
+# not have its license(s) checked
+registries = [
+ #"https://sekretz.com/registry
+]
+
+# This section is considered when running `cargo deny check bans`.
+# More documentation about the 'bans' section can be found here:
+# https://embarkstudios.github.io/cargo-deny/checks/bans/cfg.html
+[bans]
+# Lint level for when multiple versions of the same crate are detected
+multiple-versions = "warn"
+# Lint level for when a crate version requirement is `*`
+wildcards = "allow"
+# The graph highlighting used when creating dotgraphs for crates
+# with multiple versions
+# * lowest-version - The path to the lowest versioned duplicate is highlighted
+# * simplest-path - The path to the version with the fewest edges is highlighted
+# * all - Both lowest-version and simplest-path are used
+highlight = "all"
+# List of crates that are allowed. Use with care!
+allow = [
+ #{ name = "ansi_term", version = "=0.11.0" },
+]
+# List of crates to deny
+deny = [
+ # Each entry the name of a crate and a version range. If version is
+ # not specified, all versions will be matched.
+ #{ name = "ansi_term", version = "=0.11.0" },
+ #
+ # Wrapper crates can optionally be specified to allow the crate when it
+ # is a direct dependency of the otherwise banned crate
+ #{ name = "ansi_term", version = "=0.11.0", wrappers = [] },
+]
+# Certain crates/versions that will be skipped when doing duplicate detection.
+skip = [
+ #{ name = "ansi_term", version = "=0.11.0" },
+]
+# Similarly to `skip` allows you to skip certain crates during duplicate
+# detection. Unlike skip, it also includes the entire tree of transitive
+# dependencies starting at the specified crate, up to a certain depth, which is
+# by default infinite
+skip-tree = [
+ #{ name = "ansi_term", version = "=0.11.0", depth = 20 },
+]
+
+# This section is considered when running `cargo deny check sources`.
+# More documentation about the 'sources' section can be found here:
+# https://embarkstudios.github.io/cargo-deny/checks/sources/cfg.html
+[sources]
+# Lint level for what to happen when a crate from a crate registry that is not
+# in the allow list is encountered
+unknown-registry = "warn"
+# Lint level for what to happen when a crate from a git repository that is not
+# in the allow list is encountered
+unknown-git = "warn"
+# List of URLs for allowed crate registries. Defaults to the crates.io index
+# if not specified. If it is specified but empty, no registries are allowed.
+allow-registry = ["https://github.com/rust-lang/crates.io-index"]
+# List of URLs for allowed Git repositories
+allow-git = ["https://gitlab.insrt.uk/insert/hive"]
+
+[sources.allow-org]
+# 1 or more github.com organizations to allow git sources for
+github = ["insertish"]
+# 1 or more gitlab.com organizations to allow git sources for
+gitlab = []
+# 1 or more bitbucket.org organizations to allow git sources for
+bitbucket = [""]
diff --git a/src/database/entities/bots.rs b/src/database/entities/bots.rs
deleted file mode 100644
index d507615a..00000000
--- a/src/database/entities/bots.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use serde::{Serialize, Deserialize};
-
-pub fn if_false(t: &bool) -> bool {
- !t
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct Bot {
- #[serde(rename = "_id")]
- pub id: String,
- pub owner: String,
- pub token: String,
- pub public: bool,
- #[serde(skip_serializing_if = "if_false", default)]
- pub analytics: bool,
- #[serde(skip_serializing_if = "if_false", default)]
- pub discoverable: bool,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub interactions_url: Option,
-}
diff --git a/src/database/entities/channel.rs b/src/database/entities/channel.rs
deleted file mode 100644
index b44659f3..00000000
--- a/src/database/entities/channel.rs
+++ /dev/null
@@ -1,392 +0,0 @@
-use std::collections::HashMap;
-
-use crate::database::*;
-use crate::notifications::events::ClientboundNotification;
-use crate::util::result::{Error, Result};
-use crate::util::variables::MAX_GROUP_SIZE;
-use futures::StreamExt;
-use mongodb::bson::Bson;
-use mongodb::{
- bson::{doc, to_document, Document},
- options::FindOptions,
-};
-use rocket::serde::json::Value;
-use serde::{Deserialize, Serialize};
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(tag = "channel_type")]
-pub enum Channel {
- SavedMessages {
- #[serde(rename = "_id")]
- id: String,
- user: String,
- },
- DirectMessage {
- #[serde(rename = "_id")]
- id: String,
-
- active: bool,
- recipients: Vec,
- #[serde(skip_serializing_if = "Option::is_none")]
- last_message_id: Option,
- },
- Group {
- #[serde(rename = "_id")]
- id: String,
-
- name: String,
- owner: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- description: Option,
- recipients: Vec,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- icon: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- last_message_id: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- permissions: Option,
-
- #[serde(skip_serializing_if = "entities::server::if_false", default)]
- nsfw: bool
- },
- TextChannel {
- #[serde(rename = "_id")]
- id: String,
- server: String,
-
- name: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- description: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- icon: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- last_message_id: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- default_permissions: Option,
- #[serde(default = "HashMap::new", skip_serializing_if = "HashMap::is_empty")]
- role_permissions: HashMap,
-
- #[serde(skip_serializing_if = "entities::server::if_false", default)]
- nsfw: bool
- },
- VoiceChannel {
- #[serde(rename = "_id")]
- id: String,
- server: String,
-
- name: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- description: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- icon: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- default_permissions: Option,
- #[serde(default = "HashMap::new", skip_serializing_if = "HashMap::is_empty")]
- role_permissions: HashMap,
-
- #[serde(skip_serializing_if = "entities::server::if_false", default)]
- nsfw: bool
- },
-}
-
-impl Channel {
- pub fn id(&self) -> &str {
- match self {
- Channel::SavedMessages { id, .. }
- | Channel::DirectMessage { id, .. }
- | Channel::Group { id, .. }
- | Channel::TextChannel { id, .. }
- | Channel::VoiceChannel { id, .. } => id,
- }
- }
- pub fn has_messaging(&self) -> Result<()> {
- match self {
- Channel::SavedMessages { .. }
- | Channel::DirectMessage { .. }
- | Channel::Group { .. }
- | Channel::TextChannel { .. } => Ok(()),
- Channel::VoiceChannel { .. } => Err(Error::InvalidOperation)
- }
- }
-
- pub async fn publish(self) -> Result<()> {
- get_collection("channels")
- .insert_one(
- to_document(&self).map_err(|_| Error::DatabaseError {
- operation: "to_bson",
- with: "channel",
- })?,
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "insert_one",
- with: "channel",
- })?;
-
- let channel_id = self.id().to_string();
- ClientboundNotification::ChannelCreate(self).publish(channel_id);
-
- Ok(())
- }
-
- pub async fn publish_update(&self, data: Value) -> Result<()> {
- let id = self.id().to_string();
- ClientboundNotification::ChannelUpdate {
- id: id.clone(),
- data,
- clear: None,
- }
- .publish(id);
-
- Ok(())
- }
-
- pub async fn delete_associated_objects(id: Bson) -> Result<()> {
- get_collection("channel_invites")
- .delete_many(
- doc! {
- "channel": id
- },
- None,
- )
- .await
- .map(|_| ())
- .map_err(|_| Error::DatabaseError {
- operation: "delete_many",
- with: "channel_invites",
- })
- }
-
- pub async fn delete_messages(id: Bson) -> Result<()> {
- let messages = get_collection("messages");
-
- // Delete any unreads.
- get_collection("channel_unreads")
- .delete_many(
- doc! {
- "_id.channel": &id
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "delete_many",
- with: "channel_unreads",
- })?;
-
- // Check if there are any attachments we need to delete.
- let message_ids = messages
- .find(
- doc! {
- "channel": &id,
- "attachment": {
- "$exists": 1
- }
- },
- FindOptions::builder().projection(doc! { "_id": 1 }).build(),
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "fetch_many",
- with: "messages",
- })?
- .filter_map(async move |s| s.ok())
- .collect::>()
- .await
- .into_iter()
- .filter_map(|x| x.get_str("_id").ok().map(|x| x.to_string()))
- .collect::>();
-
- // If we found any, mark them as deleted.
- if message_ids.len() > 0 {
- get_collection("attachments")
- .update_many(
- doc! {
- "message_id": {
- "$in": message_ids
- }
- },
- doc! {
- "$set": {
- "deleted": true
- }
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "update_many",
- with: "attachments",
- })?;
- }
-
- // And then delete said messages.
- messages
- .delete_many(
- doc! {
- "channel": id
- },
- None,
- )
- .await
- .map(|_| ())
- .map_err(|_| Error::DatabaseError {
- operation: "delete_many",
- with: "messages",
- })
- }
-
- pub async fn delete(&self) -> Result<()> {
- let id = self.id();
-
- // Delete any invites.
- Channel::delete_associated_objects(Bson::String(id.to_string())).await?;
-
- // Delete messages.
- match &self {
- Channel::VoiceChannel { .. } => {},
- _ => {
- Channel::delete_messages(Bson::String(id.to_string())).await?;
- }
- }
-
- // Remove from server object.
- match &self {
- Channel::TextChannel { server, .. }
- | Channel::VoiceChannel { server, .. } => {
- let server = Ref::from_unchecked(server.clone()).fetch_server().await?;
- let mut update = doc! {
- "$pull": {
- "channels": id
- }
- };
-
- if let Some(sys) = &server.system_messages {
- let mut unset = doc! {};
-
- if let Some(cid) = &sys.user_joined {
- if id == cid {
- unset.insert("system_messages.user_joined", 1);
- }
- }
-
- if let Some(cid) = &sys.user_left {
- if id == cid {
- unset.insert("system_messages.user_left", 1);
- }
- }
-
- if let Some(cid) = &sys.user_kicked {
- if id == cid {
- unset.insert("system_messages.user_kicked", 1);
- }
- }
-
- if let Some(cid) = &sys.user_banned {
- if id == cid {
- unset.insert("system_messages.user_banned", 1);
- }
- }
-
- if unset.len() > 0 {
- update.insert("$unset", unset);
- }
- }
-
- get_collection("servers")
- .update_one(
- doc! {
- "_id": server.id
- },
- update,
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "update_one",
- with: "servers",
- })?;
- },
- _ => {}
- }
-
- // Finally, delete the channel object.
- get_collection("channels")
- .delete_one(
- doc! {
- "_id": id
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "delete_one",
- with: "channel",
- })?;
-
- ClientboundNotification::ChannelDelete { id: id.to_string() }.publish(id.to_string());
-
- if let Channel::Group { icon, .. } = self {
- if let Some(attachment) = icon {
- attachment.delete().await?;
- }
- }
-
- Ok(())
- }
-
- pub async fn add_to_group(&self, member: String, by_user: String) -> Result<()> {
- if let Channel::Group { id, recipients, .. } = &self {
- if recipients.len() >= *MAX_GROUP_SIZE {
- Err(Error::GroupTooLarge {
- max: *MAX_GROUP_SIZE,
- })?
- }
-
- if recipients.iter().find(|x| *x == &member).is_some() {
- Err(Error::AlreadyInGroup)?
- }
-
- get_collection("channels")
- .update_one(
- doc! {
- "_id": &id
- },
- doc! {
- "$push": {
- "recipients": &member
- }
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "update_one",
- with: "channel",
- })?;
-
- ClientboundNotification::ChannelGroupJoin {
- id: id.clone(),
- user: member.clone(),
- }
- .publish(id.clone());
-
- Content::SystemMessage(SystemMessage::UserAdded {
- id: member,
- by: by_user,
- })
- .send_as_system(&self)
- .await
- .ok();
- Ok(())
- } else {
- Err(Error::InvalidOperation)
- }
- }
-}
diff --git a/src/database/entities/invites.rs b/src/database/entities/invites.rs
deleted file mode 100644
index 9d3cfecb..00000000
--- a/src/database/entities/invites.rs
+++ /dev/null
@@ -1,96 +0,0 @@
-use mongodb::bson::doc;
-use mongodb::bson::from_document;
-use mongodb::bson::to_document;
-use serde::{Deserialize, Serialize};
-
-use crate::database::get_collection;
-use crate::util::result::Error;
-use crate::util::result::Result;
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(tag = "type")]
-pub enum Invite {
- Server {
- #[serde(rename = "_id")]
- code: String,
- server: String,
- creator: String,
- channel: String,
- },
- Group {
- #[serde(rename = "_id")]
- code: String,
- creator: String,
- channel: String,
- }, /* User {
- code: String,
- user: String
- } */
-}
-
-impl Invite {
- pub fn code(&self) -> &String {
- match &self {
- Invite::Server { code, .. } => code,
- Invite::Group { code, .. } => code,
- }
- }
-
- pub fn creator(&self) -> &String {
- match &self {
- Invite::Server { creator, .. } => creator,
- Invite::Group { creator, .. } => creator,
- }
- }
-
- pub async fn get(code: &str) -> Result {
- let doc = get_collection("channel_invites")
- .find_one(doc! { "_id": code }, None)
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "find_one",
- with: "invite",
- })?
- .ok_or_else(|| Error::UnknownServer)?;
-
- from_document::(doc).map_err(|_| Error::DatabaseError {
- operation: "from_document",
- with: "invite",
- })
- }
-
- pub async fn save(self) -> Result<()> {
- get_collection("channel_invites")
- .insert_one(
- to_document(&self).map_err(|_| Error::DatabaseError {
- operation: "to_bson",
- with: "invite",
- })?,
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "insert_one",
- with: "invite",
- })?;
-
- Ok(())
- }
-
- pub async fn delete(&self) -> Result<()> {
- get_collection("channel_invites")
- .delete_one(
- doc! {
- "_id": self.code()
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "delete_one",
- with: "invite",
- })?;
-
- Ok(())
- }
-}
diff --git a/src/database/entities/message.rs b/src/database/entities/message.rs
deleted file mode 100644
index 74a2585a..00000000
--- a/src/database/entities/message.rs
+++ /dev/null
@@ -1,363 +0,0 @@
-use crate::util::variables::{USE_JANUARY, PUBLIC_URL, APP_URL};
-use crate::{
- database::*,
- notifications::{events::ClientboundNotification, websocket::is_online},
- util::result::{Error, Result},
-};
-
-use mongodb::bson::{doc, to_bson, DateTime};
-use rocket::serde::json::Value;
-use serde::{Deserialize, Serialize};
-use ulid::Ulid;
-use validator::Validate;
-use std::collections::HashSet;
-use std::time::SystemTime;
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct PushNotification {
- pub author: String,
- pub icon: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub image: Option,
- pub body: String,
- pub tag: String,
- pub timestamp: u64,
- pub url: String,
-}
-
-impl PushNotification {
- pub async fn new(msg: Message, channel: &Channel) -> Self {
- let author = Ref::from_unchecked(msg.author.clone())
- .fetch_user()
- .await;
-
- let (author, avatar) = if let Ok(author) = author {
- (Some(author.username), author.avatar)
- } else {
- (None, None)
- };
-
- let icon = if let Some(avatar) = avatar {
- avatar.get_autumn_url()
- } else {
- format!("{}/users/{}/default_avatar", PUBLIC_URL.as_str(), msg.author)
- };
-
- let image = msg.attachments.map_or(None, |attachments| {
- attachments
- .first()
- .map_or(None, |v| Some(v.get_autumn_url()))
- });
-
- let body = match msg.content {
- Content::Text(body) => body,
- Content::SystemMessage(sys_msg) => sys_msg.into()
- };
-
- let timestamp = SystemTime::now()
- .duration_since(SystemTime::UNIX_EPOCH)
- .expect("system time should be valid")
- .as_secs();
-
- Self {
- author: author.unwrap_or_else(|| "Unknown".into()),
- icon,
- image,
- body,
- tag: channel.id().to_string(),
- timestamp,
- url: format!("{}/channel/{}/{}", *APP_URL, channel.id(), msg.id),
- }
- }
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(tag = "type")]
-pub enum SystemMessage {
- #[serde(rename = "text")]
- Text { content: String },
- #[serde(rename = "user_added")]
- UserAdded { id: String, by: String },
- #[serde(rename = "user_remove")]
- UserRemove { id: String, by: String },
- #[serde(rename = "user_joined")]
- UserJoined { id: String },
- #[serde(rename = "user_left")]
- UserLeft { id: String },
- #[serde(rename = "user_kicked")]
- UserKicked { id: String },
- #[serde(rename = "user_banned")]
- UserBanned { id: String },
- #[serde(rename = "channel_renamed")]
- ChannelRenamed { name: String, by: String },
- #[serde(rename = "channel_description_changed")]
- ChannelDescriptionChanged { by: String },
- #[serde(rename = "channel_icon_changed")]
- ChannelIconChanged { by: String },
-}
-
-impl Into for SystemMessage {
- fn into(self) -> String {
- match self {
- SystemMessage::Text { content } => content,
- SystemMessage::UserAdded { .. } => "User added to the channel.".to_string(),
- SystemMessage::UserRemove { .. } => "User removed from the channel.".to_string(),
- SystemMessage::UserJoined { .. } => "User joined the channel.".to_string(),
- SystemMessage::UserLeft { .. } => "User left the channel.".to_string(),
- SystemMessage::UserKicked { .. } => "User kicked from the channel.".to_string(),
- SystemMessage::UserBanned { .. } => "User banned from the channel.".to_string(),
- SystemMessage::ChannelRenamed { .. } => "Channel renamed.".to_string(),
- SystemMessage::ChannelDescriptionChanged { .. } => "Channel description changed.".to_string(),
- SystemMessage::ChannelIconChanged { .. } => "Channel icon changed.".to_string()
- }
- }
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(untagged)]
-pub enum Content {
- Text(String),
- SystemMessage(SystemMessage),
-}
-
-impl Content {
- pub async fn send_as_system(self, target: &Channel) -> Result<()> {
- Message::create(
- "00000000000000000000000000".to_string(),
- target.id().to_string(),
- self,
- None,
- None,
- None
- )
- .publish(&target, false)
- .await
- }
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone, Validate)]
-pub struct Masquerade {
- #[serde(skip_serializing_if = "Option::is_none")]
- #[validate(length(min = 1, max = 32))]
- name: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- #[validate(length(min = 1, max = 128))]
- avatar: Option
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct Message {
- #[serde(rename = "_id")]
- pub id: String,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub nonce: Option,
- pub channel: String,
- pub author: String,
-
- pub content: Content,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub attachments: Option>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub edited: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub embeds: Option>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub mentions: Option>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub replies: Option>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub masquerade: Option
-}
-
-impl Message {
- pub fn create(
- author: String,
- channel: String,
- content: Content,
- mentions: Option>,
- replies: Option>,
- masquerade: Option,
- ) -> Message {
- Message {
- id: Ulid::new().to_string(),
- nonce: None,
- channel,
- author,
- content,
- attachments: None,
- edited: None,
- embeds: None,
- mentions,
- replies,
- masquerade
- }
- }
-
- pub async fn publish(self, channel: &Channel, process_embeds: bool) -> Result<()> {
- // Publish message event
- ClientboundNotification::Message(self.clone())
- .publish(channel.id().to_string());
-
- // Commit message to database
- get_collection("messages")
- .insert_one(to_bson(&self).unwrap().as_document().unwrap().clone(), None)
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "insert_one",
- with: "message",
- })?;
-
- // spawn task_queue ( process embeds )
- if process_embeds {
- self.process_embed().await;
- }
-
- // spawn task_queue ( update last_message_id )
- match channel {
- Channel::DirectMessage { id, .. } =>
- crate::task_queue::task_last_message_id::queue(id.clone(), self.id.clone(), true).await,
- Channel::Group { id, .. } | Channel::TextChannel { id, .. } =>
- crate::task_queue::task_last_message_id::queue(id.clone(), self.id.clone(), false).await,
- _ => {}
- }
-
- // if mentions {
- // spawn task_queue ( update channel_unreads )
- // }
- if let Some(mentions) = &self.mentions {
- for user in mentions {
- crate::task_queue::task_ack::queue(
- channel.id().into(),
- user.clone(),
- crate::task_queue::task_ack::AckEvent::AddMention {
- ids: vec![ self.id.clone() ]
- }
- ).await;
- }
- }
-
- // if (channel => DM | Group) | mentions {
- // spawn task_queue ( web push )
- // }
- let mut target_ids = vec![];
- match &channel {
- Channel::DirectMessage { recipients, .. } | Channel::Group { recipients, .. } => {
- for recipient in recipients {
- if !is_online(recipient) {
- target_ids.push(recipient.clone());
- }
- }
- }
- Channel::TextChannel { .. } => {
- if let Some(mentions) = &self.mentions {
- target_ids.append(&mut mentions.clone());
- }
- }
- _ => {}
- }
-
- if target_ids.len() > 0 {
- if let Ok(payload) = serde_json::to_string(&PushNotification::new(self, &channel).await) {
- crate::task_queue::task_web_push::queue(target_ids, payload).await;
- }
- }
-
- Ok(())
- }
-
- pub async fn publish_update(self, data: Value) -> Result<()> {
- let channel = self.channel.clone();
- ClientboundNotification::MessageUpdate {
- id: self.id.clone(),
- channel: self.channel.clone(),
- data,
- }
- .publish(channel);
-
- self.process_embed().await;
- Ok(())
- }
-
- pub async fn process_embed(&self) {
- if !*USE_JANUARY {
- return;
- }
-
- if let Content::Text(text) = &self.content {
- crate::task_queue::task_process_embeds::queue(self.channel.clone(), self.id.clone(), text.clone()).await;
- }
- }
-
- pub async fn delete(&self) -> Result<()> {
- if let Some(attachments) = &self.attachments {
- for attachment in attachments {
- attachment.delete().await?;
- }
- }
-
- get_collection("messages")
- .delete_one(
- doc! {
- "_id": &self.id
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "delete_one",
- with: "message",
- })?;
-
- let channel = self.channel.clone();
- ClientboundNotification::MessageDelete {
- id: self.id.clone(),
- channel: self.channel.clone(),
- }
- .publish(channel);
-
- if let Some(attachments) = &self.attachments {
- let attachment_ids: Vec =
- attachments.iter().map(|f| f.id.to_string()).collect();
- get_collection("attachments")
- .update_many(
- doc! {
- "_id": {
- "$in": attachment_ids
- }
- },
- doc! {
- "$set": {
- "deleted": true
- }
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "update_many",
- with: "attachment",
- })?;
- }
-
- Ok(())
- }
-
- pub fn add_associated_user_ids(&self, ids: &mut HashSet) {
- ids.insert(self.author.clone());
-
- if let Content::SystemMessage(sys) = &self.content {
- match sys {
- SystemMessage::Text { .. } => {},
- SystemMessage::UserAdded { id, by } => { ids.insert(id.clone()); ids.insert(by.clone()); },
- SystemMessage::UserRemove { id, by } => { ids.insert(id.clone()); ids.insert(by.clone()); },
- SystemMessage::UserJoined { id } => { ids.insert(id.clone()); },
- SystemMessage::UserLeft { id } => { ids.insert(id.clone()); },
- SystemMessage::UserKicked { id } => { ids.insert(id.clone()); },
- SystemMessage::UserBanned { id } => { ids.insert(id.clone()); },
- SystemMessage::ChannelRenamed { by, .. } => { ids.insert(by.clone()); },
- SystemMessage::ChannelDescriptionChanged { by } => { ids.insert(by.clone()); },
- SystemMessage::ChannelIconChanged { by } => { ids.insert(by.clone()); }
- }
- }
- }
-}
diff --git a/src/database/entities/microservice/autumn.rs b/src/database/entities/microservice/autumn.rs
deleted file mode 100644
index dc360b1d..00000000
--- a/src/database/entities/microservice/autumn.rs
+++ /dev/null
@@ -1,122 +0,0 @@
-use mongodb::bson::{doc, from_document};
-use serde::{Deserialize, Serialize};
-
-use crate::database::*;
-use crate::util::result::{Error, Result};
-use crate::util::variables::AUTUMN_URL;
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(tag = "type")]
-enum Metadata {
- File,
- Text,
- Image { width: isize, height: isize },
- Video { width: isize, height: isize },
- Audio,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct File {
- #[serde(rename = "_id")]
- pub id: String,
- tag: String,
- filename: String,
- metadata: Metadata,
- content_type: String,
- size: isize,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- deleted: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- reported: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- message_id: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- user_id: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- server_id: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- object_id: Option,
-}
-
-impl File {
- pub async fn find_and_use(
- attachment_id: &str,
- tag: &str,
- parent_type: &str,
- parent_id: &str,
- ) -> Result {
- let attachments = get_collection("attachments");
- let key = format!("{}_id", parent_type);
- if let Some(doc) = attachments
- .find_one(
- doc! {
- "_id": attachment_id,
- "tag": &tag,
- key.clone(): {
- "$exists": false
- }
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "find_one",
- with: "attachment",
- })?
- {
- let attachment = from_document::(doc).map_err(|_| Error::DatabaseError {
- operation: "from_document",
- with: "attachment",
- })?;
-
- attachments
- .update_one(
- doc! {
- "_id": &attachment.id
- },
- doc! {
- "$set": {
- key: &parent_id
- }
- },
- None,
- )
- .await
- .map_err(|_| Error::DatabaseError {
- operation: "update_one",
- with: "attachment",
- })?;
-
- Ok(attachment)
- } else {
- Err(Error::UnknownAttachment)
- }
- }
-
- pub async fn delete(&self) -> Result<()> {
- get_collection("attachments")
- .update_one(
- doc! {
- "_id": &self.id
- },
- doc! {
- "$set": {
- "deleted": true
- }
- },
- None,
- )
- .await
- .map(|_| ())
- .map_err(|_| Error::DatabaseError {
- operation: "update_one",
- with: "attachment",
- })
- }
-
- pub fn get_autumn_url(&self) -> String {
- format!("{}/{}/{}", AUTUMN_URL.as_str(), self.tag, self.id)
- }
-}
diff --git a/src/database/entities/microservice/january.rs b/src/database/entities/microservice/january.rs
deleted file mode 100644
index 862ce88b..00000000
--- a/src/database/entities/microservice/january.rs
+++ /dev/null
@@ -1,200 +0,0 @@
-use crate::util::{
- result::{Error, Result},
- variables::JANUARY_URL,
- variables::MAX_EMBED_COUNT,
-};
-use crate::database::entities::microservice::autumn::File;
-use linkify::{LinkFinder, LinkKind};
-use regex::Regex;
-use serde::{Deserialize, Serialize};
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum ImageSize {
- Large,
- Preview,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct Image {
- pub url: String,
- pub width: isize,
- pub height: isize,
- pub size: ImageSize,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct Video {
- pub url: String,
- pub width: isize,
- pub height: isize,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum TwitchType {
- Channel,
- Video,
- Clip,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum BandcampType {
- Album,
- Track,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-#[serde(tag = "type")]
-pub enum Special {
- None,
- YouTube {
- id: String,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- timestamp: Option,
- },
- Twitch {
- content_type: TwitchType,
- id: String,
- },
- Spotify {
- content_type: String,
- id: String,
- },
- Soundcloud,
- Bandcamp {
- content_type: BandcampType,
- id: String,
- },
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct Metadata {
- #[serde(skip_serializing_if = "Option::is_none")]
- url: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- special: Option,
-
- #[serde(skip_serializing_if = "Option::is_none")]
- title: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- description: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- image: Option,
- #[serde(skip_serializing_if = "Option::is_none")]
- video: Option