add async/.await until all our errors are the same: that our Connection is not Send-safe.

This commit is contained in:
Mina Galić 2020-05-23 23:32:10 +02:00
parent 850b3c1337
commit d2881ee3f7
No known key found for this signature in database
GPG Key ID: ACFEFF7F6A123A86
12 changed files with 264 additions and 204 deletions

334
Cargo.lock generated
View File

@ -31,9 +31,9 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65608fdeae5eb05485d5b71a3d2242d76b2b7413608c196d47eb4dff3eed7b85" checksum = "65608fdeae5eb05485d5b71a3d2242d76b2b7413608c196d47eb4dff3eed7b85"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -62,6 +62,15 @@ dependencies = [
"serde_json", "serde_json",
] ]
[[package]]
name = "addr2line"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a49806b9dadc843c61e7c97e72490ad7f7220ae249012fbda9ad0609457c0543"
dependencies = [
"gimli",
]
[[package]] [[package]]
name = "adler32" name = "adler32"
version = "1.0.4" version = "1.0.4"
@ -70,9 +79,9 @@ checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c251dce3391a07b43218ca070203ecb8f9f520d35ab71312296a59dbceab154" checksum = "2f3e0bf23f51883cce372d5d5892211236856e4bb37fb942e1eb135ee0f146e3"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
@ -147,13 +156,13 @@ checksum = "719b48039ffac1564f67d70162109ba9341125cee0096a540e478355b3c724a7"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.30" version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" checksum = "26c4f3195085c36ea8d24d32b2f828d23296a9370a28aa39d111f6f16bef9f3b"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -218,13 +227,14 @@ dependencies = [
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.46" version = "0.3.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" checksum = "0df2f85c8a2abbe3b7d7e748052fdd9b76a0458fdeb16ad4223f5eca78c7c130"
dependencies = [ dependencies = [
"backtrace-sys", "addr2line",
"cfg-if", "cfg-if",
"libc", "libc",
"object",
"rustc-demangle", "rustc-demangle",
] ]
@ -300,9 +310,9 @@ dependencies = [
[[package]] [[package]]
name = "bindgen" name = "bindgen"
version = "0.50.1" version = "0.53.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0e5a5f74b2bafe0b39379f616b5975e08bcaca4e779c078d5c31324147e9ba" checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"cexpr", "cexpr",
@ -310,13 +320,14 @@ dependencies = [
"clang-sys", "clang-sys",
"clap", "clap",
"env_logger", "env_logger",
"fxhash",
"lazy_static", "lazy_static",
"lazycell",
"log 0.4.8", "log 0.4.8",
"peeking_take_while", "peeking_take_while",
"proc-macro2 0.4.30", "proc-macro2 1.0.15",
"quote 0.6.13", "quote 1.0.6",
"regex", "regex",
"rustc-hash",
"shlex", "shlex",
"which", "which",
] ]
@ -395,9 +406,9 @@ checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8"
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.2.1" version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
[[package]] [[package]]
name = "bytecount" name = "bytecount"
@ -425,9 +436,9 @@ checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.52" version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
[[package]] [[package]]
name = "census" name = "census"
@ -437,11 +448,11 @@ checksum = "641317709904ba3c1ad137cb5d88ec9d8c03c07de087b2cff5e84ec565c7e299"
[[package]] [[package]]
name = "cexpr" name = "cexpr"
version = "0.3.6" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d" checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [ dependencies = [
"nom 4.2.3", "nom 5.1.1",
] ]
[[package]] [[package]]
@ -476,9 +487,9 @@ dependencies = [
[[package]] [[package]]
name = "clang-sys" name = "clang-sys"
version = "0.28.1" version = "0.29.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a"
dependencies = [ dependencies = [
"glob", "glob",
"libc", "libc",
@ -487,9 +498,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.0" version = "2.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" checksum = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"atty", "atty",
@ -746,7 +757,7 @@ version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089"
dependencies = [ dependencies = [
"devise_core", "devise_core",
"quote 1.0.4", "quote 1.0.6",
] ]
[[package]] [[package]]
@ -755,9 +766,9 @@ version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -793,9 +804,9 @@ version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -930,18 +941,18 @@ checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]] [[package]]
name = "encoding_rs" name = "encoding_rs"
version = "0.8.22" version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.6.2" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
dependencies = [ dependencies = [
"atty", "atty",
"humantime", "humantime",
@ -956,7 +967,7 @@ version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd"
dependencies = [ dependencies = [
"backtrace 0.3.46", "backtrace 0.3.48",
"version_check 0.9.1", "version_check 0.9.1",
] ]
@ -977,7 +988,7 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [ dependencies = [
"backtrace 0.3.46", "backtrace 0.3.48",
"failure_derive", "failure_derive",
] ]
@ -987,9 +998,9 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
"synstructure", "synstructure",
] ]
@ -1028,9 +1039,9 @@ dependencies = [
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.6" version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
@ -1125,9 +1136,9 @@ checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -1140,9 +1151,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -1150,9 +1161,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
[[package]] [[package]]
name = "futures-cpupool" name = "futures-cpupool"
@ -1166,9 +1177,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -1177,39 +1188,42 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
dependencies = [ dependencies = [
"proc-macro-hack 0.5.15", "proc-macro-hack 0.5.15",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
dependencies = [
"once_cell 1.4.0",
]
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -1218,21 +1232,13 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project",
"pin-utils", "pin-utils",
"proc-macro-hack 0.5.15", "proc-macro-hack 0.5.15",
"proc-macro-nested", "proc-macro-nested",
"slab", "slab",
] ]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder 1.3.4",
]
[[package]] [[package]]
name = "generic-array" name = "generic-array"
version = "0.12.3" version = "0.12.3"
@ -1286,6 +1292,12 @@ name = "gettext-utils"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Plume-org/gettext-macros/?rev=a7c605f7edd6bfbfbfe7778026bfefd88d82db10#a7c605f7edd6bfbfbfe7778026bfefd88d82db10" source = "git+https://github.com/Plume-org/gettext-macros/?rev=a7c605f7edd6bfbfbfe7778026bfefd88d82db10#a7c605f7edd6bfbfbfe7778026bfefd88d82db10"
[[package]]
name = "gimli"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.0" version = "0.3.0"
@ -1384,9 +1396,9 @@ dependencies = [
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.12" version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
dependencies = [ dependencies = [
"libc", "libc",
] ]
@ -1668,9 +1680,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.69" version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1838,9 +1850,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c"
dependencies = [ dependencies = [
"migrations_internals", "migrations_internals",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -2116,6 +2128,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "object"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "0.2.4" version = "0.2.4"
@ -2127,9 +2145,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.3.1" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
[[package]] [[package]]
name = "onig" name = "onig"
@ -2145,9 +2163,9 @@ dependencies = [
[[package]] [[package]]
name = "onig_sys" name = "onig_sys"
version = "69.2.0" version = "69.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a8d4efbf5f59cece01f539305191485b651acb3785b9d5eef05749f0496514e" checksum = "3814583fad89f3c60ae0701d80e87e1fd3028741723deda72d0d4a0ecf0cb0db"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"cc", "cc",
@ -2365,22 +2383,22 @@ dependencies = [
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "0.4.13" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82c3bfbfb5bb42f99498c7234bbd768c220eb0cea6818259d0d18a1aa3d2595d" checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "0.4.13" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccbf6449dcfb18562c015526b085b8df1aa3cdab180af8ec2ebd300a3bd28f63" checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -2421,6 +2439,7 @@ version = "0.4.0"
dependencies = [ dependencies = [
"activitypub", "activitypub",
"askama_escape", "askama_escape",
"async-trait",
"atom_syndication", "atom_syndication",
"chrono", "chrono",
"clap", "clap",
@ -2455,7 +2474,7 @@ dependencies = [
"tokio", "tokio",
"validator", "validator",
"validator_derive", "validator_derive",
"webfinger", "webfinger 0.5.0 (git+https://github.com/Plume-org/webfinger?rev=4e8f12810c4a7ba7a07bbcb722cd265fdff512b6)",
] ]
[[package]] [[package]]
@ -2539,7 +2558,7 @@ dependencies = [
"diesel", "diesel",
"diesel-derive-newtype", "diesel-derive-newtype",
"diesel_migrations", "diesel_migrations",
"futures 0.3.4", "futures 0.3.5",
"glob", "glob",
"guid-create", "guid-create",
"heck", "heck",
@ -2562,15 +2581,15 @@ dependencies = [
"tokio", "tokio",
"url 2.1.1", "url 2.1.1",
"walkdir", "walkdir",
"webfinger", "webfinger 0.5.0 (git+https://github.com/Plume-org/webfinger?rev=update-deps)",
"whatlang", "whatlang",
] ]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.6" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
[[package]] [[package]]
name = "pq-sys" name = "pq-sys"
@ -2643,9 +2662,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.12" version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319" checksum = "70a50b9351bfa8d65a7d93ce712dc63d2fd15ddbf2c36990fc7cac344859c04f"
dependencies = [ dependencies = [
"unicode-xid 0.2.0", "unicode-xid 0.2.0",
] ]
@ -2712,11 +2731,11 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.4" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c1f4b0efa5fc5e8ceb705136bfee52cfdb6a4e3509f770b478cd6ed434232a7" checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
] ]
[[package]] [[package]]
@ -2995,7 +3014,7 @@ checksum = "703516ae74571f24b465b4a1431e81e2ad51336cb0ded733a55a1aa3eccac196"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
"once_cell 1.3.1", "once_cell 1.4.0",
"spin", "spin",
"untrusted", "untrusted",
"web-sys", "web-sys",
@ -3011,7 +3030,7 @@ dependencies = [
"atty", "atty",
"base16", "base16",
"base64 0.11.0", "base64 0.11.0",
"futures 0.3.4", "futures 0.3.5",
"futures-util", "futures-util",
"log 0.4.8", "log 0.4.8",
"memchr", "memchr",
@ -3034,7 +3053,7 @@ source = "git+https://github.com/SergioBenitez/Rocket?rev=async#78c8ac8ccdbe85ab
dependencies = [ dependencies = [
"devise", "devise",
"indexmap", "indexmap",
"quote 1.0.4", "quote 1.0.6",
"rocket_http", "rocket_http",
"version_check 0.9.1", "version_check 0.9.1",
"yansi 0.5.0", "yansi 0.5.0",
@ -3134,6 +3153,12 @@ version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.2.3" version = "0.2.3"
@ -3166,9 +3191,9 @@ dependencies = [
[[package]] [[package]]
name = "schannel" name = "schannel"
version = "0.1.18" version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"winapi 0.3.8", "winapi 0.3.8",
@ -3214,9 +3239,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "0.4.3" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f331b9025654145cd425b9ded0caf8f5ae0df80d418b326e2dc1c3dc5eb0620" checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"core-foundation", "core-foundation",
@ -3252,29 +3277,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.106" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.106" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.52" version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7894c8ed05b7a3a279aeb79025fdec1d3158080b75b98a08faf2806bb799edd" checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -3325,9 +3350,9 @@ checksum = "83695fde96cbe9e08f0e4eb96b1b56fdbd44f2098ee27462dda964c7745fddc7"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"itertools", "itertools",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -3338,9 +3363,9 @@ checksum = "e63e6744142336dfb606fe2b068afa2e1cca1ee6a5d8377277a92945d81fa331"
dependencies = [ dependencies = [
"bitflags 1.2.1", "bitflags 1.2.1",
"itertools", "itertools",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
] ]
[[package]] [[package]]
@ -3488,8 +3513,8 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6"
dependencies = [ dependencies = [
"phf_generator", "phf_generator",
"phf_shared", "phf_shared",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"string_cache_shared", "string_cache_shared",
] ]
@ -3562,12 +3587,12 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.19" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8e5aa70697bb26ee62214ae3288465ecec0000f05182f039b477001f08f5ae7" checksum = "95b5f192649e48a5302a13f2feb224df883b98933222369e4b3b0fe2a5447269"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"unicode-xid 0.2.0", "unicode-xid 0.2.0",
] ]
@ -3586,9 +3611,9 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
"unicode-xid 0.2.0", "unicode-xid 0.2.0",
] ]
@ -3749,9 +3774,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "0.2.20" version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05c1d570eb1a36f0345a5ce9c6c6e665b70b73d11236912c0b477616aeec47b1" checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -4068,9 +4093,9 @@ dependencies = [
"bumpalo", "bumpalo",
"lazy_static", "lazy_static",
"log 0.4.8", "log 0.4.8",
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4092,7 +4117,7 @@ version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" checksum = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776"
dependencies = [ dependencies = [
"quote 1.0.4", "quote 1.0.6",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
] ]
@ -4102,9 +4127,9 @@ version = "0.2.62"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" checksum = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a"
dependencies = [ dependencies = [
"proc-macro2 1.0.12", "proc-macro2 1.0.15",
"quote 1.0.4", "quote 1.0.6",
"syn 1.0.19", "syn 1.0.23",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4125,6 +4150,16 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webfinger"
version = "0.5.0"
source = "git+https://github.com/Plume-org/webfinger?rev=4e8f12810c4a7ba7a07bbcb722cd265fdff512b6#4e8f12810c4a7ba7a07bbcb722cd265fdff512b6"
dependencies = [
"async-trait",
"reqwest",
"serde",
]
[[package]] [[package]]
name = "webfinger" name = "webfinger"
version = "0.5.0" version = "0.5.0"
@ -4136,20 +4171,19 @@ dependencies = [
[[package]] [[package]]
name = "whatlang" name = "whatlang"
version = "0.7.4" version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eb4694f7385e63fab02bb374e8ab39bffb5c25c2bce68a9b18c51cfd554e69a" checksum = "3437a8cc85accfcd03f291a2d2a6ae8400fa78ad6f2b6aa6c38d2badb6e378e9"
dependencies = [ dependencies = [
"hashbrown", "hashbrown",
] ]
[[package]] [[package]]
name = "which" name = "which"
version = "2.0.1" version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [ dependencies = [
"failure",
"libc", "libc",
] ]

View File

@ -76,6 +76,12 @@ impl From<std::option::NoneError> for Error {
} }
} }
impl From<Error> for std::option::NoneError {
fn from(_: Error) -> Self {
std::option::NoneError
}
}
impl From<url::ParseError> for Error { impl From<url::ParseError> for Error {
fn from(_: url::ParseError) -> Self { fn from(_: url::ParseError) -> Self {
Error::Url Error::Url

View File

@ -66,6 +66,7 @@ pub struct OAuthRequest {
} }
#[get("/oauth2?<query..>")] #[get("/oauth2?<query..>")]
#[rocket::async_trait(?Send)]
pub async fn oauth( pub async fn oauth(
query: Form<OAuthRequest>, query: Form<OAuthRequest>,
rockets: PlumeRocket, rockets: PlumeRocket,

View File

@ -11,7 +11,7 @@ use rocket_contrib::json::*;
use serde::Deserialize; use serde::Deserialize;
use tokio::io::AsyncReadExt; use tokio::io::AsyncReadExt;
pub fn handle_incoming( pub async fn handle_incoming(
rockets: PlumeRocket, rockets: PlumeRocket,
data: SignedJson<serde_json::Value>, data: SignedJson<serde_json::Value>,
headers: Headers<'_>, headers: Headers<'_>,
@ -32,6 +32,7 @@ pub fn handle_incoming(
// maybe we just know an old key? // maybe we just know an old key?
actor actor
.refetch(conn) .refetch(conn)
.await
.and_then(|_| User::get(conn, actor.id)) .and_then(|_| User::get(conn, actor.id))
.and_then(|u| { .and_then(|u| {
if verify_http_headers(&u, &headers.0, &sig).is_secure() || act.clone().verify(&u) { if verify_http_headers(&u, &headers.0, &sig).is_secure() || act.clone().verify(&u) {

View File

@ -19,10 +19,14 @@ use plume_models::{
}; };
#[get("/~/<name>?<page>", rank = 2)] #[get("/~/<name>?<page>", rank = 2)]
pub fn details(name: String, page: Option<Page>, rockets: PlumeRocket) -> Result<Ructe, ErrorPage> { pub async fn details(
name: String,
page: Option<Page>,
rockets: PlumeRocket,
) -> Result<Ructe, ErrorPage> {
let page = page.unwrap_or_default(); let page = page.unwrap_or_default();
let conn = &*rockets.conn; let conn = &*rockets.conn;
let blog = Blog::find_by_fqn(&rockets, &name)?; let blog = Blog::find_by_fqn(&rockets, &name).await?;
let posts = Post::blog_page(conn, &blog, page.limits())?; let posts = Post::blog_page(conn, &blog, page.limits())?;
let articles_count = Post::count_for_blog(conn, &blog)?; let articles_count = Post::count_for_blog(conn, &blog)?;
let authors = &blog.list_authors(conn)?; let authors = &blog.list_authors(conn)?;
@ -43,7 +47,7 @@ pub async fn activity_details(
rockets: PlumeRocket, rockets: PlumeRocket,
_ap: ApRequest, _ap: ApRequest,
) -> Option<ActivityStream<CustomGroup>> { ) -> Option<ActivityStream<CustomGroup>> {
let blog = Blog::find_by_fqn(&rockets, &name).await?.ok()?; let blog = Blog::find_by_fqn(&rockets, &name).await?;
Some(ActivityStream::new(blog.to_activity(&*rockets.conn).ok()?)) Some(ActivityStream::new(blog.to_activity(&*rockets.conn).ok()?))
} }
@ -83,7 +87,7 @@ fn valid_slug(title: &str) -> Result<(), ValidationError> {
} }
#[post("/blogs/new", data = "<form>")] #[post("/blogs/new", data = "<form>")]
pub fn create(form: LenientForm<NewBlogForm>, rockets: PlumeRocket) -> RespondOrRedirect { pub async fn create(form: LenientForm<NewBlogForm>, rockets: PlumeRocket) -> RespondOrRedirect {
let slug = utils::make_actor_id(&form.title); let slug = utils::make_actor_id(&form.title);
let conn = &*rockets.conn; let conn = &*rockets.conn;
let intl = &rockets.intl.catalog; let intl = &rockets.intl.catalog;
@ -143,9 +147,11 @@ pub fn create(form: LenientForm<NewBlogForm>, rockets: PlumeRocket) -> RespondOr
} }
#[post("/~/<name>/delete")] #[post("/~/<name>/delete")]
pub fn delete(name: String, rockets: PlumeRocket) -> RespondOrRedirect { pub async fn delete(name: String, rockets: PlumeRocket) -> RespondOrRedirect {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let blog = Blog::find_by_fqn(&rockets, &name).expect("blog::delete: blog not found"); let blog = Blog::find_by_fqn(&rockets, &name)
.await
.expect("blog::delete: blog not found");
if rockets if rockets
.user .user
@ -348,9 +354,10 @@ pub async fn outbox(
name: String, name: String,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Option<ActivityStream<OrderedCollection>> { ) -> Option<ActivityStream<OrderedCollection>> {
let blog = Blog::find_by_fqn(&rockets, &name).await?.ok()?; let blog = Blog::find_by_fqn(&rockets, &name).await?;
Some(blog.outbox(&*rockets.conn).ok()?) Some(blog.outbox(&*rockets.conn).ok()?)
} }
#[allow(unused_variables)] #[allow(unused_variables)]
#[get("/~/<name>/outbox?<page>")] #[get("/~/<name>/outbox?<page>")]
pub async fn outbox_page( pub async fn outbox_page(
@ -358,12 +365,13 @@ pub async fn outbox_page(
page: Page, page: Page,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Option<ActivityStream<OrderedCollectionPage>> { ) -> Option<ActivityStream<OrderedCollectionPage>> {
let blog = Blog::find_by_fqn(&rockets, &name).await?.ok()?; let blog = Blog::find_by_fqn(&rockets, &name).await?;
Some(blog.outbox_page(&*rockets.conn, page.limits()).ok()?) Some(blog.outbox_page(&*rockets.conn, page.limits()).ok()?)
} }
#[get("/~/<name>/atom.xml")] #[get("/~/<name>/atom.xml")]
pub async fn atom_feed(name: String, rockets: PlumeRocket) -> Option<Content<String>> { pub async fn atom_feed(name: String, rockets: PlumeRocket) -> Option<Content<String>> {
let blog = Blog::find_by_fqn(&rockets, &name).await?.ok()?; let blog = Blog::find_by_fqn(&rockets, &name).await?;
let conn = &*rockets.conn; let conn = &*rockets.conn;
let entries = Post::get_recents_for_blog(&*conn, &blog, 15).ok()?; let entries = Post::get_recents_for_blog(&*conn, &blog, 15).ok()?;
let uri = Instance::get_local() let uri = Instance::get_local()

View File

@ -28,7 +28,7 @@ pub struct NewCommentForm {
} }
#[post("/~/<blog_name>/<slug>/comment", data = "<form>")] #[post("/~/<blog_name>/<slug>/comment", data = "<form>")]
pub fn create( pub async fn create(
blog_name: String, blog_name: String,
slug: String, slug: String,
form: LenientForm<NewCommentForm>, form: LenientForm<NewCommentForm>,
@ -39,9 +39,7 @@ pub fn create(
let blog = Blog::find_by_fqn(&rockets, &blog_name) let blog = Blog::find_by_fqn(&rockets, &blog_name)
.await .await
.expect("comments::create: blog error"); .expect("comments::create: blog error");
let post = Post::find_by_slug(&*conn, &slug, blog.id) let post = Post::find_by_slug(&*conn, &slug, blog.id).expect("comments::create: post error");
.await
.expect("comments::create: post error");
form.validate() form.validate()
.map(|_| { .map(|_| {
let (html, mentions, _hashtags) = utils::md_to_html( let (html, mentions, _hashtags) = utils::md_to_html(
@ -70,6 +68,7 @@ pub fn create(
.expect("comments::create: insert error"); .expect("comments::create: insert error");
let new_comment = comm let new_comment = comm
.create_activity(&rockets) .create_activity(&rockets)
.await
.expect("comments::create: activity error"); .expect("comments::create: activity error");
// save mentions // save mentions
@ -77,6 +76,7 @@ pub fn create(
Mention::from_activity( Mention::from_activity(
&*conn, &*conn,
&Mention::build_activity(&rockets, &ment) &Mention::build_activity(&rockets, &ment)
.await
.expect("comments::create: build mention error"), .expect("comments::create: build mention error"),
comm.id, comm.id,
false, false,
@ -185,8 +185,9 @@ pub fn activity_pub(
_ap: ApRequest, _ap: ApRequest,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Option<ActivityStream<Note>> { ) -> Option<ActivityStream<Note>> {
Comment::get(&*rockets.conn, id) let c = match Comment::get(&*rockets.conn, id) {
.and_then(|c| c.to_activity(&rockets)) Ok(c) => c.to_activity(&rockets).await.ok(),
.ok() Err(_) => None,
.map(ActivityStream::new) };
c.map(ActivityStream::new)
} }

View File

@ -41,20 +41,20 @@ impl<'r> Responder<'r> for ErrorPage {
} }
#[catch(404)] #[catch(404)]
pub fn not_found(req: &Request<'_>) -> Ructe { pub async fn not_found(req: &Request<'_>) -> Ructe {
let rockets = req.guard::<PlumeRocket>().unwrap(); let rockets = req.guard::<PlumeRocket>().await.unwrap();
render!(errors::not_found(&rockets.to_context())) render!(errors::not_found(&rockets.to_context()))
} }
#[catch(422)] #[catch(422)]
pub fn unprocessable_entity(req: &Request<'_>) -> Ructe { pub async fn unprocessable_entity(req: &Request<'_>) -> Ructe {
let rockets = req.guard::<PlumeRocket>().unwrap(); let rockets = req.guard::<PlumeRocket>().await.unwrap();
render!(errors::unprocessable_entity(&rockets.to_context())) render!(errors::unprocessable_entity(&rockets.to_context()))
} }
#[catch(500)] #[catch(500)]
pub fn server_error(req: &Request<'_>) -> Ructe { pub async fn server_error(req: &Request<'_>) -> Ructe {
let rockets = req.guard::<PlumeRocket>().unwrap(); let rockets = req.guard::<PlumeRocket>().await.unwrap();
render!(errors::server_error(&rockets.to_context())) render!(errors::server_error(&rockets.to_context()))
} }

View File

@ -304,11 +304,11 @@ pub async fn update(
if post.published { if post.published {
post.update_mentions( post.update_mentions(
&conn,
mentions mentions
.into_iter() .into_iter()
.filter_map(|m| Mention::build_activity(&rockets, &m).await.ok()) .filter_map(|m| Mention::build_activity(&rockets, &m).await.ok())
.collect(), .collect(),
&conn,
) )
.expect("post::update: mentions error"); .expect("post::update: mentions error");
} }
@ -645,9 +645,10 @@ pub async fn remote_interact_post(
let target = Blog::find_by_fqn(&rockets, &blog_name) let target = Blog::find_by_fqn(&rockets, &blog_name)
.await .await
.and_then(|blog| Post::find_by_slug(&rockets.conn, &slug, blog.id))?; .and_then(|blog| Post::find_by_slug(&rockets.conn, &slug, blog.id))?;
if let Some(uri) = User::fetch_remote_interact_uri(&remote.remote) if let uri = User::fetch_remote_interact_uri(&remote.remote)
.await .await
.map(|uri| uri.replace("{uri}", format!("{}", target.ap_url)).ok()) .map(|uri| uri.replace("{uri}", &format!("{}", target.ap_url)))
.unwrap()
{ {
Ok(Redirect::to(uri).into()) Ok(Redirect::to(uri).into())
} else { } else {

View File

@ -10,14 +10,14 @@ use plume_models::{
}; };
#[post("/~/<blog>/<slug>/reshare")] #[post("/~/<blog>/<slug>/reshare")]
pub fn create( pub async fn create(
blog: String, blog: String,
slug: String, slug: String,
user: User, user: User,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Result<Redirect, ErrorPage> { ) -> Result<Redirect, ErrorPage> {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let b = Blog::find_by_fqn(&rockets, &blog)?; let b = Blog::find_by_fqn(&rockets, &blog).await?;
let post = Post::find_by_slug(&*conn, &slug, b.id)?; let post = Post::find_by_slug(&*conn, &slug, b.id)?;
if !user.has_reshared(&*conn, &post)? { if !user.has_reshared(&*conn, &post)? {

View File

@ -42,14 +42,16 @@ pub struct LoginForm {
} }
#[post("/login", data = "<form>")] #[post("/login", data = "<form>")]
pub fn create( pub async fn create(
form: LenientForm<LoginForm>, form: LenientForm<LoginForm>,
mut cookies: Cookies<'_>, mut cookies: Cookies<'_>,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> RespondOrRedirect { ) -> RespondOrRedirect {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let user = User::find_by_email(&*conn, &form.email_or_name) let user = match User::find_by_email(&*conn, &form.email_or_name) {
.or_else(|_| User::find_by_fqn(&rockets, &form.email_or_name)); Ok(user) => Ok(user),
Err(_) => User::find_by_fqn(&rockets, &form.email_or_name).await,
};
let mut errors = match form.validate() { let mut errors = match form.validate() {
Ok(_) => ValidationErrors::new(), Ok(_) => ValidationErrors::new(),
Err(e) => e, Err(e) => e,

View File

@ -50,7 +50,7 @@ pub async fn details(
update_conn: DbConn, update_conn: DbConn,
) -> Result<Ructe, ErrorPage> { ) -> Result<Ructe, ErrorPage> {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let user = User::find_by_fqn(&rockets, &name)?; let user = User::find_by_fqn(&rockets, &name).await?;
let recents = Post::get_recents_for_author(&*conn, &user, 6)?; let recents = Post::get_recents_for_author(&*conn, &user, 6)?;
let reshares = Reshare::get_recents_for_author(&*conn, &user, 6)?; let reshares = Reshare::get_recents_for_author(&*conn, &user, 6)?;
let worker = &rockets.worker; let worker = &rockets.worker;
@ -149,7 +149,7 @@ pub fn dashboard_auth(i18n: I18n) -> Flash<Redirect> {
} }
#[post("/@/<name>/follow")] #[post("/@/<name>/follow")]
pub fn follow( pub async fn follow(
name: String, name: String,
user: User, user: User,
rockets: PlumeRocket, rockets: PlumeRocket,
@ -193,7 +193,7 @@ pub fn follow(
} }
#[post("/@/<name>/follow", data = "<remote_form>", rank = 2)] #[post("/@/<name>/follow", data = "<remote_form>", rank = 2)]
pub fn follow_not_connected( pub async fn follow_not_connected(
rockets: PlumeRocket, rockets: PlumeRocket,
name: String, name: String,
remote_form: Option<LenientForm<RemoteForm>>, remote_form: Option<LenientForm<RemoteForm>>,
@ -205,14 +205,14 @@ pub fn follow_not_connected(
.await .await
.ok() .ok()
.and_then(|uri| { .and_then(|uri| {
uri.replace( Some(uri.replace(
"{uri}", "{uri}",
format!( &format!(
"{}@{}", "{}@{}",
target.fqn, target.fqn,
target.get_instance(&rockets.conn).ok()?.public_domain target.get_instance(&rockets.conn).ok()?.public_domain
), ),
) ))
}) })
{ {
Ok(Redirect::to(uri).into()) Ok(Redirect::to(uri).into())
@ -270,14 +270,14 @@ pub fn follow_auth(name: String, i18n: I18n) -> Flash<Redirect> {
#[get("/@/<name>/followers?<page>", rank = 2)] #[get("/@/<name>/followers?<page>", rank = 2)]
pub async fn followers( pub async fn followers(
String, name: String,
page: Option<Page>, page: Option<Page>,
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Result<Ructe, ErrorPage> { ) -> Result<Ructe, ErrorPage> {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let page = page.unwrap_or_default(); let page = page.unwrap_or_default();
let user = User::find_by_fqn(&rockets, &name).await?; let user: User = User::find_by_fqn(&rockets, &name).await?;
let followers_count = user.count_followers(&*; let followers_count = user.count_followers(&conn);
Ok(render!(users::followers( Ok(render!(users::followers(
&rockets.to_context(), &rockets.to_context(),
@ -296,7 +296,7 @@ pub async fn followers(
} }
#[get("/@/<name>/followed?<page>", rank = 2)] #[get("/@/<name>/followed?<page>", rank = 2)]
pub fn followed( pub async fn followed(
name: String, name: String,
page: Option<Page>, page: Option<Page>,
rockets: PlumeRocket, rockets: PlumeRocket,
@ -328,8 +328,8 @@ pub async fn activity_details(
rockets: PlumeRocket, rockets: PlumeRocket,
_ap: ApRequest, _ap: ApRequest,
) -> Option<ActivityStream<CustomPerson>> { ) -> Option<ActivityStream<CustomPerson>> {
let user = User::find_by_fqn(&rockets, &name).await?.ok()?; let user: User = User::find_by_fqn(&rockets, &name).await?;
Some(ActivityStream::new(user.to_activity(&*roonn).ok()?)) Some(ActivityStream::new(user.to_activity(&*rockets.conn).ok()?))
} }
#[get("/users/new")] #[get("/users/new")]
@ -595,7 +595,7 @@ pub async fn inbox(
User::find_by_fqn(&rockets, &name) User::find_by_fqn(&rockets, &name)
.await .await
.map_err(|_| status::BadRequest(Some("User not found")))?; .map_err(|_| status::BadRequest(Some("User not found")))?;
inbox::handle_incoming(rockets, data, headers) inbox::handle_incoming(rockets, data, headers).await
} }
#[get("/@/<name>/followers", rank = 1)] #[get("/@/<name>/followers", rank = 1)]
@ -604,7 +604,7 @@ pub async fn ap_followers(
rockets: PlumeRocket, rockets: PlumeRocket,
_ap: ApRequest, _ap: ApRequest,
) -> Option<ActivityStream<OrderedCollection>> { ) -> Option<ActivityStream<OrderedCollection>> {
let user = User::find_by_fqn(&rockets, &name).await?.ok()?; let user = User::find_by_fqn(&rockets, &name).await?;
let followers = user let followers = user
.get_followers(&*rockets.conn) .get_followers(&*rockets.conn)
.ok()? .ok()?
@ -626,7 +626,7 @@ pub async fn ap_followers(
#[get("/@/<name>/atom.xml")] #[get("/@/<name>/atom.xml")]
pub async fn atom_feed(name: String, rockets: PlumeRocket) -> Option<Content<String>> { pub async fn atom_feed(name: String, rockets: PlumeRocket) -> Option<Content<String>> {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let author = User::find_by_fqn(&rockets, &name).await?.ok()?; let author = User::find_by_fqn(&rockets, &name).await?;
let entries = Post::get_recents_for_author(conn, &author, 15).ok()?; let entries = Post::get_recents_for_author(conn, &author, 15).ok()?;
let uri = Instance::get_local() let uri = Instance::get_local()
.ok()? .ok()?

View File

@ -1,3 +1,4 @@
use async_trait;
use rocket::http::ContentType; use rocket::http::ContentType;
use rocket::response::Content; use rocket::response::Content;
use serde_json; use serde_json;
@ -43,12 +44,14 @@ pub fn host_meta() -> String {
struct WebfingerResolver; struct WebfingerResolver;
impl Resolver<PlumeRocket> for WebfingerResolver { #[async_trait::async_trait]
fn instance_domain<'a>(&self) -> &'a str { impl AsyncResolver for WebfingerResolver {
type Repo = PlumeRocket;
async fn instance_domain<'a>(&self) -> &'a str {
CONFIG.base_url.as_str() CONFIG.base_url.as_str()
} }
fn find( async fn find(
&self, &self,
prefix: Prefix, prefix: Prefix,
acct: String, acct: String,
@ -66,9 +69,9 @@ impl Resolver<PlumeRocket> for WebfingerResolver {
Prefix::Custom(_) => Err(ResolverError::NotFound), Prefix::Custom(_) => Err(ResolverError::NotFound),
} }
} }
fn endpoint( async fn endpoint(
&self, &self,
resource: impl Into<String>, resource: impl Into<String> + 'async_trait,
resource_repo: PlumeRocket, resource_repo: PlumeRocket,
) -> Result<Webfinger, ResolverError> { ) -> Result<Webfinger, ResolverError> {
let resource = resource.into(); let resource = resource.into();
@ -80,7 +83,9 @@ impl Resolver<PlumeRocket> for WebfingerResolver {
let user = parsed_res.next().ok_or(ResolverError::InvalidResource)?; let user = parsed_res.next().ok_or(ResolverError::InvalidResource)?;
let domain = parsed_res.next().ok_or(ResolverError::InvalidResource)?; let domain = parsed_res.next().ok_or(ResolverError::InvalidResource)?;
if domain == webfinger.instance_domain() { if domain == webfinger.instance_domain() {
webfinger.find(res_prefix, user.to_string(), resource_repo) webfinger
.find(res_prefix, user.to_string(), resource_repo)
.await
} else { } else {
Err(ResolverError::WrongDomain) Err(ResolverError::WrongDomain)
} }
@ -88,8 +93,9 @@ impl Resolver<PlumeRocket> for WebfingerResolver {
} }
#[get("/.well-known/webfinger?<resource>")] #[get("/.well-known/webfinger?<resource>")]
pub fn webfinger(resource: String, rockets: PlumeRocket) -> Content<String> { pub async fn webfinger(resource: String, rockets: PlumeRocket) -> Content<String> {
match WebfingerResolver::endpoint(resource, rockets) match WebfingerResolver::endpoint(resource, rockets)
.await
.and_then(|wf| serde_json::to_string(&wf).map_err(|_| ResolverError::NotFound)) .and_then(|wf| serde_json::to_string(&wf).map_err(|_| ResolverError::NotFound))
{ {
Ok(wf) => Content(ContentType::new("application", "jrd+json"), wf), Ok(wf) => Content(ContentType::new("application", "jrd+json"), wf),