Browse Source

Implement pooled connections

master
Toromino 3 years ago
parent
commit
5dd167e427
  1. 206
      Cargo.lock
  2. 6
      Cargo.toml
  3. 8
      contrib/kibou.service
  4. 4
      env.toml.sample
  5. 4
      migrations/2019-06-23-131810_notifications/up.sql
  6. 64
      src/activity.rs
  7. 25
      src/activitypub/mod.rs
  8. 21
      src/activitypub/routes.rs
  9. 10
      src/bin/kibou_server.rs
  10. 62
      src/database/mod.rs
  11. 22
      src/env.rs
  12. 6
      src/html.rs
  13. 23
      src/kibou_api/mod.rs
  14. 5
      src/kibou_api/routes.rs
  15. 6
      src/lib.rs
  16. 783
      src/mastodon_api/controller.rs
  17. 356
      src/mastodon_api/mod.rs
  18. 166
      src/mastodon_api/routes.rs
  19. 4
      src/oauth/token.rs
  20. 115
      src/raito_fe/api_controller.rs
  21. 115
      src/raito_fe/mod.rs
  22. 366
      src/raito_fe/renderer.rs
  23. 99
      src/raito_fe/routes.rs
  24. 238
      static/raito_fe/themes/raito_light.css
  25. 5
      templates/raito_fe/components/notification.html.tera
  26. 9
      templates/raito_fe/index.html.tera
  27. 2
      templates/raito_fe/infoscreen.html.tera
  28. 2
      templates/raito_fe/login.html.tera
  29. 10
      templates/raito_fe/notification_view.html.tera

206
Cargo.lock generated

@ -15,7 +15,7 @@ dependencies = [ @@ -15,7 +15,7 @@ dependencies = [
[[package]]
name = "arrayvec"
version = "0.4.10"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
@ -23,11 +23,10 @@ dependencies = [ @@ -23,11 +23,10 @@ dependencies = [
[[package]]
name = "atty"
version = "0.2.11"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -156,14 +155,6 @@ dependencies = [ @@ -156,14 +155,6 @@ dependencies = [
"ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cached"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.37"
@ -236,7 +227,7 @@ dependencies = [ @@ -236,7 +227,7 @@ dependencies = [
"cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
@ -281,7 +272,7 @@ name = "crossbeam-epoch" @@ -281,7 +272,7 @@ name = "crossbeam-epoch"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -326,7 +317,7 @@ version = "0.2.0" @@ -326,7 +317,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -336,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -336,7 +327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -350,6 +341,7 @@ dependencies = [ @@ -350,6 +341,7 @@ dependencies = [
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pq-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"r2d2 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -359,7 +351,7 @@ version = "1.4.0" @@ -359,7 +351,7 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -413,7 +405,7 @@ version = "0.1.5" @@ -413,7 +405,7 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -557,12 +549,21 @@ dependencies = [ @@ -557,12 +549,21 @@ dependencies = [
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hashbrown"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "http"
version = "0.1.17"
@ -614,7 +615,7 @@ dependencies = [ @@ -614,7 +615,7 @@ dependencies = [
[[package]]
name = "hyper"
version = "0.12.31"
version = "0.12.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -626,7 +627,7 @@ dependencies = [ @@ -626,7 +627,7 @@ dependencies = [
"httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
@ -648,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -648,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -715,12 +716,12 @@ version = "0.1.0" @@ -715,12 +716,12 @@ version = "0.1.0"
dependencies = [
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bcrypt 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cached 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lru 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)",
"pem 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -785,22 +786,38 @@ dependencies = [ @@ -785,22 +786,38 @@ dependencies = [
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lock_api"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.6"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lru"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "maplit"
version = "1.0.1"
@ -877,7 +894,7 @@ dependencies = [ @@ -877,7 +894,7 @@ dependencies = [
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -890,7 +907,7 @@ version = "2.0.5" @@ -890,7 +907,7 @@ version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -913,7 +930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -913,7 +930,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.10.23 (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.47 (registry+https://github.com/rust-lang/crates.io-index)",
@ -998,19 +1015,6 @@ dependencies = [ @@ -998,19 +1015,6 @@ dependencies = [
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "numtoa"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "once_cell"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "opaque-debug"
version = "0.2.2"
@ -1063,6 +1067,16 @@ dependencies = [ @@ -1063,6 +1067,16 @@ dependencies = [
"parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.4.0"
@ -1075,6 +1089,21 @@ dependencies = [ @@ -1075,6 +1089,21 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pear"
version = "0.1.2"
@ -1089,7 +1118,7 @@ version = "0.1.2" @@ -1089,7 +1118,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"yansi 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1136,7 +1165,7 @@ dependencies = [ @@ -1136,7 +1165,7 @@ dependencies = [
"pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_meta 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1225,12 +1254,22 @@ dependencies = [ @@ -1225,12 +1254,22 @@ dependencies = [
[[package]]
name = "quote"
version = "0.6.12"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "r2d2"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"scheduled-thread-pool 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.6.5"
@ -1378,14 +1417,6 @@ name = "redox_syscall" @@ -1378,14 +1417,6 @@ name = "redox_syscall"
version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "redox_termios"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "1.1.9"
@ -1427,9 +1458,9 @@ dependencies = [ @@ -1427,9 +1458,9 @@ dependencies = [
"flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1462,9 +1493,9 @@ name = "rocket" @@ -1462,9 +1493,9 @@ name = "rocket"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1484,7 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1484,7 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"devise 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_http 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1496,7 +1527,7 @@ version = "0.4.2" @@ -1496,7 +1527,7 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 4.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1565,11 +1596,24 @@ dependencies = [ @@ -1565,11 +1596,24 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "scheduled-thread-pool"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "scopeguard"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scopeguard"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "security-framework"
version = "0.3.1"
@ -1633,7 +1677,7 @@ version = "1.0.94" @@ -1633,7 +1677,7 @@ version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1729,7 +1773,7 @@ version = "0.15.39" @@ -1729,7 +1773,7 @@ version = "0.15.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1739,7 +1783,7 @@ version = "0.10.2" @@ -1739,7 +1783,7 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1777,17 +1821,6 @@ dependencies = [ @@ -1777,17 +1821,6 @@ dependencies = [
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "termion"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)",
"numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "thread_local"
version = "0.3.6"
@ -1859,7 +1892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1859,7 +1892,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1870,7 +1903,7 @@ dependencies = [ @@ -1870,7 +1903,7 @@ dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1911,7 +1944,7 @@ dependencies = [ @@ -1911,7 +1944,7 @@ dependencies = [
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2121,7 +2154,7 @@ version = "0.2.0" @@ -2121,7 +2154,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2192,8 +2225,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2192,8 +2225,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282"
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
"checksum atty 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ecaaea69f52b3b18633611ec0007d188517d0366f47ff703d400fa6879d6f8d5"
"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
"checksum backtrace 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)" = "18b50f5258d1a9ad8396d2d345827875de4261b158124d4c819d9b351454fae5"
"checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61"
@ -2209,7 +2242,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2209,7 +2242,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
"checksum cached 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24f3f5ca5651b8360fb859d6fd1b80fb4c25bc3cbf3ffc3a74d3d6a79fba328e"
"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe"
@ -2257,12 +2289,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2257,12 +2289,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
"checksum h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "a539b63339fbbb00e081e84b6e11bd1d9634a82d91da2984a18ac74a8823f392"
"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da"
"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a"
"checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
"checksum hyper 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273"
"checksum hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)" = "6481fff8269772d4463253ca83c788104a7305cb3fb9136bc651a6211e46e03f"
"checksum hyper 0.12.32 (registry+https://github.com/rust-lang/crates.io-index)" = "a64d71c1e77d39da024f06f5821ee00ad9c38febb90370bad1f07a94e0bc8793"
"checksum hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f"
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
@ -2279,8 +2312,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2279,8 +2312,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd"
"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3"
"checksum lru 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "276235bb6b60773280b44b65e93815de82da5b6279ef175004fca03f4d06770a"
"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
@ -2302,15 +2337,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2302,15 +2337,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
"checksum once_cell 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "532c29a261168a45ce28948f9537ddd7a5dd272cc513b3017b1e82a88f962c37"
"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409"
"checksum openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)" = "97c140cbb82f3b3468193dd14c1b88def39f341f68257f8a7fe8ed9ed3f628a5"
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
"checksum openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)" = "75bdd6dbbb4958d38e47a1d2348847ad1eb4dc205dc5d37473ae504391865acc"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7"
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c"
"checksum pear 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c26d2b92e47063ffce70d3e3b1bd097af121a9e0db07ca38a6cc1cf0cc85ff25"
"checksum pear_codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "336db4a192cc7f54efeb0c4e11a9245394824cc3bcbd37ba3ff51240c35d7a6e"
"checksum pem 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2ae096568d61688cd1d419ca9815c94475d7b4622b1834d6e068e5bb2eb3d2"
@ -2328,7 +2363,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2328,7 +2363,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum pq-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5afecba86dcf1e4fd610246f89899d1924fe12e1e89f555eb7c7f710f3c5ad1d"
"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum r2d2 0.8.5 (registry+https://github.com/rust-lang/crates.io-index)" = "bc42ce75d9f4447fb2a04bbe1ed5d18dd949104572850ec19b164e274919f81b"
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
@ -2345,7 +2381,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2345,7 +2381,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21"
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
@ -2362,7 +2397,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2362,7 +2397,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
"checksum schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339"
"checksum scheduled-thread-pool 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bbecfcb36d47e0d6a4aefb198d475b13aa06e326770c1271171d44893766ae1c"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
"checksum security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eee63d0f4a9ec776eeb30e220f0bc1e092c3ad744b2a379e3993070364d3adc2"
"checksum security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9636f8989cbf61385ae4824b98c1aaa54c994d7d8b41f11c601ed799f0549a56"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
@ -2387,7 +2424,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2387,7 +2424,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
"checksum termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8fb22f7cde82c8220e5aeacb3258ed7ce996142c77cba193f203515e26c330"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6"

6
Cargo.toml

@ -1,5 +1,3 @@ @@ -1,5 +1,3 @@
cargo-features = ["default-run"]
[package]
name = "kibou"
version = "0.1.0"
@ -9,12 +7,12 @@ default-run = "kibou_server" @@ -9,12 +7,12 @@ default-run = "kibou_server"
[dependencies]
base64 = "0.10.1"
bcrypt = "0.5.0"
cached = "0.9.0"
chrono = "0.4.7"
config = "0.9.3"
diesel = { version = "1.4.2", features = ["chrono", "postgres", "serde_json"] }
diesel = { version = "1.4.2", features = ["chrono", "postgres", "r2d2", "serde_json"] }
getopts = "0.2.19"
lazy_static = "1.3.0"
lru = "0.1.15"
openssl-sys = "0.9.47"
openssl = "0.10.23"
pem = "0.6.0"

8
contrib/kibou.service

@ -7,7 +7,13 @@ Description=Kibou server @@ -7,7 +7,13 @@ Description=Kibou server
; paths according to your Kibou installation
; ------------------------------------------------
WorkingDirectory=/srv/kibou
ExecStart=/srv/kibou/target/debug/kibou_server
ExecStart=/srv/kibou/target/release/kibou_server
; ------------------------------------------------
; Change the the environment
; -> Enum {production, development, staging}
; ------------------------------------------------
Environment="ROCKET_ENV=production"
; ------------------------------------------------
ExecReload=/bin/kill $MAINPID

4
env.toml.sample

@ -17,6 +17,10 @@ base_scheme = "https" @@ -17,6 +17,10 @@ base_scheme = "https"
host = "localhost"
port = 8000
# Adjust the workers value
# -> Number of CPU cores * 2
workers = 2
[node]
name = "Kibou"
description = "A Kibou instance"

4
migrations/2019-06-23-131810_notifications/up.sql

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
CREATE TABLE notifications (
id BIGSERIAL PRIMARY KEY,
activity_id BIGSERIAL REFERENCES activities(id),
actor_id BIGSERIAL REFERENCES actors(id),
activity_id BIGSERIAL REFERENCES activities(id) ON DELETE CASCADE,
actor_id BIGSERIAL REFERENCES actors(id) ON DELETE CASCADE,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

64
src/activity.rs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
use database::models::{InsertActivity, QueryActivity};
use database::models::{InsertActivity, QueryActivity, QueryActivityId};
use database::runtime_escape;
use database::schema::activities;
use database::schema::activities::dsl::*;
@ -16,15 +16,23 @@ pub struct Activity { @@ -16,15 +16,23 @@ pub struct Activity {
pub actor: String,
}
// Beware: This module depends on a lot of raw queries, which we should deprecate in the future. The
// only reason they're being used is because Diesel.rs does not support JSONB operators that are
// needed:
// {->, ->>, @>, ?}
//
// Related issue: https://git.cybre.club/kibouproject/kibou/issues/32
// Diesel.rs issue: https://github.com/diesel-rs/diesel/issues/44
pub fn count_ap_object_replies_by_id(
db_connection: &PgConnection,
object_id: &str,
) -> Result<usize, diesel::result::Error> {
match sql_query(format!(
"SELECT * FROM activities WHERE data @> '{{\"object\": {{\"inReplyTo\": \"{}\"}}}}';",
"SELECT id FROM activities WHERE data @> '{{\"object\": {{\"inReplyTo\": \"{}\"}}}}';",
runtime_escape(object_id)
))
.load::<QueryActivity>(db_connection)
.load::<QueryActivityId>(db_connection)
{
Ok(activity_arr) => Ok(activity_arr.len()),
Err(e) => Err(e),
@ -37,12 +45,12 @@ pub fn count_ap_object_reactions_by_id( @@ -37,12 +45,12 @@ pub fn count_ap_object_reactions_by_id(
reaction: &str,
) -> Result<usize, diesel::result::Error> {
match sql_query(format!(
"SELECT * FROM activities WHERE data @> '{{\"type\": \"{reaction_type}\"}}' \
"SELECT id FROM activities WHERE data @> '{{\"type\": \"{reaction_type}\"}}' \
AND data @> '{{\"object\": \"{id}\"}}';",
reaction_type = runtime_escape(reaction),
id = runtime_escape(object_id)
))
.load::<QueryActivity>(db_connection)
.load::<QueryActivityId>(db_connection)
{
Ok(activity_arr) => Ok(activity_arr.len()),
Err(e) => Err(e),
@ -54,16 +62,16 @@ pub fn count_ap_notes_for_actor( @@ -54,16 +62,16 @@ pub fn count_ap_notes_for_actor(
actor: &str,
) -> Result<usize, diesel::result::Error> {
match sql_query(format!(
"SELECT * \
"SELECT id \
FROM activities \
WHERE data->>'type' = 'Create' \
AND data->'object'->>'type' = 'Note' \
AND data->>'actor' = '{actor}' \
WHERE data @> '{{\"actor\": \"{actor}\", \
\"type\": \"Create\", \
\"object\": {{\"type\": \"Note\"}}}}' \
AND ((data->>'to')::jsonb ? 'https://www.w3.org/ns/activitystreams#Public' \
OR (data->>'cc')::jsonb ? 'https://www.w3.org/ns/activitystreams#Public');",
actor = runtime_escape(actor)
))
.load::<QueryActivity>(db_connection)
.load::<QueryActivityId>(db_connection)
{
Ok(activity_arr) => Ok(activity_arr.len()),
Err(e) => Err(e),
@ -72,7 +80,7 @@ pub fn count_ap_notes_for_actor( @@ -72,7 +80,7 @@ pub fn count_ap_notes_for_actor(
pub fn count_local_ap_notes(db_connection: &PgConnection) -> Result<usize, diesel::result::Error> {
match sql_query(format!(
"SELECT * \
"SELECT id \
FROM activities \
WHERE data->>'type' = 'Create' \
AND data->'object'->>'type' = 'Note' \
@ -83,13 +91,32 @@ pub fn count_local_ap_notes(db_connection: &PgConnection) -> Result<usize, diese @@ -83,13 +91,32 @@ pub fn count_local_ap_notes(db_connection: &PgConnection) -> Result<usize, diese
base_domain = env::get_value(String::from("endpoint.base_domain"))
))
.clone()
.load::<QueryActivity>(db_connection)
.load::<QueryActivityId>(db_connection)
{
Ok(activity_arr) => Ok(activity_arr.len()),
Err(e) => Err(e),
}
}
pub fn get_activities_by_id(
db_connection: &PgConnection,
ids: Vec<i64>,
) -> Result<Vec<Activity>, diesel::result::Error> {
let parsed_ids: Vec<String> = ids.iter().map(|num| num.to_string()).collect();
match sql_query(format!(
"SELECT * FROM activities WHERE id = ANY(ARRAY[{}]);",
parsed_ids.join(", ")
))
.load::<QueryActivity>(db_connection)
{
Ok(activity_arr) => Ok(activity_arr
.iter()
.map(|activity| serialize_activity(activity.clone()))
.collect()),
Err(e) => Err(e),
}
}
pub fn get_activity_by_id(
db_connection: &PgConnection,
activity_id: i64,
@ -159,15 +186,10 @@ pub fn get_ap_object_replies_by_id( @@ -159,15 +186,10 @@ pub fn get_ap_object_replies_by_id(
))
.load::<QueryActivity>(db_connection)
{
Ok(activity) => {
let mut serialized_activites: Vec<Activity> = vec![];
for object in activity {
serialized_activites.push(serialize_activity(object));
}
Ok(serialized_activites)
}
Ok(activity_arr) => Ok(activity_arr
.iter()
.map(|activity| serialize_activity(activity.clone()))
.collect()),
Err(e) => Err(e),
}
}

25
src/activitypub/mod.rs

@ -5,6 +5,7 @@ pub mod routes; @@ -5,6 +5,7 @@ pub mod routes;
pub mod validator;
use base64;
use rocket::data::{self, Data, FromDataSimple};
use rocket::http::ContentType;
use rocket::http::MediaType;
use rocket::http::Status;
@ -13,7 +14,7 @@ use rocket::response::{self, Responder, Response}; @@ -13,7 +14,7 @@ use rocket::response::{self, Responder, Response};
use rocket::Outcome;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::io::Cursor;
use std::io::{Cursor, Read};
use web::http_signatures::Signature;
pub struct ActivitypubMediatype(bool);
@ -31,6 +32,28 @@ pub struct Attachment { @@ -31,6 +32,28 @@ pub struct Attachment {
pub mediaType: Option<String>,
}
pub struct Payload(serde_json::Value);
impl FromDataSimple for Payload {
type Error = String;
fn from_data(req: &Request, data: Data) -> data::Outcome<Self, String> {
let mut data_stream = String::new();
// Read at most a 1MB payload
//
// TODO: This value should be adjustable in the config
if let Err(e) = data.open().take(1048576).read_to_string(&mut data_stream) {
return Outcome::Failure((Status::InternalServerError, format!("{:?}", e)));
}
match serde_json::from_str(&data_stream) {
Ok(value) => return Outcome::Success(Payload(value)),
Err(e) => return Outcome::Failure((Status::UnprocessableEntity, format!("{:?}", e))),
}
}
}
impl<'a, 'r> FromRequest<'a, 'r> for ActivitypubMediatype {
type Error = ();

21
src/activitypub/routes.rs

@ -3,6 +3,7 @@ use activitypub::actor as ap_actor; @@ -3,6 +3,7 @@ use activitypub::actor as ap_actor;
use activitypub::controller;
use activitypub::ActivitypubMediatype;
use activitypub::ActivitystreamsResponse;
use activitypub::Payload;
use activitypub::Signature;
use rocket::http::Status;
use serde_json;
@ -18,25 +19,13 @@ pub fn actor(_media_type: ActivitypubMediatype, handle: String) -> Activitystrea @@ -18,25 +19,13 @@ pub fn actor(_media_type: ActivitypubMediatype, handle: String) -> Activitystrea
}
#[post("/actors/<id>/inbox", data = "<activity>")]
pub fn actor_inbox(id: String, activity: String, _signature: Signature) -> Status {
match serde_json::from_str(&activity) {
Ok(serialized_activity) => {
controller::prepare_incoming(serialized_activity, _signature);
return rocket::http::Status::Ok;
}
Err(_) => return rocket::http::Status::BadRequest,
}
pub fn actor_inbox(id: String, activity: Payload, _signature: Signature) {
controller::prepare_incoming(activity.0, _signature);
}
#[post("/inbox", data = "<activity>")]
pub fn inbox(activity: String, _signature: Signature) -> Status {
match serde_json::from_str(&activity) {
Ok(serialized_activity) => {
controller::prepare_incoming(serialized_activity, _signature);
return rocket::http::Status::Ok;
}
Err(_) => return rocket::http::Status::BadRequest,
}
pub fn inbox(activity: Payload, _signature: Signature) {
controller::prepare_incoming(activity.0, _signature);
}
#[get("/objects/<id>")]

10
src/bin/kibou_server.rs

@ -4,16 +4,16 @@ use kibou::env; @@ -4,16 +4,16 @@ use kibou::env;
use kibou::rocket_app;
fn main() {
// TODO: Determine the environment Rocket is running in (ROCKET_ENV)
// We are currently just assuming a development enviroment
let rocket_config = rocket::config::Config::build(rocket::config::Environment::Development)
let rocket_config = rocket::config::Config::build(rocket::config::Environment::active().expect("Unknown ROCKET_ENV value! (enum: {Development, Staging, Production})"))
.address(env::get_value("endpoint.host".to_string()))
.port(
env::get_value("endpoint.port".to_string())
.parse::<u16>()
.unwrap(),
);
)
.workers(env::get_value("endpoint.workers".to_string())
.parse::<u16>()
.unwrap_or_else(|_| 2));
unsafe {
kibou::raito_fe::BYPASS_API = &true;

62
src/database/mod.rs

@ -1,22 +1,54 @@ @@ -1,22 +1,54 @@
pub mod models;
pub mod schema;
use diesel::pg::PgConnection;
use diesel::prelude::*;
use diesel::r2d2;
use diesel::r2d2::ConnectionManager;
use env;
use regex::Regex;
use rocket::http::Status;
use rocket::request::{self, FromRequest};
use rocket::{Outcome, Request, State};
pub type Pool = r2d2::Pool<ConnectionManager<PgConnection>>;
pub struct PooledConnection(pub r2d2::PooledConnection<ConnectionManager<PgConnection>>);
lazy_static! {
pub static ref POOL: Pool = initialize_pool();
}
impl<'a, 'r> FromRequest<'a, 'r> for PooledConnection {
type Error = ();
fn from_request(request: &'a Request<'r>) -> request::Outcome<PooledConnection, Self::Error> {
match POOL.get() {
Ok(db_connection) => Outcome::Success(PooledConnection(db_connection)),
Err(_) => Outcome::Failure((Status::ServiceUnavailable, ())),
}
}
}
impl std::ops::Deref for PooledConnection {
type Target = PgConnection;
fn deref(&self) -> &Self::Target {
return &self.0;
}
}
#[deprecated]
pub fn establish_connection() -> PgConnection {
let database_url = format!(
"postgres://{username}:{password}@{host}/{database}",
username = env::get_value("database.username".to_string()),
password = env::get_value("database.password".to_string()),
host = env::get_value("database.hostname".to_string()),
database = env::get_value("database.database".to_string())
);
PgConnection::establish(&prepare_postgres_url()).unwrap_or_else(|_| {
panic!(format!(
"Could not connect to {url}",
url = &prepare_postgres_url()
))
})
}
PgConnection::establish(&database_url)
.unwrap_or_else(|_| panic!(format!("Could not connect to {url}", url = &database_url)))
pub fn initialize_pool() -> Pool {
let connection_manager = ConnectionManager::<PgConnection>::new(prepare_postgres_url());
// TODO: Eventually replace this with r2d2::Pool::builder()
return Pool::new(connection_manager).expect("Could not initialize database pool!");
}
pub fn runtime_escape(value: &str) -> String {
@ -26,3 +58,13 @@ pub fn runtime_escape(value: &str) -> String { @@ -26,3 +58,13 @@ pub fn runtime_escape(value: &str) -> String {
.filter(|&c| escape_regex.is_match(&c.to_string()))
.collect()
}
fn prepare_postgres_url() -> String {
return format!(
"postgres://{username}:{password}@{host}/{database}",
username = env::get_value("database.username".to_string()),
password = env::get_value("database.password".to_string()),
host = env::get_value("database.hostname".to_string()),
database = env::get_value("database.database".to_string())
);
}

22
src/env.rs

@ -1,20 +1,26 @@ @@ -1,20 +1,26 @@
extern crate config;
use rocket::config::Environment;
pub fn get_value(key: String) -> String {
let mut config = config::Config::default();
let environment = match Environment::active() {
Ok(Environment::Development) => "development",
Ok(Environment::Staging) => "staging",
Ok(Environment::Production) => "production",
Err(_) => "development"
};
set_default_config_values(&mut config);
// TODO: Find config file based on ROCKET_ENV
config
.merge(config::File::with_name("env.development.toml"))
.merge(config::File::with_name(&format!("env.{}.toml", environment)))
.expect("Environment config not found!");
if config.get_str(&key).is_ok() {
config.get_str(&key).ok().unwrap()
} else {
eprintln!("Key '{}' in environment config not found", &key);
String::from("")
match config.get_str(&key) {
Ok(value) => value,
Err(_) => {
eprintln!("Key '{}' not found in config", &key);
return String::from("");
}
}
}

6
src/html.rs

@ -1,5 +1,11 @@ @@ -1,5 +1,11 @@
use regex::Regex;
pub fn to_plain_text(input: &str) -> String {
let output = str::replace(&input, "\n", "<br>");
return strip_tags(&output);
}
pub fn strip_tags(input: &str) -> String {
let allowed_tags = vec!["a", "b", "br", "em", "img", "strong", "u"];
let forbidden_attributes = vec![

23
src/kibou_api/mod.rs

@ -12,9 +12,9 @@ use activity::{ @@ -12,9 +12,9 @@ use activity::{
use activitypub::activity::{serialize_from_internal_activity, Tag};
use activitypub::actor::{add_follow, remove_follow};
use activitypub::controller as ap_controller;
use actor::{get_actor_by_acct, get_actor_by_id, get_actor_by_uri, is_actor_followed_by, Actor};
use database;
use database::PooledConnection;
use diesel::PgConnection;
use html;
use mastodon_api;
@ -121,8 +121,11 @@ pub fn react(actor: &i64, _type: &str, object_id: &str) { @@ -121,8 +121,11 @@ pub fn react(actor: &i64, _type: &str, object_id: &str) {
}
}
pub fn route_activities() -> JsonValue {
return json!(public_activities());
pub fn public_activities(pooled_connection: &PooledConnection) -> JsonValue {
match timeline::public_activities(pooled_connection) {
Ok(activities) => mastodon_api::controller::cached_statuses(pooled_connection, activities),
Err(_) => json!({"error": "An error occured while querying public activities"}),
}
}
pub fn status_build(
@ -140,7 +143,7 @@ pub fn status_build( @@ -140,7 +143,7 @@ pub fn status_build(
let mut tags: Vec<serde_json::Value> = Vec::new();
let mut in_reply_to_id: Option<String>;
let parsed_mentions = parse_mentions(html::strip_tags(&content));
let parsed_mentions = parse_mentions(html::to_plain_text(&content));
direct_receipients.extend(parsed_mentions.0);
inboxes.extend(parsed_mentions.1);
tags.extend(parsed_mentions.2);
@ -335,15 +338,3 @@ fn parse_mentions(content: String) -> (Vec<String>, Vec<String>, Vec<serde_json: @@ -335,15 +338,3 @@ fn parse_mentions(content: String) -> (Vec<String>, Vec<String>, Vec<serde_json:
}
(receipients, inboxes, tags, new_content)
}
fn public_activities() -> Vec<mastodon_api::Status> {
let database = database::establish_connection();
match timeline::public_activities(&database) {
Ok(activities) => activities
.iter()
.map(|activity| mastodon_api::controller::status_cached_by_id(*activity).unwrap())
.collect(),
Err(_) => Vec::new(),
}
}

5
src/kibou_api/routes.rs

@ -1,7 +1,8 @@ @@ -1,7 +1,8 @@
use database::PooledConnection;
use kibou_api;
use rocket_contrib::json::JsonValue;
#[get("/api/kibou/activities")]
pub fn activities() -> JsonValue {
return kibou_api::route_activities();
pub fn activities(pooled_connection: PooledConnection) -> JsonValue {
return kibou_api::public_activities(&pooled_connection);
}

6
src/lib.rs

@ -3,17 +3,19 @@ @@ -3,17 +3,19 @@
extern crate base64;
extern crate bcrypt;
#[macro_use]
extern crate cached;
extern crate chrono;
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate lazy_static;
extern crate lru;
extern crate openssl;
extern crate pem;
extern crate regex;
extern crate reqwest;
#[macro_use]
extern crate rocket;
extern crate core;
extern crate rocket_contrib;
extern crate serde;
extern crate serde_json;

783
src/mastodon_api/controller.rs

@ -1,19 +1,26 @@ @@ -1,19 +1,26 @@
use activity;
use activity::{get_ap_object_by_id, get_ap_object_replies_by_id, type_exists_for_object_id};
use activity::{
get_activities_by_id, get_ap_object_by_id, get_ap_object_replies_by_id,
type_exists_for_object_id,
};
use activitypub;
use actor;
use actor::get_actor_by_id;
use actor::get_actor_by_uri;
use cached::TimedCache;
use chrono;
use chrono::Utc;
use core::borrow::Borrow;
use database;
use database::PooledConnection;
use diesel::PgConnection;
use env;
use kibou_api;
use lru::LruCache;
use mastodon_api::routes::status;
use mastodon_api::{
Account, Attachment, HomeTimeline, Instance, Notification, PublicTimeline, RegistrationForm,
Relationship, Source, Status, StatusForm,
Relationship, Source, Status, StatusForm, MASTODON_API_ACCOUNT_CACHE,
MASTODON_API_NOTIFICATION_CACHE, MASTODON_API_STATUS_CACHE,
};
use notification::notifications_for_actor;
use oauth;
@ -25,47 +32,26 @@ use rocket_contrib::json::JsonValue; @@ -25,47 +32,26 @@ use rocket_contrib::json::JsonValue;
use timeline;
use timeline::{home_timeline as get_home_timeline, public_timeline as get_public_timeline};
pub fn account(id: i64) -> JsonValue {
let database = database::establish_connection();
match actor::get_actor_by_id(&database, &id) {
Ok(actor) => json!(serialize_account(actor, false)),
pub fn account(pooled_connection: &PooledConnection, id: i64) -> JsonValue {
match actor::get_actor_by_id(pooled_connection, &id) {
Ok(actor) => json!(Account::from_actor(pooled_connection, actor, false)),
Err(_) => json!({"error": "User not found."}),
}
}
pub fn account_by_oauth_token(token: String) -> Result<Account, diesel::result::Error> {
let database = database::establish_connection();
match verify_token(&database, token) {
Ok(token) => match actor::get_local_actor_by_preferred_username(&database, &token.actor) {
Ok(actor) => Ok(serialize_account(actor, true)),
Err(e) => Err(e),
},
Err(e) => Err(e),
}
}
pub fn account_json_by_oauth_token(token: String) -> JsonValue {
let database = database::establish_connection();
match verify_token(&database, token) {
Ok(token) => match actor::get_local_actor_by_preferred_username(&database, &token.actor) {
Ok(actor) => json!(serialize_account(actor, true)),
Err(_) => json!({"error": "No user is associated to this token!"}),
},
pub fn account_by_oauth_token(pooled_connection: &PooledConnection, token: String) -> JsonValue {
match verify_token(pooled_connection, token) {
Ok(token) => {
match actor::get_local_actor_by_preferred_username(pooled_connection, &token.actor) {
Ok(actor) => json!(Account::from_actor(pooled_connection, actor, true)),
Err(_) => json!({"error": "No user is associated to this token!"}),
}
}
Err(_) => json!({"error": "Token invalid!"}),
}
}
pub fn account_create_json(form: &RegistrationForm) -> JsonValue {
match account_create(form) {
Some(token) => serde_json::to_value(token).unwrap().into(),
None => json!({"error": "Account could not be created!"}),
}
}
pub fn account_create(form: &RegistrationForm) -> Option<Token> {
pub fn account_create(form: &RegistrationForm) -> JsonValue {
let email_regex = Regex::new(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$").unwrap();
let username_regex = Regex::new(r"^[A-Za-z0-9_]{1,32}$").unwrap();
@ -96,34 +82,27 @@ pub fn account_create(form: &RegistrationForm) -> Option<Token> { @@ -96,34 +82,27 @@ pub fn account_create(form: &RegistrationForm) -> Option<Token> {
actor::create_actor(&database, &mut new_actor);
match actor::get_local_actor_by_preferred_username(&database, &form.username) {
Ok(_actor) => Some(oauth::token::create(&form.username)),
Err(_) => None,
Ok(_actor) => json!(oauth::token::create(&form.username)),
Err(_) => json!({"error": "Account could not be created"}),
}
} else {
return None;
return json!({"error": "Username or E-mail contains unsupported characters"});
}
}
pub fn account_statuses_json_by_id(
pub fn account_statuses_by_id(
pooled_connection: &PooledConnection,
id: i64,
max_id: Option<i64>,
since_id: Option<i64>,
min_id: Option<i64>,
limit: Option<i64>,
) -> JsonValue {
let database = database::establish_connection();
match actor::get_actor_by_id(&database, &id) {
match actor::get_actor_by_id(pooled_connection, &id) {
Ok(actor) => {
match timeline::user_timeline(&database, actor, max_id, since_id, min_id, limit) {
Ok(statuses) => {
let status_vec: Vec<Status> = statuses
.iter()
.filter(|&id| status_cached_by_id(*id).is_ok())
.map(|id| status_cached_by_id(*id).unwrap())
.collect();
return json!(status_vec);
}
match timeline::user_timeline(pooled_connection, actor, max_id, since_id, min_id, limit)
{
Ok(statuses) => cached_statuses(pooled_connection, statuses),
Err(_) => json!({"error": "Error generating user timeline."}),
}
}
@ -131,9 +110,11 @@ pub fn account_statuses_json_by_id( @@ -131,9 +110,11 @@ pub fn account_statuses_json_by_id(
}
}
pub fn application_create(application: OAuthApplication) -> rocket_contrib::json::JsonValue {
let database = database::establish_connection();
let oauth_app: OAuthApplication = oauth::application::create(&database, application);
pub fn application_create(
pooled_connection: &PooledConnection,
application: OAuthApplication,
) -> JsonValue {
let oauth_app: OAuthApplication = oauth::application::create(pooled_connection, application);
rocket_contrib::json!({
"name": oauth_app.client_name.unwrap_or_default(),
"website": oauth_app.website,
@ -144,13 +125,95 @@ pub fn application_create(application: OAuthApplication) -> rocket_contrib::json @@ -144,13 +125,95 @@ pub fn application_create(application: OAuthApplication) -> rocket_contrib::json
})
}
pub fn context_json_for_id(id: i64) -> JsonValue {
let database = database::establish_connection();
pub fn cached_account(pooled_connection: &PooledConnection, uri: &str) -> JsonValue {
let mut account_cache = MASTODON_API_ACCOUNT_CACHE.lock().unwrap();
if account_cache.contains(&uri.to_string()) {
return json!(account_cache.get(&uri.to_string()));
} else {
match actor::get_actor_by_uri(pooled_connection, uri) {
Ok(actor) => {
let result =
serde_json::json!(Account::from_actor(pooled_connection, actor, false));
account_cache.put(uri.to_string(), result.clone());
return json!(result);
}