mirror of
https://github.com/Tim-Paik/srv.git
synced 2024-10-13 00:29:43 +00:00
Compare commits
6 Commits
v1.0.3
...
fc809f9bc9
Author | SHA1 | Date | |
---|---|---|---|
fc809f9bc9
|
|||
479f6006a6
|
|||
c15c09f07c
|
|||
17c6053ed2
|
|||
4ccea5edf2
|
|||
8251624981
|
514
Cargo.lock
generated
514
Cargo.lock
generated
@ -21,9 +21,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "actix-files"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e04dcf7654254676d434b0285e2298d577ed4826f67f536e7a39bb0f64721164"
|
||||
checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"actix-service",
|
||||
@ -226,16 +226,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "actix-web-httpauth"
|
||||
version = "0.6.0"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08c25a48b4684f90520183cd1a688e5f4f7e9905835fa75d02c0fe4f60fcdbe6"
|
||||
checksum = "6dda62cf04bc3a9ad2ea8f314f721951cfdb4cdacec4e984d20e77c7bb170991"
|
||||
dependencies = [
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"base64",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
@ -280,12 +280,65 @@ dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139"
|
||||
dependencies = [
|
||||
"askama_derive",
|
||||
"askama_escape",
|
||||
"askama_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_actix"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c52f74f8382a142ecfc052100b21abc33f2c069e20fe345808e7ed914b179449"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"askama",
|
||||
"askama_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_derive"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71"
|
||||
dependencies = [
|
||||
"askama_shared",
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_escape"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
|
||||
|
||||
[[package]]
|
||||
name = "askama_shared"
|
||||
version = "0.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0"
|
||||
dependencies = [
|
||||
"askama_escape",
|
||||
"humansize",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"nom",
|
||||
"num-traits",
|
||||
"percent-encoding",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
@ -366,15 +419,6 @@ dependencies = [
|
||||
"alloc-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.10.0"
|
||||
@ -395,9 +439,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
|
||||
|
||||
[[package]]
|
||||
name = "bytestring"
|
||||
@ -423,45 +467,11 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58549f1842da3080ce63002102d5bc954c7bc843d4f47818e642abdc36253552"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz-build",
|
||||
"phf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono-tz-build"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db058d493fb2f65f41861bfed7e3fe6335264a9f0f92710cab5bdf01fef09069"
|
||||
dependencies = [
|
||||
"parse-zoneinfo",
|
||||
"phf",
|
||||
"phf_codegen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.12"
|
||||
version = "3.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab8b79fe3946ceb4a0b1c080b4018992b8d27e9ff363644c1c9b6387c854614d"
|
||||
checksum = "44bbe24bbd31a185bc2c4f7c2abe80bea13a20d57ee4e55be70ac512bdc76417"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
@ -483,6 +493,24 @@ dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "comrak"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15bf1e432b302dc6236dd0db580d182ce520bb24af82d6462e2d7a5e0a31c50d"
|
||||
dependencies = [
|
||||
"entities",
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"regex",
|
||||
"shell-words",
|
||||
"typed-arena",
|
||||
"unicode_categories",
|
||||
"xdg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.4.0"
|
||||
@ -518,16 +546,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
@ -551,12 +569,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.8.1"
|
||||
@ -576,6 +588,26 @@ dependencies = [
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.31"
|
||||
@ -585,6 +617,12 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "entities"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.9.0"
|
||||
@ -664,6 +702,7 @@ dependencies = [
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -696,30 +735,6 @@ dependencies = [
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "globwalk"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"ignore",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "h2"
|
||||
version = "0.3.13"
|
||||
@ -806,24 +821,6 @@ dependencies = [
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.1"
|
||||
@ -851,9 +848,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@ -947,6 +944,12 @@ dependencies = [
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.5.3"
|
||||
@ -969,13 +972,13 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
name = "nom"
|
||||
version = "7.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
|
||||
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
"memchr",
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1047,15 +1050,6 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parse-zoneinfo"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.7"
|
||||
@ -1111,45 +1105,6 @@ dependencies = [
|
||||
"sha-1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_codegen"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
|
||||
dependencies = [
|
||||
"phf_generator",
|
||||
"phf_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
"uncased",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
@ -1170,9 +1125,9 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -1218,13 +1173,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.6.0"
|
||||
@ -1293,15 +1259,6 @@ version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
@ -1326,18 +1283,18 @@ checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.139"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0171ebb889e45aa68b44aee0859b3eede84c6f5f5c228e6f140c0b2a0a46cad6"
|
||||
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.139"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1d3230c1de7932af58ad8ffbe1d784bd55efd5a9d84ac24f69c72d83543dfb"
|
||||
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1401,6 +1358,12 @@ dependencies = [
|
||||
"digest 0.10.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-words"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.0"
|
||||
@ -1410,25 +1373,13 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
|
||||
[[package]]
|
||||
name = "slug"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
|
||||
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
||||
dependencies = [
|
||||
"deunicode",
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1455,21 +1406,22 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "srv"
|
||||
version = "1.0.2"
|
||||
version = "1.0.5"
|
||||
dependencies = [
|
||||
"actix-files",
|
||||
"actix-web",
|
||||
"actix-web-httpauth",
|
||||
"askama",
|
||||
"askama_actix",
|
||||
"clap",
|
||||
"comrak",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"mime_guess",
|
||||
"rustls",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"sha2",
|
||||
"tera",
|
||||
"time",
|
||||
"toml",
|
||||
"urlencoding",
|
||||
@ -1492,28 +1444,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tera"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c9783d6ff395ae80cf17ed9a25360e7ba37742a79fa8fddabb073c5c7c8856d"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"chrono-tz",
|
||||
"globwalk",
|
||||
"humansize",
|
||||
"lazy_static",
|
||||
"percent-encoding",
|
||||
"pest",
|
||||
"pest_derive",
|
||||
"rand",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"slug",
|
||||
"unic-segment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
@ -1543,12 +1473,23 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.4"
|
||||
name = "thiserror"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1586,9 +1527,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.20.0"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57aec3cfa4c296db7255446efb4928a6be304b431a806216105542a67b6ca82e"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
@ -1658,6 +1599,12 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typed-arena"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.15.0"
|
||||
@ -1670,65 +1617,6 @@ version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c"
|
||||
|
||||
[[package]]
|
||||
name = "uncased"
|
||||
version = "0.9.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-property"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221"
|
||||
dependencies = [
|
||||
"unic-char-range",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-char-range"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-common"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc"
|
||||
|
||||
[[package]]
|
||||
name = "unic-segment"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23"
|
||||
dependencies = [
|
||||
"unic-ucd-segment",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-segment"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700"
|
||||
dependencies = [
|
||||
"unic-char-property",
|
||||
"unic-char-range",
|
||||
"unic-ucd-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unic-ucd-version"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4"
|
||||
dependencies = [
|
||||
"unic-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
@ -1759,6 +1647,12 @@ dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
version = "0.7.1"
|
||||
@ -1789,17 +1683,6 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
@ -1808,9 +1691,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@ -1818,13 +1701,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@ -1833,9 +1716,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@ -1843,9 +1726,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -1856,15 +1739,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||
checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@ -1963,6 +1846,15 @@ version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
||||
[[package]]
|
||||
name = "xdg"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.11.2+zstd.1.5.2"
|
||||
|
11
Cargo.toml
11
Cargo.toml
@ -3,23 +3,24 @@ authors = ["Tim_Paik <timpaikc@outlook.com>"]
|
||||
description = "simple http server written in rust"
|
||||
edition = "2018"
|
||||
name = "srv"
|
||||
version = "1.0.2"
|
||||
version = "1.0.5"
|
||||
|
||||
[dependencies]
|
||||
actix-files = "0.6"
|
||||
actix-web = {version = "4.1", features = ["rustls"]}
|
||||
actix-web-httpauth = "0.6"
|
||||
actix-web-httpauth = "0.8"
|
||||
askama = "0.11"
|
||||
askama_actix = "0.13"
|
||||
clap = {version = "3.2", features = ["wrap_help", "color", "cargo"]}
|
||||
comrak = {version = "0.14.0", default-features = false}
|
||||
env_logger = "0.9"
|
||||
lazy_static = "1.4"
|
||||
log = "0.4"
|
||||
mime_guess = "2.0"
|
||||
rustls = "0.20"
|
||||
rustls-pemfile = "1.0"
|
||||
serde = {version = "1.0", features = ["derive"]}
|
||||
sha2 = "0.10"
|
||||
tera = "1.16"
|
||||
time = { version = "0.3", features = ["formatting", "parsing"] }
|
||||
time = {version = "0.3", features = ["formatting", "parsing"]}
|
||||
toml = "0.5"
|
||||
urlencoding = "2.1"
|
||||
|
||||
|
@ -8,7 +8,7 @@ This is a simple HTTP Server for use in a development environment, inspired by [
|
||||
### Built With
|
||||
|
||||
- [clap](https://github.com/clap-rs/clap) Provide command line parameter analysis
|
||||
- [tera](https://github.com/Keats/tera) Provide template support
|
||||
- [askama](https://github.com/djc/askama) Provide template support
|
||||
- [actix-web](https://github.com/actix/actix-web) Main frame
|
||||
- [actix-files](https://github.com/actix/actix-web/tree/master/actix-files) Provide static resources
|
||||
- [actix-web-httpauth](https://github.com/actix/actix-extras/tree/master/actix-web-httpauth) Provide authentication
|
||||
|
120
src/filetype.rs
Normal file
120
src/filetype.rs
Normal file
@ -0,0 +1,120 @@
|
||||
#[inline]
|
||||
pub fn get_file_type(from: &std::path::Path) -> String {
|
||||
match from.extension() {
|
||||
Some(os_str) => match os_str.to_str().unwrap_or("") {
|
||||
"7z" => "archive",
|
||||
"bz" => "archive",
|
||||
"bz2" => "archive",
|
||||
"cab" => "archive",
|
||||
"gz" => "archive",
|
||||
"iso" => "archive",
|
||||
"rar" => "archive",
|
||||
"xz" => "archive",
|
||||
"zip" => "archive",
|
||||
"zst" => "archive",
|
||||
"zstd" => "archive",
|
||||
"doc" => "word",
|
||||
"docx" => "word",
|
||||
"ppt" => "powerpoint",
|
||||
"pptx" => "powerpoint",
|
||||
"xls" => "excel",
|
||||
"xlsx" => "excel",
|
||||
"heic" => "image",
|
||||
"pdf" => "pdf",
|
||||
// JavaScript / TypeScript
|
||||
"js" => "code",
|
||||
"cjs" => "code",
|
||||
"mjs" => "code",
|
||||
"jsx" => "code",
|
||||
"ts" => "code",
|
||||
"tsx" => "code",
|
||||
"json" => "code",
|
||||
"coffee" => "code",
|
||||
// HTML / CSS
|
||||
"html" => "code",
|
||||
"htm" => "code",
|
||||
"xml" => "code",
|
||||
"xhtml" => "code",
|
||||
"vue" => "code",
|
||||
"ejs" => "code",
|
||||
"template" => "code",
|
||||
"tmpl" => "code",
|
||||
"pug" => "code",
|
||||
"art" => "code",
|
||||
"hbs" => "code",
|
||||
"css" => "code",
|
||||
"scss" => "code",
|
||||
"sass" => "code",
|
||||
"less" => "code",
|
||||
// Python
|
||||
"py" => "code",
|
||||
"pyc" => "code",
|
||||
// JVM
|
||||
"java" => "code",
|
||||
"kt" => "code",
|
||||
"kts" => "code",
|
||||
"gradle" => "code",
|
||||
"groovy" => "code",
|
||||
"scala" => "code",
|
||||
"jsp" => "code",
|
||||
// Shell
|
||||
"sh" => "code",
|
||||
// Php
|
||||
"php" => "code",
|
||||
// C / C++
|
||||
"c" => "code",
|
||||
"cc" => "code",
|
||||
"cpp" => "code",
|
||||
"h" => "code",
|
||||
"cmake" => "code",
|
||||
// C#
|
||||
"cs" => "code",
|
||||
"xaml" => "code",
|
||||
"sln" => "code",
|
||||
"csproj" => "code",
|
||||
// Golang
|
||||
"go" => "code",
|
||||
"mod" => "code",
|
||||
"sum" => "code",
|
||||
// Swift
|
||||
"swift" => "code",
|
||||
"plist" => "code",
|
||||
"xib" => "code",
|
||||
"xcconfig" => "code",
|
||||
"entitlements" => "code",
|
||||
"xcworkspacedata" => "code",
|
||||
"pbxproj" => "code",
|
||||
// Ruby
|
||||
"rb" => "code",
|
||||
// Rust
|
||||
"rs" => "code",
|
||||
// Objective-C
|
||||
"m" => "code",
|
||||
// Dart
|
||||
"dart" => "code",
|
||||
// Microsoft
|
||||
"manifest" => "code",
|
||||
"rc" => "code",
|
||||
"cmd" => "code",
|
||||
"bat" => "code",
|
||||
"ps1" => "code",
|
||||
// Config
|
||||
"ini" => "code",
|
||||
"yaml" => "code",
|
||||
"toml" => "code",
|
||||
"conf" => "code",
|
||||
"properties" => "code",
|
||||
"lock" => "alt",
|
||||
_ => match mime_guess::from_path(from).first_or_octet_stream().type_() {
|
||||
mime_guess::mime::AUDIO => "audio",
|
||||
mime_guess::mime::IMAGE => "image",
|
||||
mime_guess::mime::PDF => "pdf",
|
||||
mime_guess::mime::VIDEO => "video",
|
||||
mime_guess::mime::TEXT => "alt",
|
||||
_ => "file",
|
||||
},
|
||||
},
|
||||
None => "file",
|
||||
}
|
||||
.to_string()
|
||||
}
|
283
src/main.rs
283
src/main.rs
@ -2,158 +2,34 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
mod filetype;
|
||||
|
||||
use actix_files as fs;
|
||||
use actix_web::{
|
||||
dev::{self, Service, ServiceResponse},
|
||||
http, middleware, App, HttpResponse, HttpServer,
|
||||
dev::{Response, Service, ServiceRequest, ServiceResponse},
|
||||
http, middleware, App, HttpRequest, HttpResponse, HttpServer,
|
||||
};
|
||||
use actix_web_httpauth::{
|
||||
extractors::{basic::BasicAuth, AuthenticationError},
|
||||
headers::www_authenticate::basic::Basic,
|
||||
middleware::HttpAuthentication,
|
||||
};
|
||||
use askama_actix::TemplateToResponse;
|
||||
use clap::Arg;
|
||||
use env_logger::fmt::Color;
|
||||
use log::{error, info};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::Digest;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
env::{set_var, var},
|
||||
fs::read_dir,
|
||||
io::{BufReader, Error, ErrorKind, Read, Write},
|
||||
fs::{self, metadata, read_dir, read_to_string},
|
||||
io::{self, BufReader, Read, Write},
|
||||
net::IpAddr,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
pub static ref TEMPLATE: tera::Tera = {
|
||||
let mut tera = tera::Tera::default();
|
||||
tera.add_raw_template("index", include_str!("../templates/index.html.tera"))
|
||||
.unwrap();
|
||||
tera
|
||||
};
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_file_type(from: &Path) -> String {
|
||||
match from.extension() {
|
||||
Some(os_str) => match os_str.to_str().unwrap_or("") {
|
||||
"7z" => "archive",
|
||||
"bz" => "archive",
|
||||
"bz2" => "archive",
|
||||
"cab" => "archive",
|
||||
"gz" => "archive",
|
||||
"iso" => "archive",
|
||||
"rar" => "archive",
|
||||
"xz" => "archive",
|
||||
"zip" => "archive",
|
||||
"zst" => "archive",
|
||||
"zstd" => "archive",
|
||||
"doc" => "word",
|
||||
"docx" => "word",
|
||||
"ppt" => "powerpoint",
|
||||
"pptx" => "powerpoint",
|
||||
"xls" => "excel",
|
||||
"xlsx" => "excel",
|
||||
"heic" => "image",
|
||||
"pdf" => "pdf",
|
||||
// JavaScript / TypeScript
|
||||
"js" => "code",
|
||||
"cjs" => "code",
|
||||
"mjs" => "code",
|
||||
"jsx" => "code",
|
||||
"ts" => "code",
|
||||
"tsx" => "code",
|
||||
"json" => "code",
|
||||
"coffee" => "code",
|
||||
// HTML / CSS
|
||||
"html" => "code",
|
||||
"htm" => "code",
|
||||
"xml" => "code",
|
||||
"xhtml" => "code",
|
||||
"vue" => "code",
|
||||
"ejs" => "code",
|
||||
"template" => "code",
|
||||
"tmpl" => "code",
|
||||
"pug" => "code",
|
||||
"art" => "code",
|
||||
"hbs" => "code",
|
||||
"tera" => "code",
|
||||
"css" => "code",
|
||||
"scss" => "code",
|
||||
"sass" => "code",
|
||||
"less" => "code",
|
||||
// Python
|
||||
"py" => "code",
|
||||
"pyc" => "code",
|
||||
// JVM
|
||||
"java" => "code",
|
||||
"kt" => "code",
|
||||
"kts" => "code",
|
||||
"gradle" => "code",
|
||||
"groovy" => "code",
|
||||
"scala" => "code",
|
||||
"jsp" => "code",
|
||||
// Shell
|
||||
"sh" => "code",
|
||||
// Php
|
||||
"php" => "code",
|
||||
// C / C++
|
||||
"c" => "code",
|
||||
"cc" => "code",
|
||||
"cpp" => "code",
|
||||
"h" => "code",
|
||||
"cmake" => "code",
|
||||
// C#
|
||||
"cs" => "code",
|
||||
"xaml" => "code",
|
||||
"sln" => "code",
|
||||
"csproj" => "code",
|
||||
// Golang
|
||||
"go" => "code",
|
||||
"mod" => "code",
|
||||
"sum" => "code",
|
||||
// Swift
|
||||
"swift" => "code",
|
||||
"plist" => "code",
|
||||
"xib" => "code",
|
||||
"xcconfig" => "code",
|
||||
"entitlements" => "code",
|
||||
"xcworkspacedata" => "code",
|
||||
"pbxproj" => "code",
|
||||
// Ruby
|
||||
"rb" => "code",
|
||||
// Rust
|
||||
"rs" => "code",
|
||||
// Objective-C
|
||||
"m" => "code",
|
||||
// Dart
|
||||
"dart" => "code",
|
||||
// Microsoft
|
||||
"manifest" => "code",
|
||||
"rc" => "code",
|
||||
"cmd" => "code",
|
||||
"bat" => "code",
|
||||
"ps1" => "code",
|
||||
// Config
|
||||
"ini" => "code",
|
||||
"yaml" => "code",
|
||||
"toml" => "code",
|
||||
"conf" => "code",
|
||||
"properties" => "code",
|
||||
"lock" => "alt",
|
||||
_ => match mime_guess::from_path(from).first_or_octet_stream().type_() {
|
||||
mime_guess::mime::AUDIO => "audio",
|
||||
mime_guess::mime::IMAGE => "image",
|
||||
mime_guess::mime::PDF => "pdf",
|
||||
mime_guess::mime::VIDEO => "video",
|
||||
mime_guess::mime::TEXT => "alt",
|
||||
_ => "file",
|
||||
},
|
||||
},
|
||||
None => "file",
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Package {
|
||||
@ -179,9 +55,12 @@ struct File {
|
||||
modified: String,
|
||||
}
|
||||
|
||||
#[derive(askama_actix::Template)]
|
||||
#[template(path = "index.html")]
|
||||
#[derive(Serialize)]
|
||||
struct IndexContext {
|
||||
title: String,
|
||||
readme: String,
|
||||
paths: Vec<String>,
|
||||
dirs: Vec<Dir>,
|
||||
files: Vec<File>,
|
||||
@ -189,8 +68,8 @@ struct IndexContext {
|
||||
|
||||
fn render_index(
|
||||
dir: &actix_files::Directory,
|
||||
req: &actix_web::HttpRequest,
|
||||
) -> Result<ServiceResponse, std::io::Error> {
|
||||
req: &HttpRequest,
|
||||
) -> Result<ServiceResponse, io::Error> {
|
||||
let mut index = dir.path.clone();
|
||||
index.push("index.html");
|
||||
if index.exists() && index.is_file() {
|
||||
@ -208,6 +87,7 @@ fn render_index(
|
||||
let show_dot_files = var("DOTFILES").unwrap_or_else(|_| "false".to_string()) == "true";
|
||||
let mut context = IndexContext {
|
||||
title: "".to_string(),
|
||||
readme: "".to_string(),
|
||||
paths: vec![],
|
||||
dirs: vec![],
|
||||
files: vec![],
|
||||
@ -216,11 +96,11 @@ fn render_index(
|
||||
if path.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let path =
|
||||
urlencoding::decode(path).unwrap_or(std::borrow::Cow::Borrowed("[Parse URL Error]"));
|
||||
let path = urlencoding::decode(path).unwrap_or(Cow::Borrowed("[Parse URL Error]"));
|
||||
let path = path.into_owned();
|
||||
context.paths.push(path);
|
||||
}
|
||||
let mut readme_str = "".to_string();
|
||||
match read_dir(&dir.path) {
|
||||
Err(e) => {
|
||||
error!(target: "read_dir", "[ERROR] Read dir error: {}", e.to_string());
|
||||
@ -252,7 +132,7 @@ fn render_index(
|
||||
}
|
||||
};
|
||||
let modified = match metadata.modified() {
|
||||
Ok(time) => time::OffsetDateTime::from(time)
|
||||
Ok(time) => OffsetDateTime::from(time)
|
||||
.format(time::macros::format_description!(
|
||||
"[year]/[month]/[day] [hour]:[minute]:[second]"
|
||||
))
|
||||
@ -266,35 +146,55 @@ fn render_index(
|
||||
context.dirs.push(Dir { name, modified });
|
||||
} else if metadata.is_file() {
|
||||
let size = metadata.len();
|
||||
let filetype = get_file_type(&path.path());
|
||||
let filetype = filetype::get_file_type(&path.path());
|
||||
context.files.push(File {
|
||||
name,
|
||||
size,
|
||||
filetype,
|
||||
modified,
|
||||
});
|
||||
if path.file_name().to_ascii_lowercase() == "readme.md" {
|
||||
readme_str = read_to_string(path.path()).unwrap_or_else(|_| "".to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if var("NOINDEX").unwrap_or_else(|_| "false".to_string()) != "true" {
|
||||
context.readme = comrak::markdown_to_html(
|
||||
&readme_str,
|
||||
&comrak::ComrakOptions {
|
||||
extension: comrak::ComrakExtensionOptions {
|
||||
strikethrough: true,
|
||||
tagfilter: true,
|
||||
table: true,
|
||||
autolink: true,
|
||||
tasklist: true,
|
||||
superscript: true,
|
||||
header_ids: None,
|
||||
footnotes: true,
|
||||
description_lists: true,
|
||||
front_matter_delimiter: None,
|
||||
},
|
||||
parse: comrak::ComrakParseOptions {
|
||||
smart: false,
|
||||
default_info_string: None,
|
||||
},
|
||||
render: comrak::ComrakRenderOptions {
|
||||
hardbreaks: false,
|
||||
github_pre_lang: false,
|
||||
width: 1000,
|
||||
unsafe_: true,
|
||||
escape: false,
|
||||
list_style: comrak::ListStyleType::default(),
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
context.title = context.paths.last().unwrap_or(&"/".to_string()).to_string();
|
||||
context.dirs.sort();
|
||||
context.files.sort();
|
||||
let content = tera::Context::from_serialize(&context);
|
||||
let content = match content {
|
||||
Ok(ctx) => ctx,
|
||||
Err(e) => {
|
||||
error!(target: "tera::Context::from_serialize", "[ERROR] Read modified time error: {}", e.to_string());
|
||||
return Err(Error::new(ErrorKind::Other, e.to_string()));
|
||||
}
|
||||
};
|
||||
let index = TEMPLATE
|
||||
.render("index", &content)
|
||||
.unwrap_or_else(|_| "TEMPLATE RENDER ERROR".to_string());
|
||||
let res = HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(index);
|
||||
Ok(ServiceResponse::new(req.to_owned(), res))
|
||||
Ok(ServiceResponse::new(req.to_owned(), context.to_response()))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -316,31 +216,27 @@ fn hash(from: &str) -> String {
|
||||
|
||||
#[inline]
|
||||
async fn validator(
|
||||
req: dev::ServiceRequest,
|
||||
auth: actix_web_httpauth::extractors::basic::BasicAuth,
|
||||
) -> Result<dev::ServiceRequest, actix_web::Error> {
|
||||
req: ServiceRequest,
|
||||
auth: BasicAuth,
|
||||
) -> Result<ServiceRequest, (actix_web::Error, ServiceRequest)> {
|
||||
if auth.user_id()
|
||||
== var("AUTH_USERNAME")
|
||||
.unwrap_or_else(|_| "".to_string())
|
||||
.as_str()
|
||||
&& hash(auth.password().unwrap_or(&std::borrow::Cow::from("")))
|
||||
&& hash(auth.password().unwrap_or(&Cow::from("")))
|
||||
== var("AUTH_PASSWORD")
|
||||
.unwrap_or_else(|_| "".to_string())
|
||||
.as_str()
|
||||
{
|
||||
return Ok(req);
|
||||
}
|
||||
let err = actix_web_httpauth::extractors::AuthenticationError::new(
|
||||
actix_web_httpauth::headers::www_authenticate::basic::Basic::with_realm(
|
||||
"Incorrect username or password",
|
||||
),
|
||||
);
|
||||
Err(actix_web::Error::from(err))
|
||||
let err = AuthenticationError::new(Basic::with_realm("Incorrect username or password"));
|
||||
Err((actix_web::Error::from(err), req))
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
let check_does_dir_exits = |path: &str| match std::fs::metadata(path) {
|
||||
async fn main() -> io::Result<()> {
|
||||
let check_does_dir_exits = |path: &str| match metadata(path) {
|
||||
Ok(meta) => {
|
||||
if meta.is_dir() {
|
||||
Ok(())
|
||||
@ -350,7 +246,7 @@ async fn main() -> std::io::Result<()> {
|
||||
}
|
||||
Err(e) => Err(e.to_string()),
|
||||
};
|
||||
let check_does_file_exits = |path: &str| match std::fs::metadata(path) {
|
||||
let check_does_file_exits = |path: &str| match metadata(path) {
|
||||
Ok(metadata) => {
|
||||
if metadata.is_file() {
|
||||
Ok(())
|
||||
@ -380,6 +276,7 @@ async fn main() -> std::io::Result<()> {
|
||||
};
|
||||
let matches = clap::command!()
|
||||
.arg(Arg::new("noindex").long("noindex").help("Disable automatic index page generation"))
|
||||
.arg(Arg::new("noreadme").long("noreadme").help("Disable automatic readme rendering"))
|
||||
.arg(Arg::new("nocache").long("nocache").help("Disable HTTP cache"))
|
||||
.arg(Arg::new("nocolor").long("nocolor").help("Disable cli colors"))
|
||||
.arg(Arg::new("cors").long("cors").takes_value(true).min_values(0).max_values(1).help("Enable CORS [with custom value]"))
|
||||
@ -411,6 +308,7 @@ async fn main() -> std::io::Result<()> {
|
||||
);
|
||||
|
||||
set_var("NOINDEX", matches.is_present("noindex").to_string());
|
||||
set_var("NOREADME", matches.is_present("noreadme").to_string());
|
||||
set_var("SPA", matches.is_present("spa").to_string());
|
||||
set_var("DOTFILES", matches.is_present("dotfiles").to_string());
|
||||
set_var("NOCACHE", matches.is_present("nocache").to_string());
|
||||
@ -463,9 +361,9 @@ async fn main() -> std::io::Result<()> {
|
||||
|
||||
let open_in_browser = |url: &str| {
|
||||
if cfg!(target_os = "windows") {
|
||||
std::process::Command::new("explorer").arg(url).spawn().ok();
|
||||
Command::new("explorer").arg(url).spawn().ok();
|
||||
} else if cfg!(target_os = "macos") {
|
||||
std::process::Command::new("open").arg(url).spawn().ok();
|
||||
Command::new("open").arg(url).spawn().ok();
|
||||
} else if cfg!(target_os = "linux")
|
||||
|| cfg!(target_os = "android")
|
||||
|| cfg!(target_os = "freebsd")
|
||||
@ -473,7 +371,7 @@ async fn main() -> std::io::Result<()> {
|
||||
|| cfg!(target_os = "openbsd")
|
||||
|| cfg!(target_os = "netbsd")
|
||||
{
|
||||
std::process::Command::new("xdg-open").arg(url).spawn().ok();
|
||||
Command::new("xdg-open").arg(url).spawn().ok();
|
||||
}
|
||||
};
|
||||
|
||||
@ -505,15 +403,12 @@ async fn main() -> std::io::Result<()> {
|
||||
if record.target() == "actix_web::middleware::logger" {
|
||||
let data: Vec<&str> = data.splitn(5, '^').collect();
|
||||
let time = blue.value(
|
||||
time::OffsetDateTime::parse(
|
||||
data[0],
|
||||
&time::format_description::well_known::Rfc3339,
|
||||
)
|
||||
.unwrap_or(time::OffsetDateTime::UNIX_EPOCH)
|
||||
.format(time::macros::format_description!(
|
||||
"[year]/[month]/[day] [hour]:[minute]:[second]"
|
||||
))
|
||||
.unwrap_or_else(|_| "".to_string()),
|
||||
OffsetDateTime::parse(data[0], &time::format_description::well_known::Rfc3339)
|
||||
.unwrap_or(OffsetDateTime::UNIX_EPOCH)
|
||||
.format(time::macros::format_description!(
|
||||
"[year]/[month]/[day] [hour]:[minute]:[second]"
|
||||
))
|
||||
.unwrap_or_else(|_| "".to_string()),
|
||||
);
|
||||
let ipaddr = blue.value(data[1]);
|
||||
let status_code = data[2].parse().unwrap_or(500);
|
||||
@ -533,7 +428,7 @@ async fn main() -> std::io::Result<()> {
|
||||
});
|
||||
let content = blue.value(
|
||||
urlencoding::decode(data[4])
|
||||
.unwrap_or(std::borrow::Cow::Borrowed("[Parse URL Error]"))
|
||||
.unwrap_or(Cow::Borrowed("[Parse URL Error]"))
|
||||
.into_owned(),
|
||||
);
|
||||
return writeln!(
|
||||
@ -580,7 +475,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.init();
|
||||
|
||||
let addr = if let Some(matches) = matches.subcommand_matches("doc") {
|
||||
let mut cargo_toml = match std::fs::File::open("./Cargo.toml") {
|
||||
let mut cargo_toml = match fs::File::open("./Cargo.toml") {
|
||||
Ok(file) => file,
|
||||
Err(e) => {
|
||||
error!("[ERROR] {}", e.to_string());
|
||||
@ -604,7 +499,7 @@ async fn main() -> std::io::Result<()> {
|
||||
};
|
||||
let crate_name = contents.package.name;
|
||||
info!("[INFO] Generating document (may take a while)");
|
||||
match std::process::Command::new("cargo").arg("doc").output() {
|
||||
match Command::new("cargo").arg("doc").output() {
|
||||
Ok(output) => {
|
||||
let output = std::str::from_utf8(&output.stderr).unwrap_or("");
|
||||
if output.starts_with("error: could not find `Cargo.toml` in") {
|
||||
@ -680,7 +575,7 @@ async fn main() -> std::io::Result<()> {
|
||||
if isdotfile
|
||||
&& var("DOTFILES").unwrap_or_else(|_| "false".to_string()) != "true"
|
||||
{
|
||||
return dev::Response::new(http::StatusCode::FORBIDDEN).into_body();
|
||||
return Response::new(http::StatusCode::FORBIDDEN).into_body();
|
||||
}
|
||||
body
|
||||
}))
|
||||
@ -689,15 +584,15 @@ async fn main() -> std::io::Result<()> {
|
||||
.wrap(middleware::Compress::default())
|
||||
.wrap(middleware::Condition::new(
|
||||
var("ENABLE_AUTH").unwrap_or_else(|_| "false".to_string()) == "true",
|
||||
actix_web_httpauth::middleware::HttpAuthentication::basic(validator),
|
||||
HttpAuthentication::basic(validator),
|
||||
))
|
||||
.wrap(middleware::Logger::new("%t^%a^%s^%D^%r"));
|
||||
let files = fs::Files::new("/", var("ROOT").unwrap_or_else(|_| ".".to_string()))
|
||||
let files = actix_files::Files::new("/", var("ROOT").unwrap_or_else(|_| ".".to_string()))
|
||||
.use_hidden_files()
|
||||
.prefer_utf8(true)
|
||||
.show_files_listing()
|
||||
.files_listing_renderer(render_index)
|
||||
.default_handler(|req: dev::ServiceRequest| {
|
||||
.default_handler(|req: ServiceRequest| {
|
||||
let (http_req, _payload) = req.into_parts();
|
||||
async {
|
||||
let path = var("ROOT").unwrap_or_else(|_| ".".to_string());
|
||||
@ -707,7 +602,7 @@ async fn main() -> std::io::Result<()> {
|
||||
&& path.is_file()
|
||||
&& var("SPA").unwrap_or_else(|_| "false".to_string()) == "true"
|
||||
{
|
||||
let res = fs::NamedFile::open(path)?.into_response(&http_req);
|
||||
let res = actix_files::NamedFile::open(path)?.into_response(&http_req);
|
||||
return Ok(ServiceResponse::new(http_req, res));
|
||||
}
|
||||
Ok(ServiceResponse::new(
|
||||
@ -720,10 +615,10 @@ async fn main() -> std::io::Result<()> {
|
||||
});
|
||||
let server = if enable_tls {
|
||||
let cert = &mut BufReader::new(
|
||||
std::fs::File::open(Path::new(matches.value_of("cert").unwrap())).unwrap(),
|
||||
fs::File::open(Path::new(matches.value_of("cert").unwrap())).unwrap(),
|
||||
);
|
||||
let key = &mut BufReader::new(
|
||||
std::fs::File::open(Path::new(matches.value_of("key").unwrap())).unwrap(),
|
||||
fs::File::open(Path::new(matches.value_of("key").unwrap())).unwrap(),
|
||||
);
|
||||
let cert = rustls_pemfile::certs(cert)
|
||||
.unwrap()
|
||||
|
1
templates/github-markdown.css.html
Normal file
1
templates/github-markdown.css.html
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. #}
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. -#}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@ -12,9 +12,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<title>{{ title }}</title>
|
||||
<!--[if lt IE 9
|
||||
]><script src="https://cdn.jsdelivr.net/npm/html5shiv/dist/html5shiv.min.js"></script
|
||||
><![endif]-->
|
||||
<!--[if lt IE 9]><script>
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
|
||||
</script><![endif]-->
|
||||
<style>
|
||||
html,
|
||||
body,
|
||||
@ -142,7 +145,7 @@
|
||||
#meta,
|
||||
#listing {
|
||||
color: #cacaca;
|
||||
background: #000000;
|
||||
background: #0d1117;
|
||||
}
|
||||
|
||||
#header nav span a {
|
||||
@ -151,7 +154,7 @@
|
||||
|
||||
#header {
|
||||
padding: 1.5rem 5% 1rem;
|
||||
background-color: #0e0e0e;
|
||||
background-color: #161b22;
|
||||
}
|
||||
|
||||
#listing table {
|
||||
@ -219,7 +222,6 @@
|
||||
d="M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm220.1-208c-5.7 0-10.6 4-11.7 9.5-20.6 97.7-20.4 95.4-21 103.5-.2-1.2-.4-2.6-.7-4.3-.8-5.1.3.2-23.6-99.5-1.3-5.4-6.1-9.2-11.7-9.2h-13.3c-5.5 0-10.3 3.8-11.7 9.1-24.4 99-24 96.2-24.8 103.7-.1-1.1-.2-2.5-.5-4.2-.7-5.2-14.1-73.3-19.1-99-1.1-5.6-6-9.7-11.8-9.7h-16.8c-7.8 0-13.5 7.3-11.7 14.8 8 32.6 26.7 109.5 33.2 136 1.3 5.4 6.1 9.1 11.7 9.1h25.2c5.5 0 10.3-3.7 11.6-9.1l17.9-71.4c1.5-6.2 2.5-12 3-17.3l2.9 17.3c.1.4 12.6 50.5 17.9 71.4 1.3 5.3 6.1 9.1 11.6 9.1h24.7c5.5 0 10.3-3.7 11.6-9.1 20.8-81.9 30.2-119 34.5-136 1.9-7.6-3.8-14.9-11.6-14.9h-15.8z" />
|
||||
</defs>
|
||||
</svg>
|
||||
{% set paths_length = paths | length -%}
|
||||
<header id="header">
|
||||
<h1>
|
||||
<nav>
|
||||
@ -228,7 +230,7 @@
|
||||
</span>
|
||||
{% for path in paths -%}
|
||||
<span>
|
||||
<a href="./{% for i in range(end=paths | length - loop.index) %}../{% endfor %}">{{ path }} /
|
||||
<a href="./{% for i in 0..(paths.len() - loop.index) %}../{% endfor %}">{{ path }} /
|
||||
</a>
|
||||
</span>
|
||||
{% endfor -%}
|
||||
@ -237,10 +239,8 @@
|
||||
</header>
|
||||
<main>
|
||||
<div id="meta">
|
||||
{% set dir_length = dirs | length -%}
|
||||
{% set file_length = files | length -%}
|
||||
<span><b>{{ dir_length }}</b> directories</span>
|
||||
<span><b>{{ file_length }}</b> files</span>
|
||||
<span><b>{{ dirs.len() }}</b> directories</span>
|
||||
<span><b>{{ files.len() }}</b> files</span>
|
||||
</div>
|
||||
<div id="listing">
|
||||
<table>
|
||||
@ -298,15 +298,7 @@
|
||||
<span>{{ file.name }}</span></a>
|
||||
</td>
|
||||
<td data-order="-1">
|
||||
{{ file.size | filesizeformat |
|
||||
replace(from="KB", to="KiB") |
|
||||
replace(from="MB", to="MiB") |
|
||||
replace(from="GB", to="GiB") |
|
||||
replace(from="TB", to="TiB") |
|
||||
replace(from="PB", to="PiB") |
|
||||
replace(from="EB", to="EiB") |
|
||||
replace(from="ZB", to="ZiB") |
|
||||
replace(from="YB", to="YiB") }}
|
||||
{{ file.size|filesizeformat }}
|
||||
</td>
|
||||
<td class="hideable">
|
||||
<time class="date" datetime="{{ file.modified }}">{{ file.modified }}</time>
|
||||
@ -317,10 +309,30 @@
|
||||
<tr></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% if dir_length + file_length == 0 -%}
|
||||
{% if dirs.len() + files.len() == 0 -%}
|
||||
<div style="text-align: center; margin: 1rem; color: #cccccc;">Nothing here</div>
|
||||
{% endif -%}
|
||||
</div>
|
||||
{% if readme != "".to_string() -%}
|
||||
<div id="readme">
|
||||
{{ readme|safe }}
|
||||
</div>
|
||||
{% include "github-markdown.css.html" %}
|
||||
<style>
|
||||
#readme {
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 10px auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
#readme {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
{% endif -%}
|
||||
</main>
|
||||
<script>
|
||||
(function () {
|
Reference in New Issue
Block a user