mirror of https://github.com/raftario/filite.git
Yet another refactor, back to the origins
This commit is contained in:
parent
3e05f767df
commit
4bbf268196
|
@ -5,3 +5,4 @@ target/
|
|||
|
||||
filite.json
|
||||
.env
|
||||
*.db
|
||||
|
|
|
@ -82,7 +82,7 @@ dependencies = [
|
|||
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -217,7 +217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -304,15 +304,6 @@ dependencies = [
|
|||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-mac"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"generic-array 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"subtle 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.8.1"
|
||||
|
@ -343,6 +334,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "either"
|
||||
version = "1.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fake-simd"
|
||||
|
@ -355,19 +349,18 @@ version = "0.3.0"
|
|||
dependencies = [
|
||||
"anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"askama 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.10.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rust-argon2 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sqlx 0.4.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"structopt 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"structopt 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-futures 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-subscriber 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-subscriber 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"warp 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -587,15 +580,6 @@ name = "hex"
|
|||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"crypto-mac 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.0"
|
||||
|
@ -773,16 +757,6 @@ name = "maybe-uninit"
|
|||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.3"
|
||||
|
@ -849,7 +823,7 @@ dependencies = [
|
|||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl 0.10.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"openssl-sys 0.9.58 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"schannel 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -920,7 +894,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.29"
|
||||
version = "0.10.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1242,15 +1216,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.114"
|
||||
version = "1.0.115"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.114"
|
||||
version = "1.0.115"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1263,9 +1237,10 @@ name = "serde_json"
|
|||
version = "1.0.57"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1275,7 +1250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1290,18 +1265,6 @@ dependencies = [
|
|||
"opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha-1"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"block-buffer 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cpuid-bool 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.9.1"
|
||||
|
@ -1378,7 +1341,6 @@ version = "0.4.0-beta.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atoi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"base64 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bytes 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1393,19 +1355,16 @@ dependencies = [
|
|||
"futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashbrown 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hmac 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.71 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libsqlite3-sys 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"md-5 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha-1 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sqlformat 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1425,8 +1384,11 @@ dependencies = [
|
|||
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sqlx-core 0.4.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sqlx-rt 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1461,17 +1423,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clap 2.33.1 (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.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"structopt-derive 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.8"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1481,11 +1443,6 @@ dependencies = [
|
|||
"syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.33"
|
||||
|
@ -1630,7 +1587,7 @@ name = "toml"
|
|||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1640,18 +1597,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.18"
|
||||
version = "0.1.19"
|
||||
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)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-attributes 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-attributes 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1661,7 +1618,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.12"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1673,7 +1630,7 @@ version = "0.2.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"pin-project 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1683,7 +1640,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1691,13 +1648,13 @@ name = "tracing-serde"
|
|||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.2.10"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1705,11 +1662,12 @@ dependencies = [
|
|||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matchers 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sharded-slab 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-core 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-log 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1827,13 +1785,13 @@ dependencies = [
|
|||
"mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pin-project 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio-rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tracing-futures 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1995,7 +1953,6 @@ dependencies = [
|
|||
"checksum crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6"
|
||||
"checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
|
||||
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
|
||||
"checksum crypto-mac 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
|
||||
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
|
||||
"checksum digest 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
|
||||
"checksum dotenv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
|
||||
|
@ -2026,7 +1983,6 @@ dependencies = [
|
|||
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
|
||||
"checksum hermit-abi 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909"
|
||||
"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
|
||||
"checksum hmac 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
|
||||
"checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b"
|
||||
"checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
|
||||
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
|
||||
|
@ -2050,7 +2006,6 @@ dependencies = [
|
|||
"checksum matchers 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
|
||||
"checksum md-5 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15"
|
||||
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
|
||||
"checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf"
|
||||
"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
|
||||
|
@ -2066,7 +2021,7 @@ dependencies = [
|
|||
"checksum once_cell 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
|
||||
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
||||
"checksum opaque-debug 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
"checksum openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)" = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd"
|
||||
"checksum openssl 0.10.30 (registry+https://github.com/rust-lang/crates.io-index)" = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4"
|
||||
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||
"checksum openssl-src 111.10.0+1.1.1g (registry+https://github.com/rust-lang/crates.io-index)" = "47cd4a96d49c3abf4cac8e8a80cba998a030c75608f158fb1c5f609772f265e6"
|
||||
"checksum openssl-sys 0.9.58 (registry+https://github.com/rust-lang/crates.io-index)" = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de"
|
||||
|
@ -2104,12 +2059,11 @@ dependencies = [
|
|||
"checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c"
|
||||
"checksum security-framework 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
|
||||
"checksum security-framework-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405"
|
||||
"checksum serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)" = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
|
||||
"checksum serde_derive 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)" = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
|
||||
"checksum serde 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
|
||||
"checksum serde_derive 1.0.115 (registry+https://github.com/rust-lang/crates.io-index)" = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
|
||||
"checksum serde_json 1.0.57 (registry+https://github.com/rust-lang/crates.io-index)" = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
|
||||
"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
|
||||
"checksum sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
|
||||
"checksum sha-1 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770"
|
||||
"checksum sha2 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
|
||||
"checksum sharded-slab 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
|
@ -2124,9 +2078,8 @@ dependencies = [
|
|||
"checksum sqlx-rt 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23f9104f6116b568358f315e9839ae66c4ebbc0e974db5580105f0acfeb4863f"
|
||||
"checksum stringprep 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1"
|
||||
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
"checksum structopt 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "de2f5e239ee807089b62adce73e48c625e0ed80df02c7ab3f068f5db5281065c"
|
||||
"checksum structopt-derive 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "510413f9de616762a4fbeab62509bf15c729603b72d7cd71280fbca431b1c118"
|
||||
"checksum subtle 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
|
||||
"checksum structopt 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "de5472fb24d7e80ae84a7801b7978f95a19ec32cb1876faea59ab711eb901976"
|
||||
"checksum structopt-derive 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e0eb37335aeeebe51be42e2dc07f031163fbabfa6ac67d7ea68b5c2f68d5f99"
|
||||
"checksum syn 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
|
||||
"checksum syn-mid 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
|
||||
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||
|
@ -2142,13 +2095,13 @@ dependencies = [
|
|||
"checksum tokio-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
|
||||
"checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
|
||||
"checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
|
||||
"checksum tracing 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "f0aae59226cf195d8e74d4b34beae1859257efb4e5fed3f147d2dc2c7d372178"
|
||||
"checksum tracing-attributes 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b"
|
||||
"checksum tracing-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "b2734b5a028fa697686f16c6d18c2c6a3c7e41513f9a213abb6754c4acb3c8d7"
|
||||
"checksum tracing 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6d79ca061b032d6ce30c660fded31189ca0b9922bf483cd70759f13a2d86786c"
|
||||
"checksum tracing-attributes 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "1fe233f4227389ab7df5b32649239da7ebe0b281824b4e84b342d04d3fd8c25e"
|
||||
"checksum tracing-core 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "db63662723c316b43ca36d833707cc93dff82a02ba3d7e354f342682cc8b3545"
|
||||
"checksum tracing-futures 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c"
|
||||
"checksum tracing-log 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9"
|
||||
"checksum tracing-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79"
|
||||
"checksum tracing-subscriber 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b33f8b2ef2ab0c3778c12646d9c42a24f7772bee4cdafc72199644a9f58fdc"
|
||||
"checksum tracing-subscriber 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "abd165311cc4d7a555ad11cc77a37756df836182db0d81aac908c8184c584f40"
|
||||
"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
|
||||
"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||
"checksum unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150"
|
||||
|
|
47
Cargo.toml
47
Cargo.toml
|
@ -17,53 +17,18 @@ license = "MIT"
|
|||
[dependencies]
|
||||
anyhow = "1.0.32"
|
||||
askama = "0.10.3"
|
||||
cfg-if = "0.1.10"
|
||||
chrono = { version = "0.4.13", features = ["serde"] }
|
||||
futures = "0.3.5"
|
||||
rust-argon2 = "0.8.2"
|
||||
serde = { version = "1.0.114", features = ["derive"] }
|
||||
serde = { version = "1.0.115", features = ["derive"] }
|
||||
serde_json = "1.0.57"
|
||||
sqlx = { version = "0.4.0-beta.1", features = ["any", "chrono", "macros", "migrate", "runtime-tokio"], default-features = false }
|
||||
structopt = "0.3.15"
|
||||
sqlx = { version = "0.4.0-beta.1", features = ["chrono", "macros", "migrate", "offline", "runtime-tokio", "sqlite"], default-features = false }
|
||||
structopt = "0.3.16"
|
||||
tokio = { version = "0.2.22", features = ["blocking", "fs", "rt-core"] }
|
||||
tracing = "0.1.18"
|
||||
tracing = "0.1.19"
|
||||
tracing-futures = "0.2.4"
|
||||
tracing-subscriber = "0.2.10"
|
||||
warp = { version = "0.2.4", default-features = false }
|
||||
tracing-subscriber = "0.2.11"
|
||||
warp = { version = "0.2.4", features = ["tls"], default-features = false }
|
||||
|
||||
# Makes cross-compiliing easier by statically linking to OpenSSL
|
||||
[target.'cfg(not(any(target_os = "windows", target_os = "macos")))'.dependencies]
|
||||
openssl = { version = "*", features = ["vendored"] }
|
||||
|
||||
[features]
|
||||
default = ["full"]
|
||||
|
||||
# Presets
|
||||
lite = ["filite", "sqlite"]
|
||||
full = [
|
||||
"filite",
|
||||
"sqlite",
|
||||
"postgres",
|
||||
"tls",
|
||||
"threaded",
|
||||
"analytics",
|
||||
]
|
||||
|
||||
# Data types
|
||||
fi = []
|
||||
li = []
|
||||
te = []
|
||||
filite = ["fi", "li", "te"]
|
||||
|
||||
# Database backends
|
||||
sqlite = ["sqlx/sqlite"]
|
||||
postgres = ["sqlx/postgres"]
|
||||
|
||||
# TLS support
|
||||
tls = ["warp/tls"]
|
||||
|
||||
# Threaded runtime
|
||||
threaded = ["tokio/rt-threaded"]
|
||||
|
||||
# Track views
|
||||
analytics = []
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE users (
|
||||
user varchar(32) PRIMARY KEY,
|
||||
id varchar(32) NOT NULL PRIMARY KEY,
|
||||
password varchar(256) NOT NULL,
|
||||
role smallint NOT NULL
|
||||
role int NOT NULL
|
||||
);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
CREATE TABLE filite (
|
||||
id varchar(32) PRIMARY KEY,
|
||||
ty smallint NOT NULL,
|
||||
id varchar(32) NOT NULL PRIMARY KEY,
|
||||
ty int NOT NULL,
|
||||
val text NOT NULL,
|
||||
|
||||
creator varchar(32) NOT NULL REFERENCES users(user),
|
||||
creator varchar(32) NOT NULL REFERENCES users(id),
|
||||
created timestamp NOT NULL,
|
||||
|
||||
visibility smallint NOT NULL,
|
||||
views int NOT NULL DEFAULT 0
|
||||
visibility int NOT NULL,
|
||||
views int NOT NULL
|
||||
);
|
||||
|
|
|
@ -0,0 +1,353 @@
|
|||
{
|
||||
"db": "SQLite",
|
||||
"0fa193d147d714b9cbd4efc9f4aef2d0603089dfd0a5a1644db38b2383cb3d75": {
|
||||
"query": "SELECT id, password, role as \"role: Role\" FROM users WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "role: Role",
|
||||
"ordinal": 2,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"2939cc3de5feaa6024500b980f0bc425cf15ca0e08a47397d2ce56a2d8ca3aaf": {
|
||||
"query": "SELECT id, ty as \"ty: Type\", val, creator, created FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "ty: Type",
|
||||
"ordinal": 1,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "val",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "creator",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"ordinal": 4,
|
||||
"type_info": "Datetime"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"2bded90766f48d62b0426cf9fe55477232add7cd45d15f613feada68fc11e80e": {
|
||||
"query": "SELECT id FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"5f0027d087a1932b987e697800210f9267b5730e002ef14bf79841ea790c3ab5": {
|
||||
"query": "SELECT * FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "ty",
|
||||
"ordinal": 1,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "val",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "creator",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"ordinal": 4,
|
||||
"type_info": "Datetime"
|
||||
},
|
||||
{
|
||||
"name": "visibility",
|
||||
"ordinal": 5,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "views",
|
||||
"ordinal": 6,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"79f48ed4fbf70048313a8ef5b665bc371ed16957e7e7186fb4817029931847ab": {
|
||||
"query": "SELECT id, password, role FROM users WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"ordinal": 2,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"7fd8490787f6136611e1e30fc87177c7f6ec8ce072539efe6963155107458ba4": {
|
||||
"query": "SELECT id, ty as \"ty: Type\", val, creator, created, visibility as \"visibility: Visibility\" FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "ty: Type",
|
||||
"ordinal": 1,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "val",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "creator",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"ordinal": 4,
|
||||
"type_info": "Datetime"
|
||||
},
|
||||
{
|
||||
"name": "visibility: Visibility",
|
||||
"ordinal": 5,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"843923b9a0257cf80f1dff554e7dc8fdfc05f489328e8376513124dfb42996e3": {
|
||||
"query": "SELECT * FROM users WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"ordinal": 1,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"ordinal": 2,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
true,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"a0cf6aac396dc7c11b86d885fdb5cbc78c40344ad134a83136d19189d5877538": {
|
||||
"query": "SELECT id, ty as \"ty: Type\", val, creator, created, visibility as \"visibility: Visibility\", views FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "ty: Type",
|
||||
"ordinal": 1,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "val",
|
||||
"ordinal": 2,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "creator",
|
||||
"ordinal": 3,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "created",
|
||||
"ordinal": 4,
|
||||
"type_info": "Datetime"
|
||||
},
|
||||
{
|
||||
"name": "visibility: Visibility",
|
||||
"ordinal": 5,
|
||||
"type_info": "Int64"
|
||||
},
|
||||
{
|
||||
"name": "views",
|
||||
"ordinal": 6,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855": {
|
||||
"query": "",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
},
|
||||
"e7baf3f2538368ddc02bf7712da5deaf4c19969d69181717033f9b29087ebf8b": {
|
||||
"query": "SELECT id, ty as \"ty: Type\" FROM filite WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"ordinal": 0,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "ty: Type",
|
||||
"ordinal": 1,
|
||||
"type_info": "Int64"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
}
|
||||
},
|
||||
"fac905277f1bd32c350c4fa7d3636ec79fb74c242f2a3bd4b4e52a10fcd0d0ae": {
|
||||
"query": "UPDATE filite SET views = views + 1 WHERE id = $1",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": []
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
use crate::utils::DefaultExt;
|
||||
use anyhow::Error;
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fs::File,
|
||||
|
@ -7,8 +7,13 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
fn log_level_is_info(level: &str) -> bool {
|
||||
level.to_lowercase() == "info"
|
||||
#[inline]
|
||||
fn default_log_level() -> String {
|
||||
"info,sqlx=warn".to_owned()
|
||||
}
|
||||
#[inline]
|
||||
fn log_level_is_default(level: &str) -> bool {
|
||||
level.to_lowercase() == default_log_level()
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
|
@ -16,18 +21,13 @@ fn log_level_is_info(level: &str) -> bool {
|
|||
pub struct Config {
|
||||
pub port: u16,
|
||||
pub database_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "log_level_is_info")]
|
||||
pub files_dir: PathBuf,
|
||||
#[serde(skip_serializing_if = "log_level_is_default")]
|
||||
pub log_level: String,
|
||||
|
||||
#[serde(skip_serializing_if = "DefaultExt::is_default")]
|
||||
pub pool: PoolConfig,
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tls: Option<TlsConfig>,
|
||||
|
||||
#[cfg(feature = "threaded")]
|
||||
#[serde(skip_serializing_if = "DefaultExt::is_default")]
|
||||
pub threads: ThreadsConfig,
|
||||
}
|
||||
|
@ -36,44 +36,29 @@ impl Default for Config {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
port: 80,
|
||||
database_url: {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "sqlite")] {
|
||||
"sqlite://filite.db"
|
||||
} else if #[cfg(feature = "postgres")] {
|
||||
"postgresql://localhost:5432/filite"
|
||||
}
|
||||
}
|
||||
}
|
||||
.to_owned(),
|
||||
|
||||
log_level: "info".to_owned(),
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
database_url: "filite.db".to_owned(),
|
||||
files_dir: PathBuf::from("files"),
|
||||
log_level: default_log_level(),
|
||||
tls: None,
|
||||
|
||||
pool: Default::default(),
|
||||
|
||||
#[cfg(feature = "threaded")]
|
||||
threads: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read(path: impl AsRef<Path>) -> Result<&'static Config, Error> {
|
||||
pub fn read(path: impl AsRef<Path>) -> Result<&'static Config> {
|
||||
let file = File::open(path)?;
|
||||
let config: Config = serde_json::from_reader(BufReader::new(file))?;
|
||||
Ok(&*Box::leak(Box::new(config)))
|
||||
}
|
||||
|
||||
pub fn write(path: impl AsRef<Path>) -> Result<(), Error> {
|
||||
pub fn write(path: impl AsRef<Path>) -> Result<()> {
|
||||
let config: Config = Default::default();
|
||||
let file = File::create(path)?;
|
||||
serde_json::to_writer_pretty(BufWriter::new(file), &config)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct TlsConfig {
|
||||
|
@ -98,7 +83,6 @@ pub struct PoolConfig {
|
|||
pub max_lifetime: Option<u64>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "threaded")]
|
||||
#[derive(Debug, Deserialize, Serialize, Default, PartialEq)]
|
||||
#[serde(default, rename_all = "kebab-case")]
|
||||
pub struct ThreadsConfig {
|
||||
|
|
|
@ -1 +1,37 @@
|
|||
pub mod models;
|
||||
pub mod pool;
|
||||
|
||||
use crate::db::models::{Filite, Role, Type, User, Visibility};
|
||||
use anyhow::Result;
|
||||
use sqlx::SqlitePool;
|
||||
|
||||
#[tracing::instrument(level = "debug")]
|
||||
pub async fn user(id: &str, pool: &SqlitePool) -> Result<Option<User>> {
|
||||
Ok(sqlx::query_as!(
|
||||
User,
|
||||
r#"SELECT id, password, role as "role: Role" FROM users WHERE id = $1"#,
|
||||
id
|
||||
)
|
||||
.fetch_optional(pool)
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug")]
|
||||
pub async fn filite(id: &str, view: bool, pool: &SqlitePool) -> Result<Option<Filite>> {
|
||||
if !view
|
||||
|| sqlx::query!("UPDATE filite SET views = views + 1 WHERE id = $1", id)
|
||||
.fetch_optional(pool)
|
||||
.await?
|
||||
.is_some()
|
||||
{
|
||||
Ok(sqlx::query_as!(
|
||||
Filite,
|
||||
r#"SELECT id, ty as "ty: Type", val, creator, created, visibility as "visibility: Visibility", views FROM filite WHERE id = $1"#,
|
||||
id
|
||||
)
|
||||
.fetch_optional(pool)
|
||||
.await?)
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
use chrono::NaiveDateTime;
|
||||
|
||||
pub struct User {
|
||||
pub id: String,
|
||||
pub password: String,
|
||||
pub role: Role,
|
||||
}
|
||||
|
||||
#[derive(sqlx::Type)]
|
||||
#[repr(i64)]
|
||||
pub enum Role {
|
||||
User = 0,
|
||||
Admin = 255,
|
||||
}
|
||||
|
||||
pub struct Filite {
|
||||
pub id: String,
|
||||
pub ty: Type,
|
||||
pub val: String,
|
||||
|
||||
pub creator: String,
|
||||
pub created: NaiveDateTime,
|
||||
|
||||
pub visibility: Visibility,
|
||||
pub views: i64,
|
||||
}
|
||||
|
||||
#[derive(sqlx::Type)]
|
||||
#[repr(i64)]
|
||||
pub enum Type {
|
||||
Fi = 0,
|
||||
Li = 1,
|
||||
Te = 2,
|
||||
}
|
||||
|
||||
#[derive(sqlx::Type)]
|
||||
#[repr(i64)]
|
||||
pub enum Visibility {
|
||||
Public = 0,
|
||||
Protected = 1,
|
||||
Private = 2,
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
use crate::config::Config;
|
||||
use anyhow::Error;
|
||||
use sqlx::any::{AnyPool, AnyPoolOptions};
|
||||
use anyhow::Result;
|
||||
use sqlx::sqlite::{SqlitePool, SqlitePoolOptions};
|
||||
use std::time::Duration;
|
||||
|
||||
#[tracing::instrument(level = "debug")]
|
||||
pub async fn build(config: &Config) -> Result<&'static AnyPool, Error> {
|
||||
let mut options: AnyPoolOptions = Default::default();
|
||||
pub async fn build(config: &Config) -> Result<&'static SqlitePool> {
|
||||
let mut options: SqlitePoolOptions = Default::default();
|
||||
|
||||
if let Some(ms) = config.pool.max_connections {
|
||||
options = options.max_connections(ms);
|
||||
|
@ -25,7 +25,9 @@ pub async fn build(config: &Config) -> Result<&'static AnyPool, Error> {
|
|||
options = options.max_lifetime(Duration::from_millis(ml));
|
||||
}
|
||||
|
||||
let pool = options.connect(&config.database_url).await?;
|
||||
let pool = options
|
||||
.connect(&format!("sqlite://{}", config.database_url))
|
||||
.await?;
|
||||
sqlx::migrate!("./migrations").run(&pool).await?;
|
||||
|
||||
Ok(&*Box::leak(Box::new(pool)))
|
||||
|
|
26
src/main.rs
26
src/main.rs
|
@ -1,10 +1,6 @@
|
|||
#[cfg(not(any(feature = "fi", feature = "li", feature = "te")))]
|
||||
compile_error!("You need to select at least one data type");
|
||||
#[cfg(not(any(feature = "sqlite", feature = "postgres", feature = "mysql")))]
|
||||
compile_error!("You need to select at least one database backend");
|
||||
|
||||
mod config;
|
||||
mod db;
|
||||
mod routes;
|
||||
mod runtime;
|
||||
mod utils;
|
||||
|
||||
|
@ -63,17 +59,17 @@ async fn serve(
|
|||
filter: impl Filter<Extract = (impl Reply,)> + Send + Sync + Clone + 'static,
|
||||
config: &Config,
|
||||
) {
|
||||
#[cfg(feature = "tls")]
|
||||
if let Some(tls_config) = &config.tls {
|
||||
return warp::serve(filter)
|
||||
.tls()
|
||||
.cert_path(&tls_config.cert)
|
||||
.key_path(&tls_config.key)
|
||||
.run(([127, 0, 0, 1], config.port))
|
||||
.await;
|
||||
match &config.tls {
|
||||
Some(tls_config) => {
|
||||
warp::serve(filter)
|
||||
.tls()
|
||||
.cert_path(&tls_config.cert)
|
||||
.key_path(&tls_config.key)
|
||||
.run(([127, 0, 0, 1], config.port))
|
||||
.await
|
||||
}
|
||||
None => warp::serve(filter).run(([127, 0, 0, 1], config.port)).await,
|
||||
}
|
||||
|
||||
warp::serve(filter).run(([127, 0, 0, 1], config.port)).await
|
||||
}
|
||||
|
||||
fn init_config(path: Option<&PathBuf>) -> Result<(), Error> {
|
||||
|
|
|
@ -3,22 +3,16 @@ use anyhow::Error;
|
|||
use tokio::runtime::{Builder, Runtime};
|
||||
|
||||
#[tracing::instrument(level = "debug")]
|
||||
#[cfg_attr(not(feature = "threaded"), allow(unused_variables))]
|
||||
pub fn build(config: &Config) -> Result<Runtime, Error> {
|
||||
let mut builder = Builder::new();
|
||||
builder.basic_scheduler().enable_all();
|
||||
builder.threaded_scheduler().enable_all();
|
||||
|
||||
#[cfg(feature = "threaded")]
|
||||
{
|
||||
builder.threaded_scheduler();
|
||||
|
||||
let config = &config.threads;
|
||||
if let Some(ct) = config.core_threads {
|
||||
builder.core_threads(ct);
|
||||
}
|
||||
if let Some(mt) = config.max_threads {
|
||||
builder.max_threads(mt);
|
||||
}
|
||||
let config = &config.threads;
|
||||
if let Some(ct) = config.core_threads {
|
||||
builder.core_threads(ct);
|
||||
}
|
||||
if let Some(mt) = config.max_threads {
|
||||
builder.max_threads(mt);
|
||||
}
|
||||
|
||||
Ok(builder.build()?)
|
||||
|
|
Loading…
Reference in New Issue