mirror of https://github.com/LemmyNet/lemmy.git
Merge branch 'main' into markdown-link-rule
commit
66229ab902
|
@ -65,6 +65,16 @@ steps:
|
||||||
# need make existing toolchain available
|
# need make existing toolchain available
|
||||||
- cargo +nightly fmt -- --check
|
- cargo +nightly fmt -- --check
|
||||||
|
|
||||||
|
cargo_machete:
|
||||||
|
group: format
|
||||||
|
image: rustlang/rust:nightly
|
||||||
|
commands:
|
||||||
|
- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
|
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
|
||||||
|
- cp cargo-binstall /usr/local/cargo/bin
|
||||||
|
- cargo binstall -y cargo-machete
|
||||||
|
- cargo machete
|
||||||
|
|
||||||
restore-cache:
|
restore-cache:
|
||||||
image: meltwater/drone-cache:v1
|
image: meltwater/drone-cache:v1
|
||||||
pull: true
|
pull: true
|
||||||
|
|
|
@ -329,18 +329,6 @@ dependencies = [
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "actix-web-prom"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9df3127d20a5d01c9fc9aceb969a38d31a6767e1b48a54d55a8f56c769a84923"
|
|
||||||
dependencies = [
|
|
||||||
"actix-web",
|
|
||||||
"futures-core",
|
|
||||||
"pin-project-lite",
|
|
||||||
"prometheus",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
|
@ -2543,13 +2531,12 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_api"
|
name = "lemmy_api"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
"actix-web-httpauth",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
"captcha",
|
"captcha",
|
||||||
|
@ -2561,20 +2548,18 @@ dependencies = [
|
||||||
"lemmy_db_views_actor",
|
"lemmy_db_views_actor",
|
||||||
"lemmy_db_views_moderator",
|
"lemmy_db_views_moderator",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"serde",
|
|
||||||
"serial_test",
|
"serial_test",
|
||||||
"sitemap-rs",
|
"sitemap-rs",
|
||||||
"tokio",
|
"tokio",
|
||||||
"totp-rs",
|
"totp-rs",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"uuid",
|
|
||||||
"wav",
|
"wav",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_api_common"
|
name = "lemmy_api_common"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
@ -2613,19 +2598,16 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_api_crud"
|
name = "lemmy_api_crud"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"async-trait",
|
|
||||||
"bcrypt",
|
"bcrypt",
|
||||||
"chrono",
|
|
||||||
"lemmy_api_common",
|
"lemmy_api_common",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_db_views",
|
"lemmy_db_views",
|
||||||
"lemmy_db_views_actor",
|
"lemmy_db_views_actor",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"serde",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"uuid",
|
"uuid",
|
||||||
|
@ -2634,7 +2616,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_apub"
|
name = "lemmy_apub"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
@ -2654,7 +2636,6 @@ dependencies = [
|
||||||
"lemmy_db_views",
|
"lemmy_db_views",
|
||||||
"lemmy_db_views_actor",
|
"lemmy_db_views_actor",
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"mime",
|
|
||||||
"moka",
|
"moka",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -2672,7 +2653,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_db_schema"
|
name = "lemmy_db_schema"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -2708,7 +2689,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_db_views"
|
name = "lemmy_db_views"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"diesel",
|
"diesel",
|
||||||
|
@ -2726,7 +2707,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_db_views_actor"
|
name = "lemmy_db_views_actor"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel",
|
"diesel",
|
||||||
|
@ -2743,7 +2724,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_db_views_moderator"
|
name = "lemmy_db_views_moderator"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
|
@ -2755,16 +2736,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_federate"
|
name = "lemmy_federate"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"enum_delegate",
|
|
||||||
"futures",
|
"futures",
|
||||||
"lemmy_api_common",
|
"lemmy_api_common",
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
|
@ -2773,21 +2751,16 @@ dependencies = [
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"moka",
|
"moka",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"openssl",
|
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"reqwest-middleware",
|
|
||||||
"reqwest-tracing",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_routes"
|
name = "lemmy_routes"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
@ -2804,7 +2777,6 @@ dependencies = [
|
||||||
"reqwest-middleware",
|
"reqwest-middleware",
|
||||||
"rss",
|
"rss",
|
||||||
"serde",
|
"serde",
|
||||||
"strum",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
|
@ -2813,20 +2785,17 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_server"
|
name = "lemmy_server"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitypub_federation",
|
"activitypub_federation",
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
|
||||||
"actix-web-prom",
|
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"clokwerk",
|
"clokwerk",
|
||||||
"console-subscriber 0.1.10",
|
"console-subscriber 0.1.10",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"doku",
|
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"lemmy_api",
|
"lemmy_api",
|
||||||
"lemmy_api_common",
|
"lemmy_api_common",
|
||||||
|
@ -2843,13 +2812,9 @@ dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"reqwest-middleware",
|
"reqwest-middleware",
|
||||||
"reqwest-tracing",
|
"reqwest-tracing",
|
||||||
"rustls 0.21.8",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serial_test",
|
"serial_test",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-postgres",
|
|
||||||
"tokio-postgres-rustls",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-actix-web",
|
"tracing-actix-web",
|
||||||
"tracing-error",
|
"tracing-error",
|
||||||
|
@ -2861,11 +2826,10 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lemmy_utils"
|
name = "lemmy_utils"
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
|
||||||
"deser-hjson",
|
"deser-hjson",
|
||||||
"diesel",
|
"diesel",
|
||||||
"doku",
|
"doku",
|
||||||
|
|
32
Cargo.toml
32
Cargo.toml
|
@ -1,5 +1,5 @@
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.19.0-rc.3"
|
version = "0.19.0-rc.4"
|
||||||
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"
|
||||||
|
@ -59,16 +59,16 @@ members = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
lemmy_api = { version = "=0.19.0-rc.3", path = "./crates/api" }
|
lemmy_api = { version = "=0.19.0-rc.4", path = "./crates/api" }
|
||||||
lemmy_api_crud = { version = "=0.19.0-rc.3", path = "./crates/api_crud" }
|
lemmy_api_crud = { version = "=0.19.0-rc.4", path = "./crates/api_crud" }
|
||||||
lemmy_apub = { version = "=0.19.0-rc.3", path = "./crates/apub" }
|
lemmy_apub = { version = "=0.19.0-rc.4", path = "./crates/apub" }
|
||||||
lemmy_utils = { version = "=0.19.0-rc.3", path = "./crates/utils" }
|
lemmy_utils = { version = "=0.19.0-rc.4", path = "./crates/utils" }
|
||||||
lemmy_db_schema = { version = "=0.19.0-rc.3", path = "./crates/db_schema" }
|
lemmy_db_schema = { version = "=0.19.0-rc.4", path = "./crates/db_schema" }
|
||||||
lemmy_api_common = { version = "=0.19.0-rc.3", path = "./crates/api_common" }
|
lemmy_api_common = { version = "=0.19.0-rc.4", path = "./crates/api_common" }
|
||||||
lemmy_routes = { version = "=0.19.0-rc.3", path = "./crates/routes" }
|
lemmy_routes = { version = "=0.19.0-rc.4", path = "./crates/routes" }
|
||||||
lemmy_db_views = { version = "=0.19.0-rc.3", path = "./crates/db_views" }
|
lemmy_db_views = { version = "=0.19.0-rc.4", path = "./crates/db_views" }
|
||||||
lemmy_db_views_actor = { version = "=0.19.0-rc.3", path = "./crates/db_views_actor" }
|
lemmy_db_views_actor = { version = "=0.19.0-rc.4", path = "./crates/db_views_actor" }
|
||||||
lemmy_db_views_moderator = { version = "=0.19.0-rc.3", path = "./crates/db_views_moderator" }
|
lemmy_db_views_moderator = { version = "=0.19.0-rc.4", path = "./crates/db_views_moderator" }
|
||||||
activitypub_federation = { version = "0.5.0-beta.4", default-features = false, features = [
|
activitypub_federation = { version = "0.5.0-beta.4", default-features = false, features = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
] }
|
] }
|
||||||
|
@ -129,7 +129,6 @@ tokio-postgres = "0.7.10"
|
||||||
tokio-postgres-rustls = "0.10.0"
|
tokio-postgres-rustls = "0.10.0"
|
||||||
urlencoding = "2.1.3"
|
urlencoding = "2.1.3"
|
||||||
enum-map = "2.7"
|
enum-map = "2.7"
|
||||||
mime = "0.3.17"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_api = { workspace = true }
|
lemmy_api = { workspace = true }
|
||||||
|
@ -139,11 +138,10 @@ lemmy_utils = { workspace = true }
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
lemmy_api_common = { workspace = true }
|
lemmy_api_common = { workspace = true }
|
||||||
lemmy_routes = { workspace = true }
|
lemmy_routes = { workspace = true }
|
||||||
lemmy_federate = { version = "0.19.0-rc.3", path = "crates/federate" }
|
lemmy_federate = { version = "0.19.0-rc.4", path = "crates/federate" }
|
||||||
activitypub_federation = { workspace = true }
|
activitypub_federation = { workspace = true }
|
||||||
diesel = { workspace = true }
|
diesel = { workspace = true }
|
||||||
diesel-async = { workspace = true }
|
diesel-async = { workspace = true }
|
||||||
serde = { workspace = true }
|
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tracing-actix-web = { workspace = true }
|
tracing-actix-web = { workspace = true }
|
||||||
|
@ -155,7 +153,6 @@ reqwest = { workspace = true }
|
||||||
reqwest-middleware = { workspace = true }
|
reqwest-middleware = { workspace = true }
|
||||||
reqwest-tracing = { workspace = true }
|
reqwest-tracing = { workspace = true }
|
||||||
clokwerk = { workspace = true }
|
clokwerk = { workspace = true }
|
||||||
doku = { workspace = true }
|
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
tracing-opentelemetry = { workspace = true, optional = true }
|
tracing-opentelemetry = { workspace = true, optional = true }
|
||||||
opentelemetry = { workspace = true, optional = true }
|
opentelemetry = { workspace = true, optional = true }
|
||||||
|
@ -164,13 +161,8 @@ opentelemetry-otlp = { version = "0.12.0", optional = true }
|
||||||
pict-rs = { version = "0.4.5", optional = true }
|
pict-rs = { version = "0.4.5", optional = true }
|
||||||
tokio.workspace = true
|
tokio.workspace = true
|
||||||
actix-cors = "0.6.4"
|
actix-cors = "0.6.4"
|
||||||
rustls = { workspace = true }
|
|
||||||
futures-util = { workspace = true }
|
futures-util = { workspace = true }
|
||||||
tokio-postgres = { workspace = true }
|
|
||||||
tokio-postgres-rustls = { workspace = true }
|
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
prometheus = { version = "0.13.3", features = ["process"] }
|
prometheus = { version = "0.13.3", features = ["process"] }
|
||||||
actix-web-prom = { version = "0.6.0" }
|
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
clap = { version = "4.4.7", features = ["derive"] }
|
clap = { version = "4.4.7", features = ["derive"] }
|
||||||
actix-web-httpauth = "0.8.1"
|
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
# storage usage. It may also be necessary in certain countries which don't allow copying images
|
# storage usage. It may also be necessary in certain countries which don't allow copying images
|
||||||
# from newspaper articles, but only allow hotlinking.
|
# from newspaper articles, but only allow hotlinking.
|
||||||
#
|
#
|
||||||
# If this setting is enabled, the Opengraph image is directly returned as thumbnail.
|
# If this setting is enabled, the Opengraph image is directly returned as thumbnail. Note that
|
||||||
|
# it still gets proxied through the local instance if `image_proxy` is enabled.
|
||||||
disable_external_link_previews: false
|
disable_external_link_previews: false
|
||||||
}
|
}
|
||||||
# Email sending configuration. All options except login/password are mandatory
|
# Email sending configuration. All options except login/password are mandatory
|
||||||
|
|
|
@ -22,11 +22,8 @@ lemmy_db_views_actor = { workspace = true, features = ["full"] }
|
||||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||||
activitypub_federation = { workspace = true }
|
activitypub_federation = { workspace = true }
|
||||||
bcrypt = { workspace = true }
|
bcrypt = { workspace = true }
|
||||||
serde = { workspace = true }
|
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
base64 = { workspace = true }
|
base64 = { workspace = true }
|
||||||
uuid = { workspace = true }
|
|
||||||
async-trait = { workspace = true }
|
|
||||||
captcha = { workspace = true }
|
captcha = { workspace = true }
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::read_auth_token;
|
use crate::read_auth_token;
|
||||||
use activitypub_federation::config::Data;
|
use activitypub_federation::config::Data;
|
||||||
use actix_web::{cookie::Cookie, HttpRequest, HttpResponse};
|
use actix_web::{cookie::Cookie, HttpRequest, HttpResponse};
|
||||||
use lemmy_api_common::{context::LemmyContext, utils::AUTH_COOKIE_NAME};
|
use lemmy_api_common::{context::LemmyContext, utils::AUTH_COOKIE_NAME, SuccessResponse};
|
||||||
use lemmy_db_schema::source::login_token::LoginToken;
|
use lemmy_db_schema::source::login_token::LoginToken;
|
||||||
use lemmy_db_views::structs::LocalUserView;
|
use lemmy_db_views::structs::LocalUserView;
|
||||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||||
|
@ -16,7 +16,7 @@ pub async fn logout(
|
||||||
let jwt = read_auth_token(&req)?.ok_or(LemmyErrorType::NotLoggedIn)?;
|
let jwt = read_auth_token(&req)?.ok_or(LemmyErrorType::NotLoggedIn)?;
|
||||||
LoginToken::invalidate(&mut context.pool(), &jwt).await?;
|
LoginToken::invalidate(&mut context.pool(), &jwt).await?;
|
||||||
|
|
||||||
let mut res = HttpResponse::Ok().finish();
|
let mut res = HttpResponse::Ok().json(SuccessResponse::default());
|
||||||
let cookie = Cookie::new(AUTH_COOKIE_NAME, "");
|
let cookie = Cookie::new(AUTH_COOKIE_NAME, "");
|
||||||
res.add_removal_cookie(&cookie)?;
|
res.add_removal_cookie(&cookie)?;
|
||||||
Ok(res)
|
Ok(res)
|
||||||
|
|
|
@ -63,7 +63,7 @@ actix-web = { workspace = true, optional = true }
|
||||||
enum-map = { workspace = true }
|
enum-map = { workspace = true }
|
||||||
urlencoding = { workspace = true }
|
urlencoding = { workspace = true }
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
mime = { workspace = true, optional = true }
|
mime = { version = "0.3.17", optional = true }
|
||||||
webpage = { version = "1.6", default-features = false, features = [
|
webpage = { version = "1.6", default-features = false, features = [
|
||||||
"serde",
|
"serde",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
@ -73,6 +73,9 @@ jsonwebtoken = { version = "8.3.0", optional = true }
|
||||||
getrandom = { version = "0.2.10", features = ["js"] }
|
getrandom = { version = "0.2.10", features = ["js"] }
|
||||||
task-local-extensions = "0.1.4"
|
task-local-extensions = "0.1.4"
|
||||||
|
|
||||||
|
[package.metadata.cargo-machete]
|
||||||
|
ignored = ["getrandom"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
reqwest-middleware = { workspace = true }
|
reqwest-middleware = { workspace = true }
|
||||||
|
|
|
@ -16,11 +16,8 @@ lemmy_db_views_actor = { workspace = true, features = ["full"] }
|
||||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||||
activitypub_federation = { workspace = true }
|
activitypub_federation = { workspace = true }
|
||||||
bcrypt = { workspace = true }
|
bcrypt = { workspace = true }
|
||||||
serde = { workspace = true }
|
|
||||||
actix-web = { workspace = true }
|
actix-web = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
async-trait = { workspace = true }
|
|
||||||
webmention = "0.5.0"
|
webmention = "0.5.0"
|
||||||
chrono = { workspace = true }
|
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
|
|
|
@ -38,7 +38,6 @@ anyhow = { workspace = true }
|
||||||
reqwest = { workspace = true }
|
reqwest = { workspace = true }
|
||||||
once_cell = { workspace = true }
|
once_cell = { workspace = true }
|
||||||
serde_with = { workspace = true }
|
serde_with = { workspace = true }
|
||||||
mime = { workspace = true }
|
|
||||||
html2md = "0.2.14"
|
html2md = "0.2.14"
|
||||||
html2text = "0.6.0"
|
html2text = "0.6.0"
|
||||||
stringreader = "0.1.1"
|
stringreader = "0.1.1"
|
||||||
|
|
|
@ -76,3 +76,6 @@ uuid = { workspace = true, features = ["v4"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
|
|
||||||
|
[package.metadata.cargo-machete]
|
||||||
|
ignored = ["strum"]
|
||||||
|
|
|
@ -62,7 +62,7 @@ fn queries<'a>() -> Queries<
|
||||||
query = query
|
query = query
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.order_by(registration_application::published.desc());
|
.order_by(registration_application::published.asc());
|
||||||
|
|
||||||
query.load::<RegistrationApplicationView>(&mut conn).await
|
query.load::<RegistrationApplicationView>(&mut conn).await
|
||||||
};
|
};
|
||||||
|
@ -308,7 +308,7 @@ mod tests {
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
apps,
|
apps,
|
||||||
[read_jess_app_view.clone(), expected_sara_app_view.clone()]
|
[expected_sara_app_view.clone(), read_jess_app_view.clone()]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Make sure the counts are correct
|
// Make sure the counts are correct
|
||||||
|
|
|
@ -35,3 +35,6 @@ strum_macros = { workspace = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
|
|
||||||
|
[package.metadata.cargo-machete]
|
||||||
|
ignored = ["strum"]
|
||||||
|
|
|
@ -20,6 +20,7 @@ use lemmy_db_schema::{
|
||||||
comment_saved,
|
comment_saved,
|
||||||
community,
|
community,
|
||||||
community_follower,
|
community_follower,
|
||||||
|
community_moderator,
|
||||||
community_person_ban,
|
community_person_ban,
|
||||||
person,
|
person,
|
||||||
person_block,
|
person_block,
|
||||||
|
@ -80,6 +81,13 @@ fn queries<'a>() -> Queries<
|
||||||
.and(comment_like::person_id.eq(person_id_join)),
|
.and(comment_like::person_id.eq(person_id_join)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.left_join(
|
||||||
|
community_moderator::table.on(
|
||||||
|
community::id
|
||||||
|
.eq(community_moderator::community_id)
|
||||||
|
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.select((
|
.select((
|
||||||
comment_reply::all_columns,
|
comment_reply::all_columns,
|
||||||
comment::all_columns,
|
comment::all_columns,
|
||||||
|
@ -89,6 +97,7 @@ fn queries<'a>() -> Queries<
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
comment_aggregates::all_columns,
|
comment_aggregates::all_columns,
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
|
community_moderator::id.nullable().is_not_null(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
comment_saved::id.nullable().is_not_null(),
|
comment_saved::id.nullable().is_not_null(),
|
||||||
person_block::id.nullable().is_not_null(),
|
person_block::id.nullable().is_not_null(),
|
||||||
|
|
|
@ -20,6 +20,7 @@ use lemmy_db_schema::{
|
||||||
comment_saved,
|
comment_saved,
|
||||||
community,
|
community,
|
||||||
community_follower,
|
community_follower,
|
||||||
|
community_moderator,
|
||||||
community_person_ban,
|
community_person_ban,
|
||||||
person,
|
person,
|
||||||
person_block,
|
person_block,
|
||||||
|
@ -85,6 +86,7 @@ fn queries<'a>() -> Queries<
|
||||||
aliases::person1.fields(person::all_columns),
|
aliases::person1.fields(person::all_columns),
|
||||||
comment_aggregates::all_columns,
|
comment_aggregates::all_columns,
|
||||||
community_person_ban::id.nullable().is_not_null(),
|
community_person_ban::id.nullable().is_not_null(),
|
||||||
|
community_moderator::id.nullable().is_not_null(),
|
||||||
CommunityFollower::select_subscribed_type(),
|
CommunityFollower::select_subscribed_type(),
|
||||||
comment_saved::id.nullable().is_not_null(),
|
comment_saved::id.nullable().is_not_null(),
|
||||||
person_block::id.nullable().is_not_null(),
|
person_block::id.nullable().is_not_null(),
|
||||||
|
@ -105,6 +107,13 @@ fn queries<'a>() -> Queries<
|
||||||
.and(community_person_ban::person_id.eq(comment::creator_id)),
|
.and(community_person_ban::person_id.eq(comment::creator_id)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.left_join(
|
||||||
|
community_moderator::table.on(
|
||||||
|
community::id
|
||||||
|
.eq(community_moderator::community_id)
|
||||||
|
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.select(selection)
|
.select(selection)
|
||||||
.first::<PersonMentionView>(&mut conn)
|
.first::<PersonMentionView>(&mut conn)
|
||||||
.await
|
.await
|
||||||
|
@ -124,6 +133,13 @@ fn queries<'a>() -> Queries<
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.left_join(
|
||||||
|
community_moderator::table.on(
|
||||||
|
community::id
|
||||||
|
.eq(community_moderator::community_id)
|
||||||
|
.and(community_moderator::person_id.eq(comment::creator_id)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.select(selection);
|
.select(selection);
|
||||||
|
|
||||||
if let Some(recipient_id) = options.recipient_id {
|
if let Some(recipient_id) = options.recipient_id {
|
||||||
|
|
|
@ -99,6 +99,7 @@ pub struct PersonMentionView {
|
||||||
pub recipient: Person,
|
pub recipient: Person,
|
||||||
pub counts: CommentAggregates,
|
pub counts: CommentAggregates,
|
||||||
pub creator_banned_from_community: bool,
|
pub creator_banned_from_community: bool,
|
||||||
|
pub creator_is_moderator: bool,
|
||||||
pub subscribed: SubscribedType,
|
pub subscribed: SubscribedType,
|
||||||
pub saved: bool,
|
pub saved: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
@ -118,11 +119,12 @@ pub struct CommentReplyView {
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub recipient: Person,
|
pub recipient: Person,
|
||||||
pub counts: CommentAggregates,
|
pub counts: CommentAggregates,
|
||||||
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
pub creator_banned_from_community: bool,
|
||||||
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
pub creator_is_moderator: bool,
|
||||||
pub saved: bool, // Left join to CommentSaved
|
pub subscribed: SubscribedType,
|
||||||
pub creator_blocked: bool, // Left join to PersonBlock
|
pub saved: bool,
|
||||||
pub my_vote: Option<i16>, // Left join to CommentLike
|
pub creator_blocked: bool,
|
||||||
|
pub my_vote: Option<i16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
|
|
@ -26,16 +26,7 @@ diesel-async = { workspace = true, features = ["deadpool", "postgres"] }
|
||||||
once_cell.workspace = true
|
once_cell.workspace = true
|
||||||
reqwest.workspace = true
|
reqwest.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
serde.workspace = true
|
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
|
|
||||||
async-trait = "0.1.74"
|
|
||||||
bytes = "1.5.0"
|
|
||||||
enum_delegate = "0.2.0"
|
|
||||||
moka = { version = "0.11.3", features = ["future"] }
|
moka = { version = "0.11.3", features = ["future"] }
|
||||||
openssl = "0.10.57"
|
|
||||||
reqwest-middleware = "0.2.4"
|
|
||||||
reqwest-tracing = "0.4.6"
|
|
||||||
tokio-util = "0.7.9"
|
tokio-util = "0.7.9"
|
||||||
tracing-subscriber = "0.3.17"
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ reqwest = { workspace = true, features = ["stream"] }
|
||||||
reqwest-middleware = { workspace = true }
|
reqwest-middleware = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
strum = { workspace = true }
|
|
||||||
once_cell = { workspace = true }
|
once_cell = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
|
|
|
@ -18,7 +18,6 @@ full = ["ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
regex = { workspace = true }
|
regex = { workspace = true }
|
||||||
chrono = { workspace = true }
|
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tracing-error = { workspace = true }
|
tracing-error = { workspace = true }
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
CREATE OR REPLACE FUNCTION hot_rank (score numeric, published timestamp with time zone)
|
||||||
|
RETURNS float
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
hours_diff numeric := EXTRACT(EPOCH FROM (now() - published)) / 3600;
|
||||||
|
BEGIN
|
||||||
|
-- 24 * 7 = 168, so after a week, it will default to 0.
|
||||||
|
IF (hours_diff > 0 AND hours_diff < 168) THEN
|
||||||
|
RETURN log(greatest (1, score + 3)) / power((hours_diff + 2), 1.8);
|
||||||
|
ELSE
|
||||||
|
-- if the post is from the future, set hot score to 0. otherwise you can game the post to
|
||||||
|
-- always be on top even with only 1 vote by setting it to the future
|
||||||
|
RETURN 0.0;
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
IMMUTABLE PARALLEL SAFE;
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- The hot_rank algorithm currently uses greatest(1, score + 3)
|
||||||
|
-- This greatest of 1 incorrect because log10(1) is zero,
|
||||||
|
-- so it will push negative-voted comments / posts to the bottom, IE hot_rank = 0
|
||||||
|
-- The update_scheduled_ranks will never recalculate them, because it ignores content
|
||||||
|
-- with hot_rank = 0
|
||||||
|
CREATE OR REPLACE FUNCTION hot_rank (score numeric, published timestamp with time zone)
|
||||||
|
RETURNS float
|
||||||
|
AS $$
|
||||||
|
DECLARE
|
||||||
|
hours_diff numeric := EXTRACT(EPOCH FROM (now() - published)) / 3600;
|
||||||
|
BEGIN
|
||||||
|
-- 24 * 7 = 168, so after a week, it will default to 0.
|
||||||
|
IF (hours_diff > 0 AND hours_diff < 168) THEN
|
||||||
|
-- Use greatest(2,score), so that the hot_rank will be positive and not ignored.
|
||||||
|
RETURN log(greatest (2, score + 2)) / power((hours_diff + 2), 1.8);
|
||||||
|
ELSE
|
||||||
|
-- if the post is from the future, set hot score to 0. otherwise you can game the post to
|
||||||
|
-- always be on top even with only 1 vote by setting it to the future
|
||||||
|
RETURN 0.0;
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
IMMUTABLE PARALLEL SAFE;
|
||||||
|
|
Loading…
Reference in New Issue