aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock110
-rw-r--r--Cargo.toml10
-rw-r--r--src/file_upload.rs9
-rw-r--r--src/main.rs13
-rw-r--r--src/renderer.rs117
5 files changed, 153 insertions, 106 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ebbf5a5..ccffbda 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -321,7 +321,7 @@ dependencies = [
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -359,7 +359,7 @@ dependencies = [
[[package]]
name = "alphanumeric-sort"
-version = "1.0.11"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1101,7 +1101,7 @@ dependencies = [
[[package]]
name = "hex"
-version = "0.4.0"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1441,7 +1441,7 @@ version = "0.5.0"
dependencies = [
"actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)",
"actix-web 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "alphanumeric-sort 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "alphanumeric-sort 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
"assert_cmd 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"assert_fs 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1451,26 +1451,26 @@ dependencies = [
"chrono-humanize 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
- "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"maud 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nanoid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "port_check 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "port_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "rstest 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rstest 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"select 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
- "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"simplelog 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "structopt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "strum 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "strum_macros 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1760,7 +1760,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "port_check"
-version = "0.1.2"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -1812,12 +1812,26 @@ dependencies = [
[[package]]
name = "proc-macro-error"
-version = "0.2.6"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro-error-attr 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1845,7 +1859,7 @@ dependencies = [
"idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2134,7 +2148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rstest"
-version = "0.5.1"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2168,6 +2182,16 @@ dependencies = [
]
[[package]]
+name = "rustversion"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "ryu"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2292,7 +2316,7 @@ dependencies = [
"dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -2302,7 +2326,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "sha2"
-version = "0.8.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2416,20 +2440,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "structopt"
-version = "0.3.5"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "structopt-derive 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "structopt-derive 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "structopt-derive"
-version = "0.3.5"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro-error 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2437,12 +2462,12 @@ dependencies = [
[[package]]
name = "strum"
-version = "0.16.0"
+version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "strum_macros"
-version = "0.16.0"
+version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2472,6 +2497,16 @@ dependencies = [
]
[[package]]
+name = "syn-mid"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "synstructure"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2958,7 +2993,7 @@ dependencies = [
[[package]]
name = "url"
-version = "2.1.0"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3160,7 +3195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69"
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
-"checksum alphanumeric-sort 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f37ce94154d73f6961f87571a3ab7814e1608f373bd55a933e3e771b6dd59fc4"
+"checksum alphanumeric-sort 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "22b991f3d9c054bb99ed18f24e906b89ec3bc450e788d4911b2b9e123ab3109b"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a1eca3195b729bbd64e292ef2f5fff6b1c28504fed762ce2b1013dde4d8e92"
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
@@ -3250,7 +3285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462"
"checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
-"checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e"
+"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e"
"checksum html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce65ac8028cf5a287a7dbf6c4e0a6cf2dcf022ed5b167a81bae66ebf599a8b7"
"checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163"
@@ -3320,14 +3355,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
"checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
-"checksum port_check 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4eea6831323e5f958c4296bb21d76c788eabc209fd5f53964084ecc4bc3a9960"
+"checksum port_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f6519412c9e0d4be579b9f0618364d19cb434b324fc6ddb1b27b1e682c7105ed"
"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum predicates 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "53e09015b0d3f5a0ec2d4428f7559bb7b3fff341b4e159fedd1d57fac8b939ff"
"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
"checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
-"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
+"checksum proc-macro-error 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "875077759af22fa20b610ad4471d8155b321c89c3f2785526c9839b099be4e0a"
+"checksum proc-macro-error-attr 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c5717d9fa2664351a01ed73ba5ef6df09c01a521cb42cb65a061432a826f3c7a"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
"checksum publicsuffix 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9bf259a81de2b2eb9850ec990ec78e6a25319715584fd7652b9b26f96fcb1510"
@@ -3360,10 +3396,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb"
"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a"
"checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
-"checksum rstest 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "745d702a3d89b8f918615d9d868d26f88b5bf203ace5cc1a95dae461b95400c3"
+"checksum rstest 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9f190eb149083bb5a4a7fd9e3360ede6f2f3b3ccd4c1b00c232874c058fdcece"
"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
+"checksum rustversion 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c48f91977f4ef3be5358c15d131d3f663f6b4d7a112555bf3bf52ad23b6659e5"
"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8"
"checksum safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"
@@ -3381,7 +3418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a"
"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
-"checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d"
+"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
"checksum signal-hook 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4f61c4d59f3aaa9f61bba6450a9b80ba48362fd7d651689e7a10c453b1f6dc68"
"checksum signal-hook-registry 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1797d48f38f91643908bb14e35e79928f9f4b3cefb2420a564dde0991b4358dc"
"checksum simplelog 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "05a3e303ace6adb0a60a9e9e2fbc6a33e1749d1e43587e2125f7efa9c5e107c5"
@@ -3395,12 +3432,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum string_cache_codegen 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6"
"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-"checksum structopt 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "30b3a3e93f5ad553c38b3301c8a0a0cec829a36783f6a0c467fc4bf553a5f5bf"
-"checksum structopt-derive 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea692d40005b3ceba90a9fe7a78fa8d4b82b0ce627eebbffc329aab850f3410e"
-"checksum strum 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6138f8f88a16d90134763314e3fc76fa3ed6a7db4725d6acf9a3ef95a3188d22"
-"checksum strum_macros 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0054a7df764039a6cd8592b9de84be4bec368ff081d203a7d5371cbfa8e65c81"
+"checksum structopt 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a1bcbed7d48956fcbb5d80c6b95aedb553513de0a1b451ea92679d999c010e98"
+"checksum structopt-derive 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "095064aa1f5b94d14e635d0a5684cf140c43ae40a0fd990708d38f5d669e5f64"
+"checksum strum 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "530efb820d53b712f4e347916c5e7ed20deb76a4f0457943b3182fb889b06d2c"
+"checksum strum_macros 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6e163a520367c465f59e0a61a23cfae3b10b6546d78b6f672a382be79f7110"
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
+"checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3"
@@ -3445,7 +3483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
-"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61"
+"checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb"
"checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
"checksum v_escape 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "660b101c07b5d0863deb9e7fb3138777e858d6d2a79f9e6049a27d1cc77c6da6"
diff --git a/Cargo.toml b/Cargo.toml
index fddec70..55ccc76 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ percent-encoding = "2.1"
htmlescape = "0.3.1"
bytesize = "1.0.0"
nanoid = "0.2.0"
-alphanumeric-sort = "1.0.11"
+alphanumeric-sort = "1.0.12"
structopt = "0.3"
chrono = "0.4.10"
chrono-humanize = "0.0.11"
@@ -42,10 +42,10 @@ futures = "0.1.29"
libflate = "0.1.26"
failure = "0.1.5"
log = "0.4.8"
-strum = "0.16.0"
-strum_macros = "0.16.0"
-sha2 = "0.8.0"
-hex = "0.4.0"
+strum = "0.17.1"
+strum_macros = "0.17.1"
+sha2 = "0.8.1"
+hex = "0.4.2"
[dev-dependencies]
assert_cmd = "0.12"
diff --git a/src/file_upload.rs b/src/file_upload.rs
index b79e8ff..af4fcf2 100644
--- a/src/file_upload.rs
+++ b/src/file_upload.rs
@@ -120,6 +120,7 @@ fn handle_multipart(
pub fn upload_file(
req: &HttpRequest<crate::MiniserveConfig>,
default_color_scheme: ColorScheme,
+ uses_random_route: bool
) -> FutureResponse<HttpResponse> {
let return_path = if let Some(header) = req.headers().get(header::REFERER) {
header.to_str().unwrap_or("/").to_owned()
@@ -146,6 +147,7 @@ pub fn upload_file(
query_params.order,
color_scheme,
default_color_scheme,
+ uses_random_route
));
}
};
@@ -165,6 +167,7 @@ pub fn upload_file(
query_params.order,
color_scheme,
default_color_scheme,
+ uses_random_route
));
}
};
@@ -184,6 +187,7 @@ pub fn upload_file(
query_params.order,
color_scheme,
default_color_scheme,
+ uses_random_route
));
}
};
@@ -208,12 +212,14 @@ pub fn upload_file(
query_params.order,
color_scheme,
default_color_scheme,
+ uses_random_route
),
}),
)
}
/// Convenience method for creating response errors, if file upload fails.
+#[allow(clippy::too_many_arguments)]
fn create_error_response(
description: &str,
error_code: StatusCode,
@@ -222,6 +228,7 @@ fn create_error_response(
sorting_order: Option<SortingOrder>,
color_scheme: ColorScheme,
default_color_scheme: ColorScheme,
+ uses_random_route: bool
) -> FutureResult<HttpResponse, actix_web::error::Error> {
errors::log_error_chain(description.to_string());
future::ok(
@@ -237,7 +244,7 @@ fn create_error_response(
color_scheme,
default_color_scheme,
true,
- true,
+ !uses_random_route,
)
.into_string(),
),
diff --git a/src/main.rs b/src/main.rs
index eb90eaf..2482d95 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -267,6 +267,7 @@ fn configure_app(app: App<MiniserveConfig>) -> App<MiniserveConfig> {
};
let random_route = app.state().random_route.clone().unwrap_or_default();
+ let uses_random_route = app.state().random_route.clone().is_some();
let full_route = format!("/{}", random_route);
if let Some(s) = s {
@@ -275,7 +276,7 @@ fn configure_app(app: App<MiniserveConfig>) -> App<MiniserveConfig> {
// Allow file upload
app.resource(&upload_route, move |r| {
r.method(Method::POST)
- .f(move |file| file_upload::upload_file(file, default_color_scheme))
+ .f(move |file| file_upload::upload_file(file, default_color_scheme, uses_random_route))
})
// Handle directories
.handler(&full_route, s)
@@ -295,11 +296,7 @@ fn configure_app(app: App<MiniserveConfig>) -> App<MiniserveConfig> {
fn error_404(req: &HttpRequest<crate::MiniserveConfig>) -> Result<HttpResponse, io::Error> {
let err_404 = ContextualError::RouteNotFoundError(req.path().to_string());
let default_color_scheme = req.state().default_color_scheme;
- let return_address = match &req.state().random_route {
- Some(random_route) => format!("/{}", random_route),
- None => "/".to_string(),
- };
-
+ let uses_random_route = req.state().random_route.is_some();
let query_params = listing::extract_query_parameters(req);
let color_scheme = query_params.theme.unwrap_or(default_color_scheme);
@@ -309,13 +306,13 @@ fn error_404(req: &HttpRequest<crate::MiniserveConfig>) -> Result<HttpResponse,
renderer::render_error(
&err_404.to_string(),
StatusCode::NOT_FOUND,
- &return_address,
+ "/",
query_params.sort,
query_params.order,
color_scheme,
default_color_scheme,
false,
- true,
+ !uses_random_route,
)
.into_string(),
))
diff --git a/src/renderer.rs b/src/renderer.rs
index cbad557..1821c48 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -33,61 +33,64 @@ pub fn page(
);
html! {
- (page_header(serve_path, color_scheme, file_upload, false))
- body#drop-container {
- @if file_upload {
- div.drag-form {
- div.drag-title {
- h1 { "Drop your file here to upload it" }
+ (DOCTYPE)
+ html {
+ (page_header(serve_path, color_scheme, file_upload, false))
+ body#drop-container {
+ @if file_upload {
+ div.drag-form {
+ div.drag-title {
+ h1 { "Drop your file here to upload it" }
+ }
}
}
- }
- (color_scheme_selector(sort_method, sort_order, color_scheme, default_color_scheme, serve_path))
- div.container {
- span#top { }
- h1.title { "Index of " (serve_path) }
- div.toolbar {
- div.download {
- @for compression_method in CompressionMethod::iter() {
- (archive_button(compression_method, sort_method, sort_order, color_scheme, default_color_scheme))
+ (color_scheme_selector(sort_method, sort_order, color_scheme, default_color_scheme, serve_path))
+ div.container {
+ span#top { }
+ h1.title { "Index of " (serve_path) }
+ div.toolbar {
+ div.download {
+ @for compression_method in CompressionMethod::iter() {
+ (archive_button(compression_method, sort_method, sort_order, color_scheme, default_color_scheme))
+ }
}
- }
- @if file_upload {
- div.upload {
- form id="file_submit" action=(upload_action) method="POST" enctype="multipart/form-data" {
- p { "Select a file to upload or drag it anywhere into the window" }
- div {
- input#file-input type="file" name="file_to_upload" required="" {}
- button type="submit" { "Upload file" }
+ @if file_upload {
+ div.upload {
+ form id="file_submit" action=(upload_action) method="POST" enctype="multipart/form-data" {
+ p { "Select a file to upload or drag it anywhere into the window" }
+ div {
+ input#file-input type="file" name="file_to_upload" required="" {}
+ button type="submit" { "Upload file" }
+ }
}
}
}
}
- }
- table {
- thead {
- th { (build_link("name", "Name", sort_method, sort_order, color_scheme, default_color_scheme)) }
- th { (build_link("size", "Size", sort_method, sort_order, color_scheme, default_color_scheme)) }
- th { (build_link("date", "Last modification", sort_method, sort_order, color_scheme, default_color_scheme)) }
- }
- tbody {
- @if !is_root {
- tr {
- td colspan="3" {
- span.root-chevron { (chevron_left()) }
- a.root href=(parametrized_link("../", sort_method, sort_order, color_scheme, default_color_scheme)) {
- "Parent directory"
+ table {
+ thead {
+ th { (build_link("name", "Name", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ th { (build_link("size", "Size", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ th { (build_link("date", "Last modification", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ }
+ tbody {
+ @if !is_root {
+ tr {
+ td colspan="3" {
+ span.root-chevron { (chevron_left()) }
+ a.root href=(parametrized_link("../", sort_method, sort_order, color_scheme, default_color_scheme)) {
+ "Parent directory"
+ }
}
}
}
- }
- @for entry in entries {
- (entry_row(entry, sort_method, sort_order, color_scheme, default_color_scheme))
+ @for entry in entries {
+ (entry_row(entry, sort_method, sort_order, color_scheme, default_color_scheme))
+ }
}
}
- }
- a.back href="#top" {
- (arrow_up())
+ a.back href="#top" {
+ (arrow_up())
+ }
}
}
}
@@ -803,14 +806,13 @@ fn page_header(
is_error: bool,
) -> Markup {
html! {
- (DOCTYPE)
- html {
+ head {
meta charset="utf-8";
meta http-equiv="X-UA-Compatible" content="IE=edge";
meta name="viewport" content="width=device-width, initial-scale=1";
@if is_error {
title { (serve_path) }
- } else {
+ } @else {
title { "Index of " (serve_path) }
}
style { (css(color_scheme)) }
@@ -905,17 +907,20 @@ pub fn render_error(
};
html! {
- body {
+ (DOCTYPE)
+ html {
(page_header(&error_code.to_string(), color_scheme, false, true))
- div.error {
- p { (error_code.to_string()) }
- @for error in error_description.lines() {
- p { (error) }
- }
- @if display_back_link {
- div.error-nav {
- a.error-back href=(link) {
- "Go back to file listing"
+ body {
+ div.error {
+ p { (error_code.to_string()) }
+ @for error in error_description.lines() {
+ p { (error) }
+ }
+ @if display_back_link {
+ div.error-nav {
+ a.error-back href=(link) {
+ "Go back to file listing"
+ }
}
}
}