From 6654ad28b7dd48466869086611ee5c5b032fc5f6 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 06:23:18 +0900 Subject: [PATCH 01/61] Update rocket_csrf to 0.1.1 --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3632d47f..f4c2f04a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,8 +60,8 @@ path = "plume-common" path = "plume-models" [dependencies.rocket_csrf] -git = "https://github.com/fdb-hiroshima/rocket_csrf" -rev = "29910f2829e7e590a540da3804336577b48c7b31" +git = "https://git.joinplu.me/plume/rocket_csrf" +rev = "0.1.1" [build-dependencies] ructe = "0.14.0" From 10617f31440edbc19161aad3de075fcf771b4cde Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 06:23:25 +0900 Subject: [PATCH 02/61] Install rocket_csrf --- Cargo.lock | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd91e109..b7832850 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1290,7 +1290,7 @@ dependencies = [ "futures-sink", "nanorand", "pin-project", - "spin", + "spin 0.9.3", ] [[package]] @@ -3934,14 +3934,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.13.5" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", - "lazy_static", "libc", + "once_cell", + "spin 0.5.2", "untrusted", + "web-sys", + "winapi 0.3.9", ] [[package]] @@ -3995,8 +3998,8 @@ dependencies = [ [[package]] name = "rocket_csrf" -version = "0.1.0" -source = "git+https://github.com/fdb-hiroshima/rocket_csrf?rev=29910f2829e7e590a540da3804336577b48c7b31#29910f2829e7e590a540da3804336577b48c7b31" +version = "0.1.1" +source = "git+https://git.joinplu.me/plume/rocket_csrf?rev=0.1.1#e400909066fe57c1da7640bd086361e5233d8511" dependencies = [ "data-encoding", "ring", @@ -4398,6 +4401,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.3" @@ -5269,9 +5278,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" From 87edb2486c72dd2cd8487876ff8cd4148a9044f4 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 06:36:30 +0900 Subject: [PATCH 03/61] Update openssl --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7832850..1baa5a25 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2924,9 +2924,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.40" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", @@ -2956,9 +2956,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.73" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5fd19fb3e0a8191c1e34935718976a3e70c112ab9a24af6d7cadccd9d90bc0" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg 1.1.0", "cc", From a275aa59653ec32b215cd1949f1295e6919b32c3 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 07:10:09 +0900 Subject: [PATCH 04/61] Stick serde version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f4c2f04a..b082301b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ rocket = "0.4.11" rocket_contrib = { version = "0.4.11", features = ["json"] } rocket_i18n = "0.4.1" scheduled-thread-pool = "0.2.6" -serde = "1.0" +serde = "1.0.137" serde_json = "1.0.81" shrinkwraprs = "0.3.0" validator = { version = "0.15", features = ["derive"] } From b180089b1b1411758ffffc00dbef5987c33a59cb Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 07:10:31 +0900 Subject: [PATCH 05/61] Update ldap3 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1baa5a25..b5136b8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2163,9 +2163,9 @@ dependencies = [ [[package]] name = "ldap3" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef35dc747152dd47bdc6aaeb35a232f84cbc8d84ae4cb9673aea810a6570ab8f" +checksum = "ce38dafca0608c64cc0146fb782b06abb8d946dae7a3af23c89a95da24f6b84d" dependencies = [ "async-trait", "bytes 1.1.0", From 47394fc620f1e6c3d7a420ca29b3dcbb6a3b333d Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 07:24:32 +0900 Subject: [PATCH 06/61] Stick serde --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b082301b..a8eb72ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ rocket = "0.4.11" rocket_contrib = { version = "0.4.11", features = ["json"] } rocket_i18n = "0.4.1" scheduled-thread-pool = "0.2.6" -serde = "1.0.137" +serde = "=1.0.137" serde_json = "1.0.81" shrinkwraprs = "0.3.0" validator = { version = "0.15", features = ["derive"] } From a550291c858cfc62571233661b003dc61264e064 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 07:41:54 +0900 Subject: [PATCH 07/61] Stick activitystreams version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a8eb72ff..c767f93c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ webfinger = "0.4.1" tracing = "0.1.35" tracing-subscriber = "0.3.10" riker = "0.4.2" -activitystreams = "0.7.0-alpha.18" +activitystreams = "=0.7.0-alpha.18" [[bin]] name = "plume" From 903b48ed12e81371101cdcf73896dbd1d0de1b4c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 07:54:08 +0900 Subject: [PATCH 08/61] Stick activitystreams version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c767f93c..a8d1bd39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ webfinger = "0.4.1" tracing = "0.1.35" tracing-subscriber = "0.3.10" riker = "0.4.2" -activitystreams = "=0.7.0-alpha.18" +activitystreams = "=0.7.0-alpha.20" [[bin]] name = "plume" From 22ebecba675363047b8cb90375323de1f7d86fde Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 08:11:14 +0900 Subject: [PATCH 09/61] Stick serde for all packages --- plume-api/Cargo.toml | 2 +- plume-common/Cargo.toml | 2 +- plume-front/Cargo.toml | 2 +- plume-models/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plume-api/Cargo.toml b/plume-api/Cargo.toml index 3d608b63..8baf7aba 100644 --- a/plume-api/Cargo.toml +++ b/plume-api/Cargo.toml @@ -5,5 +5,5 @@ authors = ["Plume contributors"] edition = "2018" [dependencies] -serde = "1.0" +serde = "=1.0.137" serde_derive = "1.0" diff --git a/plume-common/Cargo.toml b/plume-common/Cargo.toml index ffa1bb47..1bc5ef5f 100644 --- a/plume-common/Cargo.toml +++ b/plume-common/Cargo.toml @@ -11,7 +11,7 @@ hex = "0.4" openssl = "0.10.40" rocket = "0.4.11" reqwest = { version = "0.11.11", features = ["blocking", "json", "socks"] } -serde = "1.0" +serde = "=1.0.137" serde_derive = "1.0" serde_json = "1.0.81" shrinkwraprs = "0.3.0" diff --git a/plume-front/Cargo.toml b/plume-front/Cargo.toml index 3ea82f17..1acea938 100644 --- a/plume-front/Cargo.toml +++ b/plume-front/Cargo.toml @@ -12,7 +12,7 @@ gettext = "0.4.0" gettext-macros = "0.6.1" gettext-utils = "0.1.0" lazy_static = "1.3" -serde = "1.0" +serde = "=1.0.137" serde_json = "1.0" wasm-bindgen = "0.2.81" js-sys = "0.3.58" diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index 49d57365..9629e277 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -17,7 +17,7 @@ rocket = "0.4.11" rocket_i18n = "0.4.1" reqwest = "0.11.11" scheduled-thread-pool = "0.2.6" -serde = "1.0" +serde = "=1.0.137" serde_derive = "1.0" serde_json = "1.0.81" tantivy = "0.13.3" From 263cf9e04fe39a153b1d51e83b552b5636e6a81e Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 1 Jan 2023 08:52:08 +0900 Subject: [PATCH 10/61] Stick activitystreams for all packages --- Cargo.lock | 4 ++-- plume-common/Cargo.toml | 2 +- plume-models/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5136b8a..d039f82c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2076,9 +2076,9 @@ checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" [[package]] name = "iri-string" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e76a2a488a2bce15f9e696e3b9b66a4e1412c13339344bba8a24b7eae30f91b" +checksum = "bf071934ee7ee97e52fa1868a9540a7885eab75926bd70794030304a9797cea1" dependencies = [ "serde 1.0.137", ] diff --git a/plume-common/Cargo.toml b/plume-common/Cargo.toml index 1bc5ef5f..29bfabee 100644 --- a/plume-common/Cargo.toml +++ b/plume-common/Cargo.toml @@ -19,7 +19,7 @@ syntect = "4.5.0" regex-syntax = { version = "0.6.26", default-features = false, features = ["unicode-perl"] } tracing = "0.1.35" askama_escape = "0.10.3" -activitystreams = "0.7.0-alpha.18" +activitystreams = "=0.7.0-alpha.20" activitystreams-ext = "0.1.0-alpha.2" url = "2.2.2" flume = "0.10.13" diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index 9629e277..0d7d0303 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -34,7 +34,7 @@ riker = "0.4.2" once_cell = "1.12.0" lettre = "0.9.6" native-tls = "0.2.10" -activitystreams = "0.7.0-alpha.18" +activitystreams = "=0.7.0-alpha.20" [dependencies.chrono] features = ["serde"] From bd91b4a3466697c20e6ccd4c0fe14fc87157b889 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 00:26:31 +0900 Subject: [PATCH 11/61] Update rocket_csrf to 0.1.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a8d1bd39..6e12e9ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,7 +61,7 @@ path = "plume-models" [dependencies.rocket_csrf] git = "https://git.joinplu.me/plume/rocket_csrf" -rev = "0.1.1" +rev = "0.1.2" [build-dependencies] ructe = "0.14.0" From ca2843822ec49e5fabca59a3cc5e0482f02da976 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 00:27:05 +0900 Subject: [PATCH 12/61] Install rocket_csrf 0.1.2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d039f82c..96313ce6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3998,8 +3998,8 @@ dependencies = [ [[package]] name = "rocket_csrf" -version = "0.1.1" -source = "git+https://git.joinplu.me/plume/rocket_csrf?rev=0.1.1#e400909066fe57c1da7640bd086361e5233d8511" +version = "0.1.2" +source = "git+https://git.joinplu.me/plume/rocket_csrf?rev=0.1.2#446d306ec5f08773253eb380f62d77077d306143" dependencies = [ "data-encoding", "ring", From 130bb4c102b89076fecc9c9bc779ceb0ea6b2f15 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 01:10:11 +0900 Subject: [PATCH 13/61] Update GitHub actions --- .github/workflows/deploy-docker-latest.yaml | 8 ++++---- .github/workflows/deploy-docker-tag.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-docker-latest.yaml b/.github/workflows/deploy-docker-latest.yaml index 8ff8f7a4..ac989f68 100644 --- a/.github/workflows/deploy-docker-latest.yaml +++ b/.github/workflows/deploy-docker-latest.yaml @@ -11,20 +11,20 @@ jobs: steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: push: true tags: plumeorg/plume:latest diff --git a/.github/workflows/deploy-docker-tag.yaml b/.github/workflows/deploy-docker-tag.yaml index 5e4a764e..73466183 100644 --- a/.github/workflows/deploy-docker-tag.yaml +++ b/.github/workflows/deploy-docker-tag.yaml @@ -11,10 +11,10 @@ jobs: steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Docker meta id: meta @@ -23,14 +23,14 @@ jobs: images: plumeorg/plume - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: push: true tags: ${{ steps.meta.outputs.tags }} From ba6d322da7fcaa3df8f91e0fa6e0268c15bc1782 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:29:48 +0900 Subject: [PATCH 14/61] Set wasm-opt = false --- plume-front/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plume-front/Cargo.toml b/plume-front/Cargo.toml index 1acea938..bcde9165 100644 --- a/plume-front/Cargo.toml +++ b/plume-front/Cargo.toml @@ -4,6 +4,9 @@ version = "0.7.2" authors = ["Plume contributors"] edition = "2018" +[package.metadata.wasm-pack.profile.release] +wasm-opt = false + [lib] crate-type = ["cdylib"] From 302026feb9e9085bf4bd0d1b208469a67eb0d1f1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:30:37 +0900 Subject: [PATCH 15/61] Update Rust on building Docker image [skip ci] --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6196e73..1c211321 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1-buster as builder +FROM rust:1 as builder RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ @@ -18,17 +18,17 @@ COPY script/wasm-deps.sh . RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh WORKDIR /app -COPY Cargo.toml Cargo.lock rust-toolchain ./ -RUN cargo install wasm-pack COPY . . +RUN echo nightly-2022-07-19 > rust-toolchain +RUN cargo install wasm-pack RUN chmod a+x ./script/plume-front.sh && sleep 1 && ./script/plume-front.sh RUN cargo install --path ./ --force --no-default-features --features postgres RUN cargo install --path plume-cli --force --no-default-features --features postgres RUN cargo clean -FROM debian:buster-slim +FROM debian:stable-slim RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ From 08cd777f8146c4a619a8615d091ef22901ed0b58 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:34:22 +0900 Subject: [PATCH 16/61] Update pear_codegen --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96313ce6..9a098f8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3070,9 +3070,9 @@ dependencies = [ [[package]] name = "pear_codegen" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" +checksum = "c0288ba5d581afbc93e2bbd931c1013584c15ecf46b1cdb927edc7abddbc8ca6" dependencies = [ "proc-macro2 0.4.30", "quote 0.6.13", From fded87654d81f3b6ce0b5001c2babcd491d9dc2c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:34:28 +0900 Subject: [PATCH 17/61] Update Rust --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index 63af764b..b57117c9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-01-27 +nightly-2022-07-19 From 2f53fc78b67b29df496aca6491de8b7e77e582a3 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:41:51 +0900 Subject: [PATCH 18/61] Remove unnecessary trick --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c211321..cfd52f1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,8 +20,6 @@ RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh WORKDIR /app COPY . . -RUN echo nightly-2022-07-19 > rust-toolchain - RUN cargo install wasm-pack RUN chmod a+x ./script/plume-front.sh && sleep 1 && ./script/plume-front.sh RUN cargo install --path ./ --force --no-default-features --features postgres From 4df2c3e6f61642937f6ca8db7ba613ae72e8e444 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 02:45:13 +0900 Subject: [PATCH 19/61] Clippy --- plume-common/src/activity_pub/sign.rs | 2 +- plume-models/src/api_tokens.rs | 2 +- plume-models/src/blocklisted_emails.rs | 5 +- plume-models/src/blogs.rs | 92 ++++----- plume-models/src/comments.rs | 16 +- plume-models/src/db_conn.rs | 3 +- plume-models/src/follows.rs | 2 +- plume-models/src/inbox.rs | 18 +- plume-models/src/instance.rs | 2 +- plume-models/src/lib.rs | 2 +- plume-models/src/likes.rs | 6 +- plume-models/src/lists.rs | 2 +- plume-models/src/medias.rs | 6 +- plume-models/src/password_reset_requests.rs | 10 +- plume-models/src/posts.rs | 29 ++- plume-models/src/reshares.rs | 6 +- plume-models/src/safe_string.rs | 2 +- plume-models/src/search/actor.rs | 34 +-- plume-models/src/search/mod.rs | 2 +- plume-models/src/tags.rs | 2 +- plume-models/src/timeline/mod.rs | 216 ++++++++++---------- plume-models/src/timeline/query.rs | 6 +- plume-models/src/users.rs | 50 ++--- src/api/apps.rs | 2 +- src/routes/blogs.rs | 26 +-- src/routes/comments.rs | 2 +- src/routes/instance.rs | 10 +- src/routes/likes.rs | 10 +- src/routes/medias.rs | 8 +- src/routes/mod.rs | 2 +- src/routes/user.rs | 12 +- src/routes/well_known.rs | 4 +- src/template_utils.rs | 2 +- 33 files changed, 297 insertions(+), 296 deletions(-) diff --git a/plume-common/src/activity_pub/sign.rs b/plume-common/src/activity_pub/sign.rs index 22aaf9d6..b7613b01 100644 --- a/plume-common/src/activity_pub/sign.rs +++ b/plume-common/src/activity_pub/sign.rs @@ -119,7 +119,7 @@ impl Signable for serde_json::Value { } } -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum SignatureValidity { Invalid, ValidNoDigest, diff --git a/plume-models/src/api_tokens.rs b/plume-models/src/api_tokens.rs index dfff4135..2a9d3618 100644 --- a/plume-models/src/api_tokens.rs +++ b/plume-models/src/api_tokens.rs @@ -103,7 +103,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApiToken { let conn = request .guard::() .map_failure(|_| (Status::InternalServerError, TokenError::DbError))?; - if let Ok(token) = ApiToken::find_by_value(&*conn, val) { + if let Ok(token) = ApiToken::find_by_value(&conn, val) { return Outcome::Success(token); } } diff --git a/plume-models/src/blocklisted_emails.rs b/plume-models/src/blocklisted_emails.rs index 3d9928b3..a6889244 100644 --- a/plume-models/src/blocklisted_emails.rs +++ b/plume-models/src/blocklisted_emails.rs @@ -126,11 +126,10 @@ pub(crate) mod tests { .id, various[1].id ); - assert_eq!( + assert!( BlocklistedEmail::matches_blocklist(&conn, no_match) .unwrap() - .is_none(), - true + .is_none() ); Ok(()) }); diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index fb20be48..489589a1 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -660,7 +660,7 @@ pub(crate) mod tests { .unwrap() .id, ); - let _: Blog = blog1.save_changes(&*conn).unwrap(); + let _: Blog = blog1.save_changes(conn).unwrap(); (users, vec![blog1, blog2, blog3]) } @@ -669,10 +669,10 @@ pub(crate) mod tests { fn get_instance() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - fill_database(&conn); + fill_database(conn); let blog = Blog::insert( - &conn, + conn, NewBlog::new_local( "SomeName".to_owned(), "Some name".to_owned(), @@ -684,7 +684,7 @@ pub(crate) mod tests { .unwrap(); assert_eq!( - blog.get_instance(&conn).unwrap().id, + blog.get_instance(conn).unwrap().id, Instance::get_local().unwrap().id ); // TODO add tests for remote instance @@ -696,10 +696,10 @@ pub(crate) mod tests { fn authors() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (user, _) = fill_database(&conn); + let (user, _) = fill_database(conn); let b1 = Blog::insert( - &conn, + conn, NewBlog::new_local( "SomeName".to_owned(), "Some name".to_owned(), @@ -710,7 +710,7 @@ pub(crate) mod tests { ) .unwrap(); let b2 = Blog::insert( - &conn, + conn, NewBlog::new_local( "Blog".to_owned(), "Blog".to_owned(), @@ -723,7 +723,7 @@ pub(crate) mod tests { let blog = vec![b1, b2]; BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[0].id, author_id: user[0].id, @@ -733,7 +733,7 @@ pub(crate) mod tests { .unwrap(); BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[0].id, author_id: user[1].id, @@ -743,7 +743,7 @@ pub(crate) mod tests { .unwrap(); BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[1].id, author_id: user[0].id, @@ -753,39 +753,39 @@ pub(crate) mod tests { .unwrap(); assert!(blog[0] - .list_authors(&conn) + .list_authors(conn) .unwrap() .iter() .any(|a| a.id == user[0].id)); assert!(blog[0] - .list_authors(&conn) + .list_authors(conn) .unwrap() .iter() .any(|a| a.id == user[1].id)); assert!(blog[1] - .list_authors(&conn) + .list_authors(conn) .unwrap() .iter() .any(|a| a.id == user[0].id)); assert!(!blog[1] - .list_authors(&conn) + .list_authors(conn) .unwrap() .iter() .any(|a| a.id == user[1].id)); - assert!(Blog::find_for_author(&conn, &user[0]) + assert!(Blog::find_for_author(conn, &user[0]) .unwrap() .iter() .any(|b| b.id == blog[0].id)); - assert!(Blog::find_for_author(&conn, &user[1]) + assert!(Blog::find_for_author(conn, &user[1]) .unwrap() .iter() .any(|b| b.id == blog[0].id)); - assert!(Blog::find_for_author(&conn, &user[0]) + assert!(Blog::find_for_author(conn, &user[0]) .unwrap() .iter() .any(|b| b.id == blog[1].id)); - assert!(!Blog::find_for_author(&conn, &user[1]) + assert!(!Blog::find_for_author(conn, &user[1]) .unwrap() .iter() .any(|b| b.id == blog[1].id)); @@ -797,10 +797,10 @@ pub(crate) mod tests { fn find_local() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - fill_database(&conn); + fill_database(conn); let blog = Blog::insert( - &conn, + conn, NewBlog::new_local( "SomeName".to_owned(), "Some name".to_owned(), @@ -811,7 +811,7 @@ pub(crate) mod tests { ) .unwrap(); - assert_eq!(Blog::find_by_fqn(&conn, "SomeName").unwrap().id, blog.id); + assert_eq!(Blog::find_by_fqn(conn, "SomeName").unwrap().id, blog.id); Ok(()) }) } @@ -820,10 +820,10 @@ pub(crate) mod tests { fn get_fqn() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - fill_database(&conn); + fill_database(conn); let blog = Blog::insert( - &conn, + conn, NewBlog::new_local( "SomeName".to_owned(), "Some name".to_owned(), @@ -843,10 +843,10 @@ pub(crate) mod tests { fn delete() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (_, blogs) = fill_database(&conn); + let (_, blogs) = fill_database(conn); - blogs[0].delete(&conn).unwrap(); - assert!(Blog::get(&conn, blogs[0].id).is_err()); + blogs[0].delete(conn).unwrap(); + assert!(Blog::get(conn, blogs[0].id).is_err()); Ok(()) }) } @@ -855,10 +855,10 @@ pub(crate) mod tests { fn delete_via_user() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (user, _) = fill_database(&conn); + let (user, _) = fill_database(conn); let b1 = Blog::insert( - &conn, + conn, NewBlog::new_local( "SomeName".to_owned(), "Some name".to_owned(), @@ -869,7 +869,7 @@ pub(crate) mod tests { ) .unwrap(); let b2 = Blog::insert( - &conn, + conn, NewBlog::new_local( "Blog".to_owned(), "Blog".to_owned(), @@ -882,7 +882,7 @@ pub(crate) mod tests { let blog = vec![b1, b2]; BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[0].id, author_id: user[0].id, @@ -892,7 +892,7 @@ pub(crate) mod tests { .unwrap(); BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[0].id, author_id: user[1].id, @@ -902,7 +902,7 @@ pub(crate) mod tests { .unwrap(); BlogAuthor::insert( - &conn, + conn, NewBlogAuthor { blog_id: blog[1].id, author_id: user[0].id, @@ -911,11 +911,11 @@ pub(crate) mod tests { ) .unwrap(); - user[0].delete(&conn).unwrap(); - assert!(Blog::get(&conn, blog[0].id).is_ok()); - assert!(Blog::get(&conn, blog[1].id).is_err()); - user[1].delete(&conn).unwrap(); - assert!(Blog::get(&conn, blog[0].id).is_err()); + user[0].delete(conn).unwrap(); + assert!(Blog::get(conn, blog[0].id).is_ok()); + assert!(Blog::get(conn, blog[1].id).is_err()); + user[1].delete(conn).unwrap(); + assert!(Blog::get(conn, blog[0].id).is_err()); Ok(()) }) } @@ -924,10 +924,10 @@ pub(crate) mod tests { fn self_federation() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, mut blogs) = fill_database(&conn); + let (users, mut blogs) = fill_database(conn); blogs[0].icon_id = Some( Media::insert( - &conn, + conn, NewMedia { file_path: "aaa.png".into(), alt_text: String::new(), @@ -943,7 +943,7 @@ pub(crate) mod tests { ); blogs[0].banner_id = Some( Media::insert( - &conn, + conn, NewMedia { file_path: "bbb.png".into(), alt_text: String::new(), @@ -958,9 +958,9 @@ pub(crate) mod tests { .id, ); let _: Blog = blogs[0].save_changes(&**conn).unwrap(); - let ap_repr = blogs[0].to_activity(&conn).unwrap(); - blogs[0].delete(&conn).unwrap(); - let blog = Blog::from_activity(&conn, ap_repr).unwrap(); + let ap_repr = blogs[0].to_activity(conn).unwrap(); + blogs[0].delete(conn).unwrap(); + let blog = Blog::from_activity(conn, ap_repr).unwrap(); assert_eq!(blog.actor_id, blogs[0].actor_id); assert_eq!(blog.title, blogs[0].title); @@ -972,8 +972,8 @@ pub(crate) mod tests { assert_eq!(blog.public_key, blogs[0].public_key); assert_eq!(blog.fqn, blogs[0].fqn); assert_eq!(blog.summary_html, blogs[0].summary_html); - assert_eq!(blog.icon_url(&conn), blogs[0].icon_url(&conn)); - assert_eq!(blog.banner_url(&conn), blogs[0].banner_url(&conn)); + assert_eq!(blog.icon_url(conn), blogs[0].icon_url(conn)); + assert_eq!(blog.banner_url(conn), blogs[0].banner_url(conn)); Ok(()) }) @@ -983,7 +983,7 @@ pub(crate) mod tests { fn to_activity() { let conn = &db(); conn.test_transaction::<_, Error, _>(|| { - let (_users, blogs) = fill_database(&conn); + let (_users, blogs) = fill_database(conn); let blog = &blogs[0]; let act = blog.to_activity(conn)?; diff --git a/plume-models/src/comments.rs b/plume-models/src/comments.rs index d928b9a3..2ae71d93 100644 --- a/plume-models/src/comments.rs +++ b/plume-models/src/comments.rs @@ -381,7 +381,7 @@ impl AsObject for Comment { } for n in Notification::find_for_comment(conn, &self)? { - n.delete(&**conn)?; + n.delete(conn)?; } diesel::update(comments::table) @@ -431,7 +431,7 @@ mod tests { use serde_json::{json, to_value}; fn prepare_activity(conn: &DbConn) -> (Comment, Vec, Vec, Vec) { - let (posts, users, blogs) = fill_database(&conn); + let (posts, users, blogs) = fill_database(conn); let comment = Comment::insert( conn, @@ -457,8 +457,8 @@ mod tests { fn self_federation() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (original_comm, posts, users, _blogs) = prepare_activity(&conn); - let act = original_comm.create_activity(&conn).unwrap(); + let (original_comm, posts, users, _blogs) = prepare_activity(conn); + let act = original_comm.create_activity(conn).unwrap(); assert_json_eq!(to_value(&act).unwrap(), json!({ "actor": "https://plu.me/@/admin/", @@ -500,7 +500,7 @@ mod tests { }, ) .unwrap(); - let reply_act = reply.create_activity(&conn).unwrap(); + let reply_act = reply.create_activity(conn).unwrap(); assert_json_eq!(to_value(&reply_act).unwrap(), json!({ "actor": "https://plu.me/@/user/", @@ -522,12 +522,12 @@ mod tests { })); inbox( - &conn, - serde_json::to_value(original_comm.build_delete(&conn).unwrap()).unwrap(), + conn, + serde_json::to_value(original_comm.build_delete(conn).unwrap()).unwrap(), ) .unwrap(); - match inbox(&conn, to_value(act).unwrap()).unwrap() { + match inbox(conn, to_value(act).unwrap()).unwrap() { InboxResult::Commented(c) => { // TODO: one is HTML, the other markdown: assert_eq!(c.content, original_comm.content); assert_eq!(c.in_response_to_id, original_comm.in_response_to_id); diff --git a/plume-models/src/db_conn.rs b/plume-models/src/db_conn.rs index 5e461b18..1f683f7f 100644 --- a/plume-models/src/db_conn.rs +++ b/plume-models/src/db_conn.rs @@ -69,7 +69,8 @@ pub(crate) mod tests { impl CustomizeConnection for TestConnectionCustomizer { fn on_acquire(&self, conn: &mut Connection) -> Result<(), ConnError> { PragmaForeignKey.on_acquire(conn)?; - Ok(conn.begin_test_transaction().unwrap()) + conn.begin_test_transaction().unwrap(); + Ok(()) } } } diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index c74b90a1..1d47b2d5 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -108,7 +108,7 @@ impl Follow { let accept = res.build_accept(from, target, follow)?; broadcast( - &*target, + target, accept, vec![from.clone()], CONFIG.proxy().cloned(), diff --git a/plume-models/src/inbox.rs b/plume-models/src/inbox.rs index fdf4056e..aafc8b32 100644 --- a/plume-models/src/inbox.rs +++ b/plume-models/src/inbox.rs @@ -82,9 +82,9 @@ pub(crate) mod tests { use crate::post_authors::*; use crate::posts::*; - let (users, blogs) = blog_fill_db(&conn); + let (users, blogs) = blog_fill_db(conn); let post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "testing".to_owned(), @@ -102,7 +102,7 @@ pub(crate) mod tests { .unwrap(); PostAuthor::insert( - &conn, + conn, NewPostAuthor { post_id: post.id, author_id: users[0].id, @@ -190,7 +190,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) @@ -221,7 +221,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) @@ -249,7 +249,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) @@ -324,7 +324,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) @@ -362,7 +362,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) @@ -397,7 +397,7 @@ pub(crate) mod tests { }); assert!(matches!( - super::inbox(&conn, act.clone()), + super::inbox(&conn, act), Err(super::Error::Inbox( box plume_common::activity_pub::inbox::InboxError::InvalidObject(_), )) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index 86cb3d46..5400a126 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -523,7 +523,7 @@ pub(crate) mod tests { .unwrap(); let inst = Instance::get(conn, inst.id).unwrap(); assert_eq!(inst.name, "NewName".to_owned()); - assert_eq!(inst.open_registrations, false); + assert!(!inst.open_registrations); assert_eq!( inst.long_description.get(), "[long_description](/with_link)" diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index c9c991b4..2de5a8cc 100644 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -354,7 +354,7 @@ mod tests { }; } - pub fn db<'a>() -> db_conn::DbConn { + pub fn db() -> db_conn::DbConn { db_conn::DbConn((*DB_POOL).get().unwrap()) } diff --git a/plume-models/src/likes.rs b/plume-models/src/likes.rs index b9dda167..5cf0b29d 100644 --- a/plume-models/src/likes.rs +++ b/plume-models/src/likes.rs @@ -199,7 +199,7 @@ mod tests { let (posts, _users, _blogs) = fill_database(&conn); let post = &posts[0]; let user = &post.get_authors(&conn)?[0]; - let like = Like::insert(&*conn, NewLike::new(post, user))?; + let like = Like::insert(&conn, NewLike::new(post, user))?; let act = like.to_activity(&conn).unwrap(); let expected = json!({ @@ -223,8 +223,8 @@ mod tests { let (posts, _users, _blogs) = fill_database(&conn); let post = &posts[0]; let user = &post.get_authors(&conn)?[0]; - let like = Like::insert(&*conn, NewLike::new(post, user))?; - let act = like.build_undo(&*conn)?; + let like = Like::insert(&conn, NewLike::new(post, user))?; + let act = like.build_undo(&conn)?; let expected = json!({ "actor": "https://plu.me/@/admin/", diff --git a/plume-models/src/lists.rs b/plume-models/src/lists.rs index 5b393f64..3a27fc52 100644 --- a/plume-models/src/lists.rs +++ b/plume-models/src/lists.rs @@ -413,7 +413,7 @@ mod tests { &List::find_for_user_by_name(conn, l1.user_id, &l1.name).unwrap(), ); l_eq( - &&l1u, + &l1u, &List::find_for_user_by_name(conn, l1u.user_id, &l1u.name).unwrap(), ); Ok(()) diff --git a/plume-models/src/medias.rs b/plume-models/src/medias.rs index 05a5278c..0d9d1157 100644 --- a/plume-models/src/medias.rs +++ b/plume-models/src/medias.rs @@ -42,7 +42,7 @@ pub struct NewMedia { pub owner_id: i32, } -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] pub enum MediaCategory { Image, Audio, @@ -343,7 +343,7 @@ pub(crate) mod tests { use std::path::Path; pub(crate) fn fill_database(conn: &Conn) -> (Vec, Vec) { - let mut wd = current_dir().unwrap().to_path_buf(); + let mut wd = current_dir().unwrap(); while wd.pop() { if wd.join(".git").exists() { set_current_dir(wd).unwrap(); @@ -456,7 +456,7 @@ pub(crate) mod tests { let media = Media::insert( conn, NewMedia { - file_path: path.clone(), + file_path: path, alt_text: "alt message".to_owned(), is_remote: false, remote_url: None, diff --git a/plume-models/src/password_reset_requests.rs b/plume-models/src/password_reset_requests.rs index cfd93529..332fdf93 100644 --- a/plume-models/src/password_reset_requests.rs +++ b/plume-models/src/password_reset_requests.rs @@ -89,7 +89,7 @@ mod tests { let request = PasswordResetRequest::find_by_token(&conn, &token) .expect("couldn't retrieve request"); - assert!(&token.len() > &32); + assert!(token.len() > 32); assert_eq!(&request.email, &admin_email); Ok(()) @@ -103,8 +103,8 @@ mod tests { user_tests::fill_database(&conn); let admin_email = "admin@example.com"; - PasswordResetRequest::insert(&conn, &admin_email).expect("couldn't insert new request"); - PasswordResetRequest::insert(&conn, &admin_email) + PasswordResetRequest::insert(&conn, admin_email).expect("couldn't insert new request"); + PasswordResetRequest::insert(&conn, admin_email) .expect("couldn't insert second request"); let count = password_reset_requests::table.count().get_result(&*conn); @@ -132,7 +132,7 @@ mod tests { .execute(&*conn) .expect("could not insert request"); - match PasswordResetRequest::find_by_token(&conn, &token) { + match PasswordResetRequest::find_by_token(&conn, token) { Err(Error::Expired) => (), _ => panic!("Received unexpected result finding expired token"), } @@ -148,7 +148,7 @@ mod tests { user_tests::fill_database(&conn); let admin_email = "admin@example.com"; - let token = PasswordResetRequest::insert(&conn, &admin_email) + let token = PasswordResetRequest::insert(&conn, admin_email) .expect("couldn't insert new request"); PasswordResetRequest::find_and_delete_by_token(&conn, &token) .expect("couldn't find and delete request"); diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index ef86ca97..d76015ac 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -133,8 +133,7 @@ impl Post { .filter(posts::id.eq_any(ids)) .filter(posts::published.eq(true)) .count() - .load(conn)? - .get(0) + .load(conn)?.first() .cloned() .ok_or(Error::NotFound) } @@ -465,7 +464,7 @@ impl Post { .collect::>(); for (m, id) in &mentions { if !old_user_mentioned.contains(id) { - Mention::from_activity(&*conn, m, self.id, true, true)?; + Mention::from_activity(conn, m, self.id, true, true)?; } } @@ -488,7 +487,7 @@ impl Post { .filter_map(|t| t.name.as_ref().map(|name| name.as_str().to_string())) .collect::>(); - let old_tags = Tag::for_post(&*conn, self.id)?; + let old_tags = Tag::for_post(conn, self.id)?; let old_tags_name = old_tags .iter() .filter_map(|tag| { @@ -525,7 +524,7 @@ impl Post { .filter_map(|t| t.name.as_ref().map(|name| name.as_str().to_string())) .collect::>(); - let old_tags = Tag::for_post(&*conn, self.id)?; + let old_tags = Tag::for_post(conn, self.id)?; let old_tags_name = old_tags .iter() .filter_map(|tag| { @@ -1036,7 +1035,7 @@ mod tests { let post = &posts[0]; let mentioned = &users[1]; let mention = Mention::insert( - &conn, + conn, NewMention { mentioned_id: mentioned.id, post_id: Some(post.id), @@ -1044,7 +1043,7 @@ mod tests { }, ) .unwrap(); - (post.to_owned(), mention.to_owned(), posts, users, blogs) + (post.to_owned(), mention, posts, users, blogs) } // creates a post, get it's Create activity, delete the post, @@ -1053,9 +1052,9 @@ mod tests { fn self_federation() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (_, users, blogs) = fill_database(&conn); + let (_, users, blogs) = fill_database(conn); let post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "yo".into(), @@ -1072,19 +1071,19 @@ mod tests { ) .unwrap(); PostAuthor::insert( - &conn, + conn, NewPostAuthor { post_id: post.id, author_id: users[0].id, }, ) .unwrap(); - let create = post.create_activity(&conn).unwrap(); - post.delete(&conn).unwrap(); + let create = post.create_activity(conn).unwrap(); + post.delete(conn).unwrap(); - match inbox(&conn, serde_json::to_value(create).unwrap()).unwrap() { + match inbox(conn, serde_json::to_value(create).unwrap()).unwrap() { InboxResult::Post(p) => { - assert!(p.is_author(&conn, users[0].id).unwrap()); + assert!(p.is_author(conn, users[0].id).unwrap()); assert_eq!(p.source, "Hello".to_owned()); assert_eq!(p.blog_id, blogs[0].id); assert_eq!(p.content, SafeString::new("Hello")); @@ -1221,7 +1220,7 @@ mod tests { let actual = to_value(act)?; let id = actual["id"].to_string(); - let (id_pre, id_post) = id.rsplit_once("-").unwrap(); + let (id_pre, id_post) = id.rsplit_once('-').unwrap(); assert_eq!(post.ap_url, "https://plu.me/~/BlogName/testing"); assert_eq!( id_pre, diff --git a/plume-models/src/reshares.rs b/plume-models/src/reshares.rs index aec75796..67811da1 100644 --- a/plume-models/src/reshares.rs +++ b/plume-models/src/reshares.rs @@ -229,7 +229,7 @@ mod test { let (posts, _users, _blogs) = fill_database(&conn); let post = &posts[0]; let user = &post.get_authors(&conn)?[0]; - let reshare = Reshare::insert(&*conn, NewReshare::new(post, user))?; + let reshare = Reshare::insert(&conn, NewReshare::new(post, user))?; let act = reshare.to_activity(&conn).unwrap(); let expected = json!({ @@ -253,8 +253,8 @@ mod test { let (posts, _users, _blogs) = fill_database(&conn); let post = &posts[0]; let user = &post.get_authors(&conn)?[0]; - let reshare = Reshare::insert(&*conn, NewReshare::new(post, user))?; - let act = reshare.build_undo(&*conn)?; + let reshare = Reshare::insert(&conn, NewReshare::new(post, user))?; + let act = reshare.build_undo(&conn)?; let expected = json!({ "actor": "https://plu.me/@/admin/", diff --git a/plume-models/src/safe_string.rs b/plume-models/src/safe_string.rs index fedcdd70..7560aa43 100644 --- a/plume-models/src/safe_string.rs +++ b/plume-models/src/safe_string.rs @@ -93,7 +93,7 @@ fn url_add_prefix(url: &str) -> Option> { } } -#[derive(Debug, Clone, PartialEq, AsExpression, FromSqlRow, Default)] +#[derive(Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, Default)] #[sql_type = "Text"] pub struct SafeString { value: String, diff --git a/plume-models/src/search/actor.rs b/plume-models/src/search/actor.rs index d97718e0..0b8afcfb 100644 --- a/plume-models/src/search/actor.rs +++ b/plume-models/src/search/actor.rs @@ -108,7 +108,7 @@ mod tests { let searcher = Arc::new(get_searcher(&CONFIG.search_tokenizers)); SearchActor::init(searcher.clone(), db_pool.clone()); - let conn = db_pool.clone().get().unwrap(); + let conn = db_pool.get().unwrap(); let title = random_hex()[..8].to_owned(); let (_instance, _user, blog) = fill_database(&conn); @@ -161,41 +161,43 @@ mod tests { long_description_html: "

Good morning

".to_string(), short_description: SafeString::new("Hello"), short_description_html: "

Hello

".to_string(), - name: random_hex().to_string(), + name: random_hex(), open_registrations: true, - public_domain: random_hex().to_string(), + public_domain: random_hex(), }, ) .unwrap(); let user = User::insert( conn, NewUser { - username: random_hex().to_string(), - display_name: random_hex().to_string(), - outbox_url: random_hex().to_string(), - inbox_url: random_hex().to_string(), + username: random_hex(), + display_name: random_hex(), + outbox_url: random_hex(), + inbox_url: random_hex(), summary: "".to_string(), email: None, hashed_password: None, instance_id: instance.id, - ap_url: random_hex().to_string(), + ap_url: random_hex(), private_key: None, public_key: "".to_string(), shared_inbox_url: None, - followers_endpoint: random_hex().to_string(), + followers_endpoint: random_hex(), avatar_id: None, summary_html: SafeString::new(""), role: 0, - fqn: random_hex().to_string(), + fqn: random_hex(), }, ) .unwrap(); - let mut blog = NewBlog::default(); - blog.instance_id = instance.id; - blog.actor_id = random_hex().to_string(); - blog.ap_url = random_hex().to_string(); - blog.inbox_url = random_hex().to_string(); - blog.outbox_url = random_hex().to_string(); + let blog = NewBlog { + instance_id: instance.id, + actor_id: random_hex(), + ap_url: random_hex(), + inbox_url: random_hex(), + outbox_url: random_hex(), + ..Default::default() + }; let blog = Blog::insert(conn, blog).unwrap(); BlogAuthor::insert( conn, diff --git a/plume-models/src/search/mod.rs b/plume-models/src/search/mod.rs index 917f7778..2948ac36 100644 --- a/plume-models/src/search/mod.rs +++ b/plume-models/src/search/mod.rs @@ -154,7 +154,7 @@ pub(crate) mod tests { }, ) .unwrap(); - searcher.add_document(&conn, &post).unwrap(); + searcher.add_document(conn, &post).unwrap(); searcher.commit(); assert_eq!( searcher.search_document(conn, Query::from_str(&title).unwrap(), (0, 1))[0].id, diff --git a/plume-models/src/tags.rs b/plume-models/src/tags.rs index 681de5e1..2d5cb08c 100644 --- a/plume-models/src/tags.rs +++ b/plume-models/src/tags.rs @@ -92,7 +92,7 @@ mod tests { let (posts, _users, _blogs) = fill_database(conn); let post_id = posts[0].id; let mut ht = Hashtag::new(); - ht.set_href(ap_url(&format!("https://plu.me/tag/a_tag")).parse::()?); + ht.set_href(ap_url("https://plu.me/tag/a_tag").parse::()?); ht.set_name("a_tag".to_string()); let tag = Tag::from_activity(conn, &ht, post_id, true)?; diff --git a/plume-models/src/timeline/mod.rs b/plume-models/src/timeline/mod.rs index 2bc87021..a8881392 100644 --- a/plume-models/src/timeline/mod.rs +++ b/plume-models/src/timeline/mod.rs @@ -14,7 +14,7 @@ pub(crate) mod query; pub use self::query::Kind; use self::query::{QueryError, TimelineQuery}; -#[derive(Clone, Debug, PartialEq, Queryable, Identifiable, AsChangeset)] +#[derive(Clone, Debug, PartialEq, Eq, Queryable, Identifiable, AsChangeset)] #[table_name = "timeline_definition"] pub struct Timeline { pub id: i32, @@ -282,73 +282,73 @@ mod tests { fn test_timeline() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let users = userTests::fill_database(&conn); + let users = userTests::fill_database(conn); let mut tl1_u1 = Timeline::new_for_user( - &conn, + conn, users[0].id, "my timeline".to_owned(), "all".to_owned(), ) .unwrap(); List::new( - &conn, + conn, "languages I speak", Some(&users[1]), ListType::Prefix, ) .unwrap(); let tl2_u1 = Timeline::new_for_user( - &conn, + conn, users[0].id, "another timeline".to_owned(), "followed".to_owned(), ) .unwrap(); let tl1_u2 = Timeline::new_for_user( - &conn, + conn, users[1].id, "english posts".to_owned(), "lang in \"languages I speak\"".to_owned(), ) .unwrap(); let tl1_instance = Timeline::new_for_instance( - &conn, + conn, "english posts".to_owned(), "license in [cc]".to_owned(), ) .unwrap(); - assert_eq!(tl1_u1, Timeline::get(&conn, tl1_u1.id).unwrap()); + assert_eq!(tl1_u1, Timeline::get(conn, tl1_u1.id).unwrap()); assert_eq!( tl2_u1, - Timeline::find_for_user_by_name(&conn, Some(users[0].id), "another timeline") + Timeline::find_for_user_by_name(conn, Some(users[0].id), "another timeline") .unwrap() ); assert_eq!( tl1_instance, - Timeline::find_for_user_by_name(&conn, None, "english posts").unwrap() + Timeline::find_for_user_by_name(conn, None, "english posts").unwrap() ); - let tl_u1 = Timeline::list_for_user(&conn, Some(users[0].id)).unwrap(); + let tl_u1 = Timeline::list_for_user(conn, Some(users[0].id)).unwrap(); assert_eq!(3, tl_u1.len()); // it is not 2 because there is a "Your feed" tl created for each user automatically - assert!(tl_u1.iter().fold(false, |res, tl| { res || *tl == tl1_u1 })); - assert!(tl_u1.iter().fold(false, |res, tl| { res || *tl == tl2_u1 })); + assert!(tl_u1.iter().any(|tl| *tl == tl1_u1)); + assert!(tl_u1.iter().any(|tl| *tl == tl2_u1)); - let tl_instance = Timeline::list_for_user(&conn, None).unwrap(); + let tl_instance = Timeline::list_for_user(conn, None).unwrap(); assert_eq!(3, tl_instance.len()); // there are also the local and federated feed by default assert!(tl_instance .iter() - .fold(false, |res, tl| { res || *tl == tl1_instance })); + .any(|tl| *tl == tl1_instance)); tl1_u1.name = "My Super TL".to_owned(); - let new_tl1_u2 = tl1_u2.update(&conn).unwrap(); + let new_tl1_u2 = tl1_u2.update(conn).unwrap(); - let tl_u2 = Timeline::list_for_user(&conn, Some(users[1].id)).unwrap(); + let tl_u2 = Timeline::list_for_user(conn, Some(users[1].id)).unwrap(); assert_eq!(2, tl_u2.len()); // same here assert!(tl_u2 .iter() - .fold(false, |res, tl| { res || *tl == new_tl1_u2 })); + .any(|tl| *tl == new_tl1_u2)); Ok(()) }); @@ -358,48 +358,48 @@ mod tests { fn test_timeline_creation_error() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let users = userTests::fill_database(&conn); + let users = userTests::fill_database(conn); assert!(Timeline::new_for_user( - &conn, + conn, users[0].id, "my timeline".to_owned(), "invalid keyword".to_owned(), ) .is_err()); assert!(Timeline::new_for_instance( - &conn, + conn, "my timeline".to_owned(), "invalid keyword".to_owned(), ) .is_err()); assert!(Timeline::new_for_user( - &conn, + conn, users[0].id, "my timeline".to_owned(), "author in non_existant_list".to_owned(), ) .is_err()); assert!(Timeline::new_for_instance( - &conn, + conn, "my timeline".to_owned(), "lang in dont-exist".to_owned(), ) .is_err()); - List::new(&conn, "friends", Some(&users[0]), ListType::User).unwrap(); - List::new(&conn, "idk", None, ListType::Blog).unwrap(); + List::new(conn, "friends", Some(&users[0]), ListType::User).unwrap(); + List::new(conn, "idk", None, ListType::Blog).unwrap(); assert!(Timeline::new_for_user( - &conn, + conn, users[0].id, "my timeline".to_owned(), "blog in friends".to_owned(), ) .is_err()); assert!(Timeline::new_for_instance( - &conn, + conn, "my timeline".to_owned(), "not author in idk".to_owned(), ) @@ -413,10 +413,10 @@ mod tests { fn test_simple_match() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, blogs) = blogTests::fill_database(&conn); + let (users, blogs) = blogTests::fill_database(conn); let gnu_tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "GNU timeline".to_owned(), "license in [AGPL, LGPL, GPL]".to_owned(), @@ -424,7 +424,7 @@ mod tests { .unwrap(); let gnu_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug".to_string(), @@ -440,10 +440,10 @@ mod tests { }, ) .unwrap(); - assert!(gnu_tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); + assert!(gnu_tl.matches(conn, &gnu_post, Kind::Original).unwrap()); let non_free_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug2".to_string(), @@ -460,7 +460,7 @@ mod tests { ) .unwrap(); assert!(!gnu_tl - .matches(&conn, &non_free_post, Kind::Original) + .matches(conn, &non_free_post, Kind::Original) .unwrap()); Ok(()) @@ -471,9 +471,9 @@ mod tests { fn test_complex_match() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, blogs) = blogTests::fill_database(&conn); + let (users, blogs) = blogTests::fill_database(conn); Follow::insert( - &conn, + conn, NewFollow { follower_id: users[0].id, following_id: users[1].id, @@ -483,11 +483,11 @@ mod tests { .unwrap(); let fav_blogs_list = - List::new(&conn, "fav_blogs", Some(&users[0]), ListType::Blog).unwrap(); - fav_blogs_list.add_blogs(&conn, &[blogs[0].id]).unwrap(); + List::new(conn, "fav_blogs", Some(&users[0]), ListType::Blog).unwrap(); + fav_blogs_list.add_blogs(conn, &[blogs[0].id]).unwrap(); let my_tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "My timeline".to_owned(), "blog in fav_blogs and not has_cover or local and followed exclude likes" @@ -496,7 +496,7 @@ mod tests { .unwrap(); let post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "about-linux".to_string(), @@ -512,10 +512,10 @@ mod tests { }, ) .unwrap(); - assert!(my_tl.matches(&conn, &post, Kind::Original).unwrap()); // matches because of "blog in fav_blogs" (and there is no cover) + assert!(my_tl.matches(conn, &post, Kind::Original).unwrap()); // matches because of "blog in fav_blogs" (and there is no cover) let post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[1].id, slug: "about-linux-2".to_string(), @@ -533,7 +533,7 @@ mod tests { }, ) .unwrap(); - assert!(!my_tl.matches(&conn, &post, Kind::Like(&users[1])).unwrap()); + assert!(!my_tl.matches(conn, &post, Kind::Like(&users[1])).unwrap()); Ok(()) }); @@ -543,17 +543,17 @@ mod tests { fn test_add_to_all_timelines() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, blogs) = blogTests::fill_database(&conn); + let (users, blogs) = blogTests::fill_database(conn); let gnu_tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "GNU timeline".to_owned(), "license in [AGPL, LGPL, GPL]".to_owned(), ) .unwrap(); let non_gnu_tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Stallman disapproved timeline".to_owned(), "not license in [AGPL, LGPL, GPL]".to_owned(), @@ -561,7 +561,7 @@ mod tests { .unwrap(); let gnu_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug".to_string(), @@ -579,7 +579,7 @@ mod tests { .unwrap(); let non_free_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug2".to_string(), @@ -596,13 +596,13 @@ mod tests { ) .unwrap(); - Timeline::add_to_all_timelines(&conn, &gnu_post, Kind::Original).unwrap(); - Timeline::add_to_all_timelines(&conn, &non_free_post, Kind::Original).unwrap(); + Timeline::add_to_all_timelines(conn, &gnu_post, Kind::Original).unwrap(); + Timeline::add_to_all_timelines(conn, &non_free_post, Kind::Original).unwrap(); - let res = gnu_tl.get_latest(&conn, 2).unwrap(); + let res = gnu_tl.get_latest(conn, 2).unwrap(); assert_eq!(res.len(), 1); assert_eq!(res[0].id, gnu_post.id); - let res = non_gnu_tl.get_latest(&conn, 2).unwrap(); + let res = non_gnu_tl.get_latest(conn, 2).unwrap(); assert_eq!(res.len(), 1); assert_eq!(res[0].id, non_free_post.id); @@ -614,10 +614,10 @@ mod tests { fn test_matches_lists_direct() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, blogs) = blogTests::fill_database(&conn); + let (users, blogs) = blogTests::fill_database(conn); let gnu_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug".to_string(), @@ -634,63 +634,63 @@ mod tests { ) .unwrap(); gnu_post - .update_tags(&conn, vec![Tag::build_activity("free".to_owned()).unwrap()]) + .update_tags(conn, vec![Tag::build_activity("free".to_owned()).unwrap()]) .unwrap(); PostAuthor::insert( - &conn, + conn, NewPostAuthor { post_id: gnu_post.id, - author_id: blogs[0].list_authors(&conn).unwrap()[0].id, + author_id: blogs[0].list_authors(conn).unwrap()[0].id, }, ) .unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "blog timeline".to_owned(), format!("blog in [{}]", blogs[0].fqn), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "blog timeline".to_owned(), "blog in [no_one@nowhere]".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "author timeline".to_owned(), format!( "author in [{}]", - blogs[0].list_authors(&conn).unwrap()[0].fqn + blogs[0].list_authors(conn).unwrap()[0].fqn ), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "author timeline".to_owned(), format!("author in [{}]", users[2].fqn), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); assert!(tl - .matches(&conn, &gnu_post, Kind::Reshare(&users[2])) + .matches(conn, &gnu_post, Kind::Reshare(&users[2])) .unwrap()); - assert!(!tl.matches(&conn, &gnu_post, Kind::Like(&users[2])).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Like(&users[2])).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "author timeline".to_owned(), format!( @@ -699,50 +699,50 @@ mod tests { ), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); assert!(!tl - .matches(&conn, &gnu_post, Kind::Reshare(&users[2])) + .matches(conn, &gnu_post, Kind::Reshare(&users[2])) .unwrap()); - assert!(tl.matches(&conn, &gnu_post, Kind::Like(&users[2])).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Like(&users[2])).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "tag timeline".to_owned(), "tags in [free]".to_owned(), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "tag timeline".to_owned(), "tags in [private]".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "english timeline".to_owned(), "lang in [en]".to_owned(), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "franco-italian timeline".to_owned(), "lang in [fr, it]".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); Ok(()) }); @@ -786,10 +786,10 @@ mod tests { fn test_matches_keyword() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let (users, blogs) = blogTests::fill_database(&conn); + let (users, blogs) = blogTests::fill_database(conn); let gnu_post = Post::insert( - &conn, + conn, NewPost { blog_id: blogs[0].id, slug: "slug".to_string(), @@ -807,61 +807,61 @@ mod tests { .unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Linux title".to_owned(), "title contains Linux".to_owned(), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Microsoft title".to_owned(), "title contains Microsoft".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Linux subtitle".to_owned(), "subtitle contains Stallman".to_owned(), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Microsoft subtitle".to_owned(), "subtitle contains Nadella".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Linux content".to_owned(), "content contains Linux".to_owned(), ) .unwrap(); - assert!(tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); let tl = Timeline::new_for_user( - &conn, + conn, users[0].id, "Microsoft content".to_owned(), "subtitle contains Windows".to_owned(), ) .unwrap(); - assert!(!tl.matches(&conn, &gnu_post, Kind::Original).unwrap()); - tl.delete(&conn).unwrap(); + assert!(!tl.matches(conn, &gnu_post, Kind::Original).unwrap()); + tl.delete(conn).unwrap(); Ok(()) }); diff --git a/plume-models/src/timeline/query.rs b/plume-models/src/timeline/query.rs index 00509440..0981d1a2 100644 --- a/plume-models/src/timeline/query.rs +++ b/plume-models/src/timeline/query.rs @@ -11,7 +11,7 @@ use crate::{ use plume_common::activity_pub::inbox::AsActor; use whatlang::{self, Lang}; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum QueryError { SyntaxError(usize, usize, String), UnexpectedEndOfQuery, @@ -20,7 +20,7 @@ pub enum QueryError { pub type QueryResult = std::result::Result; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Kind<'a> { Original, Reshare(&'a User), @@ -292,7 +292,7 @@ impl WithList { WithList::Author { boosts, likes } => match kind { Kind::Original => Ok(list .iter() - .filter_map(|a| User::find_by_fqn(&*conn, a).ok()) + .filter_map(|a| User::find_by_fqn(conn, a).ok()) .any(|a| post.is_author(conn, a.id).unwrap_or(false))), Kind::Reshare(u) => { if *boosts { diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index b33f9bc1..0314bf0b 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -187,7 +187,7 @@ impl User { users::table .filter(users::instance_id.eq(Instance::get_local()?.id)) .count() - .get_result(&*conn) + .get_result(conn) .map_err(Error::from) } @@ -435,7 +435,7 @@ impl User { } // if no user was found, and we were unable to auto-register from ldap // fake-verify a password, and return an error. - let other = User::get(&*conn, 1) + let other = User::get(conn, 1) .expect("No user is registered") .hashed_password; other.map(|pass| bcrypt::verify(password, &pass)); @@ -931,7 +931,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for User { .cookies() .get_private(AUTH_COOKIE) .and_then(|cookie| cookie.value().parse().ok()) - .and_then(|id| User::get(&*conn, id).ok()) + .and_then(|id| User::get(&conn, id).ok()) .or_forward(()) } } @@ -1232,7 +1232,7 @@ pub(crate) mod tests { ) .unwrap(); other.avatar_id = Some(avatar.id); - let other = other.save_changes::(&*conn).unwrap(); + let other = other.save_changes::(conn).unwrap(); vec![admin, user, other] } @@ -1335,11 +1335,11 @@ pub(crate) mod tests { fn delete() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let inserted = fill_database(&conn); + let inserted = fill_database(conn); - assert!(User::get(&conn, inserted[0].id).is_ok()); - inserted[0].delete(&conn).unwrap(); - assert!(User::get(&conn, inserted[0].id).is_err()); + assert!(User::get(conn, inserted[0].id).is_ok()); + inserted[0].delete(conn).unwrap(); + assert!(User::get(conn, inserted[0].id).is_err()); Ok(()) }); } @@ -1348,20 +1348,20 @@ pub(crate) mod tests { fn admin() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - let inserted = fill_database(&conn); + let inserted = fill_database(conn); let local_inst = Instance::get_local().unwrap(); let mut i = 0; - while local_inst.has_admin(&conn).unwrap() { + while local_inst.has_admin(conn).unwrap() { assert!(i < 100); //prevent from looping indefinitelly local_inst - .main_admin(&conn) + .main_admin(conn) .unwrap() - .set_role(&conn, Role::Normal) + .set_role(conn, Role::Normal) .unwrap(); i += 1; } - inserted[0].set_role(&conn, Role::Admin).unwrap(); - assert_eq!(inserted[0].id, local_inst.main_admin(&conn).unwrap().id); + inserted[0].set_role(conn, Role::Admin).unwrap(); + assert_eq!(inserted[0].id, local_inst.main_admin(conn).unwrap().id); Ok(()) }); } @@ -1370,9 +1370,9 @@ pub(crate) mod tests { fn auth() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - fill_database(&conn); + fill_database(conn); let test_user = NewUser::new_local( - &conn, + conn, "test".to_owned(), "test user".to_owned(), Role::Normal, @@ -1383,10 +1383,10 @@ pub(crate) mod tests { .unwrap(); assert_eq!( - User::login(&conn, "test", "test_password").unwrap().id, + User::login(conn, "test", "test_password").unwrap().id, test_user.id ); - assert!(User::login(&conn, "test", "other_password").is_err()); + assert!(User::login(conn, "test", "other_password").is_err()); Ok(()) }); } @@ -1395,26 +1395,26 @@ pub(crate) mod tests { fn get_local_page() { let conn = &db(); conn.test_transaction::<_, (), _>(|| { - fill_database(&conn); + fill_database(conn); - let page = User::get_local_page(&conn, (0, 2)).unwrap(); + let page = User::get_local_page(conn, (0, 2)).unwrap(); assert_eq!(page.len(), 2); assert!(page[0].username <= page[1].username); - let mut last_username = User::get_local_page(&conn, (0, 1)).unwrap()[0] + let mut last_username = User::get_local_page(conn, (0, 1)).unwrap()[0] .username .clone(); - for i in 1..User::count_local(&conn).unwrap() as i32 { - let page = User::get_local_page(&conn, (i, i + 1)).unwrap(); + for i in 1..User::count_local(conn).unwrap() as i32 { + let page = User::get_local_page(conn, (i, i + 1)).unwrap(); assert_eq!(page.len(), 1); assert!(last_username <= page[0].username); last_username = page[0].username.clone(); } assert_eq!( - User::get_local_page(&conn, (0, User::count_local(&conn).unwrap() as i32 + 10)) + User::get_local_page(conn, (0, User::count_local(conn).unwrap() as i32 + 10)) .unwrap() .len() as i64, - User::count_local(&conn).unwrap() + User::count_local(conn).unwrap() ); Ok(()) }); diff --git a/src/api/apps.rs b/src/api/apps.rs index 7bbc2d7a..b3fa280d 100644 --- a/src/api/apps.rs +++ b/src/api/apps.rs @@ -10,7 +10,7 @@ pub fn create(conn: DbConn, data: Json) -> Api { let client_id = random_hex(); let client_secret = random_hex(); let app = App::insert( - &*conn, + &conn, NewApp { name: data.name.clone(), client_id, diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index b8f28959..bff25d01 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -160,7 +160,7 @@ pub fn delete(name: String, conn: DbConn, rockets: PlumeRocket) -> RespondOrRedi .and_then(|u| u.is_author_in(&conn, &blog).ok()) .unwrap_or(false) { - blog.delete(&*conn).expect("blog::expect: deletion error"); + blog.delete(&conn).expect("blog::expect: deletion error"); Flash::success( Redirect::to(uri!(super::instance::index)), i18n!(rockets.intl.catalog, "Your blog was deleted."), @@ -364,7 +364,7 @@ pub fn outbox_page( #[get("/~//atom.xml")] pub fn atom_feed(name: String, conn: DbConn) -> Option> { let blog = Blog::find_by_fqn(&conn, &name).ok()?; - 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() .ok()? .compute_box("~", &name, "atom.xml"); @@ -454,9 +454,9 @@ mod tests { long_description_html: "

Good morning

".to_string(), short_description: SafeString::new("Hello"), short_description_html: "

Hello

".to_string(), - name: random_hex().to_string(), + name: random_hex(), open_registrations: true, - public_domain: random_hex().to_string(), + public_domain: random_hex(), }, ) .unwrap(); @@ -465,18 +465,18 @@ mod tests { }); let mut user = NewUser::default(); user.instance_id = instance.id; - user.username = random_hex().to_string(); - user.ap_url = random_hex().to_string(); - user.inbox_url = random_hex().to_string(); - user.outbox_url = random_hex().to_string(); - user.followers_endpoint = random_hex().to_string(); + user.username = random_hex(); + user.ap_url = random_hex(); + user.inbox_url = random_hex(); + user.outbox_url = random_hex(); + user.followers_endpoint = random_hex(); let user = User::insert(conn, user).unwrap(); let mut blog = NewBlog::default(); blog.instance_id = instance.id; - blog.actor_id = random_hex().to_string(); - blog.ap_url = random_hex().to_string(); - blog.inbox_url = random_hex().to_string(); - blog.outbox_url = random_hex().to_string(); + blog.actor_id = random_hex(); + blog.ap_url = random_hex(); + blog.inbox_url = random_hex(); + blog.outbox_url = random_hex(); let blog = Blog::insert(conn, blog).unwrap(); BlogAuthor::insert( conn, diff --git a/src/routes/comments.rs b/src/routes/comments.rs index 5f60aae3..c60382be 100644 --- a/src/routes/comments.rs +++ b/src/routes/comments.rs @@ -125,7 +125,7 @@ pub fn create( user.has_reshared(&conn, &post) .expect("comments::create: reshared error"), user.is_following( - &*conn, + &conn, post.get_authors(&conn) .expect("comments::create: authors error")[0] .id diff --git a/src/routes/instance.rs b/src/routes/instance.rs index 526bde31..b4ac399b 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -105,7 +105,7 @@ pub fn update_settings( Instance::get_local().expect("instance::update_settings: local instance error"); instance .update( - &*conn, + &conn, form.name.clone(), form.open_registrations, form.short_description.clone(), @@ -366,8 +366,8 @@ pub fn edit_users( } fn ban(id: i32, conn: &Connection, worker: &ScheduledThreadPool) -> Result<(), ErrorPage> { - let u = User::get(&*conn, id)?; - u.delete(&*conn)?; + let u = User::get(conn, id)?; + u.delete(conn)?; if Instance::get_local() .map(|i| u.instance_id == i.id) .unwrap_or(false) @@ -382,8 +382,8 @@ fn ban(id: i32, conn: &Connection, worker: &ScheduledThreadPool) -> Result<(), E }, ) .unwrap(); - let target = User::one_by_instance(&*conn)?; - let delete_act = u.delete_activity(&*conn)?; + let target = User::one_by_instance(conn)?; + let delete_act = u.delete_activity(conn)?; worker.execute(move || broadcast(&u, delete_act, target, CONFIG.proxy().cloned())); } diff --git a/src/routes/likes.rs b/src/routes/likes.rs index 25ca68bf..687b23a8 100644 --- a/src/routes/likes.rs +++ b/src/routes/likes.rs @@ -20,14 +20,14 @@ pub fn create( let b = Blog::find_by_fqn(&conn, &blog)?; let post = Post::find_by_slug(&conn, &slug, b.id)?; - if !user.has_liked(&*conn, &post)? { - let like = likes::Like::insert(&*conn, likes::NewLike::new(&post, &user))?; - like.notify(&*conn)?; + if !user.has_liked(&conn, &post)? { + let like = likes::Like::insert(&conn, likes::NewLike::new(&post, &user))?; + like.notify(&conn)?; Timeline::add_to_all_timelines(&conn, &post, Kind::Like(&user))?; - let dest = User::one_by_instance(&*conn)?; - let act = like.to_activity(&*conn)?; + let dest = User::one_by_instance(&conn)?; + let act = like.to_activity(&conn)?; rockets .worker .execute(move || broadcast(&user, act, dest, CONFIG.proxy().cloned())); diff --git a/src/routes/medias.rs b/src/routes/medias.rs index 8f920036..1981c542 100644 --- a/src/routes/medias.rs +++ b/src/routes/medias.rs @@ -145,9 +145,9 @@ pub fn details( #[post("/medias//delete")] pub fn delete(id: i32, user: User, conn: DbConn, intl: I18n) -> Result, ErrorPage> { - let media = Media::get(&*conn, id)?; + let media = Media::get(&conn, id)?; if media.owner_id == user.id { - media.delete(&*conn)?; + media.delete(&conn)?; Ok(Flash::success( Redirect::to(uri!(list: page = _)), i18n!(intl.catalog, "Your media have been deleted."), @@ -167,9 +167,9 @@ pub fn set_avatar( conn: DbConn, intl: I18n, ) -> Result, ErrorPage> { - let media = Media::get(&*conn, id)?; + let media = Media::get(&conn, id)?; if media.owner_id == user.id { - user.set_avatar(&*conn, media.id)?; + user.set_avatar(&conn, media.id)?; Ok(Flash::success( Redirect::to(uri!(details: id = id)), i18n!(intl.catalog, "Your avatar has been updated."), diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 5ea53c96..58d71aa6 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -165,7 +165,7 @@ fn post_to_atom(post: Post, conn: &Connection) -> Entry { .build(), ) .authors( - post.get_authors(&*conn) + post.get_authors(conn) .expect("Atom feed: author error") .into_iter() .map(|a| { diff --git a/src/routes/user.rs b/src/routes/user.rs index e1b1cfdd..c71be6e2 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -48,10 +48,10 @@ pub fn me(user: Option) -> RespondOrRedirect { #[get("/@/", rank = 2)] pub fn details(name: String, rockets: PlumeRocket, conn: DbConn) -> Result { let user = User::find_by_fqn(&conn, &name)?; - let recents = Post::get_recents_for_author(&*conn, &user, 6)?; - let reshares = Reshare::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)?; - if !user.get_instance(&*conn)?.local { + if !user.get_instance(&conn)?.local { tracing::trace!("remote user found"); user.remote_user_found(); // Doesn't block } @@ -62,14 +62,14 @@ pub fn details(name: String, rockets: PlumeRocket, conn: DbConn) -> Result for WebfingerResolver { fn find(prefix: Prefix, acct: String, conn: DbConn) -> Result { match prefix { Prefix::Acct => User::find_by_fqn(&conn, &acct) - .and_then(|usr| usr.webfinger(&*conn)) + .and_then(|usr| usr.webfinger(&conn)) .or(Err(ResolverError::NotFound)), Prefix::Group => Blog::find_by_fqn(&conn, &acct) - .and_then(|blog| blog.webfinger(&*conn)) + .and_then(|blog| blog.webfinger(&conn)) .or(Err(ResolverError::NotFound)), Prefix::Custom(_) => Err(ResolverError::NotFound), } diff --git a/src/template_utils.rs b/src/template_utils.rs index 1dfcc56d..9d4095b0 100644 --- a/src/template_utils.rs +++ b/src/template_utils.rs @@ -85,7 +85,7 @@ impl<'r> Responder<'r> for Ructe { macro_rules! render { ($group:tt :: $page:tt ( $( $param:expr ),* ) ) => { { - use crate::templates; + use $crate::templates; let mut res = vec![]; templates::$group::$page( From e10ddb50c038f510e451ed9b974f37ce0b077ba4 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 03:22:05 +0900 Subject: [PATCH 20/61] Ignore sum doc tests --- plume-models/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plume-models/src/lib.rs b/plume-models/src/lib.rs index 2de5a8cc..e74a201c 100644 --- a/plume-models/src/lib.rs +++ b/plume-models/src/lib.rs @@ -177,7 +177,7 @@ pub type Result = std::result::Result; /// /// Usage: /// -/// ```rust +/// ```ignore /// impl Model { /// find_by!(model_table, name_of_the_function, field1 as String, field2 as i32); /// } @@ -201,7 +201,7 @@ macro_rules! find_by { /// /// Usage: /// -/// ```rust +/// ```ignore /// impl Model { /// list_by!(model_table, name_of_the_function, field1 as String); /// } @@ -225,7 +225,7 @@ macro_rules! list_by { /// /// # Usage /// -/// ```rust +/// ```ignore /// impl Model { /// get!(model_table); /// } @@ -248,7 +248,7 @@ macro_rules! get { /// /// # Usage /// -/// ```rust +/// ```ignore /// impl Model { /// insert!(model_table, NewModelType); /// } @@ -280,7 +280,7 @@ macro_rules! insert { /// /// # Usage /// -/// ```rust +/// ```ignore /// impl Model { /// last!(model_table); /// } From 2804a490edea5443320c7a0e6ec84d9069526dfd Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 03:23:50 +0900 Subject: [PATCH 21/61] Don't retrieve user info from blocked instances --- plume-models/src/remote_fetch_actor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plume-models/src/remote_fetch_actor.rs b/plume-models/src/remote_fetch_actor.rs index e45a0e46..365a0180 100644 --- a/plume-models/src/remote_fetch_actor.rs +++ b/plume-models/src/remote_fetch_actor.rs @@ -45,6 +45,9 @@ impl Actor for RemoteFetchActor { RemoteUserFound(user) => match self.conn.get() { Ok(conn) => { let conn = DbConn(conn); + if user.get_instance(&conn).map_or(false, |instance| instance.blocked) { + return; + } // Don't call these functions in parallel // for the case database connections limit is too small fetch_and_cache_articles(&user, &conn); From b38d55f486ec4905653b7f1ed6253ca1c8aedcb5 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 14:34:55 +0900 Subject: [PATCH 22/61] Check email block list when email sign-up --- plume-models/src/blocklisted_emails.rs | 8 +-- plume-models/src/email_signups.rs | 11 ++++ plume-models/src/follows.rs | 7 +-- plume-models/src/posts.rs | 3 +- plume-models/src/timeline/mod.rs | 16 +---- src/routes/email_signups.rs | 85 ++++++++++++++++++++++++-- 6 files changed, 99 insertions(+), 31 deletions(-) diff --git a/plume-models/src/blocklisted_emails.rs b/plume-models/src/blocklisted_emails.rs index a6889244..ce258c85 100644 --- a/plume-models/src/blocklisted_emails.rs +++ b/plume-models/src/blocklisted_emails.rs @@ -126,11 +126,9 @@ pub(crate) mod tests { .id, various[1].id ); - assert!( - BlocklistedEmail::matches_blocklist(&conn, no_match) - .unwrap() - .is_none() - ); + assert!(BlocklistedEmail::matches_blocklist(&conn, no_match) + .unwrap() + .is_none()); Ok(()) }); } diff --git a/plume-models/src/email_signups.rs b/plume-models/src/email_signups.rs index 6867e7c7..78de4cf9 100644 --- a/plume-models/src/email_signups.rs +++ b/plume-models/src/email_signups.rs @@ -1,4 +1,5 @@ use crate::{ + blocklisted_emails::BlocklistedEmail, db_conn::DbConn, schema::email_signups, users::{NewUser, Role, User}, @@ -60,6 +61,10 @@ pub struct NewEmailSignup<'a> { impl EmailSignup { pub fn start(conn: &DbConn, email: &str) -> Result { + if let Some(x) = BlocklistedEmail::matches_blocklist(conn, email)? { + return Err(Error::Blocklisted(x.notify_user, x.notification_text)); + } + conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, email)?; let _rows = Self::delete_existings_by_email(conn, email)?; @@ -90,6 +95,9 @@ impl EmailSignup { } pub fn confirm(&self, conn: &DbConn) -> Result<()> { + if let Some(x) = BlocklistedEmail::matches_blocklist(conn, &self.email)? { + return Err(Error::Blocklisted(x.notify_user, x.notification_text)); + } conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, &self.email)?; if self.expired() { @@ -101,6 +109,9 @@ impl EmailSignup { } pub fn complete(&self, conn: &DbConn, username: String, password: String) -> Result { + if let Some(x) = BlocklistedEmail::matches_blocklist(conn, &self.email)? { + return Err(Error::Blocklisted(x.notify_user, x.notification_text)); + } conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, &self.email)?; let user = NewUser::new_local( diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index 1d47b2d5..2be7e966 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -107,12 +107,7 @@ impl Follow { res.notify(conn)?; let accept = res.build_accept(from, target, follow)?; - broadcast( - target, - accept, - vec![from.clone()], - CONFIG.proxy().cloned(), - ); + broadcast(target, accept, vec![from.clone()], CONFIG.proxy().cloned()); Ok(res) } diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index d76015ac..4d0748e0 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -133,7 +133,8 @@ impl Post { .filter(posts::id.eq_any(ids)) .filter(posts::published.eq(true)) .count() - .load(conn)?.first() + .load(conn)? + .first() .cloned() .ok_or(Error::NotFound) } diff --git a/plume-models/src/timeline/mod.rs b/plume-models/src/timeline/mod.rs index a8881392..ae515e97 100644 --- a/plume-models/src/timeline/mod.rs +++ b/plume-models/src/timeline/mod.rs @@ -291,13 +291,7 @@ mod tests { "all".to_owned(), ) .unwrap(); - List::new( - conn, - "languages I speak", - Some(&users[1]), - ListType::Prefix, - ) - .unwrap(); + List::new(conn, "languages I speak", Some(&users[1]), ListType::Prefix).unwrap(); let tl2_u1 = Timeline::new_for_user( conn, users[0].id, @@ -337,18 +331,14 @@ mod tests { let tl_instance = Timeline::list_for_user(conn, None).unwrap(); assert_eq!(3, tl_instance.len()); // there are also the local and federated feed by default - assert!(tl_instance - .iter() - .any(|tl| *tl == tl1_instance)); + assert!(tl_instance.iter().any(|tl| *tl == tl1_instance)); tl1_u1.name = "My Super TL".to_owned(); let new_tl1_u2 = tl1_u2.update(conn).unwrap(); let tl_u2 = Timeline::list_for_user(conn, Some(users[1].id)).unwrap(); assert_eq!(2, tl_u2.len()); // same here - assert!(tl_u2 - .iter() - .any(|tl| *tl == new_tl1_u2)); + assert!(tl_u2.iter().any(|tl| *tl == new_tl1_u2)); Ok(()) }); diff --git a/src/routes/email_signups.rs b/src/routes/email_signups.rs index 7a364dd0..c36b7a91 100644 --- a/src/routes/email_signups.rs +++ b/src/routes/email_signups.rs @@ -3,6 +3,7 @@ use crate::{ routes::{errors::ErrorPage, RespondOrRedirect}, template_utils::{IntoContext, Ructe}, }; + use plume_models::{ db_conn::DbConn, email_signups::EmailSignup, instance::Instance, lettre::Transport, signups, Error, PlumeRocket, CONFIG, @@ -13,7 +14,11 @@ use rocket::{ response::{Flash, Redirect}, State, }; -use std::sync::{Arc, Mutex}; +use std::{ + borrow::Cow, + collections::HashMap, + sync::{Arc, Mutex}, +}; use tracing::warn; use validator::{Validate, ValidationError, ValidationErrors}; @@ -105,6 +110,26 @@ pub fn create( render!(email_signups::create(&(&conn, &rockets).to_context())).into() } Error::NotFound => render!(errors::not_found(&(&conn, &rockets).to_context())).into(), + Error::Blocklisted(show, msg) => { + let mut errors = ValidationErrors::new(); + if *show { + errors.add( + "email", + ValidationError { + code: Cow::from("blocklisted"), + message: Some(Cow::from(msg.clone())), + params: HashMap::new(), + }, + ); + } + render!(email_signups::new( + &(&conn, &rockets).to_context(), + registration_open, + &form, + errors + )) + .into() + } _ => render!(errors::not_found(&(&conn, &rockets).to_context())).into(), // FIXME }); } @@ -153,6 +178,28 @@ pub fn show( ))) } // TODO: Flash and redirect Error::NotFound => return Err(Error::NotFound.into()), + Error::Blocklisted(show, msg) => { + let mut errors = ValidationErrors::new(); + if show { + errors.add( + "email", + ValidationError { + code: Cow::from("blocklisted"), + message: Some(Cow::from(msg)), + params: HashMap::new(), + }, + ); + } + return Ok(render!(email_signups::new( + &(&conn, &rockets).to_context(), + Instance::get_local()?.open_registrations, + &EmailSignupForm { + email: signup.email.clone(), + email_confirmation: signup.email + }, + errors + ))); + } _ => return Err(Error::NotFound.into()), // FIXME } } @@ -207,12 +254,38 @@ pub fn signup( err )))); } - let _user = signup - .complete(&conn, form.username.clone(), form.password.clone()) - .map_err(|e| { + let user = signup.complete(&conn, form.username.clone(), form.password.clone()); + match user { + Err(Error::Blocklisted(show, msg)) => { + let instance = Instance::get_local().map_err(|_| Status::UnprocessableEntity)?; + let mut errors = ValidationErrors::new(); + if show { + errors.add( + "email", + ValidationError { + code: Cow::from("blocklisted"), + message: Some(Cow::from(msg)), + params: HashMap::new(), + }, + ); + } + return Ok(render!(email_signups::new( + &(&conn, &rockets).to_context(), + instance.open_registrations, + &EmailSignupForm { + email: signup.email.clone(), + email_confirmation: signup.email + }, + errors + )) + .into()); + } + Err(e) => { warn!("{:?}", e); - Status::UnprocessableEntity - })?; + return Err(Status::UnprocessableEntity); + } + _ => {} + } Ok(FlashRedirect(Flash::success( Redirect::to(uri!(super::session::new: m = _)), i18n!( From 3b3148fa6b5618d3cd31eda9cde751676f07cf4f Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 17:41:31 +0900 Subject: [PATCH 23/61] Clippy --- src/routes/blogs.rs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index bff25d01..295d08a8 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -463,20 +463,24 @@ mod tests { Instance::cache_local(conn); instance }); - let mut user = NewUser::default(); - user.instance_id = instance.id; - user.username = random_hex(); - user.ap_url = random_hex(); - user.inbox_url = random_hex(); - user.outbox_url = random_hex(); - user.followers_endpoint = random_hex(); + let user = NewUser { + instance_id: instance.id, + username: random_hex(), + ap_url: random_hex(), + inbox_url: random_hex(), + outbox_url: random_hex(), + followers_endpoint: random_hex(), + ..Default::default() + }; let user = User::insert(conn, user).unwrap(); - let mut blog = NewBlog::default(); - blog.instance_id = instance.id; - blog.actor_id = random_hex(); - blog.ap_url = random_hex(); - blog.inbox_url = random_hex(); - blog.outbox_url = random_hex(); + let blog = NewBlog { + instance_id: instance.id, + actor_id: random_hex(), + ap_url: random_hex(), + inbox_url: random_hex(), + outbox_url: random_hex(), + ..Default::default() + }; let blog = Blog::insert(conn, blog).unwrap(); BlogAuthor::insert( conn, From 832479a7068435b560cb4c8f08af925a73794388 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 17:49:15 +0900 Subject: [PATCH 24/61] Extract EmailSingup::ensure_email_not_blocked() --- plume-models/src/email_signups.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plume-models/src/email_signups.rs b/plume-models/src/email_signups.rs index 78de4cf9..55fa1646 100644 --- a/plume-models/src/email_signups.rs +++ b/plume-models/src/email_signups.rs @@ -61,9 +61,7 @@ pub struct NewEmailSignup<'a> { impl EmailSignup { pub fn start(conn: &DbConn, email: &str) -> Result { - if let Some(x) = BlocklistedEmail::matches_blocklist(conn, email)? { - return Err(Error::Blocklisted(x.notify_user, x.notification_text)); - } + Self::ensure_email_not_blocked(conn, email)?; conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, email)?; @@ -95,9 +93,8 @@ impl EmailSignup { } pub fn confirm(&self, conn: &DbConn) -> Result<()> { - if let Some(x) = BlocklistedEmail::matches_blocklist(conn, &self.email)? { - return Err(Error::Blocklisted(x.notify_user, x.notification_text)); - } + Self::ensure_email_not_blocked(conn, &self.email)?; + conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, &self.email)?; if self.expired() { @@ -109,9 +106,8 @@ impl EmailSignup { } pub fn complete(&self, conn: &DbConn, username: String, password: String) -> Result { - if let Some(x) = BlocklistedEmail::matches_blocklist(conn, &self.email)? { - return Err(Error::Blocklisted(x.notify_user, x.notification_text)); - } + Self::ensure_email_not_blocked(conn, &self.email)?; + conn.transaction(|| { Self::ensure_user_not_exist_by_email(conn, &self.email)?; let user = NewUser::new_local( @@ -133,6 +129,14 @@ impl EmailSignup { Ok(()) } + fn ensure_email_not_blocked(conn: &DbConn, email: &str) -> Result<()> { + if let Some(x) = BlocklistedEmail::matches_blocklist(conn, email)? { + Err(Error::Blocklisted(x.notify_user, x.notification_text)) + } else { + Ok(()) + } + } + fn ensure_user_not_exist_by_email(conn: &DbConn, email: &str) -> Result<()> { if User::email_used(conn, email)? { let _rows = Self::delete_existings_by_email(conn, email)?; From 3b08d5b4850376c4d2be29d8060d8070f9af32b6 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 18:05:25 +0900 Subject: [PATCH 25/61] Update .dockerignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.dockerignore b/.dockerignore index 98547cd9..0e8239d0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,5 @@ data Dockerfile docker-compose.yml .env +target +data From 172c78c41d95ec907e8e3cc990489c814078ddaf Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 18:05:34 +0900 Subject: [PATCH 26/61] Update Dockerfile for CI --- .circleci/config.yml | 2 +- .circleci/images/plume-buildenv/Dockerfile | 3 ++- .circleci/images/plume-buildenv/rust-toolchain | 2 +- script/prebuild-in-docker.sh | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f5ac952d..f528041e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ executors: type: boolean default: false docker: - - image: plumeorg/plume-buildenv:v0.7.0 + - image: plumeorg/plume-buildenv:v0.8.0 - image: <<#parameters.postgres>>cimg/postgres:14.2<><<^parameters.postgres>>alpine:latest<> environment: POSTGRES_USER: postgres diff --git a/.circleci/images/plume-buildenv/Dockerfile b/.circleci/images/plume-buildenv/Dockerfile index 216b30e1..ceafef65 100644 --- a/.circleci/images/plume-buildenv/Dockerfile +++ b/.circleci/images/plume-buildenv/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1-buster +FROM rust:1 ENV PATH="/root/.cargo/bin:${PATH}" #install native/circleci/build dependancies @@ -14,6 +14,7 @@ RUN apt update &&\ #stick rust environment COPY rust-toolchain ./ +RUN rustup component add rustfmt clippy #compile some deps RUN cargo install wasm-pack &&\ diff --git a/.circleci/images/plume-buildenv/rust-toolchain b/.circleci/images/plume-buildenv/rust-toolchain index 63af764b..b57117c9 100644 --- a/.circleci/images/plume-buildenv/rust-toolchain +++ b/.circleci/images/plume-buildenv/rust-toolchain @@ -1 +1 @@ -nightly-2022-01-27 +nightly-2022-07-19 diff --git a/script/prebuild-in-docker.sh b/script/prebuild-in-docker.sh index 64171e5c..766930ab 100755 --- a/script/prebuild-in-docker.sh +++ b/script/prebuild-in-docker.sh @@ -3,4 +3,4 @@ set -euo pipefail version="$1" -docker run --rm -v $PWD:/repo -v $PWD/pkg:/pkg -v $PWD/script/prebuild.sh:/prebuild.sh plumeorg/plume-buildenv:v0.4.0 /prebuild.sh "$version" /repo /prebuild /pkg +docker run --rm -v $PWD:/repo -v $PWD/pkg:/pkg -v $PWD/script/prebuild.sh:/prebuild.sh plumeorg/plume-buildenv:v0.7.0 /prebuild.sh "$version" /repo /prebuild /pkg From 72f7909a42b1b5edeaae9b7ae3db3563b626cd43 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 19:15:32 +0900 Subject: [PATCH 27/61] Downgrade Docker image to run on CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f528041e..f5ac952d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ executors: type: boolean default: false docker: - - image: plumeorg/plume-buildenv:v0.8.0 + - image: plumeorg/plume-buildenv:v0.7.0 - image: <<#parameters.postgres>>cimg/postgres:14.2<><<^parameters.postgres>>alpine:latest<> environment: POSTGRES_USER: postgres From ee1e553460f02a0645eefa3ec7d703f64d3ed3a1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 Jan 2023 22:09:13 +0900 Subject: [PATCH 28/61] Fix a but about blog title and AP URL --- plume-models/src/blogs.rs | 13 ++++++++----- plume-models/src/posts.rs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 489589a1..d9c35414 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,10 +18,13 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::activity_pub::{ - inbox::{AsActor, FromId}, - sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, - ToAsString, ToAsUri, +use plume_common::{ + activity_pub::{ + inbox::{AsActor, FromId}, + sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, + SourceProperty, ToAsString, ToAsUri, + }, + utils::iri_percent_encode_seg, }; use webfinger::*; @@ -450,7 +453,7 @@ impl FromId for Blog { let any_base = AnyBase::from_extended(object)?; let id = any_base.id().ok_or(Error::MissingApProperty)?; - new_blog.ap_url = id.to_string(); + new_blog.ap_url = iri_percent_encode_seg(id.as_ref()); let inst = id .authority_components() diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 4d0748e0..74ff21d8 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -255,7 +255,7 @@ impl Post { ap_url(&format!( "{}/~/{}/{}/", CONFIG.base_url, - blog.fqn, + iri_percent_encode_seg(&blog.fqn), iri_percent_encode_seg(slug) )) } From 40e1a1fc2cbb29dd08accdea3c9e0b4d179ca18f Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 Jan 2023 17:48:31 +0900 Subject: [PATCH 29/61] Don't encode whole AP ID --- plume-models/src/blogs.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index d9c35414..489589a1 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,13 +18,10 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::{ - activity_pub::{ - inbox::{AsActor, FromId}, - sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, - SourceProperty, ToAsString, ToAsUri, - }, - utils::iri_percent_encode_seg, +use plume_common::activity_pub::{ + inbox::{AsActor, FromId}, + sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, + ToAsString, ToAsUri, }; use webfinger::*; @@ -453,7 +450,7 @@ impl FromId for Blog { let any_base = AnyBase::from_extended(object)?; let id = any_base.id().ok_or(Error::MissingApProperty)?; - new_blog.ap_url = iri_percent_encode_seg(id.as_ref()); + new_blog.ap_url = id.to_string(); let inst = id .authority_components() From afa875366ecc866d370be8b6eb5eeaa0818b5367 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Wed, 4 Jan 2023 18:54:38 +0900 Subject: [PATCH 30/61] Percent encode to create ActivityPub URI --- plume-models/src/instance.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index 5400a126..5f8e09af 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -9,7 +9,7 @@ use crate::{ use chrono::NaiveDateTime; use diesel::{self, result::Error::NotFound, ExpressionMethods, QueryDsl, RunQueryDsl}; use once_cell::sync::OnceCell; -use plume_common::utils::md_to_html; +use plume_common::utils::{md_to_html, iri_percent_encode_seg}; use std::sync::RwLock; #[derive(Clone, Identifiable, Queryable)] @@ -173,8 +173,8 @@ impl Instance { "{instance}/{prefix}/{name}/{box_name}", instance = self.public_domain, prefix = prefix, - name = name, - box_name = box_name + name = iri_percent_encode_seg(name), + box_name = iri_percent_encode_seg(box_name) )) } From 9a3699160d695713eb5160f74faa78988ab98be0 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 01:16:13 +0900 Subject: [PATCH 31/61] Fix test name --- plume-common/src/activity_pub/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index fc5c7bd7..6d93cdba 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -592,7 +592,7 @@ mod tests { } #[test] - fn de_custom_group() { + fn se_custom_group() { let group = CustomGroup::new( ApActor::new("https://example.com/inbox".parse().unwrap(), Group::new()), ApSignature { From d36f13e9849fc6b4f251cba812b00ce81824cea7 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:19:10 +0900 Subject: [PATCH 32/61] Add test for deserializing CustomGroup --- plume-common/src/activity_pub/mod.rs | 68 +++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/plume-common/src/activity_pub/mod.rs b/plume-common/src/activity_pub/mod.rs index 6d93cdba..34637399 100644 --- a/plume-common/src/activity_pub/mod.rs +++ b/plume-common/src/activity_pub/mod.rs @@ -518,7 +518,8 @@ mod tests { use super::*; use activitystreams::{ activity::{ActorAndObjectRef, Create}, - object::kind::ArticleType, + object::{kind::ArticleType, Image}, + prelude::{ApActorExt, BaseExt, ExtendsExt, ObjectExt}, }; use assert_json_diff::assert_json_eq; use serde_json::{from_str, json, to_value}; @@ -625,6 +626,71 @@ mod tests { assert_eq!(to_value(group).unwrap(), expected); } + #[test] + fn de_custom_group() { + let value: CustomGroup = from_str( + r#" + { + "icon": { + "type": "Image" + }, + "id": "https://plume01.localhost/~/Plume01%20Blog%202/", + "image": { + "type": "Image" + }, + "inbox": "https://plume01.localhost/~/Plume01%20Blog%202/inbox", + "name": "Plume01 Blog 2", + "outbox": "https://plume01.localhost/~/Plume01%20Blog%202/outbox", + "preferredUsername": "Plume01 Blog 2", + "publicKey": { + "id": "https://plume01.localhost/~/Plume01%20Blog%202/#main-key", + "owner": "https://plume01.localhost/~/Plume01%20Blog%202/", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPGtKkl/iMsNAyeVaJGz\noEz5PoNkjRnKK7G97MFvb4zw9zs5SpzWW7b/pKHa4dODcGDJXmkCJ1H5JWyguzN8\n2GNoFjtEOJHxEGwBHSYDsTmhuLNB0DKxMU2iu55g8iIiXhZiIW1FBNGs/Geaymvr\nh/TEtzdReN8wzloRR55kOVcU49xBkqx8cfDSk/lrrDLlpveHdqgaFnIvuw2vycK0\nxFzS3xlEUpzJk9kHxoR1uEAfZ+gCv26Sgo/HqOAhqSD5IU3QZC3kdkr/hwVqtr8U\nXGkGG6Mo1rgzhkYiCFkWrV2WoKkcEHD4nEzbgoZZ5MyuSoloxnyF3NiScqmqW+Yx\nkQIDAQAB\n-----END PUBLIC KEY-----\n" + }, + "source": { + "content": "", + "mediaType": "text/markdown" + }, + "summary": "", + "type": "Group" + } + "# + ).unwrap(); + let mut expected = CustomGroup::new( + ApActor::new("https://plume01.localhost/~/Plume01%20Blog%202/inbox".parse().unwrap(), Group::new()), + ApSignature { + public_key: PublicKey { + id: "https://plume01.localhost/~/Plume01%20Blog%202/#main-key".parse().unwrap(), + owner: "https://plume01.localhost/~/Plume01%20Blog%202/".parse().unwrap(), + public_key_pem: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPGtKkl/iMsNAyeVaJGz\noEz5PoNkjRnKK7G97MFvb4zw9zs5SpzWW7b/pKHa4dODcGDJXmkCJ1H5JWyguzN8\n2GNoFjtEOJHxEGwBHSYDsTmhuLNB0DKxMU2iu55g8iIiXhZiIW1FBNGs/Geaymvr\nh/TEtzdReN8wzloRR55kOVcU49xBkqx8cfDSk/lrrDLlpveHdqgaFnIvuw2vycK0\nxFzS3xlEUpzJk9kHxoR1uEAfZ+gCv26Sgo/HqOAhqSD5IU3QZC3kdkr/hwVqtr8U\nXGkGG6Mo1rgzhkYiCFkWrV2WoKkcEHD4nEzbgoZZ5MyuSoloxnyF3NiScqmqW+Yx\nkQIDAQAB\n-----END PUBLIC KEY-----\n".into(), + } + }, + SourceProperty { + source: Source { + content: String::from(""), + media_type: String::from("text/markdown") + } + } + ); + expected.set_icon(Image::new().into_any_base().unwrap()); + expected.set_id( + "https://plume01.localhost/~/Plume01%20Blog%202/" + .parse() + .unwrap(), + ); + expected.set_image(Image::new().into_any_base().unwrap()); + expected.set_name("Plume01 Blog 2"); + expected.set_outbox( + "https://plume01.localhost/~/Plume01%20Blog%202/outbox" + .parse() + .unwrap(), + ); + expected.set_preferred_username("Plume01 Blog 2"); + expected.set_summary(""); + + assert_json_eq!(value, expected); + } + #[test] fn se_licensed_article() { let object = ApObject::new(Article::new()); From 399af4004a3bf034573f1d35e838ebe62521fe20 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:20:25 +0900 Subject: [PATCH 33/61] Build CustomPerson from source string at once --- plume-models/src/users.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 0314bf0b..200260fe 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -246,20 +246,7 @@ impl User { fn fetch(url: &str) -> Result { let res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?; let text = &res.text()?; - // without this workaround, publicKey is not correctly deserialized - let ap_sign = serde_json::from_str::(text)?; - let person = serde_json::from_str::(text)?; - let json = CustomPerson::new( - ApActor::new( - person - .clone() - .id_unchecked() - .ok_or(Error::MissingApProperty)? - .to_owned(), - person, - ), - ap_sign, - ); // FIXME: Don't clone() + let json = serde_json::from_str::(text)?; Ok(json) } From f138ae6ed9702f5905482b12210598bc93fdbd3f Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:20:57 +0900 Subject: [PATCH 34/61] Allow empty avatar for remote users --- plume-models/src/users.rs | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 200260fe..3908739c 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -256,23 +256,13 @@ impl User { pub fn refetch(&self, conn: &Connection) -> Result<()> { User::fetch(&self.ap_url.clone()).and_then(|json| { - let avatar = Media::save_remote( - conn, - json.ap_actor_ref() - .icon() - .ok_or(Error::MissingApProperty)? // FIXME: Fails when icon is not set - .iter() - .next() - .and_then(|i| { - i.clone() - .extend::() // FIXME: Don't clone() - .ok()? - .and_then(|url| Some(url.id_unchecked()?.to_string())) - }) - .ok_or(Error::MissingApProperty)?, - self, - ) - .ok(); + let avatar = json + .icon() + .and_then(|icon| icon.iter().next()) + .and_then(|i| i.clone().extend::().ok()) + .and_then(|image| image) + .and_then(|image| image.id_unchecked().map(|url| url.to_string())) + .and_then(|url| Media::save_remote(conn, url, self).ok()); let pub_key = &json.ext_one.public_key.public_key_pem; diesel::update(self) From 85cacf4239178215b2085f46f7b1c0b745703d21 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:23:50 +0900 Subject: [PATCH 35/61] Format --- plume-models/src/instance.rs | 2 +- plume-models/src/remote_fetch_actor.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index 5f8e09af..3da8cbb8 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -9,7 +9,7 @@ use crate::{ use chrono::NaiveDateTime; use diesel::{self, result::Error::NotFound, ExpressionMethods, QueryDsl, RunQueryDsl}; use once_cell::sync::OnceCell; -use plume_common::utils::{md_to_html, iri_percent_encode_seg}; +use plume_common::utils::{iri_percent_encode_seg, md_to_html}; use std::sync::RwLock; #[derive(Clone, Identifiable, Queryable)] diff --git a/plume-models/src/remote_fetch_actor.rs b/plume-models/src/remote_fetch_actor.rs index 365a0180..ea0ecc2d 100644 --- a/plume-models/src/remote_fetch_actor.rs +++ b/plume-models/src/remote_fetch_actor.rs @@ -45,7 +45,10 @@ impl Actor for RemoteFetchActor { RemoteUserFound(user) => match self.conn.get() { Ok(conn) => { let conn = DbConn(conn); - if user.get_instance(&conn).map_or(false, |instance| instance.blocked) { + if user + .get_instance(&conn) + .map_or(false, |instance| instance.blocked) + { return; } // Don't call these functions in parallel From e746a0b03f2223d8ac0357a78a1a5fe6a0d221ad Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:25:58 +0900 Subject: [PATCH 36/61] Add error log for invalid preferredUsername --- plume-models/src/blogs.rs | 1 + plume-models/src/users.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 489589a1..0458895c 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -381,6 +381,7 @@ impl FromId for Blog { .ok_or(Error::MissingApProperty)? .to_string(); if name.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\t'][..]) { + tracing::error!("preferredUsername includes invalid character(s): {}", &name); return Err(Error::InvalidValue); } ( diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 3908739c..8dbd2712 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -937,6 +937,7 @@ impl FromId for User { .to_string(); if username.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\t'][..]) { + tracing::error!("preferredUsername includes invalid character(s): {}", &username); return Err(Error::InvalidValue); } From 2d10ddb9fa524a73d49d231e70594ff3d8651f72 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:33:29 +0900 Subject: [PATCH 37/61] Clippy --- plume-common/src/activity_pub/inbox.rs | 6 +++--- plume-common/src/activity_pub/request.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plume-common/src/activity_pub/inbox.rs b/plume-common/src/activity_pub/inbox.rs index e2a769ee..e8d36ccb 100644 --- a/plume-common/src/activity_pub/inbox.rs +++ b/plume-common/src/activity_pub/inbox.rs @@ -561,7 +561,7 @@ mod tests { use once_cell::sync::Lazy; use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa}; - static MY_SIGNER: Lazy = Lazy::new(|| MySigner::new()); + static MY_SIGNER: Lazy = Lazy::new(MySigner::new); struct MySigner { public_key: String, @@ -596,7 +596,7 @@ mod tests { .unwrap(); let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap(); verifier.update(data.as_bytes()).unwrap(); - verifier.verify(&signature).map_err(|_| SignError()) + verifier.verify(signature).map_err(|_| SignError()) } } @@ -782,7 +782,7 @@ mod tests { .done(); assert!(res.is_err()); - let res: Result<(), ()> = Inbox::handle(&(), act.clone()) + let res: Result<(), ()> = Inbox::handle(&(), act) .with::(None) .with::(None) .done(); diff --git a/plume-common/src/activity_pub/request.rs b/plume-common/src/activity_pub/request.rs index 3d60b820..4d5a4097 100644 --- a/plume-common/src/activity_pub/request.rs +++ b/plume-common/src/activity_pub/request.rs @@ -253,7 +253,7 @@ mod tests { .unwrap(); let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap(); verifier.update(data.as_bytes()).unwrap(); - verifier.verify(&signature).map_err(|_| Error()) + verifier.verify(signature).map_err(|_| Error()) } } @@ -262,7 +262,7 @@ mod tests { let signer = MySigner::new(); let headers = HeaderMap::new(); let result = signature(&signer, &headers, ("post", "/inbox", None)).unwrap(); - let fields: Vec<&str> = result.to_str().unwrap().split(",").collect(); + let fields: Vec<&str> = result.to_str().unwrap().split(',').collect(); assert_eq!(r#"headers="(request-target)""#, fields[2]); let sign = &fields[3][11..(fields[3].len() - 1)]; assert!(signer.verify("post /inbox", sign.as_bytes()).is_ok()); From 9776374d17822d5a4bb43e833a1830310cbbfecc Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 02:46:07 +0900 Subject: [PATCH 38/61] Rejectd illegal characters from blog name --- src/routes/blogs.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 295d08a8..40150ca3 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -82,6 +82,8 @@ fn valid_slug(title: &str) -> Result<(), ValidationError> { let slug = Blog::slug(title); if slug.is_empty() { Err(ValidationError::new("empty_slug")) + } else if slug.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\n', '\t'][..]) { + Err(ValidationError::new("slug_illegal_char")) } else { Ok(()) } From d741238ccb966ff69c8aeeaa7c7538b14844102a Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 03:11:20 +0900 Subject: [PATCH 39/61] Revert "Rejectd illegal characters from blog name" This reverts commit 9776374d17822d5a4bb43e833a1830310cbbfecc. --- src/routes/blogs.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 40150ca3..295d08a8 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -82,8 +82,6 @@ fn valid_slug(title: &str) -> Result<(), ValidationError> { let slug = Blog::slug(title); if slug.is_empty() { Err(ValidationError::new("empty_slug")) - } else if slug.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\n', '\t'][..]) { - Err(ValidationError::new("slug_illegal_char")) } else { Ok(()) } From 704e9aa47fb46a27ec6c7fe0be4fa43f09baf81c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 04:13:40 +0900 Subject: [PATCH 40/61] Make blogs.fqn valid --- plume-models/src/blogs.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 0458895c..53f3c76e 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,11 +18,11 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::activity_pub::{ +use plume_common::{activity_pub::{ inbox::{AsActor, FromId}, sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, ToAsString, ToAsUri, -}; +}, utils::iri_percent_encode_seg}; use webfinger::*; #[derive(Queryable, Identifiable, Clone, AsChangeset, Debug)] @@ -83,9 +83,9 @@ impl Blog { if inserted.fqn.is_empty() { if instance.local { - inserted.fqn = inserted.actor_id.clone(); + inserted.fqn = iri_percent_encode_seg(&inserted.actor_id.clone()); } else { - inserted.fqn = format!("{}@{}", inserted.actor_id, instance.public_domain); + inserted.fqn = format!("{}@{}", iri_percent_encode_seg(&inserted.actor_id), instance.public_domain); } } From 699fdc30d96e14e45c58d4ad29bd1d81680967ee Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 04:13:52 +0900 Subject: [PATCH 41/61] Make preferredUsername of blogs valid --- plume-models/src/blogs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 53f3c76e..a0ec276a 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -166,7 +166,7 @@ impl Blog { pub fn to_activity(&self, conn: &Connection) -> Result { let mut blog = ApActor::new(self.inbox_url.parse()?, Group::new()); - blog.set_preferred_username(self.actor_id.clone()); + blog.set_preferred_username(iri_percent_encode_seg(&self.actor_id)); blog.set_name(self.title.clone()); blog.set_outbox(self.outbox_url.parse()?); blog.set_summary(self.summary_html.to_string()); From 3580fb04fa65505b6cb2db119ad0903ec7683140 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 04:14:25 +0900 Subject: [PATCH 42/61] Format --- plume-models/src/blogs.rs | 19 +++++++++++++------ plume-models/src/users.rs | 5 ++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index a0ec276a..fada72f8 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -18,11 +18,14 @@ use openssl::{ rsa::Rsa, sign::{Signer, Verifier}, }; -use plume_common::{activity_pub::{ - inbox::{AsActor, FromId}, - sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, SourceProperty, - ToAsString, ToAsUri, -}, utils::iri_percent_encode_seg}; +use plume_common::{ + activity_pub::{ + inbox::{AsActor, FromId}, + sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, + SourceProperty, ToAsString, ToAsUri, + }, + utils::iri_percent_encode_seg, +}; use webfinger::*; #[derive(Queryable, Identifiable, Clone, AsChangeset, Debug)] @@ -85,7 +88,11 @@ impl Blog { if instance.local { inserted.fqn = iri_percent_encode_seg(&inserted.actor_id.clone()); } else { - inserted.fqn = format!("{}@{}", iri_percent_encode_seg(&inserted.actor_id), instance.public_domain); + inserted.fqn = format!( + "{}@{}", + iri_percent_encode_seg(&inserted.actor_id), + instance.public_domain + ); } } diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 8dbd2712..0d2627d4 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -937,7 +937,10 @@ impl FromId for User { .to_string(); if username.contains(&['<', '>', '&', '@', '\'', '"', ' ', '\t'][..]) { - tracing::error!("preferredUsername includes invalid character(s): {}", &username); + tracing::error!( + "preferredUsername includes invalid character(s): {}", + &username + ); return Err(Error::InvalidValue); } From 1679315322c06de69c4c17f7f1eb00d9de9135fc Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 05:08:53 +0900 Subject: [PATCH 43/61] Clippy --- plume-models/src/blogs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index fada72f8..d373dec9 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -86,7 +86,7 @@ impl Blog { if inserted.fqn.is_empty() { if instance.local { - inserted.fqn = iri_percent_encode_seg(&inserted.actor_id.clone()); + inserted.fqn = iri_percent_encode_seg(&inserted.actor_id); } else { inserted.fqn = format!( "{}@{}", From d196e1dbd0df48d6c5b27e1dbb7f5f23e4691923 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 5 Jan 2023 23:46:35 +0900 Subject: [PATCH 44/61] Add changelogs [skip ci] --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a818a97..12cf7c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ ## [Unreleased] - ReleaseDate +### Added + +- Add 'My feed' to i18n timeline name (#1084) +- Bidirectional support for user page header (#1092) + +### Changed + +- Use blog title as slug (#1094, #1126, #1127) +- Bump Rust to nightly 2022-07-19 (#1119) + +### Fixed + +- Malfunction while creating a blog post in Persian (#1116) +- Email block list is ignored when email sign-up (#1122) +- Bug that some Activity Sytreams properties are not parsed properly (#1129) +- Allow empty avatar for remote users (#1129) +- Percent encode blog FQN for federation interoperability (#1129) +- The same to `preferredUsername` (#1129) + ## [[0.7.2]] - 2022-05-11 ### Added From c97361f5f432c9fcb7dcc7ddabcdbfe27a8ecfb1 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:04:45 +0900 Subject: [PATCH 45/61] Update crates --- Cargo.toml | 2 +- plume-api/Cargo.toml | 2 +- plume-common/Cargo.toml | 2 +- plume-front/Cargo.toml | 2 +- plume-models/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6e12e9ea..39b331ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ rocket = "0.4.11" rocket_contrib = { version = "0.4.11", features = ["json"] } rocket_i18n = "0.4.1" scheduled-thread-pool = "0.2.6" -serde = "=1.0.137" +serde = "1.0.137" serde_json = "1.0.81" shrinkwraprs = "0.3.0" validator = { version = "0.15", features = ["derive"] } diff --git a/plume-api/Cargo.toml b/plume-api/Cargo.toml index 8baf7aba..54d18fb8 100644 --- a/plume-api/Cargo.toml +++ b/plume-api/Cargo.toml @@ -5,5 +5,5 @@ authors = ["Plume contributors"] edition = "2018" [dependencies] -serde = "=1.0.137" +serde = "1.0.137" serde_derive = "1.0" diff --git a/plume-common/Cargo.toml b/plume-common/Cargo.toml index 29bfabee..924899f2 100644 --- a/plume-common/Cargo.toml +++ b/plume-common/Cargo.toml @@ -11,7 +11,7 @@ hex = "0.4" openssl = "0.10.40" rocket = "0.4.11" reqwest = { version = "0.11.11", features = ["blocking", "json", "socks"] } -serde = "=1.0.137" +serde = "1.0.137" serde_derive = "1.0" serde_json = "1.0.81" shrinkwraprs = "0.3.0" diff --git a/plume-front/Cargo.toml b/plume-front/Cargo.toml index bcde9165..70e12cff 100644 --- a/plume-front/Cargo.toml +++ b/plume-front/Cargo.toml @@ -15,7 +15,7 @@ gettext = "0.4.0" gettext-macros = "0.6.1" gettext-utils = "0.1.0" lazy_static = "1.3" -serde = "=1.0.137" +serde = "1.0.137" serde_json = "1.0" wasm-bindgen = "0.2.81" js-sys = "0.3.58" diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index 0d7d0303..94ac6c0e 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -17,7 +17,7 @@ rocket = "0.4.11" rocket_i18n = "0.4.1" reqwest = "0.11.11" scheduled-thread-pool = "0.2.6" -serde = "=1.0.137" +serde = "1.0.137" serde_derive = "1.0" serde_json = "1.0.81" tantivy = "0.13.3" From bbf2e0092008c0d986432b809f531cfc7a196c21 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:04:53 +0900 Subject: [PATCH 46/61] Install updated crates --- Cargo.lock | 438 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 245 insertions(+), 193 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a098f8c..9c75221a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,7 +11,7 @@ dependencies = [ "activitystreams-kinds", "iri-string", "mime 0.3.16", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "time 0.3.9", ] @@ -23,7 +23,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb8e19a0810cc25df3535061a08b7d8f8a734d309ea4411c57a9767e4a2ffa0e" dependencies = [ "activitystreams", - "serde 1.0.137", + "serde 1.0.152", "serde_json", ] @@ -34,7 +34,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d014a4fb8828870b7b46bee6257b9a89d06188ae8d435381ba94f14c8c697d8" dependencies = [ "iri-string", - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -137,15 +137,15 @@ dependencies = [ [[package]] name = "ammonia" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5ed2509ee88cc023cccee37a6fab35826830fe8b748b3869790e7720c2c4a74" +checksum = "64e6d1c7838db705c9b756557ee27c384ce695a1c51a6fe528784cb1c6840170" dependencies = [ "html5ever", "maplit", "once_cell", "tendril", - "url 2.2.2", + "url 2.3.0", ] [[package]] @@ -193,7 +193,7 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50f1c3703dd33532d7f0ca049168930e9099ecac238e23cf932f3a69c42f06da" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", "serde_json", ] @@ -203,9 +203,9 @@ version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -325,9 +325,9 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bcrypt" @@ -335,7 +335,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe4fef31efb0f76133ae8e3576a88e58edb7cfc5584c81c758c349ba46b43fc" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "blowfish", "getrandom 0.2.6", "zeroize", @@ -347,7 +347,7 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -492,7 +492,7 @@ dependencies = [ "libc", "num-integer", "num-traits 0.2.15", - "serde 1.0.137", + "serde 1.0.152", "time 0.1.43", "winapi 0.3.9", ] @@ -558,7 +558,7 @@ dependencies = [ "lazy_static", "nom 5.1.2", "rust-ini", - "serde 1.0.137", + "serde 1.0.152", "serde-hjson", "serde_json", "toml 0.5.9", @@ -613,7 +613,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80f6044740a4a516b8aac14c140cdf35c1a640b1bd6b98b6224e49143b2f1566" dependencies = [ "aes-gcm", - "base64 0.13.0", + "base64 0.13.1", "hkdf", "hmac", "percent-encoding 2.1.0", @@ -643,7 +643,7 @@ dependencies = [ "idna 0.1.5", "log 0.4.17", "publicsuffix", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "time 0.1.43", "try_from", @@ -868,12 +868,12 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.2.2" +version = "3.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865" +checksum = "1631ca6e3c59112501a9d87fd86f21591ff77acd31331e8a73f8d80a65bbdd71" dependencies = [ - "nix 0.24.1", - "winapi 0.3.9", + "nix 0.26.1", + "windows-sys 0.42.0", ] [[package]] @@ -900,10 +900,10 @@ checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", "strsim 0.10.0", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -914,7 +914,7 @@ checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" dependencies = [ "darling_core", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -975,9 +975,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5" dependencies = [ "darling", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -987,7 +987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73" dependencies = [ "derive_builder_core", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -1054,9 +1054,9 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -1232,9 +1232,9 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", "synstructure", ] @@ -1282,9 +1282,9 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.13" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ceeb589a3157cac0ab8cc585feb749bd2cea5cb55a6ee802ad72d9fd38303da" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ "futures-core", "futures-sink", @@ -1456,9 +1456,9 @@ version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -1543,9 +1543,9 @@ checksum = "649db3b5cda06091ea6aacb9f66f7002dfe885505b324b8ed795261253ffc2b3" dependencies = [ "gettext", "gettext-utils", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -1680,7 +1680,7 @@ dependencies = [ "http 0.2.7", "indexmap", "slab", - "tokio 1.19.2", + "tokio 1.23.1", "tokio-util 0.7.1", "tracing", ] @@ -1757,9 +1757,9 @@ dependencies = [ "log 0.4.17", "mac", "markup5ever", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -1932,7 +1932,7 @@ dependencies = [ "itoa 1.0.1", "pin-project-lite 0.2.9", "socket2 0.4.4", - "tokio 1.19.2", + "tokio 1.23.1", "tower-service", "tracing", "want 0.3.0", @@ -1973,7 +1973,7 @@ dependencies = [ "bytes 1.1.0", "hyper 0.14.18", "native-tls", - "tokio 1.19.2", + "tokio 1.23.1", "tokio-native-tls", ] @@ -2080,7 +2080,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf071934ee7ee97e52fa1868a9540a7885eab75926bd70794030304a9797cea1" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -2094,9 +2094,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either 1.6.1", ] @@ -2115,9 +2115,9 @@ checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "js-sys" -version = "0.3.58" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -2178,11 +2178,11 @@ dependencies = [ "nom 2.2.1", "percent-encoding 2.1.0", "thiserror", - "tokio 1.19.2", + "tokio 1.23.1", "tokio-native-tls", "tokio-stream", "tokio-util 0.7.1", - "url 2.2.2", + "url 2.3.0", ] [[package]] @@ -2198,7 +2198,7 @@ dependencies = [ "log 0.4.17", "native-tls", "nom 4.2.3", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", ] @@ -2238,9 +2238,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.125" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libsqlite3-sys" @@ -2265,7 +2265,7 @@ dependencies = [ "lindera-dictionary", "lindera-ipadic", "lindera-ipadic-builder", - "serde 1.0.137", + "serde 1.0.152", "serde_json", ] @@ -2278,7 +2278,7 @@ dependencies = [ "bincode", "byteorder", "encoding", - "serde 1.0.137", + "serde 1.0.152", "yada", ] @@ -2500,9 +2500,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" dependencies = [ "migrations_internals", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -2566,16 +2566,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log 0.4.17", - "miow 0.3.7", - "ntapi", "wasi 0.11.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] @@ -2726,13 +2724,14 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.1" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" +checksum = "46a58d1d356c6597d08cde02c2f09d785b09e28711837b1ed667dc652c08a694" dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", "libc", + "static_assertions", ] [[package]] @@ -2801,15 +2800,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "ntapi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -2943,9 +2933,9 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -3056,7 +3046,7 @@ dependencies = [ "libc", "redox_syscall 0.2.13", "smallvec 1.8.0", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -3146,9 +3136,9 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -3181,10 +3171,10 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "indexmap", "line-wrap", - "serde 1.0.137", + "serde 1.0.152", "time 0.3.9", "xml-rs", ] @@ -3218,7 +3208,7 @@ dependencies = [ "rsass", "ructe", "scheduled-thread-pool", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "shrinkwraprs", "tracing", @@ -3231,7 +3221,7 @@ dependencies = [ name = "plume-api" version = "0.7.2" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", "serde_derive", ] @@ -3255,7 +3245,7 @@ dependencies = [ "array_tool", "askama_escape", "assert-json-diff", - "base64 0.13.0", + "base64 0.13.1", "chrono", "flume", "futures 0.3.21", @@ -3264,16 +3254,16 @@ dependencies = [ "openssl", "pulldown-cmark", "regex-syntax 0.6.26", - "reqwest 0.11.11", + "reqwest 0.11.13", "rocket", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", "shrinkwraprs", "syntect", - "tokio 1.19.2", + "tokio 1.23.1", "tracing", - "url 2.2.2", + "url 2.3.0", ] [[package]] @@ -3286,7 +3276,7 @@ dependencies = [ "gettext-utils", "js-sys", "lazy_static", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", "wasm-bindgen", @@ -3316,7 +3306,7 @@ dependencies = [ "diesel_migrations", "glob", "guid-create", - "itertools 0.10.3", + "itertools 0.10.5", "lazy_static", "ldap3", "lettre", @@ -3328,18 +3318,18 @@ dependencies = [ "plume-api", "plume-common", "plume-macro", - "reqwest 0.11.11", + "reqwest 0.11.13", "riker", "rocket", "rocket_i18n", "scheduled-thread-pool", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", "shrinkwraprs", "tantivy 0.13.3", "tracing", - "url 2.2.2", + "url 2.3.0", "walkdir", "webfinger", "whatlang", @@ -3384,9 +3374,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", "version_check 0.9.4", ] @@ -3396,7 +3386,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", "version_check 0.9.4", ] @@ -3442,11 +3432,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.37" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ - "unicode-xid 0.2.3", + "unicode-ident", ] [[package]] @@ -3456,7 +3446,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" dependencies = [ "idna 0.2.3", - "url 2.2.2", + "url 2.3.0", ] [[package]] @@ -3509,7 +3499,7 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", ] [[package]] @@ -3813,7 +3803,7 @@ dependencies = [ "mime 0.3.16", "mime_guess", "native-tls", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "serde_urlencoded 0.5.5", "time 0.1.43", @@ -3833,7 +3823,7 @@ version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytes 0.5.6", "encoding_rs", "futures-core", @@ -3851,11 +3841,11 @@ dependencies = [ "native-tls", "percent-encoding 2.1.0", "pin-project-lite 0.2.9", - "serde 1.0.137", + "serde 1.0.152", "serde_urlencoded 0.7.1", "tokio 0.2.25", "tokio-tls", - "url 2.2.2", + "url 2.3.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3864,11 +3854,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytes 1.1.0", "encoding_rs", "futures-core", @@ -3880,20 +3870,20 @@ dependencies = [ "hyper-tls 0.5.0", "ipnet", "js-sys", - "lazy_static", "log 0.4.17", "mime 0.3.16", "native-tls", + "once_cell", "percent-encoding 2.1.0", "pin-project-lite 0.2.9", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "serde_urlencoded 0.7.1", - "tokio 1.19.2", + "tokio 1.23.1", "tokio-native-tls", "tokio-socks", "tower-service", - "url 2.2.2", + "url 2.3.0", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3954,7 +3944,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83b9d9dc08c5dcc1d8126a9dd615545e6a358f8c13c883c8dfed8c0376fa355e" dependencies = [ "atty", - "base64 0.13.0", + "base64 0.13.1", "log 0.4.17", "memchr", "num_cpus", @@ -3992,7 +3982,7 @@ dependencies = [ "log 0.4.17", "notify", "rocket", - "serde 1.0.137", + "serde 1.0.152", "serde_json", ] @@ -4004,7 +3994,7 @@ dependencies = [ "data-encoding", "ring", "rocket", - "serde 1.0.137", + "serde 1.0.152", "time 0.1.43", ] @@ -4042,7 +4032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956" dependencies = [ "libc", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "winapi 0.3.9", ] @@ -4070,9 +4060,9 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef88d8c2492d7266e264b31e0ffcf1149d5ba183bccd3abaf1483ee905fc85de" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytecount", - "itertools 0.10.3", + "itertools 0.10.5", "md5", "nom 7.1.1", ] @@ -4089,7 +4079,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e46a2036019fdb888131db7a4c847a1063a7493f971ed94ea82c67eada63ca54" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", "serde_derive", ] @@ -4200,9 +4190,9 @@ checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" dependencies = [ "serde_derive", ] @@ -4222,24 +4212,24 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "itoa 1.0.1", "ryu", - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -4259,7 +4249,7 @@ checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" dependencies = [ "dtoa", "itoa 0.4.8", - "serde 1.0.137", + "serde 1.0.152", "url 1.7.2", ] @@ -4272,7 +4262,7 @@ dependencies = [ "form_urlencoded", "itoa 1.0.1", "ryu", - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -4305,9 +4295,9 @@ checksum = "e63e6744142336dfb606fe2b068afa2e1cca1ee6a5d8377277a92945d81fa331" dependencies = [ "bitflags 1.3.2", "itertools 0.8.2", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -4454,7 +4444,7 @@ dependencies = [ "parking_lot 0.12.0", "phf_shared", "precomputed-hash", - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -4465,7 +4455,7 @@ checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ "phf_generator", "phf_shared", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", ] @@ -4522,13 +4512,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.92" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "unicode-xid 0.2.3", + "unicode-ident", ] [[package]] @@ -4537,9 +4527,9 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", "unicode-xid 0.2.3", ] @@ -4558,7 +4548,7 @@ dependencies = [ "onig", "plist", "regex-syntax 0.6.26", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", "walkdir", @@ -4598,7 +4588,7 @@ dependencies = [ "rayon", "regex", "rust-stemmers", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "smallvec 1.8.0", "snap", @@ -4616,7 +4606,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca90bddda472f39fdc74a031d61d52b08b1de97f2a704afae726a8004abb0d" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bitpacking", "byteorder", "census", @@ -4639,7 +4629,7 @@ dependencies = [ "rayon", "regex", "rust-stemmers", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "smallvec 1.8.0", "snap", @@ -4751,9 +4741,9 @@ version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -4855,22 +4845,22 @@ dependencies = [ [[package]] name = "tokio" -version = "1.19.2" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" +checksum = "38a54aca0c15d014013256222ba0ebed095673f89345dd79119d912eb561b7a8" dependencies = [ + "autocfg 1.1.0", "bytes 1.1.0", "libc", "memchr", - "mio 0.8.2", + "mio 0.8.5", "num_cpus", - "once_cell", "parking_lot 0.12.0", "pin-project-lite 0.2.9", "signal-hook-registry", "socket2 0.4.4", "tokio-macros 1.7.0", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] @@ -4921,9 +4911,9 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -4932,9 +4922,9 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -4944,7 +4934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio 1.19.2", + "tokio 1.23.1", ] [[package]] @@ -4975,7 +4965,7 @@ dependencies = [ "either 1.6.1", "futures-util", "thiserror", - "tokio 1.19.2", + "tokio 1.23.1", ] [[package]] @@ -4986,7 +4976,7 @@ checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" dependencies = [ "futures-core", "pin-project-lite 0.2.9", - "tokio 1.19.2", + "tokio 1.23.1", ] [[package]] @@ -5076,7 +5066,7 @@ dependencies = [ "futures-core", "futures-sink", "pin-project-lite 0.2.9", - "tokio 1.19.2", + "tokio 1.23.1", "tracing", ] @@ -5086,7 +5076,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -5095,7 +5085,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -5123,9 +5113,9 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", ] [[package]] @@ -5239,6 +5229,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + [[package]] name = "unicode-normalization" version = "0.1.19" @@ -5295,13 +5291,12 @@ dependencies = [ [[package]] name = "url" -version = "2.2.2" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" dependencies = [ "form_urlencoded", "idna 0.2.3", - "matches", "percent-encoding 2.1.0", ] @@ -5333,7 +5328,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ "getrandom 0.2.6", - "serde 1.0.137", + "serde 1.0.152", ] [[package]] @@ -5345,10 +5340,10 @@ dependencies = [ "idna 0.2.3", "lazy_static", "regex", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", "serde_json", - "url 2.2.2", + "url 2.3.0", "validator_derive", ] @@ -5361,10 +5356,10 @@ dependencies = [ "if_chain", "lazy_static", "proc-macro-error", - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", "regex", - "syn 1.0.92", + "syn 1.0.107", "validator_types", ] @@ -5374,8 +5369,8 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ddf34293296847abfc1493b15c6e2f5d3cd19f57ad7d22673bf4c6278da329" dependencies = [ - "proc-macro2 1.0.37", - "syn 1.0.92", + "proc-macro2 1.0.49", + "syn 1.0.107", ] [[package]] @@ -5466,28 +5461,28 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if 1.0.0", - "serde 1.0.137", + "serde 1.0.152", "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", - "lazy_static", "log 0.4.17", - "proc-macro2 1.0.37", + "once_cell", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", "wasm-bindgen-shared", ] @@ -5505,9 +5500,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote 1.0.18", "wasm-bindgen-macro-support", @@ -5515,22 +5510,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.37", + "proc-macro2 1.0.49", "quote 1.0.18", - "syn 1.0.92", + "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.81" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "web-sys" @@ -5549,7 +5544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec24b1b0700d4b466d280228ed0f62274eedeaa80206820f071fdc8ed787b664" dependencies = [ "reqwest 0.9.24", - "serde 1.0.137", + "serde 1.0.152", "serde_derive", ] @@ -5612,43 +5607,100 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.36.1", + "windows_i686_gnu 0.36.1", + "windows_i686_msvc 0.36.1", + "windows_x86_64_gnu 0.36.1", + "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.6.2" From 5d48b93c8bfbeee104c38c9cbe4792867f9fe60d Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:27:57 +0900 Subject: [PATCH 47/61] Update Docker image for CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f5ac952d..f528041e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ executors: type: boolean default: false docker: - - image: plumeorg/plume-buildenv:v0.7.0 + - image: plumeorg/plume-buildenv:v0.8.0 - image: <<#parameters.postgres>>cimg/postgres:14.2<><<^parameters.postgres>>alpine:latest<> environment: POSTGRES_USER: postgres From 94f20c8fc28e1eaa932cbd9d8494d5bc8e1b34a5 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:42:20 +0900 Subject: [PATCH 48/61] Update rustfmt and clippy on Ci --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f528041e..62a5643a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,7 +63,7 @@ commands: type: boolean default: false steps: - - run: rustup component add clippy --toolchain nightly-2022-01-27-x86_64-unknown-linux-gnu + - run: rustup component add clippy --toolchain nightly-2022-07-19-x86_64-unknown-linux-gnu - run: cargo clippy <<^parameters.no_feature>>--no-default-features --features="${FEATURES}"<> --release -p <> -- -D warnings run_with_coverage: @@ -112,7 +112,7 @@ jobs: name: default steps: - restore_env - - run: rustup component add rustfmt --toolchain nightly-2022-01-27-x86_64-unknown-linux-gnu + - run: rustup component add rustfmt --toolchain nightly-2022-07-19-x86_64-unknown-linux-gnu - run: cargo fmt --all -- --check clippy: From b2942f3f47cfa746d1fa9330f5381279ab95b16c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:42:29 +0900 Subject: [PATCH 49/61] Update crates --- Cargo.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c75221a..5f74c3be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2880,9 +2880,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.12.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "onig" @@ -3253,7 +3253,7 @@ dependencies = [ "once_cell", "openssl", "pulldown-cmark", - "regex-syntax 0.6.26", + "regex-syntax 0.6.28", "reqwest 0.11.13", "rocket", "serde 1.0.152", @@ -3759,7 +3759,7 @@ checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.6.26", + "regex-syntax 0.6.28", ] [[package]] @@ -3770,9 +3770,9 @@ checksum = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -4547,7 +4547,7 @@ dependencies = [ "lazycell", "onig", "plist", - "regex-syntax 0.6.26", + "regex-syntax 0.6.28", "serde 1.0.152", "serde_derive", "serde_json", From 2df6138ff101fc5e3f1463265fa287beca811d4e Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 00:59:00 +0900 Subject: [PATCH 50/61] Fix caddy run option --- script/run_browser_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/run_browser_test.sh b/script/run_browser_test.sh index 96294500..9f1ac83c 100755 --- a/script/run_browser_test.sh +++ b/script/run_browser_test.sh @@ -10,7 +10,7 @@ plm instance new -d plume-test.local -n plume-test plm users new -n admin -N 'Admin' -e 'email@exemple.com' -p 'password' plume & -caddy run -config /Caddyfile & +caddy run --config /Caddyfile & until curl http://localhost:7878/test/health -f; do sleep 1; done 2>/dev/null >/dev/null From 0c856a5252458ef010f4461d4ca21eea847df259 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 01:11:46 +0900 Subject: [PATCH 51/61] Update Ructe --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f74c3be..45ced755 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4056,9 +4056,9 @@ dependencies = [ [[package]] name = "ructe" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef88d8c2492d7266e264b31e0ffcf1149d5ba183bccd3abaf1483ee905fc85de" +checksum = "ef279e568db5dad3a1867112fedc63e2f0567991e82beec01c04ade6bd53c08a" dependencies = [ "base64 0.13.1", "bytecount", From 301aad3f73ab106ed778d3945d8219e18c83c5b7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 19:06:39 +0000 Subject: [PATCH 52/61] Bump whatlang from 0.16.0 to 0.16.2 Bumps [whatlang](https://github.com/greyblake/whatlang-rs) from 0.16.0 to 0.16.2. - [Release notes](https://github.com/greyblake/whatlang-rs/releases) - [Changelog](https://github.com/greyblake/whatlang-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/greyblake/whatlang-rs/compare/v0.16.0...v0.16.2) --- updated-dependencies: - dependency-name: whatlang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- plume-models/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45ced755..75049a9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5550,9 +5550,9 @@ dependencies = [ [[package]] name = "whatlang" -version = "0.16.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2989d7e9d3cb96a76438e879144030b1be0931b944fbfed65e89e2ae536cd3b9" +checksum = "9c531a2dc4c462b833788be2c07eef4e621d0e9edbd55bf280cc164c1c1aa043" dependencies = [ "hashbrown 0.12.1", "once_cell", diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index 94ac6c0e..7c6e3bf8 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -24,7 +24,7 @@ tantivy = "0.13.3" url = "2.1" walkdir = "2.2" webfinger = "0.4.1" -whatlang = "0.16.0" +whatlang = "0.16.2" shrinkwraprs = "0.3.0" diesel-derive-newtype = "1.0.0" glob = "0.3.0" From 19766662f1f0497b58d5febee0cc91ab1614958e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 19:06:52 +0000 Subject: [PATCH 53/61] Bump ldap3 from 0.10.6 to 0.11.1 Bumps [ldap3](https://github.com/inejge/ldap3) from 0.10.6 to 0.11.1. - [Release notes](https://github.com/inejge/ldap3/releases) - [Changelog](https://github.com/inejge/ldap3/blob/master/CHANGELOG.md) - [Commits](https://github.com/inejge/ldap3/compare/v0.10.6...v0.11.1) --- updated-dependencies: - dependency-name: ldap3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 170 ++++++++++++++++++++-------------------- plume-models/Cargo.toml | 2 +- 2 files changed, 87 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45ced755..4421d5b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,7 +145,7 @@ dependencies = [ "maplit", "once_cell", "tendril", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -199,9 +199,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" dependencies = [ "proc-macro2 1.0.49", "quote 1.0.18", @@ -443,9 +443,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "bytes" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "cc" @@ -616,7 +616,7 @@ dependencies = [ "base64 0.13.1", "hkdf", "hmac", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "rand 0.8.5", "sha2", "time 0.1.43", @@ -1316,12 +1316,11 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "matches", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", ] [[package]] @@ -1393,9 +1392,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -1408,9 +1407,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -1418,9 +1417,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-cpupool" @@ -1434,9 +1433,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -1446,15 +1445,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2 1.0.49", "quote 1.0.18", @@ -1463,21 +1462,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -1672,7 +1671,7 @@ version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "fnv", "futures-core", "futures-sink", @@ -1681,7 +1680,7 @@ dependencies = [ "indexmap", "slab", "tokio 1.23.1", - "tokio-util 0.7.1", + "tokio-util 0.7.4", "tracing", ] @@ -1785,7 +1784,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "fnv", "itoa 1.0.1", ] @@ -1818,7 +1817,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "http 0.2.7", "pin-project-lite 0.2.9", ] @@ -1920,7 +1919,7 @@ version = "0.14.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "futures-channel", "futures-core", "futures-util", @@ -1970,7 +1969,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "hyper 0.14.18", "native-tls", "tokio 1.23.1", @@ -2005,6 +2004,16 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "if_chain" version = "1.0.2" @@ -2152,37 +2161,36 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "lber" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a99b520993b21a6faab32643cf4726573dc18ca4cf2d48cbeb24d248c86c930" +checksum = "b5d85f5e00e12cb50c70c3b1c1f0daff6546eb4c608b44d0a990e38a539e0446" dependencies = [ - "byteorder", - "bytes 1.1.0", - "nom 2.2.1", + "bytes 1.3.0", + "nom 7.1.1", ] [[package]] name = "ldap3" -version = "0.10.6" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce38dafca0608c64cc0146fb782b06abb8d946dae7a3af23c89a95da24f6b84d" +checksum = "c5cfbd3c59ca16d6671b002b8b3dd013cd825d9c77a1664a3135194d3270511e" dependencies = [ "async-trait", - "bytes 1.1.0", - "futures 0.3.21", + "bytes 1.3.0", + "futures 0.3.25", "futures-util", "lazy_static", "lber", "log 0.4.17", "native-tls", - "nom 2.2.1", - "percent-encoding 2.1.0", + "nom 7.1.1", + "percent-encoding 2.2.0", "thiserror", "tokio 1.23.1", "tokio-native-tls", "tokio-stream", - "tokio-util 0.7.1", - "url 2.3.0", + "tokio-util 0.7.4", + "url 2.3.1", ] [[package]] @@ -2670,9 +2678,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", @@ -2734,12 +2742,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "nom" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf51a729ecf40266a2368ad335a5fdde43471f545a967109cd62146ecf8b66ff" - [[package]] name = "nom" version = "4.2.3" @@ -3079,9 +3081,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" [[package]] name = "percent-encoding" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "phf" @@ -3248,7 +3250,7 @@ dependencies = [ "base64 0.13.1", "chrono", "flume", - "futures 0.3.21", + "futures 0.3.25", "hex", "once_cell", "openssl", @@ -3263,7 +3265,7 @@ dependencies = [ "syntect", "tokio 1.23.1", "tracing", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -3329,7 +3331,7 @@ dependencies = [ "shrinkwraprs", "tantivy 0.13.3", "tracing", - "url 2.3.0", + "url 2.3.1", "walkdir", "webfinger", "whatlang", @@ -3446,7 +3448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" dependencies = [ "idna 0.2.3", - "url 2.3.0", + "url 2.3.1", ] [[package]] @@ -3839,13 +3841,13 @@ dependencies = [ "mime 0.3.16", "mime_guess", "native-tls", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "pin-project-lite 0.2.9", "serde 1.0.152", "serde_urlencoded 0.7.1", "tokio 0.2.25", "tokio-tls", - "url 2.3.0", + "url 2.3.1", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3859,7 +3861,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64 0.13.1", - "bytes 1.1.0", + "bytes 1.3.0", "encoding_rs", "futures-core", "futures-util", @@ -3874,7 +3876,7 @@ dependencies = [ "mime 0.3.16", "native-tls", "once_cell", - "percent-encoding 2.1.0", + "percent-encoding 2.2.0", "pin-project-lite 0.2.9", "serde 1.0.152", "serde_json", @@ -3883,7 +3885,7 @@ dependencies = [ "tokio-native-tls", "tokio-socks", "tower-service", - "url 2.3.0", + "url 2.3.1", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -3899,7 +3901,7 @@ dependencies = [ "chrono", "config", "dashmap", - "futures 0.3.21", + "futures 0.3.25", "num_cpus", "pin-utils", "rand 0.7.3", @@ -4574,7 +4576,7 @@ dependencies = [ "failure", "fnv", "fs2", - "futures 0.3.21", + "futures 0.3.25", "htmlescape", "levenshtein_automata", "log 0.4.17", @@ -4617,7 +4619,7 @@ dependencies = [ "fail", "fnv", "fs2", - "futures 0.3.21", + "futures 0.3.25", "htmlescape", "levenshtein_automata", "log 0.4.17", @@ -4728,18 +4730,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2 1.0.49", "quote 1.0.18", @@ -4850,7 +4852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38a54aca0c15d014013256222ba0ebed095673f89345dd79119d912eb561b7a8" dependencies = [ "autocfg 1.1.0", - "bytes 1.1.0", + "bytes 1.3.0", "libc", "memchr", "mio 0.8.5", @@ -4970,9 +4972,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.8" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" dependencies = [ "futures-core", "pin-project-lite 0.2.9", @@ -5058,11 +5060,11 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes 1.1.0", + "bytes 1.3.0", "futures-core", "futures-sink", "pin-project-lite 0.2.9", @@ -5291,13 +5293,13 @@ dependencies = [ [[package]] name = "url" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fe195a4f217c25b25cb5058ced57059824a678474874038dc88d211bf508d3" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", - "idna 0.2.3", - "percent-encoding 2.1.0", + "idna 0.3.0", + "percent-encoding 2.2.0", ] [[package]] @@ -5343,7 +5345,7 @@ dependencies = [ "serde 1.0.152", "serde_derive", "serde_json", - "url 2.3.0", + "url 2.3.1", "validator_derive", ] diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index 94ac6c0e..b0f21a8c 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -10,7 +10,7 @@ bcrypt = "0.12.1" guid-create = "0.2" itertools = "0.10.3" lazy_static = "1.0" -ldap3 = "0.10.5" +ldap3 = "0.11.1" migrations_internals= "1.4.0" openssl = "0.10.40" rocket = "0.4.11" From 2f8d188d595c530f2df23585cb3e27b58779e821 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 19:07:12 +0000 Subject: [PATCH 54/61] Bump futures from 0.3.21 to 0.3.25 Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.21 to 0.3.25. - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.21...0.3.25) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 46 ++++++++++++++++++++--------------------- plume-common/Cargo.toml | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45ced755..b15a48c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1393,9 +1393,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -1408,9 +1408,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -1418,9 +1418,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-cpupool" @@ -1434,9 +1434,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -1446,15 +1446,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2 1.0.49", "quote 1.0.18", @@ -1463,21 +1463,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -2169,7 +2169,7 @@ checksum = "ce38dafca0608c64cc0146fb782b06abb8d946dae7a3af23c89a95da24f6b84d" dependencies = [ "async-trait", "bytes 1.1.0", - "futures 0.3.21", + "futures 0.3.25", "futures-util", "lazy_static", "lber", @@ -3248,7 +3248,7 @@ dependencies = [ "base64 0.13.1", "chrono", "flume", - "futures 0.3.21", + "futures 0.3.25", "hex", "once_cell", "openssl", @@ -3899,7 +3899,7 @@ dependencies = [ "chrono", "config", "dashmap", - "futures 0.3.21", + "futures 0.3.25", "num_cpus", "pin-utils", "rand 0.7.3", @@ -4574,7 +4574,7 @@ dependencies = [ "failure", "fnv", "fs2", - "futures 0.3.21", + "futures 0.3.25", "htmlescape", "levenshtein_automata", "log 0.4.17", @@ -4617,7 +4617,7 @@ dependencies = [ "fail", "fnv", "fs2", - "futures 0.3.21", + "futures 0.3.25", "htmlescape", "levenshtein_automata", "log 0.4.17", diff --git a/plume-common/Cargo.toml b/plume-common/Cargo.toml index 924899f2..ac24594d 100644 --- a/plume-common/Cargo.toml +++ b/plume-common/Cargo.toml @@ -24,7 +24,7 @@ activitystreams-ext = "0.1.0-alpha.2" url = "2.2.2" flume = "0.10.13" tokio = { version = "1.19.2", features = ["full"] } -futures = "0.3.21" +futures = "0.3.25" [dependencies.chrono] features = ["serde"] From 4f796e788cd36e03c4e658097cf2ddcf27cbb2c7 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 23:38:38 +0900 Subject: [PATCH 55/61] Clippy --- plume-models/src/posts.rs | 2 +- plume-models/src/search/query.rs | 10 +++++----- src/routes/search.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 74ff21d8..b78690d9 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -756,7 +756,7 @@ impl FromId for Post { let timestamp_secs = published.unix_timestamp(); let timestamp_nanos = published.unix_timestamp_nanos() - (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128; - NaiveDateTime::from_timestamp(timestamp_secs, timestamp_nanos as u32) + NaiveDateTime::from_timestamp_opt(timestamp_secs, timestamp_nanos as u32).unwrap() }), subtitle: article .summary() diff --git a/plume-models/src/search/query.rs b/plume-models/src/search/query.rs index a2c4f252..edab5711 100644 --- a/plume-models/src/search/query.rs +++ b/plume-models/src/search/query.rs @@ -94,7 +94,7 @@ macro_rules! gen_to_string { )* $( for val in &$self.$date { - $result.push_str(&format!("{}:{} ", stringify!($date), NaiveDate::from_num_days_from_ce(*val as i32).format("%Y-%m-%d"))); + $result.push_str(&format!("{}:{} ", stringify!($date), NaiveDate::from_num_days_from_ce_opt(*val as i32).unwrap().format("%Y-%m-%d"))); } )* } @@ -182,10 +182,10 @@ impl PlumeQuery { // if at least one range bound is provided let after = self .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd(2000, 1, 1).num_days_from_ce())); + .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); let before = self .before - .unwrap_or_else(|| i64::from(Utc::today().num_days_from_ce())); + .unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce())); let field = Searcher::schema().get_field("creation_date").unwrap(); let range = RangeQuery::new_i64_bounds(field, Bound::Included(after), Bound::Included(before)); @@ -202,7 +202,7 @@ impl PlumeQuery { pub fn before(&mut self, date: &D) -> &mut Self { let before = self .before - .unwrap_or_else(|| i64::from(Utc::today().num_days_from_ce())); + .unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce())); self.before = Some(cmp::min(before, i64::from(date.num_days_from_ce()))); self } @@ -211,7 +211,7 @@ impl PlumeQuery { pub fn after(&mut self, date: &D) -> &mut Self { let after = self .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd(2000, 1, 1).num_days_from_ce())); + .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce()))); self } diff --git a/src/routes/search.rs b/src/routes/search.rs index 33d8443f..0807b792 100644 --- a/src/routes/search.rs +++ b/src/routes/search.rs @@ -65,7 +65,7 @@ pub fn search(query: Option>, conn: DbConn, rockets: PlumeRock if str_query.is_empty() { render!(search::index( &(&conn, &rockets).to_context(), - &format!("{}", Utc::today().format("%Y-%m-d")) + &format!("{}", Utc::now().date_naive().format("%Y-%m-d")) )) } else { let res = rockets From 0020242571ff9208d647788934faa28b64c6a1d7 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Fri, 6 Jan 2023 23:40:05 +0900 Subject: [PATCH 56/61] Format --- plume-models/src/posts.rs | 6 +++++- plume-models/src/search/query.rs | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index b78690d9..203e0d5e 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -756,7 +756,11 @@ impl FromId for Post { let timestamp_secs = published.unix_timestamp(); let timestamp_nanos = published.unix_timestamp_nanos() - (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128; - NaiveDateTime::from_timestamp_opt(timestamp_secs, timestamp_nanos as u32).unwrap() + NaiveDateTime::from_timestamp_opt( + timestamp_secs, + timestamp_nanos as u32, + ) + .unwrap() }), subtitle: article .summary() diff --git a/plume-models/src/search/query.rs b/plume-models/src/search/query.rs index edab5711..5dcd605c 100644 --- a/plume-models/src/search/query.rs +++ b/plume-models/src/search/query.rs @@ -180,9 +180,13 @@ impl PlumeQuery { if self.before.is_some() || self.after.is_some() { // if at least one range bound is provided - let after = self - .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); + let after = self.after.unwrap_or_else(|| { + i64::from( + NaiveDate::from_ymd_opt(2000, 1, 1) + .unwrap() + .num_days_from_ce(), + ) + }); let before = self .before .unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce())); @@ -209,9 +213,13 @@ impl PlumeQuery { // documents older than the provided date will be ignored pub fn after(&mut self, date: &D) -> &mut Self { - let after = self - .after - .unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce())); + let after = self.after.unwrap_or_else(|| { + i64::from( + NaiveDate::from_ymd_opt(2000, 1, 1) + .unwrap() + .num_days_from_ce(), + ) + }); self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce()))); self } From 93d6ee04d4931b5159bdc06d4355e070b4bf6055 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Jan 2023 19:06:09 +0000 Subject: [PATCH 57/61] Bump ructe from 0.14.2 to 0.15.0 Bumps [ructe](https://github.com/kaj/ructe) from 0.14.2 to 0.15.0. - [Release notes](https://github.com/kaj/ructe/releases) - [Changelog](https://github.com/kaj/ructe/blob/master/CHANGELOG.md) - [Commits](https://github.com/kaj/ructe/compare/v0.14.2...v0.15.0) --- updated-dependencies: - dependency-name: ructe dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9953649c..f73db16d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4141,9 +4141,9 @@ dependencies = [ [[package]] name = "ructe" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef279e568db5dad3a1867112fedc63e2f0567991e82beec01c04ade6bd53c08a" +checksum = "85517cd381cf0c34694881d8aaf173107c6af7670e66cec18d7a1a8bfce3b758" dependencies = [ "base64 0.13.1", "bytecount", diff --git a/Cargo.toml b/Cargo.toml index 39b331ff..740f3a4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ git = "https://git.joinplu.me/plume/rocket_csrf" rev = "0.1.2" [build-dependencies] -ructe = "0.14.0" +ructe = "0.15.0" rsass = "0.25" [features] From c1d9d39dc1fa1a264225b4b2fa20c0f57b51015c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Jan 2023 19:06:33 +0000 Subject: [PATCH 58/61] Bump rsass from 0.25.2 to 0.26.0 Bumps [rsass](https://github.com/kaj/rsass) from 0.25.2 to 0.26.0. - [Release notes](https://github.com/kaj/rsass/releases) - [Changelog](https://github.com/kaj/rsass/blob/main/CHANGELOG.md) - [Commits](https://github.com/kaj/rsass/compare/v0.25.2...v0.26.0) --- updated-dependencies: - dependency-name: rsass dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9953649c..027da1db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4124,10 +4124,11 @@ dependencies = [ [[package]] name = "rsass" -version = "0.25.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab003a9ff922b4d7b1f5f383bc54645887ad278f534dfc65e071096fcb30023" +checksum = "665387d3be91521de331a04cc7118c8c129ffe43c5f4e8a61e78990850046b5a" dependencies = [ + "arc-swap", "fastrand", "lazy_static", "nom 7.1.2", diff --git a/Cargo.toml b/Cargo.toml index 39b331ff..a1e7d753 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,7 +65,7 @@ rev = "0.1.2" [build-dependencies] ructe = "0.14.0" -rsass = "0.25" +rsass = "0.26" [features] default = ["postgres"] From 3303a4af84be21252a47be24743d97578191be18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Jan 2023 19:06:09 +0000 Subject: [PATCH 59/61] Bump ructe from 0.14.2 to 0.15.0 Bumps [ructe](https://github.com/kaj/ructe) from 0.14.2 to 0.15.0. - [Release notes](https://github.com/kaj/ructe/releases) - [Changelog](https://github.com/kaj/ructe/blob/master/CHANGELOG.md) - [Commits](https://github.com/kaj/ructe/compare/v0.14.2...v0.15.0) --- updated-dependencies: - dependency-name: ructe dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Change blog title specification Revert "Change blog title specification" This reverts commit a362b2474fa32b0e937f59acb9edb68d462c0719. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 027da1db..1119ad6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4142,9 +4142,9 @@ dependencies = [ [[package]] name = "ructe" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef279e568db5dad3a1867112fedc63e2f0567991e82beec01c04ade6bd53c08a" +checksum = "85517cd381cf0c34694881d8aaf173107c6af7670e66cec18d7a1a8bfce3b758" dependencies = [ "base64 0.13.1", "bytecount", diff --git a/Cargo.toml b/Cargo.toml index a1e7d753..b3e3912f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ git = "https://git.joinplu.me/plume/rocket_csrf" rev = "0.1.2" [build-dependencies] -ructe = "0.14.0" +ructe = "0.15.0" rsass = "0.26" [features] From aa4cfd374d90bdb56ffb4721a2bd1be00832e5bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 19:13:35 +0000 Subject: [PATCH 60/61] Bump atom_syndication from 0.11.0 to 0.12.0 Bumps [atom_syndication](https://github.com/rust-syndication/atom) from 0.11.0 to 0.12.0. - [Release notes](https://github.com/rust-syndication/atom/releases) - [Changelog](https://github.com/rust-syndication/atom/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-syndication/atom/compare/0.11.0...0.12.0) --- updated-dependencies: - dependency-name: atom_syndication dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 32 ++++++++++++++++---------------- Cargo.toml | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1119ad6f..16efba6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,9 +219,9 @@ dependencies = [ [[package]] name = "atom_syndication" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fb6a0b39c6517edafe46f8137e53c51742425a4dae1c73ee12264a37ad7541" +checksum = "91a85f2ee28cbd1ecf91288460f6dc74661fd99b4e9a559836a667ccf63aa38c" dependencies = [ "chrono", "derive_builder", @@ -947,9 +947,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.12.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" dependencies = [ "darling_core", "darling_macro", @@ -957,9 +957,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.12.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" dependencies = [ "fnv", "ident_case", @@ -971,9 +971,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.12.4" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" dependencies = [ "darling_core", "quote 1.0.23", @@ -1024,18 +1024,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d13202debe11181040ae9063d739fa32cfcaaebe2275fe387703460ae2365b30" +checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5" +checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" dependencies = [ "darling", "proc-macro2 1.0.49", @@ -1045,9 +1045,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73" +checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ "derive_builder_core", "syn 1.0.107", @@ -3554,9 +3554,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quick-xml" -version = "0.22.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b" +checksum = "ffc053f057dd768a56f62cd7e434c42c831d296968997e9ac1f76ea7c2d14c41" dependencies = [ "encoding_rs", "memchr", diff --git a/Cargo.toml b/Cargo.toml index b3e3912f..2c2e1d30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/Plume-org/Plume" edition = "2018" [dependencies] -atom_syndication = "0.11.0" +atom_syndication = "0.12.0" clap = "2.33" dotenv = "0.15.0" gettext = "0.4.0" From 6028295748553e94d1d2941b29962fdea9f271dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 19:14:30 +0000 Subject: [PATCH 61/61] Bump glob from 0.3.0 to 0.3.1 Bumps [glob](https://github.com/rust-lang/glob) from 0.3.0 to 0.3.1. - [Release notes](https://github.com/rust-lang/glob/releases) - [Commits](https://github.com/rust-lang/glob/compare/0.3.0...0.3.1) --- updated-dependencies: - dependency-name: glob dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- plume-models/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16efba6b..1a4e162d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1632,9 +1632,9 @@ checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "guid" diff --git a/plume-models/Cargo.toml b/plume-models/Cargo.toml index a7dfe9e5..914bf803 100644 --- a/plume-models/Cargo.toml +++ b/plume-models/Cargo.toml @@ -27,7 +27,7 @@ webfinger = "0.4.1" whatlang = "0.16.2" shrinkwraprs = "0.3.0" diesel-derive-newtype = "1.0.0" -glob = "0.3.0" +glob = "0.3.1" lindera-tantivy = { version = "0.7.1", optional = true } tracing = "0.1.35" riker = "0.4.2"