Merge branch 'main' into migration-runner

This commit is contained in:
dullbananas 2024-05-23 15:39:26 -07:00 committed by GitHub
commit db856efcdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 299 additions and 165 deletions

247
Cargo.lock generated
View file

@ -81,9 +81,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-cors" name = "actix-cors"
version = "0.6.5" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0346d8c1f762b41b458ed3145eea914966bb9ad20b9be0d6d463b20d45586370" checksum = "f9e772b3bcafe335042b5db010ab7c09013dad6eac4915c91d8d50902769f331"
dependencies = [ dependencies = [
"actix-utils", "actix-utils",
"actix-web", "actix-web",
@ -337,15 +337,17 @@ dependencies = [
[[package]] [[package]]
name = "actix-web-prom" name = "actix-web-prom"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f23f332a652836b8f3a6876103c70c9ed436d0e69fa779ab5d7f57b1d5c8d488" checksum = "76743e67d4e7efa9fc2ac7123de0dd7b2ca592668e19334f1d81a3b077afc6ac"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"futures-core", "futures-core",
"log",
"pin-project-lite", "pin-project-lite",
"prometheus", "prometheus",
"regex", "regex",
"strfmt",
] ]
[[package]] [[package]]
@ -1396,11 +1398,10 @@ dependencies = [
[[package]] [[package]]
name = "deadpool" name = "deadpool"
version = "0.10.0" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" checksum = "6541a3916932fe57768d4be0b1ffb5ec7cbf74ca8c903fdfd5c0fe8aa958f0ed"
dependencies = [ dependencies = [
"async-trait",
"deadpool-runtime", "deadpool-runtime",
"num_cpus", "num_cpus",
"tokio", "tokio",
@ -2228,25 +2229,25 @@ version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be92446e11d68f5d71367d571c229d09ced1f24ab6d08ea0bff329d5f6c0b2a3" checksum = "be92446e11d68f5d71367d571c229d09ced1f24ab6d08ea0bff329d5f6c0b2a3"
dependencies = [ dependencies = [
"html5ever", "html5ever 0.26.0",
"jni", "jni",
"lazy_static", "lazy_static",
"markup5ever_rcdom", "markup5ever_rcdom 0.2.0",
"percent-encoding", "percent-encoding",
"regex", "regex",
] ]
[[package]] [[package]]
name = "html2text" name = "html2text"
version = "0.6.0" version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74cda84f06c1cc83476f79ae8e2e892b626bdadafcb227baec54c918cadc18a0" checksum = "8c66ee488a63a92237d5b48875b7e05bb293be8fb2894641c8118b60c08ab5ef"
dependencies = [ dependencies = [
"html5ever", "html5ever 0.27.0",
"markup5ever", "markup5ever 0.12.1",
"tendril", "tendril",
"thiserror",
"unicode-width", "unicode-width",
"xml5ever",
] ]
[[package]] [[package]]
@ -2257,12 +2258,26 @@ checksum = "bea68cab48b8459f17cf1c944c67ddc572d272d9f2b274140f223ecb1da4a3b7"
dependencies = [ dependencies = [
"log", "log",
"mac", "mac",
"markup5ever", "markup5ever 0.11.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "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]] [[package]]
name = "http" name = "http"
version = "0.2.12" version = "0.2.12"
@ -2634,6 +2649,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.11" version = "1.0.11"
@ -2680,13 +2704,14 @@ dependencies = [
[[package]] [[package]]
name = "jsonwebtoken" name = "jsonwebtoken"
version = "8.3.0" version = "9.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"pem 1.1.1", "js-sys",
"ring 0.16.20", "pem",
"ring 0.17.8",
"serde", "serde",
"serde_json", "serde_json",
"simple_asn1", "simple_asn1",
@ -2712,7 +2737,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]] [[package]]
name = "lemmy_api" name = "lemmy_api"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2741,7 +2766,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_common" name = "lemmy_api_common"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2779,7 +2804,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_api_crud" name = "lemmy_api_crud"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"accept-language", "accept-language",
"activitypub_federation", "activitypub_federation",
@ -2802,7 +2827,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_apub" name = "lemmy_apub"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2816,7 +2841,7 @@ dependencies = [
"html2md", "html2md",
"html2text", "html2text",
"http 0.2.12", "http 0.2.12",
"itertools 0.12.1", "itertools 0.13.0",
"lemmy_api_common", "lemmy_api_common",
"lemmy_db_schema", "lemmy_db_schema",
"lemmy_db_views", "lemmy_db_views",
@ -2840,7 +2865,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_perf" name = "lemmy_db_perf"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
@ -2855,14 +2880,14 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_schema" name = "lemmy_db_schema"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"anyhow", "anyhow",
"async-trait", "async-trait",
"bcrypt", "bcrypt",
"chrono", "chrono",
"deadpool 0.10.0", "deadpool 0.12.1",
"diesel", "diesel",
"diesel-async", "diesel-async",
"diesel-derive-enum", "diesel-derive-enum",
@ -2877,7 +2902,7 @@ dependencies = [
"once_cell", "once_cell",
"pretty_assertions", "pretty_assertions",
"regex", "regex",
"rustls 0.23.7", "rustls 0.23.8",
"serde", "serde",
"serde_json", "serde_json",
"serde_with", "serde_with",
@ -2896,7 +2921,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views" name = "lemmy_db_views"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"chrono", "chrono",
@ -2918,7 +2943,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_actor" name = "lemmy_db_views_actor"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"chrono", "chrono",
"diesel", "diesel",
@ -2938,7 +2963,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_db_views_moderator" name = "lemmy_db_views_moderator"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"diesel", "diesel",
"diesel-async", "diesel-async",
@ -2950,7 +2975,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_federate" name = "lemmy_federate"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"anyhow", "anyhow",
@ -2973,7 +2998,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_routes" name = "lemmy_routes"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-web", "actix-web",
@ -2998,7 +3023,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_server" name = "lemmy_server"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"activitypub_federation", "activitypub_federation",
"actix-cors", "actix-cors",
@ -3041,7 +3066,7 @@ dependencies = [
[[package]] [[package]]
name = "lemmy_utils" name = "lemmy_utils"
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"anyhow", "anyhow",
@ -3053,7 +3078,7 @@ dependencies = [
"futures", "futures",
"html2text", "html2text",
"http 0.2.12", "http 0.2.12",
"itertools 0.12.1", "itertools 0.13.0",
"lettre", "lettre",
"markdown-it", "markdown-it",
"once_cell", "once_cell",
@ -3232,7 +3257,21 @@ checksum = "7a2629bb1404f3d34c2e921f21fd34ba00b206124c81f65c50b43b6aaefeb016"
dependencies = [ dependencies = [
"log", "log",
"phf 0.10.1", "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",
"string_cache_codegen", "string_cache_codegen",
"tendril", "tendril",
@ -3244,10 +3283,22 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9521dd6750f8e80ee6c53d65e2e4656d7de37064f3a7a5d2d11d05df93839c2" checksum = "b9521dd6750f8e80ee6c53d65e2e4656d7de37064f3a7a5d2d11d05df93839c2"
dependencies = [ dependencies = [
"html5ever", "html5ever 0.26.0",
"markup5ever", "markup5ever 0.11.0",
"tendril", "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]] [[package]]
@ -3860,15 +3911,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" 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]] [[package]]
name = "pem" name = "pem"
version = "3.0.4" version = "3.0.4"
@ -3918,10 +3960,20 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
dependencies = [ dependencies = [
"phf_generator", "phf_generator 0.10.0",
"phf_shared 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]] [[package]]
name = "phf_generator" name = "phf_generator"
version = "0.10.0" version = "0.10.0"
@ -3932,6 +3984,16 @@ dependencies = [
"rand", "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]] [[package]]
name = "phf_shared" name = "phf_shared"
version = "0.10.0" version = "0.10.0"
@ -3985,7 +4047,7 @@ dependencies = [
"reqwest 0.12.4", "reqwest 0.12.4",
"reqwest-middleware 0.3.1", "reqwest-middleware 0.3.1",
"reqwest-tracing 0.5.0", "reqwest-tracing 0.5.0",
"rustls 0.23.7", "rustls 0.23.8",
"rustls-channel-resolver", "rustls-channel-resolver",
"rustls-pemfile 2.1.2", "rustls-pemfile 2.1.2",
"rusty-s3", "rusty-s3",
@ -4839,9 +4901,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.7" version = "0.23.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b" checksum = "79adb16721f56eb2d843e67676896a61ce7a0fa622dc18d3e372477a029d2740"
dependencies = [ dependencies = [
"aws-lc-rs", "aws-lc-rs",
"log", "log",
@ -4860,7 +4922,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fede2a247359da6b4998f7723ec6468c2d6a577a5d8c17e54f21806426ad2290" checksum = "fede2a247359da6b4998f7723ec6468c2d6a577a5d8c17e54f21806426ad2290"
dependencies = [ dependencies = [
"nanorand", "nanorand",
"rustls 0.23.7", "rustls 0.23.8",
] ]
[[package]] [[package]]
@ -4940,6 +5002,15 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "scc"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76ad2bbb0ae5100a07b7a6f2ed7ab5fd0045551a4c507989b7a620046ea3efdc"
dependencies = [
"sdd",
]
[[package]] [[package]]
name = "schannel" name = "schannel"
version = "0.1.23" version = "0.1.23"
@ -4975,6 +5046,12 @@ dependencies = [
"untrusted 0.9.0", "untrusted 0.9.0",
] ]
[[package]]
name = "sdd"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d"
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.11.0" version = "2.11.0"
@ -5005,8 +5082,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f9da09dc3f4dfdb6374cbffff7a2cffcec316874d4429899eefdc97b3b94dcd" checksum = "6f9da09dc3f4dfdb6374cbffff7a2cffcec316874d4429899eefdc97b3b94dcd"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"html5ever", "html5ever 0.26.0",
"markup5ever_rcdom", "markup5ever_rcdom 0.2.0",
] ]
[[package]] [[package]]
@ -5118,23 +5195,23 @@ dependencies = [
[[package]] [[package]]
name = "serial_test" name = "serial_test"
version = "2.0.0" version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" checksum = "4b4b487fe2acf240a021cf57c6b2b4903b1e78ca0ecd862a71b71d2a51fed77d"
dependencies = [ dependencies = [
"dashmap",
"futures", "futures",
"lazy_static",
"log", "log",
"once_cell",
"parking_lot 0.12.2", "parking_lot 0.12.2",
"scc",
"serial_test_derive", "serial_test_derive",
] ]
[[package]] [[package]]
name = "serial_test_derive" name = "serial_test_derive"
version = "2.0.0" version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -5339,6 +5416,12 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
] ]
[[package]]
name = "strfmt"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a8348af2d9fc3258c8733b8d9d8db2e56f54b2363a4b5b81585c7875ed65e65"
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.8.7" version = "0.8.7"
@ -5359,7 +5442,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
dependencies = [ dependencies = [
"phf_generator", "phf_generator 0.10.0",
"phf_shared 0.10.0", "phf_shared 0.10.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -5396,15 +5479,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.25.0" version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
[[package]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.25.3" version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro2", "proc-macro2",
@ -5724,7 +5807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8e98c31c29b2666fb28720739e11476166be4ead1610a37dcd7414bb124413a" checksum = "c8e98c31c29b2666fb28720739e11476166be4ead1610a37dcd7414bb124413a"
dependencies = [ dependencies = [
"aws-lc-rs", "aws-lc-rs",
"rustls 0.23.7", "rustls 0.23.8",
"tokio", "tokio",
"tokio-postgres", "tokio-postgres",
"tokio-rustls 0.26.0", "tokio-rustls 0.26.0",
@ -5738,7 +5821,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04fb792ccd6bbcd4bba408eb8a292f70fc4a3589e5d793626f45190e6454b6ab" checksum = "04fb792ccd6bbcd4bba408eb8a292f70fc4a3589e5d793626f45190e6454b6ab"
dependencies = [ dependencies = [
"ring 0.17.8", "ring 0.17.8",
"rustls 0.23.7", "rustls 0.23.8",
"tokio", "tokio",
"tokio-postgres", "tokio-postgres",
"tokio-rustls 0.26.0", "tokio-rustls 0.26.0",
@ -5773,7 +5856,7 @@ version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [ dependencies = [
"rustls 0.23.7", "rustls 0.23.8",
"rustls-pki-types", "rustls-pki-types",
"tokio", "tokio",
] ]
@ -6532,14 +6615,15 @@ dependencies = [
[[package]] [[package]]
name = "webpage" name = "webpage"
version = "1.6.0" version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8598785beeb5af95abe95e7bb20c7e747d1188347080d6811d5a56d2b9a5f368" checksum = "70862efc041d46e6bbaa82bb9c34ae0596d090e86cbd14bd9e93b36ee6802eac"
dependencies = [ dependencies = [
"html5ever", "html5ever 0.27.0",
"markup5ever_rcdom", "markup5ever_rcdom 0.3.0",
"serde", "serde",
"serde_json", "serde_json",
"url",
] ]
[[package]] [[package]]
@ -6843,7 +6927,7 @@ dependencies = [
"chrono", "chrono",
"der", "der",
"hex", "hex",
"pem 3.0.4", "pem",
"ring 0.17.8", "ring 0.17.8",
"signature", "signature",
"spki", "spki",
@ -6865,7 +6949,18 @@ checksum = "4034e1d05af98b51ad7214527730626f019682d797ba38b51689212118d8e650"
dependencies = [ dependencies = [
"log", "log",
"mac", "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]] [[package]]

View file

@ -1,5 +1,5 @@
[workspace.package] [workspace.package]
version = "0.19.4-rc.1" version = "0.19.4-rc.2"
edition = "2021" edition = "2021"
description = "A link aggregator for the fediverse" description = "A link aggregator for the fediverse"
license = "AGPL-3.0" license = "AGPL-3.0"
@ -67,8 +67,8 @@ members = [
[workspace.lints.clippy] [workspace.lints.clippy]
cast_lossless = "deny" cast_lossless = "deny"
complexity = "deny" complexity = { level = "deny", priority = -1 }
correctness = "deny" correctness = { level = "deny", priority = -1 }
dbg_macro = "deny" dbg_macro = "deny"
explicit_into_iter_loop = "deny" explicit_into_iter_loop = "deny"
explicit_iter_loop = "deny" explicit_iter_loop = "deny"
@ -79,35 +79,35 @@ inefficient_to_string = "deny"
items-after-statements = "deny" items-after-statements = "deny"
manual_string_new = "deny" manual_string_new = "deny"
needless_collect = "deny" needless_collect = "deny"
perf = "deny" perf = { level = "deny", priority = -1 }
redundant_closure_for_method_calls = "deny" redundant_closure_for_method_calls = "deny"
style = "deny" style = { level = "deny", priority = -1 }
suspicious = "deny" suspicious = { level = "deny", priority = -1 }
uninlined_format_args = "allow" uninlined_format_args = "allow"
unused_self = "deny" unused_self = "deny"
unwrap_used = "deny" unwrap_used = "deny"
[workspace.dependencies] [workspace.dependencies]
lemmy_api = { version = "=0.19.4-rc.1", path = "./crates/api" } lemmy_api = { version = "=0.19.4-rc.2", path = "./crates/api" }
lemmy_api_crud = { version = "=0.19.4-rc.1", path = "./crates/api_crud" } lemmy_api_crud = { version = "=0.19.4-rc.2", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.19.4-rc.1", path = "./crates/apub" } lemmy_apub = { version = "=0.19.4-rc.2", path = "./crates/apub" }
lemmy_utils = { version = "=0.19.4-rc.1", path = "./crates/utils", default-features = false } lemmy_utils = { version = "=0.19.4-rc.2", path = "./crates/utils", default-features = false }
lemmy_db_schema = { version = "=0.19.4-rc.1", path = "./crates/db_schema" } lemmy_db_schema = { version = "=0.19.4-rc.2", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.19.4-rc.1", path = "./crates/api_common" } lemmy_api_common = { version = "=0.19.4-rc.2", path = "./crates/api_common" }
lemmy_routes = { version = "=0.19.4-rc.1", path = "./crates/routes" } lemmy_routes = { version = "=0.19.4-rc.2", path = "./crates/routes" }
lemmy_db_views = { version = "=0.19.4-rc.1", path = "./crates/db_views" } lemmy_db_views = { version = "=0.19.4-rc.2", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.4-rc.1", path = "./crates/db_views_actor" } lemmy_db_views_actor = { version = "=0.19.4-rc.2", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.4-rc.1", path = "./crates/db_views_moderator" } lemmy_db_views_moderator = { version = "=0.19.4-rc.2", path = "./crates/db_views_moderator" }
lemmy_federate = { version = "=0.19.4-rc.1", path = "./crates/federate" } lemmy_federate = { version = "=0.19.4-rc.2", path = "./crates/federate" }
activitypub_federation = { version = "0.5.6", default-features = false, features = [ activitypub_federation = { version = "0.5.6", default-features = false, features = [
"actix-web", "actix-web",
] } ] }
diesel = "2.1.6" diesel = "2.1.6"
diesel_migrations = "2.1.0" diesel_migrations = "2.1.0"
diesel-async = "0.4.1" diesel-async = "0.4.1"
serde = { version = "1.0.199", features = ["derive"] } serde = { version = "1.0.202", features = ["derive"] }
serde_with = "3.8.1" 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", "macros",
"rustls", "rustls",
"compress-brotli", "compress-brotli",
@ -128,25 +128,25 @@ clokwerk = "0.4.0"
doku = { version = "0.21.1", features = ["url-2"] } doku = { version = "0.21.1", features = ["url-2"] }
bcrypt = "0.15.1" bcrypt = "0.15.1"
chrono = { version = "0.4.38", features = ["serde"], default-features = false } 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" base64 = "0.22.1"
uuid = { version = "1.8.0", features = ["serde", "v4"] } uuid = { version = "1.8.0", features = ["serde", "v4"] }
async-trait = "0.1.80" async-trait = "0.1.80"
captcha = "0.0.9" captcha = "0.0.9"
anyhow = { version = "1.0.82", features = [ anyhow = { version = "1.0.86", features = [
"backtrace", "backtrace",
] } # backtrace is on by default on nightly, but not stable rust ] } # backtrace is on by default on nightly, but not stable rust
diesel_ltree = "0.3.1" diesel_ltree = "0.3.1"
typed-builder = "0.18.2" typed-builder = "0.18.2"
serial_test = "2.0.0" serial_test = "3.1.1"
tokio = { version = "1.37.0", features = ["full"] } tokio = { version = "1.37.0", features = ["full"] }
regex = "1.10.4" regex = "1.10.4"
once_cell = "1.19.0" once_cell = "1.19.0"
diesel-derive-newtype = "2.1.2" diesel-derive-newtype = "2.1.2"
diesel-derive-enum = { version = "2.1.0", features = ["postgres"] } diesel-derive-enum = { version = "2.1.0", features = ["postgres"] }
strum = "0.25.0" strum = "0.26.2"
strum_macros = "0.25.3" strum_macros = "0.26.2"
itertools = "0.12.1" itertools = "0.13.0"
futures = "0.3.30" futures = "0.3.30"
http = "0.2.12" http = "0.2.12"
rosetta-i18n = "0.1.3" rosetta-i18n = "0.1.3"
@ -157,7 +157,7 @@ ts-rs = { version = "7.1.1", features = [
"chrono-impl", "chrono-impl",
"no-serde-warnings", "no-serde-warnings",
] } ] }
rustls = { version = "0.23.5", features = ["ring"] } rustls = { version = "0.23.8", features = ["ring"] }
futures-util = "0.3.30" futures-util = "0.3.30"
tokio-postgres = "0.7.10" tokio-postgres = "0.7.10"
tokio-postgres-rustls = "0.12.0" tokio-postgres-rustls = "0.12.0"
@ -196,15 +196,15 @@ tracing-opentelemetry = { workspace = true, optional = true }
opentelemetry = { workspace = true, optional = true } opentelemetry = { workspace = true, optional = true }
console-subscriber = { version = "0.1.10", optional = true } console-subscriber = { version = "0.1.10", optional = true }
opentelemetry-otlp = { version = "0.12.0", 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 tokio.workspace = true
actix-cors = "0.6.5" actix-cors = "0.7.0"
futures-util = { workspace = true } futures-util = { workspace = true }
chrono = { workspace = true } chrono = { workspace = true }
prometheus = { version = "0.13.3", features = ["process"] } prometheus = { version = "0.13.4", features = ["process"] }
serial_test = { workspace = true } serial_test = { workspace = true }
clap = { workspace = true } clap = { workspace = true }
actix-web-prom = "0.7.0" actix-web-prom = "0.8.0"
[dev-dependencies] [dev-dependencies]
pretty_assertions = { workspace = true } pretty_assertions = { workspace = true }

View file

@ -31,6 +31,7 @@ import {
waitUntil, waitUntil,
createPostWithThumbnail, createPostWithThumbnail,
sampleImage, sampleImage,
sampleSite,
} from "./shared"; } from "./shared";
const downloadFileSync = require("download-file-sync"); const downloadFileSync = require("download-file-sync");
@ -172,54 +173,94 @@ test("Purge post, linked image removed", async () => {
expect(content2).toBe(""); expect(content2).toBe("");
}); });
test("Images in remote post are proxied if setting enabled", async () => { test("Images in remote image post are proxied if setting enabled", async () => {
let user = await registerUser(beta, betaUrl);
let community = await createCommunity(gamma); let community = await createCommunity(gamma);
let postRes = await createPost(
const upload_form: UploadImage = {
image: Buffer.from("test"),
};
const upload = await user.uploadImage(upload_form);
let post = await createPost(
gamma, gamma,
community.community_view.community.id, community.community_view.community.id,
upload.url, sampleImage,
`![](${sampleImage})`, `![](${sampleImage})`,
); );
expect(post.post_view.post).toBeDefined(); const post = postRes.post_view.post;
expect(post).toBeDefined();
// remote image gets proxied after upload // remote image gets proxied after upload
expect( expect(
post.post_view.post.thumbnail_url?.startsWith( post.thumbnail_url?.startsWith(
"http://lemmy-gamma:8561/api/v3/image_proxy?url", "http://lemmy-gamma:8561/api/v3/image_proxy?url",
), ),
).toBeTruthy(); ).toBeTruthy();
expect( expect(
post.post_view.post.body?.startsWith( post.body?.startsWith("![](http://lemmy-gamma:8561/api/v3/image_proxy?url"),
"![](http://lemmy-gamma:8561/api/v3/image_proxy?url",
),
).toBeTruthy(); ).toBeTruthy();
let epsilonPost = await resolvePost(epsilon, post.post_view.post); // Make sure that it ends with jpg, to be sure its an image
expect(epsilonPost.post).toBeDefined(); 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 // Fetch the post again, the metadata should be backgrounded now
// Wait for the metadata to get fetched, since this is backgrounded now // Wait for the metadata to get fetched, since this is backgrounded now
let epsilonPost2 = await waitUntil( let epsilonPostRes2 = await waitUntil(
() => getPost(epsilon, epsilonPost.post!.post.id), () => getPost(epsilon, epsilonPostRes.post!.post.id),
p => p.post_view.post.thumbnail_url != undefined, p => p.post_view.post.thumbnail_url != undefined,
); );
const epsilonPost = epsilonPostRes2.post_view.post;
expect( expect(
epsilonPost2.post_view.post.thumbnail_url?.startsWith( epsilonPost.thumbnail_url?.startsWith(
"http://lemmy-epsilon:8581/api/v3/image_proxy?url", "http://lemmy-epsilon:8581/api/v3/image_proxy?url",
), ),
).toBeTruthy(); ).toBeTruthy();
expect( expect(
epsilonPost2.post_view.post.body?.startsWith( epsilonPost.body?.startsWith(
"![](http://lemmy-epsilon:8581/api/v3/image_proxy?url", "![](http://lemmy-epsilon:8581/api/v3/image_proxy?url",
), ),
).toBeTruthy(); ).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 () => { test("No image proxying if setting is disabled", async () => {

View file

@ -83,21 +83,22 @@ export const fetchFunction = fetch;
export const imageFetchLimit = 50; export const imageFetchLimit = 50;
export const sampleImage = export const sampleImage =
"https://i.pinimg.com/originals/df/5f/5b/df5f5b1b174a2b4b6026cc6c8f9395c1.jpg"; "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 const alphaUrl = "http://127.0.0.1:8541";
export let betaUrl = "http://127.0.0.1:8551"; export const betaUrl = "http://127.0.0.1:8551";
export let gammaUrl = "http://127.0.0.1:8561"; export const gammaUrl = "http://127.0.0.1:8561";
export let deltaUrl = "http://127.0.0.1:8571"; export const deltaUrl = "http://127.0.0.1:8571";
export let epsilonUrl = "http://127.0.0.1:8581"; export const epsilonUrl = "http://127.0.0.1:8581";
export let alpha = new LemmyHttp(alphaUrl, { fetchFunction }); export const alpha = new LemmyHttp(alphaUrl, { fetchFunction });
export let alphaImage = new LemmyHttp(alphaUrl); export const alphaImage = new LemmyHttp(alphaUrl);
export let beta = new LemmyHttp(betaUrl, { fetchFunction }); export const beta = new LemmyHttp(betaUrl, { fetchFunction });
export let gamma = new LemmyHttp(gammaUrl, { fetchFunction }); export const gamma = new LemmyHttp(gammaUrl, { fetchFunction });
export let delta = new LemmyHttp(deltaUrl, { fetchFunction }); export const delta = new LemmyHttp(deltaUrl, { fetchFunction });
export let epsilon = new LemmyHttp(epsilonUrl, { fetchFunction }); export const epsilon = new LemmyHttp(epsilonUrl, { fetchFunction });
export let betaAllowedInstances = [ export const betaAllowedInstances = [
"lemmy-alpha", "lemmy-alpha",
"lemmy-gamma", "lemmy-gamma",
"lemmy-delta", "lemmy-delta",

View file

@ -33,7 +33,7 @@ anyhow = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
chrono = { workspace = true } chrono = { workspace = true }
url = { workspace = true } url = { workspace = true }
wav = "1.0.0" wav = "1.0.1"
sitemap-rs = "0.2.1" sitemap-rs = "0.2.1"
totp-rs = { version = "5.5.1", features = ["gen_secret", "otpauth"] } totp-rs = { version = "5.5.1", features = ["gen_secret", "otpauth"] }
actix-web-httpauth = "0.8.1" actix-web-httpauth = "0.8.1"

View file

@ -66,13 +66,13 @@ actix-web = { workspace = true, optional = true }
enum-map = { workspace = true } enum-map = { workspace = true }
urlencoding = { workspace = true } urlencoding = { workspace = true }
mime = { version = "0.3.17", optional = 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", "serde",
], optional = true } ], optional = true }
encoding_rs = { version = "0.8.34", 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 # necessary for wasmt compilation
getrandom = { version = "0.2.14", features = ["js"] } getrandom = { version = "0.2.15", features = ["js"] }
[package.metadata.cargo-machete] [package.metadata.cargo-machete]
ignored = ["getrandom"] ignored = ["getrandom"]

View file

@ -44,7 +44,7 @@ once_cell = { workspace = true }
moka.workspace = true moka.workspace = true
serde_with.workspace = true serde_with.workspace = true
html2md = "0.2.14" html2md = "0.2.14"
html2text = "0.6.0" html2text = "0.12.5"
stringreader = "0.1.1" stringreader = "0.1.1"
enum_delegate = "0.2.0" enum_delegate = "0.2.0"

View file

@ -25,12 +25,7 @@ use html2text::{from_read_with_decorator, render::text_renderer::TrivialDecorato
use lemmy_api_common::{ use lemmy_api_common::{
context::LemmyContext, context::LemmyContext,
request::generate_post_link_metadata, request::generate_post_link_metadata,
utils::{ utils::{get_url_blocklist, local_site_opt_to_slur_regex, process_markdown_opt},
get_url_blocklist,
local_site_opt_to_slur_regex,
process_markdown_opt,
proxy_image_link_opt_apub,
},
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{
source::{ source::{
@ -228,8 +223,6 @@ impl Object for ApubPost {
let alt_text = first_attachment.cloned().and_then(Attachment::alt_text); 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 slur_regex = &local_site_opt_to_slur_regex(&local_site);
let url_blocklist = get_url_blocklist(context).await?; let url_blocklist = get_url_blocklist(context).await?;

View file

@ -70,7 +70,7 @@ diesel_ltree = { workspace = true, optional = true }
typed-builder = { workspace = true } typed-builder = { workspace = true }
async-trait = { workspace = true } async-trait = { workspace = true }
tracing = { 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 } ts-rs = { workspace = true, optional = true }
futures-util = { workspace = true } futures-util = { workspace = true }
tokio = { workspace = true, optional = true } tokio = { workspace = true, optional = true }

View file

@ -652,7 +652,7 @@ impl<'a> PostQuery<'a> {
pool: &mut DbPool<'_>, pool: &mut DbPool<'_>,
) -> Result<Option<PostQuery<'a>>, Error> { ) -> Result<Option<PostQuery<'a>>, Error> {
// first get one page for the most popular community to get an upper bound for the page end for // 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 // 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 // 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 // (IN, >=, >=, >=) which it currently can't do at all (as of PG 16). see the discussion

View file

@ -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 /// 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 /// 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 /// numbers as numbers) about apis that aren't part of the spec
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)] #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]

View file

@ -32,4 +32,4 @@ serde_json.workspace = true
tokio = { workspace = true, features = ["full"] } tokio = { workspace = true, features = ["full"] }
tracing.workspace = true tracing.workspace = true
moka.workspace = true moka.workspace = true
tokio-util = "0.7.10" tokio-util = "0.7.11"

View file

@ -37,8 +37,8 @@ use tokio_util::sync::CancellationToken;
use tracing::{debug, info, trace, warn}; 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 /// 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 /// saved after every attempt). This determines the batch size for loop_batch. After a batch ends
/// SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB. /// and SAVE_STATE_EVERY_TIME has passed, the federation_queue_state is updated in the DB.
static CHECK_SAVE_STATE_EVERY_IT: i64 = 100; 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 /// 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) /// SIGKILLed, less than X seconds of activities are resent)
@ -161,7 +161,9 @@ impl InstanceWorker {
id id
} else { } else {
// this is the initial creation (instance first seen) of the federation queue for this // 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); 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 // save here to ensure it's not read as 0 again later if no activities have happened
self.save_and_send_state(pool).await?; self.save_and_send_state(pool).await?;

View file

@ -34,4 +34,4 @@ once_cell = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
urlencoding = { workspace = true } urlencoding = { workspace = true }
rss = "2.0.7" rss = "2.0.8"

View file

@ -14,10 +14,12 @@ use url::Url;
pub fn config(cfg: &mut web::ServiceConfig) { pub fn config(cfg: &mut web::ServiceConfig) {
cfg cfg
.route( .route(
"/nodeinfo/2.0.json", "/nodeinfo/2.1.json",
web::get().to(node_info).wrap(cache_1hour()), 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( .route(
"/.well-known/nodeinfo", "/.well-known/nodeinfo",
web::get().to(node_info_well_known).wrap(cache_3days()), 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<LemmyContext>) -> LemmyResult<HttpResponse> { async fn node_info_well_known(context: web::Data<LemmyContext>) -> LemmyResult<HttpResponse> {
let node_info = NodeInfoWellKnown { let node_info = NodeInfoWellKnown {
links: vec![NodeInfoWellKnownLinks { 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!( href: Url::parse(&format!(
"{}/nodeinfo/2.0.json", "{}/nodeinfo/2.1.json",
&context.settings().get_protocol_and_hostname(), &context.settings().get_protocol_and_hostname(),
))?, ))?,
}], }],

View file

@ -75,7 +75,7 @@ rosetta-i18n = { workspace = true, optional = true }
tokio = { workspace = true, optional = true } tokio = { workspace = true, optional = true }
urlencoding = { workspace = true, optional = true } urlencoding = { workspace = true, optional = true }
openssl = { version = "0.10.64", 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 } deser-hjson = { version = "2.2.4", optional = true }
smart-default = { version = "0.7.1", optional = true } smart-default = { version = "0.7.1", optional = true }
lettre = { version = "0.11.7", features = [ lettre = { version = "0.11.7", features = [

View file

@ -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));
} }