Compare commits
No commits in common. "c6518a33b187527b1fc4414cf181bea187a0be0d" and "c8a06f7af9e0b2e5bb2d98d42b86730d78b021ed" have entirely different histories.
c6518a33b1
...
c8a06f7af9
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This hook checks if the commit message ends with an issue number, and if not,
|
|
||||||
# tries to derive that number from the branch name
|
|
||||||
|
|
||||||
branch=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
|
|
||||||
# This check doesn't need to run when commiting to develop/master
|
|
||||||
[[ "$branch" =~ ^master|develop$ ]] && exit 0
|
|
||||||
|
|
||||||
issue_num=`echo "$branch" | grep -Po '^[0-9]+(?=-)'`
|
|
||||||
|
|
||||||
# Check if issue number is already present
|
|
||||||
if ! grep -q '([0-9]\+)$' "$1"; then
|
|
||||||
# Error out if we can't derive issue number
|
|
||||||
[[ -z "$issue_num" ]] && {
|
|
||||||
>&2 echo "Couldn't derive issue number from branch. Please add one manually.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Append issue number, and remove all comments
|
|
||||||
echo "[#$issue_num]" "$(cat "$1")" > "$1"
|
|
||||||
fi
|
|
|
@ -1,17 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This hook lints the code, and if we're on develop or master, also forces the tests to pass.
|
|
||||||
make lint &> /dev/null 2>&1 || {
|
|
||||||
>&2 echo "Format check failed, use 'make lint' for more information.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
branch=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
|
|
||||||
# TODO should we add release branches here as well?
|
|
||||||
if [[ "$branch" =~ ^master|develop$ ]]; then
|
|
||||||
make test > /dev/null 2>&1 || {
|
|
||||||
>&2 echo "Tests failed. check 'make test' for more info.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
fi
|
|
|
@ -56,15 +56,6 @@ dependencies = [
|
||||||
"opaque-debug",
|
"opaque-debug",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "aho-corasick"
|
|
||||||
version = "0.7.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
@ -82,12 +73,6 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "base-x"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
|
@ -133,9 +118,9 @@ checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.4.3"
|
version = "1.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
|
@ -161,29 +146,6 @@ version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono"
|
|
||||||
version = "0.4.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
"time 0.1.44",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono-tz"
|
|
||||||
version = "0.5.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2554a3155fec064362507487171dcc4edc3df60cb10f3a1fb10ed8094822b120"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"parse-zoneinfo",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cipher"
|
name = "cipher"
|
||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
|
@ -193,12 +155,6 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "const_fn"
|
|
||||||
version = "0.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cookie"
|
name = "cookie"
|
||||||
version = "0.11.4"
|
version = "0.11.4"
|
||||||
|
@ -212,34 +168,7 @@ dependencies = [
|
||||||
"percent-encoding 2.1.0",
|
"percent-encoding 2.1.0",
|
||||||
"rand",
|
"rand",
|
||||||
"sha2",
|
"sha2",
|
||||||
"time 0.1.44",
|
"time",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cookie"
|
|
||||||
version = "0.14.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding 2.1.0",
|
|
||||||
"time 0.2.26",
|
|
||||||
"version_check 0.9.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cookie_store"
|
|
||||||
version = "0.12.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3"
|
|
||||||
dependencies = [
|
|
||||||
"cookie 0.14.4",
|
|
||||||
"idna 0.2.2",
|
|
||||||
"log 0.4.14",
|
|
||||||
"publicsuffix",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"time 0.2.26",
|
|
||||||
"url 2.2.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -330,12 +259,6 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "discard"
|
|
||||||
version = "1.0.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.28"
|
version = "0.8.28"
|
||||||
|
@ -345,19 +268,6 @@ dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fej"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"chrono-tz",
|
|
||||||
"regex",
|
|
||||||
"reqwest",
|
|
||||||
"rocket",
|
|
||||||
"rocket_contrib",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filetime"
|
name = "filetime"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
@ -491,7 +401,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"typenum",
|
"typenum",
|
||||||
"version_check 0.9.3",
|
"version_check 0.9.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -588,13 +498,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http-body"
|
name = "http-body"
|
||||||
version = "0.4.1"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737"
|
checksum = "2861bd27ee074e5ee891e8b539837a9430012e249d7f0ca2d795650f579c1994"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"http",
|
"http",
|
||||||
"pin-project-lite",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -621,7 +530,7 @@ dependencies = [
|
||||||
"log 0.3.9",
|
"log 0.3.9",
|
||||||
"mime 0.2.6",
|
"mime 0.2.6",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"time 0.1.44",
|
"time",
|
||||||
"traitobject",
|
"traitobject",
|
||||||
"typeable",
|
"typeable",
|
||||||
"unicase",
|
"unicase",
|
||||||
|
@ -689,9 +598,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.6.2"
|
version = "1.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
|
@ -740,9 +649,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.49"
|
version = "0.3.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc15e39392125075f60c95ba416f5381ff6c3a948ff02ab12464715adf56c821"
|
checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
@ -777,9 +686,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.91"
|
version = "0.2.88"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7"
|
checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
@ -847,13 +756,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "0.7.11"
|
version = "0.7.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956"
|
checksum = "a5dede4e2065b3842b8b0af444119f3aa331cc7cc2dd20388bfb0f5d5a38823a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log 0.4.14",
|
"log 0.4.14",
|
||||||
"miow 0.3.7",
|
"miow 0.3.6",
|
||||||
"ntapi",
|
"ntapi",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
@ -884,10 +793,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miow"
|
name = "miow"
|
||||||
version = "0.3.7"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"socket2",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -947,25 +857,6 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[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"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_cpus"
|
name = "num_cpus"
|
||||||
version = "1.13.0"
|
version = "1.13.0"
|
||||||
|
@ -976,12 +867,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "once_cell"
|
|
||||||
version = "1.7.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "opaque-debug"
|
name = "opaque-debug"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -990,15 +875,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.10.33"
|
version = "0.10.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
|
checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"foreign-types",
|
"foreign-types",
|
||||||
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"once_cell",
|
|
||||||
"openssl-sys",
|
"openssl-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1010,9 +895,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.61"
|
version = "0.9.60"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
|
checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -1021,15 +906,6 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "parse-zoneinfo"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41"
|
|
||||||
dependencies = [
|
|
||||||
"regex",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pear"
|
name = "pear"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
@ -1048,7 +924,7 @@ dependencies = [
|
||||||
"proc-macro2 0.4.30",
|
"proc-macro2 0.4.30",
|
||||||
"quote 0.6.13",
|
"quote 0.6.13",
|
||||||
"syn 0.15.44",
|
"syn 0.15.44",
|
||||||
"version_check 0.9.3",
|
"version_check 0.9.2",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1081,7 +957,7 @@ checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.24",
|
"proc-macro2 1.0.24",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
"syn 1.0.64",
|
"syn 1.0.63",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1119,12 +995,6 @@ version = "0.2.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro-hack"
|
|
||||||
version = "0.5.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "0.4.30"
|
version = "0.4.30"
|
||||||
|
@ -1143,16 +1013,6 @@ dependencies = [
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "publicsuffix"
|
|
||||||
version = "1.5.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f"
|
|
||||||
dependencies = [
|
|
||||||
"idna 0.2.2",
|
|
||||||
"url 2.2.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.6.13"
|
version = "0.6.13"
|
||||||
|
@ -1220,23 +1080,6 @@ dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex"
|
|
||||||
version = "1.4.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick",
|
|
||||||
"memchr",
|
|
||||||
"regex-syntax",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.6.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remove_dir_all"
|
name = "remove_dir_all"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
|
@ -1254,8 +1097,6 @@ checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.13.0",
|
"base64 0.13.0",
|
||||||
"bytes",
|
"bytes",
|
||||||
"cookie 0.14.4",
|
|
||||||
"cookie_store",
|
|
||||||
"encoding_rs",
|
"encoding_rs",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -1274,7 +1115,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"time 0.2.26",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-native-tls",
|
"tokio-native-tls",
|
||||||
"url 2.2.1",
|
"url 2.2.1",
|
||||||
|
@ -1299,9 +1139,9 @@ dependencies = [
|
||||||
"rocket_codegen",
|
"rocket_codegen",
|
||||||
"rocket_http",
|
"rocket_http",
|
||||||
"state",
|
"state",
|
||||||
"time 0.1.44",
|
"time",
|
||||||
"toml",
|
"toml",
|
||||||
"version_check 0.9.3",
|
"version_check 0.9.2",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1316,7 +1156,7 @@ dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"quote 0.6.13",
|
"quote 0.6.13",
|
||||||
"rocket_http",
|
"rocket_http",
|
||||||
"version_check 0.9.3",
|
"version_check 0.9.2",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1339,24 +1179,25 @@ version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ce364100ed7a1bf39257b69ebd014c1d5b4979b0d365d8c9ab0aa9c79645493d"
|
checksum = "ce364100ed7a1bf39257b69ebd014c1d5b4979b0d365d8c9ab0aa9c79645493d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cookie 0.11.4",
|
"cookie",
|
||||||
"hyper 0.10.16",
|
"hyper 0.10.16",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"pear",
|
"pear",
|
||||||
"percent-encoding 1.0.1",
|
"percent-encoding 1.0.1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"state",
|
"state",
|
||||||
"time 0.1.44",
|
"time",
|
||||||
"unicode-xid 0.1.0",
|
"unicode-xid 0.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rust-api"
|
||||||
version = "0.2.3"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver",
|
"reqwest",
|
||||||
|
"rocket",
|
||||||
|
"rocket_contrib",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1413,40 +1254,11 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
|
||||||
dependencies = [
|
|
||||||
"semver-parser",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver-parser"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.125"
|
version = "1.0.124"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
|
checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f"
|
||||||
dependencies = [
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_derive"
|
|
||||||
version = "1.0.125"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2 1.0.24",
|
|
||||||
"quote 1.0.9",
|
|
||||||
"syn 1.0.64",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
|
@ -1471,12 +1283,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sha1"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha2"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
|
@ -1513,70 +1319,12 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "standback"
|
|
||||||
version = "0.2.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff"
|
|
||||||
dependencies = [
|
|
||||||
"version_check 0.9.3",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "state"
|
name = "state"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483"
|
checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "stdweb"
|
|
||||||
version = "0.4.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
|
|
||||||
dependencies = [
|
|
||||||
"discard",
|
|
||||||
"rustc_version",
|
|
||||||
"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 1.0.24",
|
|
||||||
"quote 1.0.9",
|
|
||||||
"serde",
|
|
||||||
"serde_derive",
|
|
||||||
"syn 1.0.64",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[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 1.0.24",
|
|
||||||
"quote 1.0.9",
|
|
||||||
"serde",
|
|
||||||
"serde_derive",
|
|
||||||
"serde_json",
|
|
||||||
"sha1",
|
|
||||||
"syn 1.0.64",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "stdweb-internal-runtime"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "2.4.0"
|
version = "2.4.0"
|
||||||
|
@ -1596,9 +1344,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.64"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f"
|
checksum = "8fd9bc7ccc2688b3344c2f48b9b546648b25ce0b20fc717ee7fa7981a8ca9717"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.24",
|
"proc-macro2 1.0.24",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
|
@ -1621,53 +1369,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.1.44"
|
version = "0.1.43"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.2.26"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "08a8cbfbf47955132d0202d1662f49b2423ae35862aee471f3ba4b133358f372"
|
|
||||||
dependencies = [
|
|
||||||
"const_fn",
|
|
||||||
"libc",
|
|
||||||
"standback",
|
|
||||||
"stdweb",
|
|
||||||
"time-macros",
|
|
||||||
"version_check 0.9.3",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[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]]
|
|
||||||
name = "time-macros-impl"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro-hack",
|
|
||||||
"proc-macro2 1.0.24",
|
|
||||||
"quote 1.0.9",
|
|
||||||
"standback",
|
|
||||||
"syn 1.0.64",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
|
@ -1685,15 +1394,15 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.4.0"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722"
|
checksum = "8d56477f6ed99e10225f38f9f75f872f29b8b8bd8c0b946f63345bb144e9eeda"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mio 0.7.11",
|
"mio 0.7.9",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
@ -1710,9 +1419,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-util"
|
name = "tokio-util"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f"
|
checksum = "ec31e5cc6b46e653cf57762f36f71d5e6386391d88a72fd6db4508f8f676fb29"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
@ -1777,9 +1486,9 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.13.0"
|
version = "1.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
|
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicase"
|
name = "unicase"
|
||||||
|
@ -1867,15 +1576,15 @@ checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.3"
|
version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "walkdir"
|
name = "walkdir"
|
||||||
version = "2.3.2"
|
version = "2.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"same-file",
|
"same-file",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
|
@ -1894,15 +1603,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
version = "0.10.2+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.72"
|
version = "0.2.71"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fe8f61dba8e5d645a4d8132dc7a0a66861ed5e1045d2c0ed940fab33bac0fbe"
|
checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -1912,24 +1621,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.72"
|
version = "0.2.71"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "046ceba58ff062da072c7cb4ba5b22a37f00a302483f7e2a6cdc18fedbdc1fd3"
|
checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log 0.4.14",
|
"log 0.4.14",
|
||||||
"proc-macro2 1.0.24",
|
"proc-macro2 1.0.24",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
"syn 1.0.64",
|
"syn 1.0.63",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.4.22"
|
version = "0.4.21"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73157efb9af26fb564bb59a009afd1c7c334a44db171d280690d0c3faaec3468"
|
checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
@ -1939,9 +1648,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.72"
|
version = "0.2.71"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ef9aa01d36cda046f797c57959ff5f3c615c9cc63997a8d545831ec7976819b"
|
checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
|
@ -1949,28 +1658,28 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.72"
|
version = "0.2.71"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "96eb45c1b2ee33545a813a92dbb53856418bf7eb54ab34f7f7ff1448a5b3735d"
|
checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.24",
|
"proc-macro2 1.0.24",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
"syn 1.0.64",
|
"syn 1.0.63",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.72"
|
version = "0.2.71"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7148f4696fb4960a346eaa60bbfb42a1ac4ebba21f750f75fc1375b098d5ffa"
|
checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.49"
|
version = "0.3.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "59fe19d70f5dacc03f6e46777213facae5ac3801575d56ca6cbd4c93dcd12310"
|
checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
|
22
Cargo.toml
22
Cargo.toml
|
@ -1,35 +1,19 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fej"
|
name = "rust-api"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jef Roosens <roosensjef@gmail.com>"]
|
authors = ["Jef Roosens <roosensjef@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
name = "fej_lib"
|
|
||||||
src = "src/lib.rs"
|
|
||||||
test = true
|
|
||||||
bench = true
|
|
||||||
doc = true
|
|
||||||
doctest = true
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "fej"
|
|
||||||
src = "src/main.rs"
|
|
||||||
test = false
|
|
||||||
bench = false
|
|
||||||
doc = false
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = "0.4.7"
|
rocket = "0.4.7"
|
||||||
serde = "1.0.124"
|
serde = "1.0.124"
|
||||||
chrono = "0.4.19"
|
|
||||||
chrono-tz = "0.5.3"
|
|
||||||
regex = "1.4.5"
|
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.11.2"
|
version = "0.11.2"
|
||||||
default-features = true
|
default-features = true
|
||||||
features = ["blocking", "json", "cookies"]
|
features = ["blocking", "json"]
|
||||||
|
|
||||||
[dependencies.rocket_contrib]
|
[dependencies.rocket_contrib]
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
|
|
39
Dockerfile
39
Dockerfile
|
@ -1,37 +1,18 @@
|
||||||
# syntax = docker/dockerfile:1.2
|
# syntax=docker/dockerfile:1.2
|
||||||
|
FROM rustlang/rust:nightly AS builder
|
||||||
# We use a multi-stage build to end up with a very small final image
|
|
||||||
FROM alpine:latest AS builder
|
|
||||||
|
|
||||||
ENV PATH "$PATH:/root/.cargo/bin"
|
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# Install build dependencies, rustup & rust's nightly build & toolchain
|
# Build the app
|
||||||
RUN apk update && apk add --no-cache openssl-dev build-base curl && \
|
COPY . .
|
||||||
{ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly; }
|
RUN --mount=type=cache,target=/usr/src/app/target cargo install --path .
|
||||||
|
|
||||||
# Copy source code over to builder
|
|
||||||
COPY Cargo.toml Cargo.lock ./
|
|
||||||
COPY src/ ./src/
|
|
||||||
|
|
||||||
# Run the tests, don't want no broken docker image
|
|
||||||
# And then finally, build the project
|
|
||||||
# Thank the lords that this article exists
|
|
||||||
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
|
|
||||||
# TODO add what these flags do & why they work
|
|
||||||
# NOTE: cargo install auto-appends bin to the path
|
|
||||||
RUN --mount=type=cache,target=/usr/src/app/target RUSTFLAGS="-C target-feature=-crt-static" cargo test && \
|
|
||||||
RUSTFLAGS="-C target-feature=-crt-static" cargo install --path . --bin fej --root /usr/local
|
|
||||||
|
|
||||||
|
|
||||||
# Now, we create the actual image
|
FROM debian:buster-slim
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
# Install some dynamic libraries needed for everything to work
|
# Install dependencies
|
||||||
RUN apk update && apk add --no-cache openssl libgcc
|
RUN apt update && apt install -y openssl
|
||||||
|
|
||||||
# Copy binary over to final image
|
COPY --from=builder /usr/local/cargo/bin/rust-api /usr/local/bin/rust-api
|
||||||
COPY --from=builder /usr/local/bin/fej /usr/local/bin/fej
|
|
||||||
|
|
||||||
CMD ["/usr/local/bin/fej"]
|
CMD ["rust-api"]
|
||||||
|
|
20
Makefile
20
Makefile
|
@ -1,4 +1,5 @@
|
||||||
IMAGE := chewingbever/fej
|
IMAGE := rust_api:latest
|
||||||
|
shell := /bin/bash
|
||||||
|
|
||||||
|
|
||||||
all: debug
|
all: debug
|
||||||
|
@ -14,32 +15,21 @@ release:
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
|
|
||||||
image: Dockerfile
|
image: Dockerfile
|
||||||
@ ./build '$(IMAGE)'
|
@ DOCKER_BUILDKIT=1 docker build -t '$(IMAGE)' .
|
||||||
.PHONY: image
|
.PHONY: image
|
||||||
|
|
||||||
push:
|
|
||||||
@ ./build '$(IMAGE)' push
|
|
||||||
.PHONY: push
|
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
run:
|
run:
|
||||||
@ RUST_BACKTRACE=1 cargo run --bin fej
|
@ cargo run
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
|
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
test:
|
test:
|
||||||
@ cargo test --no-fail-fast
|
@ cargo test
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
|
||||||
format:
|
|
||||||
@ cargo fmt
|
|
||||||
.PHONY: format
|
|
||||||
|
|
||||||
lint:
|
|
||||||
@ cargo fmt -- --check
|
|
||||||
.PHONY: lint
|
|
||||||
|
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
docs:
|
docs:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Fej
|
# rust-api
|
||||||
|
|
||||||
Fej is an API written in Rust. I started this project to learn the language,
|
An API written in Rust, which I used to learn the language.
|
||||||
and really just have some fun.
|
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
55
build
55
build
|
@ -1,55 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Simple guard to check input args
|
|
||||||
[[ $# -eq 1 ]] || [[ $# -eq 2 ]] || {
|
|
||||||
>&2 echo "Usage: ./build IMAGE [ACTION]"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Extract current version from Cargo.toml & get current branch
|
|
||||||
patch_version="$(grep -Po '(?<=version = ").*(?=")' Cargo.toml | head -n1)"
|
|
||||||
major_version="$(echo "$patch_version" |
|
|
||||||
sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/')"
|
|
||||||
minor_version="$(echo "$patch_version" |
|
|
||||||
sed -E 's/([0-9]+).([0-9]+).([0-9]+)/\1.\2/')"
|
|
||||||
branch="$(git branch --show-current)"
|
|
||||||
|
|
||||||
if [[ "$branch" = "master" ]]; then
|
|
||||||
tags=("$patch_version" "$minor_version" "$major_version" "latest")
|
|
||||||
|
|
||||||
elif [[ "$branch" = "develop" ]]; then
|
|
||||||
tags=("$patch_version-dev" "$minor_version-dev" "$major_version-dev" "dev")
|
|
||||||
|
|
||||||
else
|
|
||||||
tags=("$branch")
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the actual build command
|
|
||||||
DOCKER_BUILDKIT=1 docker build -t "$1:$tags" .
|
|
||||||
|
|
||||||
if [[ "$2" = push ]]; then
|
|
||||||
[[ "$branch" =~ ^develop|master$ ]] || {
|
|
||||||
>&2 echo "You can only push from develop or master."
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
|
|
||||||
for tag in "${tags[@]}"; do
|
|
||||||
# Create the tag
|
|
||||||
docker tag "$1:$tags" "$1:$tag"
|
|
||||||
|
|
||||||
# Push the tag
|
|
||||||
docker push "$1:$tag"
|
|
||||||
|
|
||||||
# Remove the tag again, if it's not the main tag
|
|
||||||
[[ "$tag" != "$tags" ]] && docker rmi "$1:$tag"
|
|
||||||
done
|
|
||||||
|
|
||||||
elif [[ "$2" = run ]]; then
|
|
||||||
docker run \
|
|
||||||
--rm \
|
|
||||||
--interactive \
|
|
||||||
--tty \
|
|
||||||
--publish 8000:8000 \
|
|
||||||
"$1:$tags"
|
|
||||||
fi
|
|
|
@ -1,6 +0,0 @@
|
||||||
use rocket::Request;
|
|
||||||
|
|
||||||
#[catch(404)]
|
|
||||||
pub fn not_found(_: &Request) -> String {
|
|
||||||
String::from("This route doesn't exist or doesn't use the specified parameters.")
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
// I can probably do this way easier using an external crate, I should do that
|
|
||||||
use rocket::http::Status;
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
pub enum FejError {
|
|
||||||
InvalidArgument,
|
|
||||||
FailedRequest,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<FejError> for Status {
|
|
||||||
fn from(err: FejError) -> Status {
|
|
||||||
match err {
|
|
||||||
FejError::InvalidArgument => Status::BadRequest,
|
|
||||||
FejError::FailedRequest => Status::InternalServerError,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO make this more advanced where possible
|
|
||||||
impl From<reqwest::Error> for FejError {
|
|
||||||
fn from(_: reqwest::Error) -> FejError {
|
|
||||||
FejError::FailedRequest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<chrono::ParseError> for FejError {
|
|
||||||
fn from(_: chrono::ParseError) -> FejError {
|
|
||||||
FejError::InvalidArgument
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#[cfg(test)] mod tests;
|
||||||
|
|
||||||
|
pub fn routes() -> Vec<rocket::Route> {
|
||||||
|
routes![
|
||||||
|
world,
|
||||||
|
hello,
|
||||||
|
name_age
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/world")]
|
||||||
|
fn world() -> &'static str {
|
||||||
|
"Hello, world!"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/<name>")]
|
||||||
|
fn hello(name: String) -> String {
|
||||||
|
format!("Hello, {}", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/world?<name>&<age>")]
|
||||||
|
fn name_age(name: String, age: u16) -> String {
|
||||||
|
format!("Hello, {} who is {} years old!", name, age)
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
use rocket::local::Client;
|
||||||
|
use rocket::http::Status;
|
||||||
|
|
||||||
|
fn rocket() -> rocket::Rocket {
|
||||||
|
rocket::ignite().mount("/", super::routes())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_world() {
|
||||||
|
let client = Client::new(rocket()).expect("valid rocket instance");
|
||||||
|
let mut response = client.get("/world").dispatch();
|
||||||
|
|
||||||
|
assert_eq!(response.status(), Status::Ok);
|
||||||
|
assert_eq!(response.body_string(), Some("Hello, world!".into()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_hello() {
|
||||||
|
let client = Client::new(rocket()).expect("valid rocket instance");
|
||||||
|
let mut response = client.get("/thisisaname").dispatch();
|
||||||
|
|
||||||
|
assert_eq!(response.status(), Status::Ok);
|
||||||
|
assert_eq!(response.body_string(), Some("Hello, thisisaname".into()));
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
# Ivago
|
|
||||||
|
|
||||||
This part of the API is a wrapper around the Ivago website (Ivago being the
|
|
||||||
company that collects the trash in my city). Their site isn't exactly RESTful,
|
|
||||||
so this endpoint simply wraps it in a RESTful wrapper.
|
|
|
@ -1,68 +0,0 @@
|
||||||
use crate::errors::FejError;
|
|
||||||
use chrono::{DateTime, NaiveDate, TimeZone};
|
|
||||||
use chrono_tz::Europe::Brussels;
|
|
||||||
use chrono_tz::Tz;
|
|
||||||
use rocket::http::RawStr;
|
|
||||||
use rocket::request::FromFormValue;
|
|
||||||
use serde::ser::Serializer;
|
|
||||||
use serde::Serialize;
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
/// This class is a simple wrapper around chrono's DateTime. Its sole purpose
|
|
||||||
/// is to avoid error E0117.
|
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
pub struct BasicDate(pub DateTime<Tz>);
|
|
||||||
|
|
||||||
impl<'v> FromFormValue<'v> for BasicDate {
|
|
||||||
type Error = &'v RawStr;
|
|
||||||
|
|
||||||
fn from_form_value(form_value: &'v RawStr) -> Result<BasicDate, Self::Error> {
|
|
||||||
match BasicDate::try_from(form_value.as_str()) {
|
|
||||||
Err(_) => Err(form_value),
|
|
||||||
Ok(date) => Ok(date),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&str> for BasicDate {
|
|
||||||
type Error = FejError;
|
|
||||||
|
|
||||||
fn try_from(s: &str) -> Result<BasicDate, Self::Error> {
|
|
||||||
let naive_date = NaiveDate::parse_from_str(s, "%Y-%m-%d")?;
|
|
||||||
|
|
||||||
Ok(BasicDate(
|
|
||||||
Brussels
|
|
||||||
.from_local_datetime(&naive_date.and_hms(0, 0, 0))
|
|
||||||
.single()
|
|
||||||
.ok_or(FejError::InvalidArgument)?,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&BasicDate> for String {
|
|
||||||
fn from(date: &BasicDate) -> String {
|
|
||||||
format!("{}", date.0.format("%Y-%m-%d"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Serialize for BasicDate {
|
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
serializer.serialize_str(&String::from(self))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
/// Tests catching a string with an invalid date
|
|
||||||
#[test]
|
|
||||||
fn test_invalid_date() {
|
|
||||||
let val = "2012-13-12";
|
|
||||||
let date = BasicDate::try_from(val);
|
|
||||||
assert_eq!(date, Err(FejError::InvalidArgument));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +1,17 @@
|
||||||
use crate::errors::FejError;
|
|
||||||
use chrono::DateTime;
|
|
||||||
use chrono_tz::Tz;
|
|
||||||
use reqwest::blocking as reqwest;
|
use reqwest::blocking as reqwest;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::{From, TryFrom};
|
use std::convert::TryFrom;
|
||||||
|
use rocket::http::Status;
|
||||||
|
use std::error::Error;
|
||||||
|
|
||||||
mod basic_date;
|
pub mod structs;
|
||||||
mod pickup_time;
|
use structs::{Street, Date, PickupTime};
|
||||||
mod street;
|
|
||||||
|
|
||||||
pub use basic_date::BasicDate;
|
|
||||||
pub use pickup_time::PickupTime;
|
|
||||||
pub use street::Street;
|
|
||||||
|
|
||||||
/// Endpoint for the search feature
|
/// The base URL where their API starts
|
||||||
const SEARCH_URL: &str = "https://www.ivago.be/nl/particulier/autocomplete/garbage/streets";
|
|
||||||
/// Endpoint for populating the initial cookies
|
|
||||||
const BASE_URL: &str = "https://www.ivago.be/nl/particulier/afval/ophaling";
|
const BASE_URL: &str = "https://www.ivago.be/nl/particulier/afval/ophaling";
|
||||||
/// Endpoint for the actual calendar output
|
const SEARCH_URL: &str ="https://www.ivago.be/nl/particulier/autocomplete/garbage/streets";
|
||||||
const CAL_URL: &str = "https://www.ivago.be/nl/particulier/garbage/pick-up/pickups";
|
|
||||||
|
|
||||||
/// Searches the Ivago API for streets in the given city
|
/// Searches the Ivago API for streets in the given city
|
||||||
///
|
///
|
||||||
|
@ -26,71 +19,36 @@ const CAL_URL: &str = "https://www.ivago.be/nl/particulier/garbage/pick-up/picku
|
||||||
///
|
///
|
||||||
/// * `street` - name of the street
|
/// * `street` - name of the street
|
||||||
/// * `city` - city the street is in
|
/// * `city` - city the street is in
|
||||||
pub fn search_streets(street_name: &str) -> Result<Vec<Street>, FejError> {
|
// TODO find out how to do this async
|
||||||
|
pub fn search_streets(street_name: &String) -> Result<Vec<Street>, Box<dyn Error>> {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
let response = client.get(SEARCH_URL).query(&[("q", street_name)]).send()?;
|
let response = client.get(SEARCH_URL)
|
||||||
let data: Vec<HashMap<String, String>> = response.json()?;
|
.query(&[("q", street_name)])
|
||||||
|
|
||||||
// This is pretty cool, filter_map first does get() on all the maps, and
|
|
||||||
// then filters out any None values
|
|
||||||
// Then, we do the same thing for streets
|
|
||||||
Ok(data
|
|
||||||
.iter()
|
|
||||||
.filter_map(|m| m.get("value"))
|
|
||||||
.filter_map(|v| Street::try_from(v.as_str()).ok())
|
|
||||||
.collect())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the pickup times for the various trash types
|
|
||||||
///
|
|
||||||
/// # Arguments
|
|
||||||
///
|
|
||||||
/// * `street` - desired street
|
|
||||||
/// * `number` - house number
|
|
||||||
/// * `start_date` - earliest date for the results
|
|
||||||
/// * `end_date` - latest date for the results
|
|
||||||
pub fn get_pickup_times(
|
|
||||||
street: &Street,
|
|
||||||
number: &u32,
|
|
||||||
start_date: &DateTime<Tz>,
|
|
||||||
end_date: &DateTime<Tz>,
|
|
||||||
) -> Result<Vec<PickupTime>, FejError> {
|
|
||||||
let client = reqwest::Client::builder().cookie_store(true).build()?;
|
|
||||||
|
|
||||||
// This populates the cookies with the necessary values
|
|
||||||
client
|
|
||||||
.post(BASE_URL)
|
|
||||||
.form(&[
|
|
||||||
("garbage_type", ""),
|
|
||||||
("ivago_street", &String::from(street)),
|
|
||||||
("number", &number.to_string()),
|
|
||||||
("form_id", "garbage_address_form"),
|
|
||||||
])
|
|
||||||
.send()?;
|
|
||||||
|
|
||||||
let response = client
|
|
||||||
.get(CAL_URL)
|
|
||||||
.query(&[
|
|
||||||
("_format", "json"),
|
|
||||||
("type", ""),
|
|
||||||
("start", &start_date.timestamp().to_string()),
|
|
||||||
("end", &end_date.timestamp().to_string()),
|
|
||||||
])
|
|
||||||
.send()?;
|
.send()?;
|
||||||
let data: Vec<HashMap<String, String>> = response.json()?;
|
let data: Vec<HashMap<String, String>> = response.json()?;
|
||||||
|
|
||||||
let mut output: Vec<PickupTime> = Vec::new();
|
let mut output: Vec<Street> = Vec::new();
|
||||||
|
|
||||||
for map in data
|
// We iterate over every item and extract the needed data
|
||||||
.iter()
|
for map in data.iter() {
|
||||||
.filter(|m| m.contains_key("date") && m.contains_key("label"))
|
if let Some(value) = map.get("value") {
|
||||||
{
|
match Street::try_from(value) {
|
||||||
// Because we filtered the maps in the loop, we can safely use unwrap
|
Ok(street) => output.push(street),
|
||||||
// here
|
Err(_) => continue,
|
||||||
if let Ok(date) = BasicDate::try_from(map.get("date").unwrap().as_str()) {
|
}
|
||||||
output.push(PickupTime::new(date, map.get("label").unwrap().to_string()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Return the known pickup times for the given street and/or city
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// * `street` - name of the street
|
||||||
|
/// * `city` - city the street is in
|
||||||
|
pub fn get_pickup_times(street: Street) -> Vec<PickupTime> {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
use super::BasicDate;
|
|
||||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
|
||||||
|
|
||||||
/// Represents a pickup time instance. All fields are a direct map of the
|
|
||||||
/// original API
|
|
||||||
pub struct PickupTime {
|
|
||||||
date: BasicDate,
|
|
||||||
label: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PickupTime {
|
|
||||||
pub fn new(date: BasicDate, label: String) -> PickupTime {
|
|
||||||
PickupTime {
|
|
||||||
date: date,
|
|
||||||
label: label,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Serialize for PickupTime {
|
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
let mut s = serializer.serialize_struct("PickupTime", 2)?;
|
|
||||||
s.serialize_field("date", &self.date)?;
|
|
||||||
s.serialize_field("label", &self.label)?;
|
|
||||||
s.end()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// I'd put tests here, but there's barely anything to do
|
|
|
@ -1,85 +0,0 @@
|
||||||
use regex::Regex;
|
|
||||||
use rocket::http::RawStr;
|
|
||||||
use rocket::request::FromFormValue;
|
|
||||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
/// Represents a street
|
|
||||||
pub struct Street {
|
|
||||||
name: String,
|
|
||||||
city: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Street {
|
|
||||||
// This constructor just makes my life a bit easier during testing
|
|
||||||
#[cfg(test)]
|
|
||||||
fn new(name: String, city: String) -> Street {
|
|
||||||
Street {
|
|
||||||
name: name,
|
|
||||||
city: city,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&Street> for String {
|
|
||||||
fn from(street: &Street) -> String {
|
|
||||||
format!("{} ({})", street.name, street.city)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Serialize for Street {
|
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
||||||
where
|
|
||||||
S: Serializer,
|
|
||||||
{
|
|
||||||
let mut s = serializer.serialize_struct("Street", 2)?;
|
|
||||||
s.serialize_field("name", &self.name)?;
|
|
||||||
s.serialize_field("city", &self.city)?;
|
|
||||||
s.end()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TryFrom<&str> for Street {
|
|
||||||
type Error = ();
|
|
||||||
|
|
||||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
|
||||||
if let Some(index) = value.find('(') {
|
|
||||||
Ok(Street {
|
|
||||||
name: (value[0..index - 1].trim()).to_string(),
|
|
||||||
city: (value[index + 1..value.len() - 1].trim()).to_string(),
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Err(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'v> FromFormValue<'v> for Street {
|
|
||||||
type Error = &'v RawStr;
|
|
||||||
|
|
||||||
fn from_form_value(form_value: &'v RawStr) -> Result<Street, Self::Error> {
|
|
||||||
// This regex is pretty loose tbh, but not sure how I can make it more
|
|
||||||
// strict right now
|
|
||||||
let re = Regex::new(r"^(.+) \((.+)\)$").unwrap();
|
|
||||||
|
|
||||||
match re.captures(&form_value.url_decode_lossy()) {
|
|
||||||
None => Err(form_value),
|
|
||||||
Some(caps) => Ok(Street {
|
|
||||||
name: String::from(caps.get(1).unwrap().as_str()),
|
|
||||||
city: String::from(caps.get(2).unwrap().as_str()),
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_to_string() {
|
|
||||||
let street = Street::new(String::from("testname"), String::from("city"));
|
|
||||||
|
|
||||||
assert_eq!(String::from("testname (city)"), String::from(&street));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
use std::convert::TryFrom;
|
||||||
|
use serde::ser::{Serialize, Serializer, SerializeStruct};
|
||||||
|
|
||||||
|
|
||||||
|
/// Represents a street
|
||||||
|
pub struct Street {
|
||||||
|
name: String,
|
||||||
|
city: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Serialize for Street {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
{
|
||||||
|
let mut s = serializer.serialize_struct("Street", 2)?;
|
||||||
|
s.serialize_field("name", &self.name)?;
|
||||||
|
s.serialize_field("city", &self.city)?;
|
||||||
|
s.end()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFrom<&String> for Street {
|
||||||
|
type Error = ();
|
||||||
|
|
||||||
|
fn try_from(value: &String) -> Result<Self, Self::Error> {
|
||||||
|
if let Some(index) = value.find('(') {
|
||||||
|
Ok(Street {
|
||||||
|
name: (value[0 .. index - 1].trim()).to_string(),
|
||||||
|
city: (value[index + 1 .. value.len() - 1].trim()).to_string(),
|
||||||
|
})
|
||||||
|
|
||||||
|
}else {
|
||||||
|
Err(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Represents a timezoneless date
|
||||||
|
pub struct Date {
|
||||||
|
day: u8,
|
||||||
|
month: u8,
|
||||||
|
year: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Represents a pickup time instance. All fields are a direct map of the
|
||||||
|
/// original API
|
||||||
|
pub struct PickupTime {
|
||||||
|
date: Date,
|
||||||
|
label: String,
|
||||||
|
classes: Vec<String>,
|
||||||
|
url: String
|
||||||
|
}
|
|
@ -1,30 +1,27 @@
|
||||||
mod controller;
|
#[cfg(test)] mod tests;
|
||||||
|
|
||||||
use controller::{get_pickup_times, search_streets};
|
|
||||||
use controller::{BasicDate, PickupTime, Street};
|
|
||||||
use rocket::http::Status;
|
|
||||||
use rocket_contrib::json::Json;
|
use rocket_contrib::json::Json;
|
||||||
|
|
||||||
|
mod controller;
|
||||||
|
use controller as ctrl;
|
||||||
|
use ctrl::structs::Street;
|
||||||
|
|
||||||
pub fn routes() -> Vec<rocket::Route> {
|
pub fn routes() -> Vec<rocket::Route> {
|
||||||
routes![route_search_streets, route_get_pickup_times]
|
routes![
|
||||||
|
search_streets,
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/search?<street>")]
|
// URL: https://www.ivago.be/nl/particulier/autocomplete/garbage/streets?q=Lange
|
||||||
pub fn route_search_streets(street: String) -> Result<Json<Vec<Street>>, Status> {
|
// TODO make this async
|
||||||
Ok(Json(search_streets(street.as_str())?))
|
// TODO change this so it can return errors instead of empty json
|
||||||
}
|
#[get("/search?<street>", format="json")]
|
||||||
|
pub fn search_streets(street: String) -> Json<Vec<Street>> {
|
||||||
#[get("/?<street>&<number>&<start_date>&<end_date>")]
|
match ctrl::search_streets(&street) {
|
||||||
pub fn route_get_pickup_times(
|
Ok(streets) => Json(streets),
|
||||||
street: Street,
|
Err(err) => {
|
||||||
number: u32,
|
println!("{:?}", err);
|
||||||
start_date: BasicDate,
|
Json(Vec::new())
|
||||||
end_date: BasicDate,
|
},
|
||||||
) -> Result<Json<Vec<PickupTime>>, Status> {
|
}
|
||||||
Ok(Json(get_pickup_times(
|
|
||||||
&street,
|
|
||||||
&number,
|
|
||||||
&start_date.0,
|
|
||||||
&end_date.0,
|
|
||||||
)?))
|
|
||||||
}
|
}
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,11 +0,0 @@
|
||||||
#![feature(proc_macro_hygiene, decl_macro)]
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate rocket;
|
|
||||||
|
|
||||||
// Route modules
|
|
||||||
pub mod ivago;
|
|
||||||
|
|
||||||
// Helper modules
|
|
||||||
pub mod catchers;
|
|
||||||
pub mod errors;
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,12 +1,15 @@
|
||||||
#[macro_use]
|
#![feature(proc_macro_hygiene, decl_macro)]
|
||||||
extern crate rocket;
|
|
||||||
|
|
||||||
use fej_lib::{catchers, ivago};
|
#[macro_use] extern crate rocket;
|
||||||
|
|
||||||
|
// Route modules
|
||||||
|
mod hello;
|
||||||
|
mod ivago;
|
||||||
|
|
||||||
fn rocket() -> rocket::Rocket {
|
fn rocket() -> rocket::Rocket {
|
||||||
rocket::ignite()
|
rocket::ignite()
|
||||||
|
.mount("/hello", hello::routes())
|
||||||
.mount("/ivago", ivago::routes())
|
.mount("/ivago", ivago::routes())
|
||||||
.register(catchers![catchers::not_found])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/// In here, any non-unit tests are placed.
|
|
||||||
use rocket::http::Status;
|
|
||||||
use rocket::local::Client;
|
|
||||||
|
|
||||||
fn rocket() -> rocket::Rocket {
|
|
||||||
rocket::ignite().mount("/", fej_lib::ivago::routes())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Test 404 response
|
|
||||||
#[test]
|
|
||||||
fn test_404_response() {
|
|
||||||
let client = Client::new(rocket()).expect("valid rocket instance");
|
|
||||||
let response = client.get("/").dispatch();
|
|
||||||
|
|
||||||
assert_eq!(response.status(), Status::NotFound);
|
|
||||||
// TODO add text check as well
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Test 404 on invalid parameters
|
|
||||||
// TODO make this check a 400 instead
|
|
||||||
#[test]
|
|
||||||
fn test_invalid_parameters() {
|
|
||||||
let client = Client::new(rocket()).expect("valid rocket instance");
|
|
||||||
let response = client
|
|
||||||
.get("/?street=astreet+(city)&number=500&start_date=2021-04-04&end_date=2021-04-555")
|
|
||||||
.dispatch();
|
|
||||||
|
|
||||||
assert_eq!(response.status(), Status::NotFound);
|
|
||||||
}
|
|
Loading…
Reference in New Issue