From d8dc38eb068ee6afc768acc116747af9b11d2e59 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 23 May 2024 16:55:20 +0200 Subject: [PATCH 1/5] Upgrade dependencies (#4740) --- Cargo.lock | 221 +++++++++++++++++++++++++---------- Cargo.toml | 26 ++--- crates/api/Cargo.toml | 2 +- crates/api_common/Cargo.toml | 6 +- crates/apub/Cargo.toml | 2 +- crates/db_schema/Cargo.toml | 2 +- crates/federate/Cargo.toml | 2 +- crates/routes/Cargo.toml | 2 +- crates/utils/Cargo.toml | 2 +- 9 files changed, 180 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07c607cb0..4dbfa3d2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "actix-cors" -version = "0.6.5" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" +checksum = "f9e772b3bcafe335042b5db010ab7c09013dad6eac4915c91d8d50902769f331" dependencies = [ "actix-utils", "actix-web", @@ -337,15 +337,17 @@ dependencies = [ [[package]] name = "actix-web-prom" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23f332a652836b8f3a6876103c70c9ed436d0e69fa779ab5d7f57b1d5c8d488" +checksum = "76743e67d4e7efa9fc2ac7123de0dd7b2ca592668e19334f1d81a3b077afc6ac" dependencies = [ "actix-web", "futures-core", + "log", "pin-project-lite", "prometheus", "regex", + "strfmt", ] [[package]] @@ -1396,11 +1398,10 @@ dependencies = [ [[package]] name = "deadpool" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" +checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed" dependencies = [ - "async-trait", "deadpool-runtime", "num_cpus", "tokio", @@ -2228,25 +2229,25 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be92446e11d68f5d71367d571c229d09ced1f24ab6d08ea0bff329d5f6c0b2a3" dependencies = [ - "html5ever", + "html5ever 0.26.0", "jni", "lazy_static", - "markup5ever_rcdom", + "markup5ever_rcdom 0.2.0", "percent-encoding", "regex", ] [[package]] name = "html2text" -version = "0.6.0" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74cda84f06c1cc83476f79ae8e2e892b626bdadafcb227baec54c918cadc18a0" +checksum = "8c66ee488a63a92237d5b48875b7e05bb293be8fb2894641c8118b60c08ab5ef" dependencies = [ - "html5ever", - "markup5ever", + "html5ever 0.27.0", + "markup5ever 0.12.1", "tendril", + "thiserror", "unicode-width", - "xml5ever", ] [[package]] @@ -2257,12 +2258,26 @@ checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7" dependencies = [ "log", "mac", - "markup5ever", + "markup5ever 0.11.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.65", +] + [[package]] name = "http" version = "0.2.12" @@ -2634,6 +2649,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2680,13 +2704,14 @@ dependencies = [ [[package]] name = "jsonwebtoken" -version = "8.3.0" +version = "9.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" dependencies = [ "base64 0.21.7", - "pem 1.1.1", - "ring 0.16.20", + "js-sys", + "pem", + "ring 0.17.8", "serde", "serde_json", "simple_asn1", @@ -2816,7 +2841,7 @@ dependencies = [ "html2md", "html2text", "http 0.2.12", - "itertools 0.12.1", + "itertools 0.13.0", "lemmy_api_common", "lemmy_db_schema", "lemmy_db_views", @@ -2862,7 +2887,7 @@ dependencies = [ "async-trait", "bcrypt", "chrono", - "deadpool 0.10.0", + "deadpool 0.12.1", "diesel", "diesel-async", "diesel-derive-enum", @@ -2876,7 +2901,7 @@ dependencies = [ "once_cell", "pretty_assertions", "regex", - "rustls 0.23.7", + "rustls 0.23.8", "serde", "serde_json", "serde_with", @@ -3052,7 +3077,7 @@ dependencies = [ "futures", "html2text", "http 0.2.12", - "itertools 0.12.1", + "itertools 0.13.0", "lettre", "markdown-it", "once_cell", @@ -3231,7 +3256,21 @@ checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016" dependencies = [ "log", "phf 0.10.1", - "phf_codegen", + "phf_codegen 0.10.0", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf 0.11.2", + "phf_codegen 0.11.2", "string_cache", "string_cache_codegen", "tendril", @@ -3243,10 +3282,22 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9521dd6750f8e80ee6c53d65e2e4656d7de37064f3a7a5d2d11d05df93839c2" dependencies = [ - "html5ever", - "markup5ever", + "html5ever 0.26.0", + "markup5ever 0.11.0", "tendril", - "xml5ever", + "xml5ever 0.17.0", +] + +[[package]] +name = "markup5ever_rcdom" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edaa21ab3701bfee5099ade5f7e1f84553fd19228cf332f13cd6e964bf59be18" +dependencies = [ + "html5ever 0.27.0", + "markup5ever 0.12.1", + "tendril", + "xml5ever 0.18.0", ] [[package]] @@ -3859,15 +3910,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - [[package]] name = "pem" version = "3.0.4" @@ -3917,10 +3959,20 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" dependencies = [ - "phf_generator", + "phf_generator 0.10.0", "phf_shared 0.10.0", ] +[[package]] +name = "phf_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", +] + [[package]] name = "phf_generator" version = "0.10.0" @@ -3931,6 +3983,16 @@ dependencies = [ "rand", ] +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", + "rand", +] + [[package]] name = "phf_shared" version = "0.10.0" @@ -3984,7 +4046,7 @@ dependencies = [ "reqwest 0.12.4", "reqwest-middleware 0.3.1", "reqwest-tracing 0.5.0", - "rustls 0.23.7", + "rustls 0.23.8", "rustls-channel-resolver", "rustls-pemfile 2.1.2", "rusty-s3", @@ -4838,9 +4900,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.7" +version = "0.23.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b" +checksum = "79adb16721f56eb2d843e67676896a61ce7a0fa622dc18d3e372477a029d2740" dependencies = [ "aws-lc-rs", "log", @@ -4859,7 +4921,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fede2a247359da6b4998f7723ec6468c2d6a577a5d8c17e54f21806426ad2290" dependencies = [ "nanorand", - "rustls 0.23.7", + "rustls 0.23.8", ] [[package]] @@ -4939,6 +5001,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc" +dependencies = [ + "sdd", +] + [[package]] name = "schannel" version = "0.1.23" @@ -4974,6 +5045,12 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "sdd" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" + [[package]] name = "security-framework" version = "2.11.0" @@ -5004,8 +5081,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f9da09dc3f4dfdb6374cbffff7a2cffcec316874d4429899eefdc97b3b94dcd" dependencies = [ "bit-set", - "html5ever", - "markup5ever_rcdom", + "html5ever 0.26.0", + "markup5ever_rcdom 0.2.0", ] [[package]] @@ -5117,23 +5194,23 @@ dependencies = [ [[package]] name = "serial_test" -version = "2.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" +checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d" dependencies = [ - "dashmap", "futures", - "lazy_static", "log", + "once_cell", "parking_lot 0.12.2", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "2.0.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" +checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", @@ -5338,6 +5415,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "strfmt" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8348af2d9fc3258c8733b8d9d8db2e56f54b2363a4b5b81585c7875ed65e65" + [[package]] name = "string_cache" version = "0.8.7" @@ -5358,7 +5441,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" dependencies = [ - "phf_generator", + "phf_generator 0.10.0", "phf_shared 0.10.0", "proc-macro2", "quote", @@ -5395,15 +5478,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -5723,7 +5806,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8e98c31c29b2666fb28720739e11476166be4ead1610a37dcd7414bb124413a" dependencies = [ "aws-lc-rs", - "rustls 0.23.7", + "rustls 0.23.8", "tokio", "tokio-postgres", "tokio-rustls 0.26.0", @@ -5737,7 +5820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04fb792ccd6bbcd4bba408eb8a292f70fc4a3589e5d793626f45190e6454b6ab" dependencies = [ "ring 0.17.8", - "rustls 0.23.7", + "rustls 0.23.8", "tokio", "tokio-postgres", "tokio-rustls 0.26.0", @@ -5772,7 +5855,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.7", + "rustls 0.23.8", "rustls-pki-types", "tokio", ] @@ -6531,14 +6614,15 @@ dependencies = [ [[package]] name = "webpage" -version = "1.6.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8598785beeb5af95abe95e7bb20c7e747d1188347080d6811d5a56d2b9a5f368" +checksum = "70862efc041d46e6bbaa82bb9c34ae0596d090e86cbd14bd9e93b36ee6802eac" dependencies = [ - "html5ever", - "markup5ever_rcdom", + "html5ever 0.27.0", + "markup5ever_rcdom 0.3.0", "serde", "serde_json", + "url", ] [[package]] @@ -6842,7 +6926,7 @@ dependencies = [ "chrono", "der", "hex", - "pem 3.0.4", + "pem", "ring 0.17.8", "signature", "spki", @@ -6864,7 +6948,18 @@ checksum = "4034e1d05af98b51ad7214527730626f019682d797ba38b51689212118d8e650" dependencies = [ "log", "mac", - "markup5ever", + "markup5ever 0.11.0", +] + +[[package]] +name = "xml5ever" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c376f76ed09df711203e20c3ef5ce556f0166fa03d39590016c0fd625437fad" +dependencies = [ + "log", + "mac", + "markup5ever 0.12.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 1494aaf47..ce329dbb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -105,9 +105,9 @@ activitypub_federation = { version = "0.5.6", default-features = false, features diesel = "2.1.6" diesel_migrations = "2.1.0" diesel-async = "0.4.1" -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.202", features = ["derive"] } serde_with = "3.8.1" -actix-web = { version = "4.5.1", default-features = false, features = [ +actix-web = { version = "4.6.0", default-features = false, features = [ "macros", "rustls", "compress-brotli", @@ -128,25 +128,25 @@ clokwerk = "0.4.0" doku = { version = "0.21.1", features = ["url-2"] } bcrypt = "0.15.1" chrono = { version = "0.4.38", features = ["serde"], default-features = false } -serde_json = { version = "1.0.116", features = ["preserve_order"] } +serde_json = { version = "1.0.117", features = ["preserve_order"] } base64 = "0.22.1" uuid = { version = "1.8.0", features = ["serde", "v4"] } async-trait = "0.1.80" captcha = "0.0.9" -anyhow = { version = "1.0.82", features = [ +anyhow = { version = "1.0.86", features = [ "backtrace", ] } # backtrace is on by default on nightly, but not stable rust diesel_ltree = "0.3.1" typed-builder = "0.18.2" -serial_test = "2.0.0" +serial_test = "3.1.1" tokio = { version = "1.37.0", features = ["full"] } regex = "1.10.4" once_cell = "1.19.0" diesel-derive-newtype = "2.1.2" diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } -strum = "0.25.0" -strum_macros = "0.25.3" -itertools = "0.12.1" +strum = "0.26.2" +strum_macros = "0.26.2" +itertools = "0.13.0" futures = "0.3.30" http = "0.2.12" rosetta-i18n = "0.1.3" @@ -157,7 +157,7 @@ ts-rs = { version = "7.1.1", features = [ "chrono-impl", "no-serde-warnings", ] } -rustls = { version = "0.23.5", features = ["ring"] } +rustls = { version = "0.23.8", features = ["ring"] } futures-util = "0.3.30" tokio-postgres = "0.7.10" tokio-postgres-rustls = "0.12.0" @@ -196,15 +196,15 @@ tracing-opentelemetry = { workspace = true, optional = true } opentelemetry = { workspace = true, optional = true } console-subscriber = { version = "0.1.10", optional = true } opentelemetry-otlp = { version = "0.12.0", optional = true } -pict-rs = { version = "0.5.13", optional = true } +pict-rs = { version = "0.5.14", optional = true } tokio.workspace = true -actix-cors = "0.6.5" +actix-cors = "0.7.0" futures-util = { workspace = true } chrono = { workspace = true } -prometheus = { version = "0.13.3", features = ["process"] } +prometheus = { version = "0.13.4", features = ["process"] } serial_test = { workspace = true } clap = { workspace = true } -actix-web-prom = "0.7.0" +actix-web-prom = "0.8.0" [dev-dependencies] pretty_assertions = { workspace = true } diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index fcbea1e5d..846583c37 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -33,7 +33,7 @@ anyhow = { workspace = true } tracing = { workspace = true } chrono = { workspace = true } url = { workspace = true } -wav = "1.0.0" +wav = "1.0.1" sitemap-rs = "0.2.1" totp-rs = { version = "5.5.1", features = ["gen_secret", "otpauth"] } actix-web-httpauth = "0.8.1" diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 4033b4130..25bc02893 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -66,13 +66,13 @@ actix-web = { workspace = true, optional = true } enum-map = { workspace = true } urlencoding = { workspace = true } mime = { version = "0.3.17", optional = true } -webpage = { version = "1.6", default-features = false, features = [ +webpage = { version = "2.0", default-features = false, features = [ "serde", ], optional = true } encoding_rs = { version = "0.8.34", optional = true } -jsonwebtoken = { version = "8.3.0", optional = true } +jsonwebtoken = { version = "9.3.0", optional = true } # necessary for wasmt compilation -getrandom = { version = "0.2.14", features = ["js"] } +getrandom = { version = "0.2.15", features = ["js"] } [package.metadata.cargo-machete] ignored = ["getrandom"] diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 4c3189a09..a9c6f657a 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -44,7 +44,7 @@ once_cell = { workspace = true } moka.workspace = true serde_with.workspace = true html2md = "0.2.14" -html2text = "0.6.0" +html2text = "0.12.5" stringreader = "0.1.1" enum_delegate = "0.2.0" diff --git a/crates/db_schema/Cargo.toml b/crates/db_schema/Cargo.toml index a0654f063..cc6b7d8f6 100644 --- a/crates/db_schema/Cargo.toml +++ b/crates/db_schema/Cargo.toml @@ -70,7 +70,7 @@ diesel_ltree = { workspace = true, optional = true } typed-builder = { workspace = true } async-trait = { workspace = true } tracing = { workspace = true } -deadpool = { version = "0.10.0", features = ["rt_tokio_1"], optional = true } +deadpool = { version = "0.12.1", features = ["rt_tokio_1"], optional = true } ts-rs = { workspace = true, optional = true } futures-util = { workspace = true } tokio = { workspace = true, optional = true } diff --git a/crates/federate/Cargo.toml b/crates/federate/Cargo.toml index 9ccd8adc3..00e2f5a60 100644 --- a/crates/federate/Cargo.toml +++ b/crates/federate/Cargo.toml @@ -32,4 +32,4 @@ serde_json.workspace = true tokio = { workspace = true, features = ["full"] } tracing.workspace = true moka.workspace = true -tokio-util = "0.7.10" +tokio-util = "0.7.11" diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index 1403f92e7..0d18e4f1f 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -34,4 +34,4 @@ once_cell = { workspace = true } tracing = { workspace = true } tokio = { workspace = true } urlencoding = { workspace = true } -rss = "2.0.7" +rss = "2.0.8" diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index 3834c3a47..046c0a872 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -75,7 +75,7 @@ rosetta-i18n = { workspace = true, optional = true } tokio = { workspace = true, optional = true } urlencoding = { workspace = true, optional = true } openssl = { version = "0.10.64", optional = true } -html2text = { version = "0.6.0", optional = true } +html2text = { version = "0.12.5", optional = true } deser-hjson = { version = "2.2.4", optional = true } smart-default = { version = "0.7.1", optional = true } lettre = { version = "0.11.7", features = [ From b2c1a14234b9c5ad543929f84da0d0cbbd61fc2b Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 23 May 2024 16:59:56 +0200 Subject: [PATCH 2/5] Correct url for nodeinfo version (#4734) * Correct url for nodeinfo version * add compat redirect --------- Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> --- crates/routes/src/nodeinfo.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/routes/src/nodeinfo.rs b/crates/routes/src/nodeinfo.rs index 665756864..f64bb72c5 100644 --- a/crates/routes/src/nodeinfo.rs +++ b/crates/routes/src/nodeinfo.rs @@ -14,10 +14,12 @@ use url::Url; pub fn config(cfg: &mut web::ServiceConfig) { cfg .route( - "/nodeinfo/2.0.json", + "/nodeinfo/2.1.json", web::get().to(node_info).wrap(cache_1hour()), ) - .service(web::redirect("/version", "/nodeinfo/2.0.json")) + .service(web::redirect("/version", "/nodeinfo/2.1.json")) + // For backwards compatibility, can be removed after Lemmy 0.20 + .service(web::redirect("/nodeinfo/2.0.json", "/nodeinfo/2.1.json")) .route( "/.well-known/nodeinfo", web::get().to(node_info_well_known).wrap(cache_3days()), @@ -27,9 +29,9 @@ pub fn config(cfg: &mut web::ServiceConfig) { async fn node_info_well_known(context: web::Data) -> LemmyResult { let node_info = NodeInfoWellKnown { links: vec![NodeInfoWellKnownLinks { - rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.0")?, + rel: Url::parse("http://nodeinfo.diaspora.software/ns/schema/2.1")?, href: Url::parse(&format!( - "{}/nodeinfo/2.0.json", + "{}/nodeinfo/2.1.json", &context.settings().get_protocol_and_hostname(), ))?, }], From 6a6108ac552d859c6a088d2996768cf79dbfca26 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 23 May 2024 11:11:25 -0400 Subject: [PATCH 3/5] Fixing proxied images for federated posts. (#4737) * Fixing proxied images for federated posts. - Also added test. - Fixes #4736 * Address PR comments. --- Cargo.toml | 10 ++-- api_tests/src/image.spec.ts | 81 +++++++++++++++++++++++++-------- api_tests/src/shared.ts | 25 +++++----- crates/apub/src/objects/post.rs | 9 +--- src/root_span_builder.rs | 2 +- 5 files changed, 81 insertions(+), 46 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ce329dbb5..aec0e8373 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,8 +67,8 @@ members = [ [workspace.lints.clippy] cast_lossless = "deny" -complexity = "deny" -correctness = "deny" +complexity = { level = "deny", priority = -1 } +correctness = { level = "deny", priority = -1 } dbg_macro = "deny" explicit_into_iter_loop = "deny" explicit_iter_loop = "deny" @@ -79,10 +79,10 @@ inefficient_to_string = "deny" items-after-statements = "deny" manual_string_new = "deny" needless_collect = "deny" -perf = "deny" +perf = { level = "deny", priority = -1 } redundant_closure_for_method_calls = "deny" -style = "deny" -suspicious = "deny" +style = { level = "deny", priority = -1 } +suspicious = { level = "deny", priority = -1 } uninlined_format_args = "allow" unused_self = "deny" unwrap_used = "deny" diff --git a/api_tests/src/image.spec.ts b/api_tests/src/image.spec.ts index 806c5b313..123982e85 100644 --- a/api_tests/src/image.spec.ts +++ b/api_tests/src/image.spec.ts @@ -31,6 +31,7 @@ import { waitUntil, createPostWithThumbnail, sampleImage, + sampleSite, } from "./shared"; const downloadFileSync = require("download-file-sync"); @@ -172,54 +173,94 @@ test("Purge post, linked image removed", async () => { expect(content2).toBe(""); }); -test("Images in remote post are proxied if setting enabled", async () => { - let user = await registerUser(beta, betaUrl); +test("Images in remote image post are proxied if setting enabled", async () => { let community = await createCommunity(gamma); - - const upload_form: UploadImage = { - image: Buffer.from("test"), - }; - const upload = await user.uploadImage(upload_form); - let post = await createPost( + let postRes = await createPost( gamma, community.community_view.community.id, - upload.url, + sampleImage, `![](${sampleImage})`, ); - expect(post.post_view.post).toBeDefined(); + const post = postRes.post_view.post; + expect(post).toBeDefined(); // remote image gets proxied after upload expect( - post.post_view.post.thumbnail_url?.startsWith( + post.thumbnail_url?.startsWith( "http://lemmy-gamma:8561/api/v3/image_proxy?url", ), ).toBeTruthy(); expect( - post.post_view.post.body?.startsWith( - "![](http://lemmy-gamma:8561/api/v3/image_proxy?url", - ), + post.body?.startsWith("![](http://lemmy-gamma:8561/api/v3/image_proxy?url"), ).toBeTruthy(); - let epsilonPost = await resolvePost(epsilon, post.post_view.post); - expect(epsilonPost.post).toBeDefined(); + // Make sure that it ends with jpg, to be sure its an image + expect(post.thumbnail_url?.endsWith(".jpg")).toBeTruthy(); + + let epsilonPostRes = await resolvePost(epsilon, postRes.post_view.post); + expect(epsilonPostRes.post).toBeDefined(); // Fetch the post again, the metadata should be backgrounded now // Wait for the metadata to get fetched, since this is backgrounded now - let epsilonPost2 = await waitUntil( - () => getPost(epsilon, epsilonPost.post!.post.id), + let epsilonPostRes2 = await waitUntil( + () => getPost(epsilon, epsilonPostRes.post!.post.id), p => p.post_view.post.thumbnail_url != undefined, ); + const epsilonPost = epsilonPostRes2.post_view.post; expect( - epsilonPost2.post_view.post.thumbnail_url?.startsWith( + epsilonPost.thumbnail_url?.startsWith( "http://lemmy-epsilon:8581/api/v3/image_proxy?url", ), ).toBeTruthy(); expect( - epsilonPost2.post_view.post.body?.startsWith( + epsilonPost.body?.startsWith( "![](http://lemmy-epsilon:8581/api/v3/image_proxy?url", ), ).toBeTruthy(); + + // Make sure that it ends with jpg, to be sure its an image + expect(epsilonPost.thumbnail_url?.endsWith(".jpg")).toBeTruthy(); +}); + +test("Thumbnail of remote image link is proxied if setting enabled", async () => { + let community = await createCommunity(gamma); + let postRes = await createPost( + gamma, + community.community_view.community.id, + // The sample site metadata thumbnail ends in png + sampleSite, + ); + const post = postRes.post_view.post; + expect(post).toBeDefined(); + + // remote image gets proxied after upload + expect( + post.thumbnail_url?.startsWith( + "http://lemmy-gamma:8561/api/v3/image_proxy?url", + ), + ).toBeTruthy(); + + // Make sure that it ends with png, to be sure its an image + expect(post.thumbnail_url?.endsWith(".png")).toBeTruthy(); + + let epsilonPostRes = await resolvePost(epsilon, postRes.post_view.post); + expect(epsilonPostRes.post).toBeDefined(); + + let epsilonPostRes2 = await waitUntil( + () => getPost(epsilon, epsilonPostRes.post!.post.id), + p => p.post_view.post.thumbnail_url != undefined, + ); + const epsilonPost = epsilonPostRes2.post_view.post; + + expect( + epsilonPost.thumbnail_url?.startsWith( + "http://lemmy-epsilon:8581/api/v3/image_proxy?url", + ), + ).toBeTruthy(); + + // Make sure that it ends with png, to be sure its an image + expect(epsilonPost.thumbnail_url?.endsWith(".png")).toBeTruthy(); }); test("No image proxying if setting is disabled", async () => { diff --git a/api_tests/src/shared.ts b/api_tests/src/shared.ts index 6cc8d5aca..056f25538 100644 --- a/api_tests/src/shared.ts +++ b/api_tests/src/shared.ts @@ -83,21 +83,22 @@ export const fetchFunction = fetch; export const imageFetchLimit = 50; export const sampleImage = "https://i.pinimg.com/originals/df/5f/5b/df5f5b1b174a2b4b6026cc6c8f9395c1.jpg"; +export const sampleSite = "https://yahoo.com"; -export let alphaUrl = "http://127.0.0.1:8541"; -export let betaUrl = "http://127.0.0.1:8551"; -export let gammaUrl = "http://127.0.0.1:8561"; -export let deltaUrl = "http://127.0.0.1:8571"; -export let epsilonUrl = "http://127.0.0.1:8581"; +export const alphaUrl = "http://127.0.0.1:8541"; +export const betaUrl = "http://127.0.0.1:8551"; +export const gammaUrl = "http://127.0.0.1:8561"; +export const deltaUrl = "http://127.0.0.1:8571"; +export const epsilonUrl = "http://127.0.0.1:8581"; -export let alpha = new LemmyHttp(alphaUrl, { fetchFunction }); -export let alphaImage = new LemmyHttp(alphaUrl); -export let beta = new LemmyHttp(betaUrl, { fetchFunction }); -export let gamma = new LemmyHttp(gammaUrl, { fetchFunction }); -export let delta = new LemmyHttp(deltaUrl, { fetchFunction }); -export let epsilon = new LemmyHttp(epsilonUrl, { fetchFunction }); +export const alpha = new LemmyHttp(alphaUrl, { fetchFunction }); +export const alphaImage = new LemmyHttp(alphaUrl); +export const beta = new LemmyHttp(betaUrl, { fetchFunction }); +export const gamma = new LemmyHttp(gammaUrl, { fetchFunction }); +export const delta = new LemmyHttp(deltaUrl, { fetchFunction }); +export const epsilon = new LemmyHttp(epsilonUrl, { fetchFunction }); -export let betaAllowedInstances = [ +export const betaAllowedInstances = [ "lemmy-alpha", "lemmy-gamma", "lemmy-delta", diff --git a/crates/apub/src/objects/post.rs b/crates/apub/src/objects/post.rs index 3f69fa0c8..59f4920d3 100644 --- a/crates/apub/src/objects/post.rs +++ b/crates/apub/src/objects/post.rs @@ -25,12 +25,7 @@ use html2text::{from_read_with_decorator, render::text_renderer::TrivialDecorato use lemmy_api_common::{ context::LemmyContext, request::generate_post_link_metadata, - utils::{ - get_url_blocklist, - local_site_opt_to_slur_regex, - process_markdown_opt, - proxy_image_link_opt_apub, - }, + utils::{get_url_blocklist, local_site_opt_to_slur_regex, process_markdown_opt}, }; use lemmy_db_schema::{ source::{ @@ -228,8 +223,6 @@ impl Object for ApubPost { let alt_text = first_attachment.cloned().and_then(Attachment::alt_text); - let url = proxy_image_link_opt_apub(url, context).await?; - let slur_regex = &local_site_opt_to_slur_regex(&local_site); let url_blocklist = get_url_blocklist(context).await?; diff --git a/src/root_span_builder.rs b/src/root_span_builder.rs index e062ade21..09ce2544e 100644 --- a/src/root_span_builder.rs +++ b/src/root_span_builder.rs @@ -79,5 +79,5 @@ fn handle_error(span: Span, status_code: StatusCode, response_error: &dyn Respon } }); - span.record("exception.message", &tracing::field::display(display_error)); + span.record("exception.message", tracing::field::display(display_error)); } From 69bdcb3069a353da88ac0e1be39c491f8847ad67 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 23 May 2024 12:10:33 -0400 Subject: [PATCH 4/5] Version 0.19.4-rc.2 --- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4dbfa3d2e..948a18125 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2737,7 +2737,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "lemmy_api" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2766,7 +2766,7 @@ dependencies = [ [[package]] name = "lemmy_api_common" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2804,7 +2804,7 @@ dependencies = [ [[package]] name = "lemmy_api_crud" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "accept-language", "activitypub_federation", @@ -2827,7 +2827,7 @@ dependencies = [ [[package]] name = "lemmy_apub" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -2865,7 +2865,7 @@ dependencies = [ [[package]] name = "lemmy_db_perf" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "anyhow", "clap", @@ -2880,7 +2880,7 @@ dependencies = [ [[package]] name = "lemmy_db_schema" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "anyhow", @@ -2920,7 +2920,7 @@ dependencies = [ [[package]] name = "lemmy_db_views" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "actix-web", "chrono", @@ -2942,7 +2942,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_actor" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "chrono", "diesel", @@ -2962,7 +2962,7 @@ dependencies = [ [[package]] name = "lemmy_db_views_moderator" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "diesel", "diesel-async", @@ -2974,7 +2974,7 @@ dependencies = [ [[package]] name = "lemmy_federate" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "anyhow", @@ -2997,7 +2997,7 @@ dependencies = [ [[package]] name = "lemmy_routes" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "actix-web", @@ -3022,7 +3022,7 @@ dependencies = [ [[package]] name = "lemmy_server" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "activitypub_federation", "actix-cors", @@ -3065,7 +3065,7 @@ dependencies = [ [[package]] name = "lemmy_utils" -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" dependencies = [ "actix-web", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index aec0e8373..d9fd4ce2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.19.4-rc.1" +version = "0.19.4-rc.2" edition = "2021" description = "A link aggregator for the fediverse" license = "AGPL-3.0" @@ -88,17 +88,17 @@ unused_self = "deny" unwrap_used = "deny" [workspace.dependencies] -lemmy_api = { version = "=0.19.4-rc.1", path = "./crates/api" } -lemmy_api_crud = { version = "=0.19.4-rc.1", path = "./crates/api_crud" } -lemmy_apub = { version = "=0.19.4-rc.1", path = "./crates/apub" } -lemmy_utils = { version = "=0.19.4-rc.1", path = "./crates/utils", default-features = false } -lemmy_db_schema = { version = "=0.19.4-rc.1", path = "./crates/db_schema" } -lemmy_api_common = { version = "=0.19.4-rc.1", path = "./crates/api_common" } -lemmy_routes = { version = "=0.19.4-rc.1", path = "./crates/routes" } -lemmy_db_views = { version = "=0.19.4-rc.1", path = "./crates/db_views" } -lemmy_db_views_actor = { version = "=0.19.4-rc.1", path = "./crates/db_views_actor" } -lemmy_db_views_moderator = { version = "=0.19.4-rc.1", path = "./crates/db_views_moderator" } -lemmy_federate = { version = "=0.19.4-rc.1", path = "./crates/federate" } +lemmy_api = { version = "=0.19.4-rc.2", path = "./crates/api" } +lemmy_api_crud = { version = "=0.19.4-rc.2", path = "./crates/api_crud" } +lemmy_apub = { version = "=0.19.4-rc.2", path = "./crates/apub" } +lemmy_utils = { version = "=0.19.4-rc.2", path = "./crates/utils", default-features = false } +lemmy_db_schema = { version = "=0.19.4-rc.2", path = "./crates/db_schema" } +lemmy_api_common = { version = "=0.19.4-rc.2", path = "./crates/api_common" } +lemmy_routes = { version = "=0.19.4-rc.2", path = "./crates/routes" } +lemmy_db_views = { version = "=0.19.4-rc.2", path = "./crates/db_views" } +lemmy_db_views_actor = { version = "=0.19.4-rc.2", path = "./crates/db_views_actor" } +lemmy_db_views_moderator = { version = "=0.19.4-rc.2", path = "./crates/db_views_moderator" } +lemmy_federate = { version = "=0.19.4-rc.2", path = "./crates/federate" } activitypub_federation = { version = "0.5.6", default-features = false, features = [ "actix-web", ] } From ec77c00ef80248e9eceec800082e34547f9aa084 Mon Sep 17 00:00:00 2001 From: dullbananas Date: Thu, 23 May 2024 11:05:35 -0700 Subject: [PATCH 5/5] Fix lost separation caused by comment width change (#4739) * Update post_view.rs * Update structs.rs * Update worker.rs * Update worker.rs --- crates/db_views/src/post_view.rs | 2 +- crates/db_views/src/structs.rs | 2 +- crates/federate/src/worker.rs | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/db_views/src/post_view.rs b/crates/db_views/src/post_view.rs index 14a9b4f81..afb0f435f 100644 --- a/crates/db_views/src/post_view.rs +++ b/crates/db_views/src/post_view.rs @@ -652,7 +652,7 @@ impl<'a> PostQuery<'a> { pool: &mut DbPool<'_>, ) -> Result>, Error> { // first get one page for the most popular community to get an upper bound for the page end for - // the real query the reason this is needed is that when fetching posts for a single + // the real query. the reason this is needed is that when fetching posts for a single // community PostgreSQL can optimize the query to use an index on e.g. (=, >=, >=, >=) and // fetch only LIMIT rows but for the followed-communities query it has to query the index on // (IN, >=, >=, >=) which it currently can't do at all (as of PG 16). see the discussion diff --git a/crates/db_views/src/structs.rs b/crates/db_views/src/structs.rs index b37abab37..350e4cad4 100644 --- a/crates/db_views/src/structs.rs +++ b/crates/db_views/src/structs.rs @@ -113,7 +113,7 @@ pub struct PostReportView { } /// currently this is just a wrapper around post id, but should be seen as opaque from the client's -/// perspective stringified since we might want to use arbitrary info later, with a P prepended to +/// perspective. stringified since we might want to use arbitrary info later, with a P prepended to /// prevent ossification (api users love to make assumptions (e.g. parse stuff that looks like /// numbers as numbers) about apis that aren't part of the spec #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index b2d897522..c11c019d6 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -37,8 +37,8 @@ use tokio_util::sync::CancellationToken; use tracing::{debug, info, trace, warn}; /// Check whether to save state to db every n sends if there's no failures (during failures state is -/// saved after every attempt) This determines the batch size for loop_batch. After a batch ends and -/// SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB. +/// saved after every attempt). This determines the batch size for loop_batch. After a batch ends +/// and SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB. static CHECK_SAVE_STATE_EVERY_IT: i64 = 100; /// Save state to db after this time has passed since the last state (so if the server crashes or is /// SIGKILLed, less than X seconds of activities are resent) @@ -161,7 +161,9 @@ impl InstanceWorker { id } else { // this is the initial creation (instance first seen) of the federation queue for this - // instance skip all past activities: + // instance + + // skip all past activities: self.state.last_successful_id = Some(latest_id); // save here to ensure it's not read as 0 again later if no activities have happened self.save_and_send_state(pool).await?;