forked from didirus/AstralRinth
Switch to time crate, add file sizes (#329)
* Switch to time crate, add file sizes * Update deps, adjust pack format * Run formatter, fix clippy
This commit is contained in:
437
Cargo.lock
generated
437
Cargo.lock
generated
@@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "actix"
|
||||
version = "0.12.0"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3720d0064a0ce5c0de7bd93bdb0a6caebab2a9b5668746145d7b3b0c5da02914"
|
||||
checksum = "f728064aca1c318585bf4bb04ffcfac9e75e508ab4e8b1bd9ba5dfe04e2cbed5"
|
||||
dependencies = [
|
||||
"actix-rt",
|
||||
"actix_derive",
|
||||
@@ -19,11 +19,11 @@ dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"once_cell",
|
||||
"parking_lot 0.11.2",
|
||||
"parking_lot 0.12.0",
|
||||
"pin-project-lite",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"tokio-util 0.6.9",
|
||||
"tokio-util 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -40,7 +40,7 @@ dependencies = [
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tokio-util 0.7.0",
|
||||
"tokio-util 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -89,7 +89,7 @@ dependencies = [
|
||||
"mime",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rand 0.8.5",
|
||||
"rand",
|
||||
"sha-1 0.10.0",
|
||||
"smallvec",
|
||||
"zstd",
|
||||
@@ -256,6 +256,18 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aes"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.4.7"
|
||||
@@ -268,7 +280,7 @@ version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
|
||||
dependencies = [
|
||||
"getrandom 0.2.5",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
@@ -398,12 +410,24 @@ dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base-x"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@@ -525,17 +549,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.19"
|
||||
name = "cipher"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"time 0.1.43",
|
||||
"winapi",
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -547,6 +566,18 @@ dependencies = [
|
||||
"cache-padded",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_fn"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935"
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
@@ -731,12 +762,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "4.0.2"
|
||||
version = "5.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
|
||||
checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"num_cpus",
|
||||
"parking_lot 0.12.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -748,7 +780,7 @@ dependencies = [
|
||||
"convert_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version",
|
||||
"rustc_version 0.4.0",
|
||||
"syn",
|
||||
]
|
||||
|
||||
@@ -769,6 +801,7 @@ checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.2",
|
||||
"crypto-common",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -791,13 +824,19 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "discard"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
|
||||
|
||||
[[package]]
|
||||
name = "dlv-list"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68df3f2b690c1b86e65ef7830956aededf3cb0a16f898f79b9a6f421a7b6211b"
|
||||
dependencies = [
|
||||
"rand 0.8.5",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -826,9 +865,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.8.4"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
|
||||
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime",
|
||||
@@ -1034,20 +1073,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
|
||||
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
@@ -1129,6 +1157,12 @@ dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
@@ -1154,6 +1188,15 @@ dependencies = [
|
||||
"digest 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.6"
|
||||
@@ -1361,7 +1404,6 @@ dependencies = [
|
||||
"base64",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"dashmap",
|
||||
"dotenv",
|
||||
"env_logger",
|
||||
@@ -1373,17 +1415,18 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"meilisearch-sdk",
|
||||
"rand 0.7.3",
|
||||
"rand",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"rust-s3",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sha1",
|
||||
"sha2",
|
||||
"sha1 0.6.1",
|
||||
"sha2 0.9.9",
|
||||
"sqlx",
|
||||
"thiserror",
|
||||
"time 0.2.27",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"urlencoding",
|
||||
@@ -1599,9 +1642,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.9"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09bf6f32a3afefd0b587ee42ed19acd945c6d1f3b5424040f50b2f24ab16be77"
|
||||
checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
@@ -1645,16 +1688,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.14"
|
||||
@@ -1792,12 +1825,35 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "password-hash"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc"
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7"
|
||||
dependencies = [
|
||||
"digest 0.10.3",
|
||||
"hmac 0.12.1",
|
||||
"password-hash",
|
||||
"sha2 0.10.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.1.0"
|
||||
@@ -1885,6 +1941,12 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.36"
|
||||
@@ -1912,19 +1974,6 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
@@ -1932,18 +1981,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1953,16 +1992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1971,16 +2001,7 @@ version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1998,7 +2019,7 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55"
|
||||
dependencies = [
|
||||
"getrandom 0.2.5",
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"thiserror",
|
||||
]
|
||||
@@ -2093,9 +2114,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-s3"
|
||||
version = "0.29.0"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a4e82923ed07143871571852a390742200607e5058ce633afec89752f9c3f82"
|
||||
checksum = "ff7c04dc81e5159a1ecc8594361f61cb8a62d4e4d0f5b0a0b4b48c463a55910f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -2104,7 +2125,7 @@ dependencies = [
|
||||
"base64",
|
||||
"cfg-if",
|
||||
"hex",
|
||||
"hmac",
|
||||
"hmac 0.11.0",
|
||||
"http",
|
||||
"log",
|
||||
"maybe-async",
|
||||
@@ -2115,20 +2136,29 @@ dependencies = [
|
||||
"serde",
|
||||
"serde-xml-rs",
|
||||
"serde_derive",
|
||||
"sha2",
|
||||
"sha2 0.9.9",
|
||||
"time 0.3.9",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
dependencies = [
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
dependencies = [
|
||||
"semver",
|
||||
"semver 1.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2207,9 +2237,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.6"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a3381e03edd24287172047536f20cabde766e2cd3e65e6b00fb3af51c4f38d"
|
||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
@@ -2322,6 +2367,17 @@ dependencies = [
|
||||
"sha1_smol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77f4e7f65455545c2153c1253d25056825e77ee2533f0e41deb65a93a34852f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1_smol"
|
||||
version = "1.0.0"
|
||||
@@ -2341,6 +2397,17 @@ dependencies = [
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.0"
|
||||
@@ -2422,7 +2489,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"chrono",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
"dirs",
|
||||
@@ -2433,7 +2499,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"hashlink",
|
||||
"hex",
|
||||
"hmac",
|
||||
"hmac 0.11.0",
|
||||
"indexmap",
|
||||
"itoa",
|
||||
"libc",
|
||||
@@ -2443,17 +2509,18 @@ dependencies = [
|
||||
"once_cell",
|
||||
"paste",
|
||||
"percent-encoding",
|
||||
"rand 0.8.5",
|
||||
"rand",
|
||||
"rustls",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha-1 0.9.8",
|
||||
"sha2",
|
||||
"sha2 0.9.9",
|
||||
"smallvec",
|
||||
"sqlformat",
|
||||
"sqlx-rt",
|
||||
"stringprep",
|
||||
"thiserror",
|
||||
"time 0.2.27",
|
||||
"tokio-stream",
|
||||
"url",
|
||||
"webpki",
|
||||
@@ -2469,14 +2536,14 @@ checksum = "eee35713129561f5e55c554bba1c378e2a7e67f81257b7311183de98c50e6f94"
|
||||
dependencies = [
|
||||
"dotenv",
|
||||
"either",
|
||||
"heck",
|
||||
"heck 0.3.3",
|
||||
"hex",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"sha2 0.9.9",
|
||||
"sqlx-core",
|
||||
"sqlx-rt",
|
||||
"syn",
|
||||
@@ -2495,12 +2562,70 @@ dependencies = [
|
||||
"tokio-rustls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "standback"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stdweb"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
|
||||
dependencies = [
|
||||
"discard",
|
||||
"rustc_version 0.2.3",
|
||||
"stdweb-derive",
|
||||
"stdweb-internal-macros",
|
||||
"stdweb-internal-runtime",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stdweb-derive"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stdweb-internal-macros"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
|
||||
dependencies = [
|
||||
"base-x",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"sha1 0.6.1",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stdweb-internal-runtime"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
|
||||
|
||||
[[package]]
|
||||
name = "stringprep"
|
||||
version = "0.1.2"
|
||||
@@ -2525,9 +2650,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.89"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54"
|
||||
checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2579,11 +2704,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.43"
|
||||
version = "0.2.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242"
|
||||
dependencies = [
|
||||
"const_fn",
|
||||
"libc",
|
||||
"serde",
|
||||
"standback",
|
||||
"stdweb",
|
||||
"time-macros 0.1.1",
|
||||
"version_check",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
@@ -2597,7 +2728,17 @@ dependencies = [
|
||||
"libc",
|
||||
"num_threads",
|
||||
"serde",
|
||||
"time-macros",
|
||||
"time-macros 0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"time-macros-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2606,6 +2747,19 @@ version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros-impl"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"standback",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.5.1"
|
||||
@@ -2688,16 +2842,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-util"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1"
|
||||
checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2836,9 +2990,9 @@ checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821"
|
||||
|
||||
[[package]]
|
||||
name = "validator"
|
||||
version = "0.13.0"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be110dc66fa015b8b1d2c4eae40c495a27fae55f82b9cae3efb8178241ed20eb"
|
||||
checksum = "6d0f08911ab0fee2c5009580f04615fa868898ee57de10692a45da0c3bcc3e5e"
|
||||
dependencies = [
|
||||
"idna",
|
||||
"lazy_static",
|
||||
@@ -2853,9 +3007,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "validator_derive"
|
||||
version = "0.13.0"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68f14fe757e2894ce4271991901567be07fbc3eac6b24246122214e1d5a16554"
|
||||
checksum = "d85135714dba11a1bd0b3eb1744169266f1a38977bf4e3ff5e2e1acb8c2b7eee"
|
||||
dependencies = [
|
||||
"if_chain",
|
||||
"lazy_static",
|
||||
@@ -2869,9 +3023,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "validator_types"
|
||||
version = "0.12.0"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad9680608df133af2c1ddd5eaf1ddce91d60d61b6bc51494ef326458365a470a"
|
||||
checksum = "ded9d97e1d42327632f5f3bae6403c04886e2de3036261ef42deebd931a6a291"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
@@ -2901,12 +3059,6 @@ dependencies = [
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.2+wasi-snapshot-preview1"
|
||||
@@ -3130,9 +3282,9 @@ checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
|
||||
|
||||
[[package]]
|
||||
name = "yaserde"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bc096efbee9ec8fee0600a15bb4fd651ccc14570cb05b6d4dd66b0325e4a0b5e"
|
||||
checksum = "4bf52af554a50b866aaad63d7eabd6fca298db3dfe49afd50b7ba5a33dfa0582"
|
||||
dependencies = [
|
||||
"log",
|
||||
"xml-rs",
|
||||
@@ -3140,28 +3292,35 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yaserde_derive"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9af81f1d48039716dd825cf4a7d61d39583f8b12705994abb446bae749a977bb"
|
||||
checksum = "7ab8bd5c76eebb8380b26833d30abddbdd885b00dd06178412e0d51d5bfc221f"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.4.0",
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.5.13"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
|
||||
checksum = "e6fa4aa90e99fb8d701bda16fb040d8ed2f9c7176fb44de750e880a74b580315"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"byteorder",
|
||||
"bzip2",
|
||||
"constant_time_eq",
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
"thiserror",
|
||||
"time 0.1.43",
|
||||
"hmac 0.12.1",
|
||||
"pbkdf2",
|
||||
"sha1 0.10.1",
|
||||
"time 0.3.9",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
54
Cargo.toml
54
Cargo.toml
@@ -13,52 +13,52 @@ path = "src/main.rs"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix = "0.12.0"
|
||||
actix-web = "4.0.0"
|
||||
actix-rt = "2.6.0"
|
||||
actix = "0.13.0"
|
||||
actix-web = "4.0.1"
|
||||
actix-rt = "2.7.0"
|
||||
tokio-stream = "0.1.8"
|
||||
actix-multipart = "0.4.0"
|
||||
actix-cors = "0.6.0"
|
||||
actix-cors = "0.6.1"
|
||||
|
||||
meilisearch-sdk = "0.15.0"
|
||||
reqwest = { version = "0.11.9", features = ["json"] }
|
||||
reqwest = { version = "0.11.10", features = ["json"] }
|
||||
|
||||
yaserde = "0.6.0"
|
||||
yaserde_derive = "0.6.0"
|
||||
xml-rs = "0.8.3"
|
||||
yaserde = "0.8.0"
|
||||
yaserde_derive = "0.8.0"
|
||||
xml-rs = "0.8.4"
|
||||
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_with = "1.5.1"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
rand = "0.7.3"
|
||||
serde_with = "1.12.0"
|
||||
time = { version = "0.2.27", features = ["serde"] }
|
||||
rand = "0.8.5"
|
||||
base64 = "0.13.0"
|
||||
sha1 = { version = "0.6.0", features = ["std"] }
|
||||
sha2 = "0.9.2"
|
||||
bitflags = "1.2.1"
|
||||
zip = "0.5.12"
|
||||
sha1 = { version = "0.6.1", features = ["std"] }
|
||||
sha2 = "0.9.9"
|
||||
bitflags = "1.3.2"
|
||||
zip = "0.6.0"
|
||||
itertools = "0.10.3"
|
||||
|
||||
validator = { version = "0.13", features = ["derive"] }
|
||||
regex = "1.5.4"
|
||||
validator = { version = "0.14.0", features = ["derive"] }
|
||||
regex = "1.5.5"
|
||||
url = "2.2.2"
|
||||
urlencoding = "2.1.0"
|
||||
|
||||
gumdrop = "0.8.0"
|
||||
dotenv = "0.15"
|
||||
log = "0.4.8"
|
||||
env_logger = "0.8.1"
|
||||
thiserror = "1.0.21"
|
||||
gumdrop = "0.8.1"
|
||||
dotenv = "0.15.0"
|
||||
log = "0.4.16"
|
||||
env_logger = "0.9.0"
|
||||
thiserror = "1.0.30"
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
futures = "0.3.6"
|
||||
futures = "0.3.21"
|
||||
futures-timer = "3.0.2"
|
||||
rust-s3 = "0.29.0"
|
||||
async-trait = "0.1.41"
|
||||
rust-s3 = "0.30.0"
|
||||
async-trait = "0.1.53"
|
||||
|
||||
sqlx = { version = "0.5.10", features = ["runtime-actix-rustls", "postgres", "chrono", "offline", "macros", "migrate"] }
|
||||
sqlx = { version = "0.5.11", features = ["runtime-actix-rustls", "postgres", "time", "offline", "macros", "migrate"] }
|
||||
|
||||
bytes = "1.1.0"
|
||||
|
||||
dashmap = "4.0.2"
|
||||
dashmap = "5.2.0"
|
||||
hex = "0.4.3"
|
||||
|
||||
1
migrations/20220329182356_file-sizes.sql
Normal file
1
migrations/20220329182356_file-sizes.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE files ADD COLUMN size integer NOT NULL default 0;
|
||||
115
sqlx-data.json
115
sqlx-data.json
@@ -3256,6 +3256,50 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"9f1f1039e8e360092e046b219fe6861368f5b4a338041d426ef689981f0cb9df": {
|
||||
"query": "\n SELECT id, filename, is_primary, url, size\n FROM files\n WHERE version_id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "filename",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "is_primary",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "url",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 4,
|
||||
"name": "size",
|
||||
"type_info": "Int4"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"a39ce28b656032f862b205cffa393a76b989f4803654a615477a94fda5f57354": {
|
||||
"query": "\n DELETE FROM states\n WHERE id = $1\n ",
|
||||
"describe": {
|
||||
@@ -3494,6 +3538,23 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"a82ece911fac855366bd25f1379778a803e61ab87da096f0ab9f6db3eaa521d4": {
|
||||
"query": "\n INSERT INTO files (id, version_id, url, filename, is_primary, size)\n VALUES ($1, $2, $3, $4, $5, $6)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
"Int8",
|
||||
"Varchar",
|
||||
"Varchar",
|
||||
"Bool",
|
||||
"Int4"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"a8f22bd234488500b06855c8258e1e290696adba0766b46640bf87d91b150518": {
|
||||
"query": "\n SELECT f.url url, f.id id, f.version_id version_id, v.mod_id mod_id FROM hashes h\n INNER JOIN files f ON h.file_id = f.id\n INNER JOIN versions v ON v.id = f.version_id\n WHERE h.algorithm = $2 AND h.hash = $1\n ",
|
||||
"describe": {
|
||||
@@ -4775,44 +4836,6 @@
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"d5807cb9a5766acc832b8715aab2b692a99e249a73974f0945710b1b394b1d74": {
|
||||
"query": "\n SELECT id, filename, is_primary, url\n FROM files\n WHERE version_id = $1\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "id",
|
||||
"type_info": "Int8"
|
||||
},
|
||||
{
|
||||
"ordinal": 1,
|
||||
"name": "filename",
|
||||
"type_info": "Varchar"
|
||||
},
|
||||
{
|
||||
"ordinal": 2,
|
||||
"name": "is_primary",
|
||||
"type_info": "Bool"
|
||||
},
|
||||
{
|
||||
"ordinal": 3,
|
||||
"name": "url",
|
||||
"type_info": "Varchar"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"d5a496a0e17c5784f98ca2067bff996b23bb0a798609c4d4928df8080e4e1758": {
|
||||
"query": "\n SELECT v.id, v.mod_id, v.author_id, v.name, v.version_number,\n v.changelog, v.changelog_url, v.date_published, v.downloads,\n v.version_type, v.featured\n FROM versions v\n WHERE v.id = ANY($1)\n ORDER BY v.date_published ASC\n ",
|
||||
"describe": {
|
||||
@@ -5743,22 +5766,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"f17dbcc3021d4144f56e9a3bbbf4e0a0087af90e202b9b9d81f1f3622be00e36": {
|
||||
"query": "\n INSERT INTO files (id, version_id, url, filename, is_primary)\n VALUES ($1, $2, $3, $4, $5)\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int8",
|
||||
"Int8",
|
||||
"Varchar",
|
||||
"Varchar",
|
||||
"Bool"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"f17df1295edfaa1cac400ce705181b14a9e763f5e515c6913d0152717b89ceaa": {
|
||||
"query": "\n SELECT d.id id\n FROM versions v\n INNER JOIN dependencies d ON d.mod_dependency_id = $1\n INNER JOIN game_versions_versions gvv ON gvv.joining_version_id = v.id AND gvv.game_version_id = ANY($2)\n INNER JOIN loaders_versions lv ON lv.version_id = v.id AND lv.loader_id = ANY($3)\n ",
|
||||
"describe": {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::ids::*;
|
||||
use super::DatabaseError;
|
||||
use futures::TryStreamExt;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct ProjectType {
|
||||
pub id: ProjectTypeId,
|
||||
@@ -19,7 +20,7 @@ pub struct GameVersion {
|
||||
pub id: GameVersionId,
|
||||
pub version: String,
|
||||
pub version_type: String,
|
||||
pub date: chrono::DateTime<chrono::Utc>,
|
||||
pub date: OffsetDateTime,
|
||||
pub major: bool,
|
||||
}
|
||||
|
||||
@@ -469,7 +470,7 @@ impl<'a> LoaderBuilder<'a> {
|
||||
pub struct GameVersionBuilder<'a> {
|
||||
pub version: Option<&'a str>,
|
||||
pub version_type: Option<&'a str>,
|
||||
pub date: Option<&'a chrono::DateTime<chrono::Utc>>,
|
||||
pub date: Option<&'a OffsetDateTime>,
|
||||
}
|
||||
|
||||
impl GameVersion {
|
||||
@@ -689,7 +690,7 @@ impl<'a> GameVersionBuilder<'a> {
|
||||
|
||||
pub fn created(
|
||||
self,
|
||||
created: &'a chrono::DateTime<chrono::Utc>,
|
||||
created: &'a OffsetDateTime,
|
||||
) -> GameVersionBuilder<'a> {
|
||||
Self {
|
||||
date: Some(created),
|
||||
@@ -718,7 +719,7 @@ impl<'a> GameVersionBuilder<'a> {
|
||||
",
|
||||
self.version,
|
||||
self.version_type,
|
||||
self.date.map(chrono::DateTime::naive_utc),
|
||||
self.date.map(|x| time::PrimitiveDateTime::new(x.date(), x.time())),
|
||||
)
|
||||
.fetch_one(exec)
|
||||
.await?;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::ids::*;
|
||||
use crate::database::models::DatabaseError;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct NotificationBuilder {
|
||||
pub notification_type: Option<String>,
|
||||
@@ -22,7 +23,7 @@ pub struct Notification {
|
||||
pub text: String,
|
||||
pub link: String,
|
||||
pub read: bool,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
pub created: OffsetDateTime,
|
||||
pub actions: Vec<NotificationAction>,
|
||||
}
|
||||
|
||||
@@ -71,7 +72,7 @@ impl NotificationBuilder {
|
||||
text: self.text.clone(),
|
||||
link: self.link.clone(),
|
||||
read: false,
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
actions,
|
||||
}
|
||||
.insert(&mut *transaction)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::ids::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DonationUrl {
|
||||
@@ -42,7 +42,7 @@ pub struct GalleryItem {
|
||||
pub featured: bool,
|
||||
pub title: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub created: DateTime<Utc>,
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
impl GalleryItem {
|
||||
@@ -109,8 +109,8 @@ impl ProjectBuilder {
|
||||
description: self.description,
|
||||
body: self.body,
|
||||
body_url: None,
|
||||
published: chrono::Utc::now(),
|
||||
updated: chrono::Utc::now(),
|
||||
published: time::OffsetDateTime::now_utc(),
|
||||
updated: time::OffsetDateTime::now_utc(),
|
||||
status: self.status,
|
||||
downloads: 0,
|
||||
follows: 0,
|
||||
@@ -169,8 +169,8 @@ pub struct Project {
|
||||
pub description: String,
|
||||
pub body: String,
|
||||
pub body_url: Option<String>,
|
||||
pub published: chrono::DateTime<chrono::Utc>,
|
||||
pub updated: chrono::DateTime<chrono::Utc>,
|
||||
pub published: time::OffsetDateTime,
|
||||
pub updated: time::OffsetDateTime,
|
||||
pub status: StatusId,
|
||||
pub downloads: i32,
|
||||
pub follows: i32,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::ids::*;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct Report {
|
||||
pub id: ReportId,
|
||||
@@ -8,7 +9,7 @@ pub struct Report {
|
||||
pub user_id: Option<UserId>,
|
||||
pub body: String,
|
||||
pub reporter: UserId,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
pub struct QueryReport {
|
||||
@@ -19,7 +20,7 @@ pub struct QueryReport {
|
||||
pub user_id: Option<UserId>,
|
||||
pub body: String,
|
||||
pub reporter: UserId,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
impl Report {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use super::ids::{ProjectId, UserId};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct User {
|
||||
pub id: UserId,
|
||||
@@ -8,7 +9,7 @@ pub struct User {
|
||||
pub email: Option<String>,
|
||||
pub avatar_url: Option<String>,
|
||||
pub bio: Option<String>,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
pub created: OffsetDateTime,
|
||||
pub role: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::ids::*;
|
||||
use super::DatabaseError;
|
||||
use std::collections::HashMap;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct VersionBuilder {
|
||||
pub version_id: VersionId,
|
||||
@@ -78,6 +79,7 @@ pub struct VersionFileBuilder {
|
||||
pub filename: String,
|
||||
pub hashes: Vec<HashBuilder>,
|
||||
pub primary: bool,
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
impl VersionFileBuilder {
|
||||
@@ -90,14 +92,15 @@ impl VersionFileBuilder {
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
INSERT INTO files (id, version_id, url, filename, is_primary)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
INSERT INTO files (id, version_id, url, filename, is_primary, size)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
",
|
||||
file_id as FileId,
|
||||
version_id as VersionId,
|
||||
self.url,
|
||||
self.filename,
|
||||
self.primary
|
||||
self.primary,
|
||||
self.size as i32
|
||||
)
|
||||
.execute(&mut *transaction)
|
||||
.await?;
|
||||
@@ -138,7 +141,7 @@ impl VersionBuilder {
|
||||
version_number: self.version_number,
|
||||
changelog: self.changelog,
|
||||
changelog_url: None,
|
||||
date_published: chrono::Utc::now(),
|
||||
date_published: OffsetDateTime::now_utc(),
|
||||
downloads: 0,
|
||||
featured: self.featured,
|
||||
version_type: self.version_type,
|
||||
@@ -238,7 +241,7 @@ pub struct Version {
|
||||
pub version_number: String,
|
||||
pub changelog: String,
|
||||
pub changelog_url: Option<String>,
|
||||
pub date_published: chrono::DateTime<chrono::Utc>,
|
||||
pub date_published: OffsetDateTime,
|
||||
pub downloads: i32,
|
||||
pub version_type: String,
|
||||
pub featured: bool,
|
||||
@@ -639,7 +642,7 @@ impl Version {
|
||||
).fetch_all(executor),
|
||||
sqlx::query!(
|
||||
"
|
||||
SELECT id, filename, is_primary, url
|
||||
SELECT id, filename, is_primary, url, size
|
||||
FROM files
|
||||
WHERE version_id = $1
|
||||
",
|
||||
@@ -699,6 +702,7 @@ impl Version {
|
||||
.or_default()
|
||||
.clone(),
|
||||
primary: x.is_primary,
|
||||
size: x.size as u32,
|
||||
})
|
||||
.collect(),
|
||||
game_versions: game_versions?
|
||||
@@ -760,7 +764,7 @@ pub struct QueryVersion {
|
||||
pub version_number: String,
|
||||
pub changelog: String,
|
||||
pub changelog_url: Option<String>,
|
||||
pub date_published: chrono::DateTime<chrono::Utc>,
|
||||
pub date_published: OffsetDateTime,
|
||||
pub downloads: i32,
|
||||
|
||||
pub version_type: String,
|
||||
@@ -785,4 +789,5 @@ pub struct QueryFile {
|
||||
pub filename: String,
|
||||
pub hashes: HashMap<String, Vec<u8>>,
|
||||
pub primary: bool,
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::time::Duration;
|
||||
use log::info;
|
||||
use sqlx::migrate::MigrateDatabase;
|
||||
use sqlx::postgres::{PgPool, PgPoolOptions};
|
||||
use sqlx::{Connection, PgConnection, Postgres};
|
||||
use std::time::Duration;
|
||||
|
||||
pub async fn connect() -> Result<PgPool, sqlx::Error> {
|
||||
info!("Initializing database connection");
|
||||
|
||||
@@ -2,6 +2,7 @@ use super::{DeleteFileData, FileHost, FileHostingError, UploadFileData};
|
||||
use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
use sha2::Digest;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct MockHost(());
|
||||
|
||||
@@ -38,7 +39,7 @@ impl FileHost for MockHost {
|
||||
content_sha1,
|
||||
content_md5: None,
|
||||
content_type: content_type.to_string(),
|
||||
upload_timestamp: chrono::Utc::now().timestamp_millis() as u64,
|
||||
upload_timestamp: OffsetDateTime::now_utc().unix_timestamp() as u64,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use s3::bucket::Bucket;
|
||||
use s3::creds::Credentials;
|
||||
use s3::region::Region;
|
||||
use sha2::Digest;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub struct S3Host {
|
||||
bucket: Bucket,
|
||||
@@ -84,7 +85,7 @@ impl FileHost for S3Host {
|
||||
content_sha1,
|
||||
content_md5: None,
|
||||
content_type: content_type.to_string(),
|
||||
upload_timestamp: chrono::Utc::now().timestamp_millis() as u64,
|
||||
upload_timestamp: OffsetDateTime::now_utc().unix_timestamp() as u64,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn random_base62_rng<R: rand::RngCore>(rng: &mut R, n: usize) -> u64 {
|
||||
assert!(n > 0 && n <= 11);
|
||||
// gen_range is [low, high): max value is `MULTIPLES[n] - 1`,
|
||||
// which is n characters long when encoded
|
||||
rng.gen_range(MULTIPLES[n - 1], MULTIPLES[n])
|
||||
rng.gen_range(MULTIPLES[n - 1]..MULTIPLES[n])
|
||||
}
|
||||
|
||||
const MULTIPLES: [u64; 12] = [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::ids::Base62Id;
|
||||
use super::users::UserId;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
@@ -18,7 +18,8 @@ pub struct Notification {
|
||||
pub text: String,
|
||||
pub link: String,
|
||||
pub read: bool,
|
||||
pub created: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub created: OffsetDateTime,
|
||||
pub actions: Vec<NotificationAction>,
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ use super::teams::TeamId;
|
||||
use super::users::UserId;
|
||||
use crate::database::models::project_item::QueryProject;
|
||||
use crate::database::models::version_item::QueryVersion;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::OffsetDateTime;
|
||||
use validator::Validate;
|
||||
|
||||
/// The ID of a specific project, encoded as base62 for usage in the API
|
||||
@@ -38,10 +38,14 @@ pub struct Project {
|
||||
pub body: String,
|
||||
/// The link to the long description of the project. (Deprecated), being replaced by `body`
|
||||
pub body_url: Option<String>,
|
||||
|
||||
/// The date at which the project was first published.
|
||||
pub published: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub published: OffsetDateTime,
|
||||
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
/// The date at which the project was first published.
|
||||
pub updated: DateTime<Utc>,
|
||||
pub updated: OffsetDateTime,
|
||||
|
||||
/// The status of the project
|
||||
pub status: ProjectStatus,
|
||||
@@ -152,7 +156,8 @@ pub struct GalleryItem {
|
||||
pub featured: bool,
|
||||
pub title: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub created: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
@@ -297,8 +302,10 @@ pub struct Version {
|
||||
pub changelog: String,
|
||||
/// A link to the changelog for this version of the project. (Deprecated), being replaced by `changelog`
|
||||
pub changelog_url: Option<String>,
|
||||
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
/// The date that this version was published.
|
||||
pub date_published: DateTime<Utc>,
|
||||
pub date_published: OffsetDateTime,
|
||||
/// The number of downloads this specific version has had.
|
||||
pub downloads: u32,
|
||||
/// The type of the release - `Alpha`, `Beta`, or `Release`.
|
||||
@@ -351,6 +358,7 @@ impl From<QueryVersion> for Version {
|
||||
.collect::<Option<_>>()
|
||||
.unwrap_or_default(),
|
||||
primary: f.primary,
|
||||
size: f.size,
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
@@ -387,6 +395,8 @@ pub struct VersionFile {
|
||||
pub filename: String,
|
||||
/// Whether the file is the primary file of a version
|
||||
pub primary: bool,
|
||||
/// The size in bytes of the file
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
/// A dependency which describes what versions are required, break support, or are optional to the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use super::ids::Base62Id;
|
||||
use crate::models::ids::UserId;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
@@ -16,7 +16,8 @@ pub struct Report {
|
||||
pub item_type: ItemType,
|
||||
pub reporter: UserId,
|
||||
pub body: String,
|
||||
pub created: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::ids::Base62Id;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(from = "Base62Id")]
|
||||
@@ -17,7 +18,8 @@ pub struct User {
|
||||
pub email: Option<String>,
|
||||
pub avatar_url: Option<String>,
|
||||
pub bio: Option<String>,
|
||||
pub created: chrono::DateTime<chrono::Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub created: OffsetDateTime,
|
||||
pub role: Role,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ use crate::util::auth::get_github_user_from_token;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::web::{scope, Data, Query, ServiceConfig};
|
||||
use actix_web::{get, HttpResponse};
|
||||
use chrono::Utc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::postgres::PgPool;
|
||||
use thiserror::Error;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub fn config(cfg: &mut ServiceConfig) {
|
||||
cfg.service(scope("auth").service(auth_callback).service(init));
|
||||
@@ -145,10 +145,10 @@ pub async fn auth_callback(
|
||||
.await?;
|
||||
|
||||
if let Some(result) = result_option {
|
||||
let now = Utc::now();
|
||||
let duration = result.expires.signed_duration_since(now);
|
||||
let now = OffsetDateTime::now_utc();
|
||||
let duration = now - result.expires;
|
||||
|
||||
if duration.num_seconds() < 0 {
|
||||
if duration.whole_seconds() < 0 {
|
||||
return Err(AuthorizationError::InvalidCredentials);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ pub async fn auth_callback(
|
||||
email: user.email,
|
||||
avatar_url: Some(user.avatar_url),
|
||||
bio: user.bio,
|
||||
created: Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
role: Role::Developer.to_string(),
|
||||
}
|
||||
.insert(&mut transaction)
|
||||
|
||||
@@ -108,7 +108,7 @@ pub async fn maven_metadata(
|
||||
.map(|x| x.version_number.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
last_updated: data.inner.updated.format("%Y%m%d%H%M%S").to_string(),
|
||||
last_updated: data.inner.updated.format("%Y%m%d%H%M%S"),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize};
|
||||
use sqlx::postgres::PgPool;
|
||||
use std::sync::Arc;
|
||||
use thiserror::Error;
|
||||
use time::OffsetDateTime;
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
@@ -498,7 +499,7 @@ pub async fn project_create_inner(
|
||||
featured: item.featured,
|
||||
title: item.title.clone(),
|
||||
description: item.description.clone(),
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
});
|
||||
|
||||
continue;
|
||||
@@ -693,7 +694,7 @@ pub async fn project_create_inner(
|
||||
.collect(),
|
||||
};
|
||||
|
||||
let now = chrono::Utc::now();
|
||||
let now = OffsetDateTime::now_utc();
|
||||
|
||||
let response = crate::models::projects::Project {
|
||||
id: project_id,
|
||||
|
||||
@@ -17,6 +17,7 @@ use futures::StreamExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{PgPool, Row};
|
||||
use std::sync::Arc;
|
||||
use time::OffsetDateTime;
|
||||
use validator::Validate;
|
||||
|
||||
#[get("search")]
|
||||
@@ -1134,7 +1135,7 @@ pub async fn add_gallery_item(
|
||||
featured: item.featured,
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
}
|
||||
.insert(&mut transaction)
|
||||
.await?;
|
||||
|
||||
@@ -8,6 +8,7 @@ use actix_web::{delete, get, post, web, HttpRequest, HttpResponse};
|
||||
use futures::StreamExt;
|
||||
use serde::Deserialize;
|
||||
use sqlx::PgPool;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CreateReport {
|
||||
@@ -59,7 +60,7 @@ pub async fn report_create(
|
||||
user_id: None,
|
||||
body: new_report.body.clone(),
|
||||
reporter: current_user.id.into(),
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
};
|
||||
|
||||
match new_report.item_type {
|
||||
@@ -108,7 +109,7 @@ pub async fn report_create(
|
||||
item_type: new_report.item_type.clone(),
|
||||
reporter: current_user.id,
|
||||
body: new_report.body.clone(),
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::util::auth::check_is_admin_from_headers;
|
||||
use actix_web::{delete, get, put, web, HttpRequest, HttpResponse};
|
||||
use models::categories::{Category, GameVersion, Loader};
|
||||
use sqlx::PgPool;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub fn config(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
@@ -201,7 +202,8 @@ pub async fn loader_delete(
|
||||
pub struct GameVersionQueryData {
|
||||
pub version: String,
|
||||
pub version_type: String,
|
||||
pub date: chrono::DateTime<chrono::Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub date: OffsetDateTime,
|
||||
pub major: bool,
|
||||
}
|
||||
|
||||
@@ -241,7 +243,7 @@ pub async fn game_version_list(
|
||||
pub struct GameVersionData {
|
||||
#[serde(rename = "type")]
|
||||
type_: String,
|
||||
date: Option<chrono::DateTime<chrono::Utc>>,
|
||||
date: Option<OffsetDateTime>,
|
||||
}
|
||||
|
||||
#[put("game_version/{name}")]
|
||||
|
||||
@@ -7,10 +7,10 @@ use crate::util::auth::{
|
||||
};
|
||||
use actix_web::web;
|
||||
use actix_web::{get, post, HttpRequest, HttpResponse};
|
||||
use chrono::{DateTime, Utc};
|
||||
use futures::StreamExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Report {
|
||||
@@ -20,7 +20,8 @@ pub struct Report {
|
||||
pub item_type: ItemType,
|
||||
pub reporter: UserId,
|
||||
pub body: String,
|
||||
pub created: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub created: OffsetDateTime,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
@@ -92,7 +93,7 @@ pub async fn report_create(
|
||||
user_id: None,
|
||||
body: new_report.body.clone(),
|
||||
reporter: current_user.id.into(),
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
};
|
||||
|
||||
match new_report.item_type {
|
||||
@@ -141,7 +142,7 @@ pub async fn report_create(
|
||||
item_type: new_report.item_type.clone(),
|
||||
reporter: current_user.id,
|
||||
body: new_report.body.clone(),
|
||||
created: chrono::Utc::now(),
|
||||
created: OffsetDateTime::now_utc(),
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ use crate::routes::ApiError;
|
||||
use crate::util::auth::get_user_from_headers;
|
||||
use crate::{database, models};
|
||||
use actix_web::{delete, get, web, HttpRequest, HttpResponse};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use std::sync::Arc;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
/// A specific version of a mod
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -25,7 +25,8 @@ pub struct LegacyVersion {
|
||||
pub version_number: String,
|
||||
pub changelog: String,
|
||||
pub changelog_url: Option<String>,
|
||||
pub date_published: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub date_published: OffsetDateTime,
|
||||
pub downloads: u32,
|
||||
pub version_type: VersionType,
|
||||
pub files: Vec<VersionFile>,
|
||||
|
||||
@@ -20,6 +20,7 @@ use actix_web::{post, HttpRequest, HttpResponse};
|
||||
use futures::stream::StreamExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::postgres::PgPool;
|
||||
use time::OffsetDateTime;
|
||||
use validator::Validate;
|
||||
|
||||
#[derive(Serialize, Deserialize, Validate, Clone)]
|
||||
@@ -398,7 +399,7 @@ async fn version_create_inner(
|
||||
version_number: builder.version_number.clone(),
|
||||
changelog: builder.changelog.clone(),
|
||||
changelog_url: None,
|
||||
date_published: chrono::Utc::now(),
|
||||
date_published: OffsetDateTime::now_utc(),
|
||||
downloads: 0,
|
||||
version_type: version_data.release_channel,
|
||||
files: builder
|
||||
@@ -422,6 +423,7 @@ async fn version_create_inner(
|
||||
url: file.url.clone(),
|
||||
filename: file.filename.clone(),
|
||||
primary: file.primary,
|
||||
size: file.size,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
dependencies: version_data.dependencies,
|
||||
@@ -719,6 +721,7 @@ pub async fn upload_file(
|
||||
&& version_files.iter().all(|x| !x.primary)
|
||||
&& !ignore_primary)
|
||||
|| force_primary,
|
||||
size: upload_data.content_length,
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use actix_rt::time;
|
||||
use actix_rt::Arbiter;
|
||||
use futures::StreamExt;
|
||||
|
||||
@@ -18,7 +17,7 @@ impl Scheduler {
|
||||
F: FnMut() -> R + Send + 'static,
|
||||
R: std::future::Future<Output = ()> + Send + 'static,
|
||||
{
|
||||
let future = IntervalStream::new(time::interval(interval))
|
||||
let future = IntervalStream::new(actix_rt::time::interval(interval))
|
||||
.for_each_concurrent(2, move |_| task());
|
||||
|
||||
self.arbiter.spawn(future);
|
||||
@@ -75,6 +74,8 @@ pub enum VersionIndexingError {
|
||||
|
||||
use crate::util::env::parse_var;
|
||||
use serde::Deserialize;
|
||||
use time::Format::Rfc3339;
|
||||
use time::OffsetDateTime;
|
||||
use tokio_stream::wrappers::IntervalStream;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -87,8 +88,8 @@ struct VersionFormat<'a> {
|
||||
id: String,
|
||||
#[serde(rename = "type")]
|
||||
type_: std::borrow::Cow<'a, str>,
|
||||
#[serde(rename = "releaseTime")]
|
||||
release_time: chrono::DateTime<chrono::Utc>,
|
||||
#[serde(rename = "releaseTime", with = "crate::util::time_ser")]
|
||||
release_time: OffsetDateTime,
|
||||
}
|
||||
|
||||
async fn update_versions(
|
||||
@@ -127,30 +128,26 @@ async fn update_versions(
|
||||
lazy_static::lazy_static! {
|
||||
/// Mojank for some reason has versions released at the same DateTime. This hardcodes them to fix this,
|
||||
/// as most of our ordering logic is with DateTime
|
||||
static ref HALL_OF_SHAME_2: [(&'static str, chrono::DateTime<chrono::Utc>); 4] = [
|
||||
static ref HALL_OF_SHAME_2: [(&'static str, OffsetDateTime); 4] = [
|
||||
(
|
||||
"1.4.5",
|
||||
chrono::DateTime::parse_from_rfc3339("2012-12-19T22:00:00+00:00")
|
||||
OffsetDateTime::parse("2012-12-19T22:00:00+00:00", Rfc3339)
|
||||
.unwrap()
|
||||
.into(),
|
||||
),
|
||||
(
|
||||
"1.4.6",
|
||||
chrono::DateTime::parse_from_rfc3339("2012-12-19T22:00:01+00:00")
|
||||
OffsetDateTime::parse("2012-12-19T22:00:01+00:00", Rfc3339)
|
||||
.unwrap()
|
||||
.into(),
|
||||
),
|
||||
(
|
||||
"1.6.3",
|
||||
chrono::DateTime::parse_from_rfc3339("2013-09-13T10:54:41+00:00")
|
||||
OffsetDateTime::parse("2013-09-13T10:54:41+00:00", Rfc3339)
|
||||
.unwrap()
|
||||
.into(),
|
||||
),
|
||||
(
|
||||
"13w37b",
|
||||
chrono::DateTime::parse_from_rfc3339("2013-09-13T10:54:42+00:00")
|
||||
OffsetDateTime::parse("2013-09-13T10:54:42+00:00", Rfc3339)
|
||||
.unwrap()
|
||||
.into(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ pub async fn index_local(
|
||||
icon_url: m.icon_url.unwrap_or_default(),
|
||||
author: m.username,
|
||||
date_created: m.published,
|
||||
created_timestamp: m.published.timestamp(),
|
||||
created_timestamp: m.published.unix_timestamp(),
|
||||
date_modified: m.updated,
|
||||
modified_timestamp: m.updated.timestamp(),
|
||||
modified_timestamp: m.updated.unix_timestamp(),
|
||||
latest_version: versions.last().cloned().unwrap_or_else(|| "None".to_string()),
|
||||
versions,
|
||||
license: m.short,
|
||||
@@ -142,9 +142,9 @@ pub async fn query_one(
|
||||
icon_url: m.icon_url.unwrap_or_default(),
|
||||
author: m.username,
|
||||
date_created: m.published,
|
||||
created_timestamp: m.published.timestamp(),
|
||||
created_timestamp: m.published.unix_timestamp(),
|
||||
date_modified: m.updated,
|
||||
modified_timestamp: m.updated.timestamp(),
|
||||
modified_timestamp: m.updated.unix_timestamp(),
|
||||
latest_version: versions
|
||||
.last()
|
||||
.cloned()
|
||||
|
||||
@@ -17,7 +17,7 @@ pub enum IndexingError {
|
||||
#[error("Error while serializing or deserializing JSON: {0}")]
|
||||
Serde(#[from] serde_json::Error),
|
||||
#[error("Error while parsing a timestamp: {0}")]
|
||||
ParseDate(#[from] chrono::format::ParseError),
|
||||
ParseDate(#[from] time::error::Error),
|
||||
#[error("Database Error: {0}")]
|
||||
Sqlx(#[from] sqlx::error::Error),
|
||||
#[error("Database Error: {0}")]
|
||||
|
||||
@@ -2,13 +2,13 @@ use crate::models::error::ApiError;
|
||||
use crate::models::projects::SearchRequest;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::HttpResponse;
|
||||
use chrono::{DateTime, Utc};
|
||||
use meilisearch_sdk::client::Client;
|
||||
use meilisearch_sdk::document::Document;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::min;
|
||||
use thiserror::Error;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
pub mod indexing;
|
||||
|
||||
@@ -84,12 +84,15 @@ pub struct UploadSearchProject {
|
||||
pub server_side: String,
|
||||
pub gallery: Vec<String>,
|
||||
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
/// RFC 3339 formatted creation date of the project
|
||||
pub date_created: DateTime<Utc>,
|
||||
pub date_created: OffsetDateTime,
|
||||
/// Unix timestamp of the creation date of the project
|
||||
pub created_timestamp: i64,
|
||||
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
/// RFC 3339 formatted date/time of last major modification (update)
|
||||
pub date_modified: DateTime<Utc>,
|
||||
pub date_modified: OffsetDateTime,
|
||||
/// Unix timestamp of the last major modification
|
||||
pub modified_timestamp: i64,
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@ pub mod env;
|
||||
pub mod ext;
|
||||
pub mod guards;
|
||||
pub mod routes;
|
||||
pub mod time_ser;
|
||||
pub mod validate;
|
||||
pub mod webhook;
|
||||
|
||||
42
src/util/time_ser.rs
Normal file
42
src/util/time_ser.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
//! Use the well-known [RFC3339 format] when serializing and deserializing an [`OffsetDateTime`].
|
||||
//!
|
||||
//! Use this module in combination with serde's [`#[with]`][with] attribute.
|
||||
//!
|
||||
//! [RFC3339 format]: https://tools.ietf.org/html/rfc3339#section-5.6
|
||||
//! [with]: https://serde.rs/field-attrs.html#with
|
||||
|
||||
use core::fmt;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
use serde::{de, Deserializer, Serialize, Serializer};
|
||||
use time::Format::Rfc3339;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
/// Serialize an [`OffsetDateTime`] using the well-known RFC3339 format.
|
||||
pub fn serialize<S: Serializer>(
|
||||
datetime: &OffsetDateTime,
|
||||
serializer: S,
|
||||
) -> Result<S::Ok, S::Error> {
|
||||
datetime.format(Rfc3339).serialize(serializer)
|
||||
}
|
||||
|
||||
/// Deserialize an [`OffsetDateTime`] from its RFC3339 representation.
|
||||
pub fn deserialize<'a, D: Deserializer<'a>>(
|
||||
deserializer: D,
|
||||
) -> Result<OffsetDateTime, D::Error> {
|
||||
deserializer.deserialize_any(Visitor(PhantomData))
|
||||
}
|
||||
|
||||
pub(super) struct Visitor<T: ?Sized>(pub(super) PhantomData<T>);
|
||||
|
||||
impl<'a> de::Visitor<'a> for Visitor<OffsetDateTime> {
|
||||
type Value = OffsetDateTime;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
formatter.write_str("an `OffsetDateTime`")
|
||||
}
|
||||
|
||||
fn visit_str<E: de::Error>(self, value: &str) -> Result<OffsetDateTime, E> {
|
||||
OffsetDateTime::parse(value, Rfc3339).map_err(E::custom)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
use crate::models::projects::Project;
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::Serialize;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct DiscordEmbed {
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub url: String,
|
||||
pub timestamp: DateTime<Utc>,
|
||||
#[serde(with = "crate::util::time_ser")]
|
||||
pub timestamp: OffsetDateTime,
|
||||
pub color: u32,
|
||||
pub fields: Vec<DiscordEmbedField>,
|
||||
pub image: DiscordEmbedImage,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::validate::{
|
||||
SupportedGameVersions, ValidationError, ValidationResult,
|
||||
};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use std::io::Cursor;
|
||||
use time::OffsetDateTime;
|
||||
use zip::ZipArchive;
|
||||
|
||||
pub struct FabricValidator;
|
||||
@@ -22,9 +22,8 @@ impl super::Validator for FabricValidator {
|
||||
|
||||
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
||||
// Time since release of 18w49a, the first fabric version
|
||||
SupportedGameVersions::PastDate(DateTime::from_utc(
|
||||
NaiveDateTime::from_timestamp(1543969469, 0),
|
||||
Utc,
|
||||
SupportedGameVersions::PastDate(OffsetDateTime::from_unix_timestamp(
|
||||
1543969469,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::validate::{
|
||||
SupportedGameVersions, ValidationError, ValidationResult,
|
||||
};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use std::io::Cursor;
|
||||
use time::OffsetDateTime;
|
||||
use zip::ZipArchive;
|
||||
|
||||
pub struct ForgeValidator;
|
||||
@@ -22,9 +22,8 @@ impl super::Validator for ForgeValidator {
|
||||
|
||||
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
||||
// Time since release of 1.13, the first forge version which uses the new TOML system
|
||||
SupportedGameVersions::PastDate(DateTime::<Utc>::from_utc(
|
||||
NaiveDateTime::from_timestamp(1540122067, 0),
|
||||
Utc,
|
||||
SupportedGameVersions::PastDate(OffsetDateTime::from_unix_timestamp(
|
||||
1540122067,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -68,14 +67,8 @@ impl super::Validator for LegacyForgeValidator {
|
||||
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
||||
// Times between versions 1.5.2 to 1.12.2, which all use the legacy way of defining mods
|
||||
SupportedGameVersions::Range(
|
||||
DateTime::from_utc(
|
||||
NaiveDateTime::from_timestamp(1366818300, 0),
|
||||
Utc,
|
||||
),
|
||||
DateTime::from_utc(
|
||||
NaiveDateTime::from_timestamp(1505810340, 0),
|
||||
Utc,
|
||||
),
|
||||
OffsetDateTime::from_unix_timestamp(1366818300),
|
||||
OffsetDateTime::from_unix_timestamp(1505810340),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ use crate::models::projects::{GameVersion, Loader};
|
||||
use crate::validate::fabric::FabricValidator;
|
||||
use crate::validate::forge::{ForgeValidator, LegacyForgeValidator};
|
||||
use crate::validate::pack::PackValidator;
|
||||
use chrono::{DateTime, Utc};
|
||||
use std::io::Cursor;
|
||||
use thiserror::Error;
|
||||
use time::OffsetDateTime;
|
||||
use zip::ZipArchive;
|
||||
|
||||
mod fabric;
|
||||
@@ -35,8 +35,8 @@ pub enum ValidationResult {
|
||||
|
||||
pub enum SupportedGameVersions {
|
||||
All,
|
||||
PastDate(DateTime<Utc>),
|
||||
Range(DateTime<Utc>, DateTime<Utc>),
|
||||
PastDate(OffsetDateTime),
|
||||
Range(OffsetDateTime, OffsetDateTime),
|
||||
#[allow(dead_code)]
|
||||
Custom(Vec<GameVersion>),
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ pub struct PackFile<'a> {
|
||||
pub env: Option<std::collections::HashMap<EnvType, SideType>>,
|
||||
#[validate(custom(function = "validate_download_url"))]
|
||||
pub downloads: Vec<&'a str>,
|
||||
pub file_size: u32,
|
||||
}
|
||||
|
||||
fn validate_download_url(
|
||||
@@ -167,6 +168,12 @@ impl super::Validator for PackValidator {
|
||||
));
|
||||
}
|
||||
|
||||
if file.hashes.get(&FileHash::Sha512).is_none() {
|
||||
return Err(ValidationError::InvalidInput(
|
||||
"All pack files must provide a SHA512 hash!".into(),
|
||||
));
|
||||
}
|
||||
|
||||
let path = std::path::Path::new(file.path)
|
||||
.components()
|
||||
.next()
|
||||
|
||||
Reference in New Issue
Block a user