mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Merge branch 'main' into enable_private_messages_setting
This commit is contained in:
commit
d77ec1327a
48 changed files with 593 additions and 87 deletions
|
@ -122,7 +122,6 @@ steps:
|
||||||
environment:
|
environment:
|
||||||
CARGO_HOME: .cargo_home
|
CARGO_HOME: .cargo_home
|
||||||
commands:
|
commands:
|
||||||
- export LEMMY_CONFIG_LOCATION=./config/config.hjson
|
|
||||||
- ./scripts/update_config_defaults.sh config/defaults_current.hjson
|
- ./scripts/update_config_defaults.sh config/defaults_current.hjson
|
||||||
- diff config/defaults.hjson config/defaults_current.hjson
|
- diff config/defaults.hjson config/defaults_current.hjson
|
||||||
when: *slow_check_paths
|
when: *slow_check_paths
|
||||||
|
@ -147,7 +146,6 @@ steps:
|
||||||
CARGO_HOME: .cargo_home
|
CARGO_HOME: .cargo_home
|
||||||
commands:
|
commands:
|
||||||
# same as scripts/db_perf.sh but without creating a new database server
|
# same as scripts/db_perf.sh but without creating a new database server
|
||||||
- export LEMMY_CONFIG_LOCATION=config/config.hjson
|
|
||||||
- cargo run --package lemmy_db_perf -- --posts 10 --read-post-pages 1
|
- cargo run --package lemmy_db_perf -- --posts 10 --read-post-pages 1
|
||||||
when: *slow_check_paths
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
@ -176,11 +174,20 @@ steps:
|
||||||
RUST_BACKTRACE: "1"
|
RUST_BACKTRACE: "1"
|
||||||
CARGO_HOME: .cargo_home
|
CARGO_HOME: .cargo_home
|
||||||
LEMMY_TEST_FAST_FEDERATION: "1"
|
LEMMY_TEST_FAST_FEDERATION: "1"
|
||||||
|
LEMMY_CONFIG_LOCATION: ../../config/config.hjson
|
||||||
commands:
|
commands:
|
||||||
- export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
|
||||||
- cargo test --workspace --no-fail-fast
|
- cargo test --workspace --no-fail-fast
|
||||||
when: *slow_check_paths
|
when: *slow_check_paths
|
||||||
|
|
||||||
|
check_ts_bindings:
|
||||||
|
image: *rust_image
|
||||||
|
environment:
|
||||||
|
CARGO_HOME: .cargo_home
|
||||||
|
commands:
|
||||||
|
- ./scripts/ts_bindings_check.sh
|
||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
check_diesel_migration:
|
check_diesel_migration:
|
||||||
# TODO: use willsquire/diesel-cli image when shared libraries become optional in lemmy_server
|
# TODO: use willsquire/diesel-cli image when shared libraries become optional in lemmy_server
|
||||||
image: *rust_image
|
image: *rust_image
|
||||||
|
|
17
Cargo.lock
generated
17
Cargo.lock
generated
|
@ -2,12 +2,6 @@
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "Inflector"
|
|
||||||
version = "0.11.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "accept-language"
|
name = "accept-language"
|
||||||
version = "3.1.0"
|
version = "3.1.0"
|
||||||
|
@ -5255,22 +5249,23 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ts-rs"
|
name = "ts-rs"
|
||||||
version = "7.1.1"
|
version = "10.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6"
|
checksum = "3a2f31991cee3dce1ca4f929a8a04fdd11fd8801aac0f2030b0fa8a0a3fef6b9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"lazy_static",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"ts-rs-macros",
|
"ts-rs-macros",
|
||||||
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ts-rs-macros"
|
name = "ts-rs-macros"
|
||||||
version = "7.1.1"
|
version = "10.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92"
|
checksum = "0ea0b99e8ec44abd6f94a18f28f7934437809dd062820797c52401298116f70e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.77",
|
"syn 2.0.77",
|
||||||
|
|
|
@ -142,10 +142,11 @@ itertools = "0.13.0"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
http = "1.1"
|
http = "1.1"
|
||||||
rosetta-i18n = "0.1.3"
|
rosetta-i18n = "0.1.3"
|
||||||
ts-rs = { version = "7.1.1", features = [
|
ts-rs = { version = "10.0.0", features = [
|
||||||
"serde-compat",
|
"serde-compat",
|
||||||
"chrono-impl",
|
"chrono-impl",
|
||||||
"no-serde-warnings",
|
"no-serde-warnings",
|
||||||
|
"url-impl",
|
||||||
] }
|
] }
|
||||||
rustls = { version = "0.23.12", features = ["ring"] }
|
rustls = { version = "0.23.12", features = ["ring"] }
|
||||||
futures-util = "0.3.30"
|
futures-util = "0.3.30"
|
||||||
|
|
|
@ -83,7 +83,7 @@ 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://google.com";
|
export const sampleSite = "https://w3.org";
|
||||||
|
|
||||||
export const alphaUrl = "http://127.0.0.1:8541";
|
export const alphaUrl = "http://127.0.0.1:8541";
|
||||||
export const betaUrl = "http://127.0.0.1:8551";
|
export const betaUrl = "http://127.0.0.1:8551";
|
||||||
|
|
|
@ -17,7 +17,9 @@ use ts_rs::TS;
|
||||||
pub struct CreateComment {
|
pub struct CreateComment {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub parent_id: Option<CommentId>,
|
pub parent_id: Option<CommentId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +39,9 @@ pub struct GetComment {
|
||||||
/// Edit a comment.
|
/// Edit a comment.
|
||||||
pub struct EditComment {
|
pub struct EditComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub content: Option<String>,
|
pub content: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +73,7 @@ pub struct DeleteComment {
|
||||||
pub struct RemoveComment {
|
pub struct RemoveComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,17 +112,29 @@ pub struct CreateCommentLike {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get a list of comments.
|
/// Get a list of comments.
|
||||||
pub struct GetComments {
|
pub struct GetComments {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<CommentSortType>,
|
pub sort: Option<CommentSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub max_depth: Option<i32>,
|
pub max_depth: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub parent_id: Option<CommentId>,
|
pub parent_id: Option<CommentId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub saved_only: Option<bool>,
|
pub saved_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub liked_only: Option<bool>,
|
pub liked_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub disliked_only: Option<bool>,
|
pub disliked_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,12 +178,17 @@ pub struct ResolveCommentReport {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// List comment reports.
|
/// List comment reports.
|
||||||
pub struct ListCommentReports {
|
pub struct ListCommentReports {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
/// Only shows the unresolved reports
|
/// Only shows the unresolved reports
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unresolved_only: Option<bool>,
|
pub unresolved_only: Option<bool>,
|
||||||
/// if no community is given, it returns reports for all communities moderated by the auth user
|
/// if no community is given, it returns reports for all communities moderated by the auth user
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +207,9 @@ pub struct ListCommentReportsResponse {
|
||||||
/// List comment likes. Admins-only.
|
/// List comment likes. Admins-only.
|
||||||
pub struct ListCommentLikes {
|
pub struct ListCommentLikes {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@ use ts_rs::TS;
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
// TODO make this into a tagged enum
|
||||||
/// Get a community. Must provide either an id, or a name.
|
/// Get a community. Must provide either an id, or a name.
|
||||||
pub struct GetCommunity {
|
pub struct GetCommunity {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub id: Option<CommunityId>,
|
pub id: Option<CommunityId>,
|
||||||
/// Example: star_trek , or star_trek@xyz.tld
|
/// Example: star_trek , or star_trek@xyz.tld
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +36,7 @@ pub struct GetCommunity {
|
||||||
/// The community response.
|
/// The community response.
|
||||||
pub struct GetCommunityResponse {
|
pub struct GetCommunityResponse {
|
||||||
pub community_view: CommunityView,
|
pub community_view: CommunityView,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub site: Option<Site>,
|
pub site: Option<Site>,
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
pub discussion_languages: Vec<LanguageId>,
|
pub discussion_languages: Vec<LanguageId>,
|
||||||
|
@ -49,18 +53,26 @@ pub struct CreateCommunity {
|
||||||
/// A longer title.
|
/// A longer title.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your community.
|
/// A shorter, one line description of your community.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// An icon URL.
|
/// An icon URL.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
/// A banner URL.
|
/// A banner URL.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
/// Whether its an NSFW community.
|
/// Whether its an NSFW community.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
/// Whether to restrict posting only to moderators.
|
/// Whether to restrict posting only to moderators.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub posting_restricted_to_mods: Option<bool>,
|
pub posting_restricted_to_mods: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub visibility: Option<CommunityVisibility>,
|
pub visibility: Option<CommunityVisibility>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +91,15 @@ pub struct CommunityResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches a list of communities.
|
/// Fetches a list of communities.
|
||||||
pub struct ListCommunities {
|
pub struct ListCommunities {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<CommunitySortType>,
|
pub sort: Option<CommunitySortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +122,14 @@ pub struct BanFromCommunity {
|
||||||
pub ban: bool,
|
pub ban: bool,
|
||||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
||||||
/// If ban is true, then this means remove. If ban is false, it means restore.
|
/// If ban is true, then this means remove. If ban is false, it means restore.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub remove_or_restore_data: Option<bool>,
|
pub remove_or_restore_data: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
/// A time that the ban will expire, in unix epoch seconds.
|
/// A time that the ban will expire, in unix epoch seconds.
|
||||||
///
|
///
|
||||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<i64>,
|
pub expires: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,20 +168,29 @@ pub struct AddModToCommunityResponse {
|
||||||
pub struct EditCommunity {
|
pub struct EditCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
/// A longer title.
|
/// A longer title.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your community.
|
/// A shorter, one line description of your community.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// An icon URL.
|
/// An icon URL.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
/// A banner URL.
|
/// A banner URL.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
/// Whether its an NSFW community.
|
/// Whether its an NSFW community.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
/// Whether to restrict posting only to moderators.
|
/// Whether to restrict posting only to moderators.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub posting_restricted_to_mods: Option<bool>,
|
pub posting_restricted_to_mods: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub visibility: Option<CommunityVisibility>,
|
pub visibility: Option<CommunityVisibility>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +202,7 @@ pub struct EditCommunity {
|
||||||
pub struct HideCommunity {
|
pub struct HideCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +224,7 @@ pub struct DeleteCommunity {
|
||||||
pub struct RemoveCommunity {
|
pub struct RemoveCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,5 +271,6 @@ pub struct TransferCommunity {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches a random community
|
/// Fetches a random community
|
||||||
pub struct GetRandomCommunity {
|
pub struct GetRandomCommunity {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,12 @@ pub struct ListCustomEmojisResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches a list of custom emojis.
|
/// Fetches a list of custom emojis.
|
||||||
pub struct ListCustomEmojis {
|
pub struct ListCustomEmojis {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub category: Option<String>,
|
pub category: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub ignore_page_limits: Option<bool>,
|
pub ignore_page_limits: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,11 @@ pub struct CreateOAuthProvider {
|
||||||
pub client_id: String,
|
pub client_id: String,
|
||||||
pub client_secret: String,
|
pub client_secret: String,
|
||||||
pub scopes: String,
|
pub scopes: String,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub auto_verify_email: Option<bool>,
|
pub auto_verify_email: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub account_linking_enabled: Option<bool>,
|
pub account_linking_enabled: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enabled: Option<bool>,
|
pub enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,15 +35,25 @@ pub struct CreateOAuthProvider {
|
||||||
/// Edit an external auth method.
|
/// Edit an external auth method.
|
||||||
pub struct EditOAuthProvider {
|
pub struct EditOAuthProvider {
|
||||||
pub id: OAuthProviderId,
|
pub id: OAuthProviderId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub authorization_endpoint: Option<String>,
|
pub authorization_endpoint: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub token_endpoint: Option<String>,
|
pub token_endpoint: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub userinfo_endpoint: Option<String>,
|
pub userinfo_endpoint: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub id_claim: Option<String>,
|
pub id_claim: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub client_secret: Option<String>,
|
pub client_secret: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub scopes: Option<String>,
|
pub scopes: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub auto_verify_email: Option<bool>,
|
pub auto_verify_email: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub account_linking_enabled: Option<bool>,
|
pub account_linking_enabled: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enabled: Option<bool>,
|
pub enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,13 +72,14 @@ pub struct DeleteOAuthProvider {
|
||||||
/// Logging in with an OAuth 2.0 authorization
|
/// Logging in with an OAuth 2.0 authorization
|
||||||
pub struct AuthenticateWithOauth {
|
pub struct AuthenticateWithOauth {
|
||||||
pub code: String,
|
pub code: String,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
pub oauth_provider_id: OAuthProviderId,
|
pub oauth_provider_id: OAuthProviderId,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
pub redirect_uri: Url,
|
pub redirect_uri: Url,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// Username is mandatory at registration time
|
/// Username is mandatory at registration time
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
/// An answer is mandatory if require application is enabled on the server
|
/// An answer is mandatory if require application is enabled on the server
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub answer: Option<String>,
|
pub answer: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub struct Login {
|
||||||
pub username_or_email: SensitiveString,
|
pub username_or_email: SensitiveString,
|
||||||
pub password: SensitiveString,
|
pub password: SensitiveString,
|
||||||
/// May be required, if totp is enabled for their account.
|
/// May be required, if totp is enabled for their account.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub totp_2fa_token: Option<String>,
|
pub totp_2fa_token: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +41,22 @@ pub struct Register {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub password: SensitiveString,
|
pub password: SensitiveString,
|
||||||
pub password_verify: SensitiveString,
|
pub password_verify: SensitiveString,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// email is mandatory if email verification is enabled on the server
|
/// email is mandatory if email verification is enabled on the server
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// The UUID of the captcha item.
|
/// The UUID of the captcha item.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_uuid: Option<String>,
|
pub captcha_uuid: Option<String>,
|
||||||
/// Your captcha answer.
|
/// Your captcha answer.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_answer: Option<String>,
|
pub captcha_answer: Option<String>,
|
||||||
/// A form field to trick signup bots. Should be None.
|
/// A form field to trick signup bots. Should be None.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub honeypot: Option<String>,
|
pub honeypot: Option<String>,
|
||||||
/// An answer is mandatory if require application is enabled on the server
|
/// An answer is mandatory if require application is enabled on the server
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub answer: Option<String>,
|
pub answer: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +67,7 @@ pub struct Register {
|
||||||
/// A wrapper for the captcha response.
|
/// A wrapper for the captcha response.
|
||||||
pub struct GetCaptchaResponse {
|
pub struct GetCaptchaResponse {
|
||||||
/// Will be None if captchas are disabled.
|
/// Will be None if captchas are disabled.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub ok: Option<CaptchaResponse>,
|
pub ok: Option<CaptchaResponse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,62 +91,91 @@ pub struct CaptchaResponse {
|
||||||
/// Saves settings for your user.
|
/// Saves settings for your user.
|
||||||
pub struct SaveUserSettings {
|
pub struct SaveUserSettings {
|
||||||
/// Show nsfw posts.
|
/// Show nsfw posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// Blur nsfw posts.
|
/// Blur nsfw posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub blur_nsfw: Option<bool>,
|
pub blur_nsfw: Option<bool>,
|
||||||
/// Your user's theme.
|
/// Your user's theme.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub theme: Option<String>,
|
pub theme: Option<String>,
|
||||||
/// The default post listing type, usually "local"
|
/// The default post listing type, usually "local"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_listing_type: Option<ListingType>,
|
pub default_listing_type: Option<ListingType>,
|
||||||
/// A post-view mode that changes how multiple post listings look.
|
/// A post-view mode that changes how multiple post listings look.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_listing_mode: Option<PostListingMode>,
|
pub post_listing_mode: Option<PostListingMode>,
|
||||||
/// The default post sort, usually "active"
|
/// The default post sort, usually "active"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
/// The default comment sort, usually "hot"
|
/// The default comment sort, usually "hot"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
/// The language of the lemmy interface
|
/// The language of the lemmy interface
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub interface_language: Option<String>,
|
pub interface_language: Option<String>,
|
||||||
/// A URL for your avatar.
|
/// A URL for your avatar.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub avatar: Option<String>,
|
pub avatar: Option<String>,
|
||||||
/// A URL for your banner.
|
/// A URL for your banner.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
/// Your display name, which can contain strange characters, and does not need to be unique.
|
/// Your display name, which can contain strange characters, and does not need to be unique.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
/// Your email.
|
/// Your email.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// Your bio / info, in markdown.
|
/// Your bio / info, in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub matrix_user_id: Option<String>,
|
pub matrix_user_id: Option<String>,
|
||||||
/// Whether to show or hide avatars.
|
/// Whether to show or hide avatars.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_avatars: Option<bool>,
|
pub show_avatars: Option<bool>,
|
||||||
/// Sends notifications to your email.
|
/// Sends notifications to your email.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub send_notifications_to_email: Option<bool>,
|
pub send_notifications_to_email: Option<bool>,
|
||||||
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub bot_account: Option<bool>,
|
pub bot_account: Option<bool>,
|
||||||
/// Whether to show bot accounts.
|
/// Whether to show bot accounts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_bot_accounts: Option<bool>,
|
pub show_bot_accounts: Option<bool>,
|
||||||
/// Whether to show read posts.
|
/// Whether to show read posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_read_posts: Option<bool>,
|
pub show_read_posts: Option<bool>,
|
||||||
/// A list of languages you are able to see discussion in.
|
/// A list of languages you are able to see discussion in.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
/// Open links in a new tab
|
/// Open links in a new tab
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub open_links_in_new_tab: Option<bool>,
|
pub open_links_in_new_tab: Option<bool>,
|
||||||
/// Enable infinite scroll
|
/// Enable infinite scroll
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub infinite_scroll_enabled: Option<bool>,
|
pub infinite_scroll_enabled: Option<bool>,
|
||||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enable_keyboard_navigation: Option<bool>,
|
pub enable_keyboard_navigation: Option<bool>,
|
||||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||||
/// should be paused
|
/// should be paused
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enable_animated_images: Option<bool>,
|
pub enable_animated_images: Option<bool>,
|
||||||
/// Whether a user can send / receive private messages
|
/// Whether a user can send / receive private messages
|
||||||
pub enable_private_messages: Option<bool>,
|
pub enable_private_messages: Option<bool>,
|
||||||
/// Whether to auto-collapse bot comments.
|
/// Whether to auto-collapse bot comments.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub collapse_bot_comments: Option<bool>,
|
pub collapse_bot_comments: Option<bool>,
|
||||||
/// Some vote display mode settings
|
/// Some vote display mode settings
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_scores: Option<bool>,
|
pub show_scores: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_upvotes: Option<bool>,
|
pub show_upvotes: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_downvotes: Option<bool>,
|
pub show_downvotes: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_upvote_percentage: Option<bool>,
|
pub show_upvote_percentage: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,6 +197,7 @@ pub struct ChangePassword {
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||||
/// requires registration applications.
|
/// requires registration applications.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub jwt: Option<SensitiveString>,
|
pub jwt: Option<SensitiveString>,
|
||||||
/// If registration applications are required, this will return true for a signup response.
|
/// If registration applications are required, this will return true for a signup response.
|
||||||
pub registration_created: bool,
|
pub registration_created: bool,
|
||||||
|
@ -175,13 +213,20 @@ pub struct LoginResponse {
|
||||||
///
|
///
|
||||||
/// Either person_id, or username are required.
|
/// Either person_id, or username are required.
|
||||||
pub struct GetPersonDetails {
|
pub struct GetPersonDetails {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub person_id: Option<PersonId>,
|
pub person_id: Option<PersonId>,
|
||||||
/// Example: dessalines , or dessalines@xyz.tld
|
/// Example: dessalines , or dessalines@xyz.tld
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<PostSortType>,
|
pub sort: Option<PostSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub saved_only: Option<bool>,
|
pub saved_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +237,7 @@ pub struct GetPersonDetails {
|
||||||
/// A person's details response.
|
/// A person's details response.
|
||||||
pub struct GetPersonDetailsResponse {
|
pub struct GetPersonDetailsResponse {
|
||||||
pub person_view: PersonView,
|
pub person_view: PersonView,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub site: Option<Site>,
|
pub site: Option<Site>,
|
||||||
pub comments: Vec<CommentView>,
|
pub comments: Vec<CommentView>,
|
||||||
pub posts: Vec<PostView>,
|
pub posts: Vec<PostView>,
|
||||||
|
@ -225,11 +271,14 @@ pub struct BanPerson {
|
||||||
pub ban: bool,
|
pub ban: bool,
|
||||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
||||||
/// If ban is true, then this means remove. If ban is false, it means restore.
|
/// If ban is true, then this means remove. If ban is false, it means restore.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub remove_or_restore_data: Option<bool>,
|
pub remove_or_restore_data: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
/// A time that the ban will expire, in unix epoch seconds.
|
/// A time that the ban will expire, in unix epoch seconds.
|
||||||
///
|
///
|
||||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<i64>,
|
pub expires: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,9 +324,13 @@ pub struct BlockPersonResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get comment replies.
|
/// Get comment replies.
|
||||||
pub struct GetReplies {
|
pub struct GetReplies {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<CommentSortType>,
|
pub sort: Option<CommentSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,9 +349,13 @@ pub struct GetRepliesResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get mentions for your user.
|
/// Get mentions for your user.
|
||||||
pub struct GetPersonMentions {
|
pub struct GetPersonMentions {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<CommentSortType>,
|
pub sort: Option<CommentSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,6 +434,7 @@ pub struct PasswordChangeAfterReset {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get a count of the number of reports.
|
/// Get a count of the number of reports.
|
||||||
pub struct GetReportCount {
|
pub struct GetReportCount {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,9 +444,11 @@ pub struct GetReportCount {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// A response for the number of reports.
|
/// A response for the number of reports.
|
||||||
pub struct GetReportCountResponse {
|
pub struct GetReportCountResponse {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
pub comment_reports: i64,
|
pub comment_reports: i64,
|
||||||
pub post_reports: i64,
|
pub post_reports: i64,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub private_message_reports: Option<i64>,
|
pub private_message_reports: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +498,9 @@ pub struct UpdateTotpResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get your user's image / media uploads.
|
/// Get your user's image / media uploads.
|
||||||
pub struct ListMedia {
|
pub struct ListMedia {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,18 +19,26 @@ use ts_rs::TS;
|
||||||
pub struct CreatePost {
|
pub struct CreatePost {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
/// An optional body for the post in markdown.
|
/// An optional body for the post in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
/// A honeypot to catch bots. Should be None.
|
/// A honeypot to catch bots. Should be None.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub honeypot: Option<String>,
|
pub honeypot: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
/// Instead of fetching a thumbnail, use a custom one.
|
/// Instead of fetching a thumbnail, use a custom one.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub custom_thumbnail: Option<String>,
|
pub custom_thumbnail: Option<String>,
|
||||||
/// Time when this post should be scheduled. Null means publish immediately.
|
/// Time when this post should be scheduled. Null means publish immediately.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub scheduled_publish_time: Option<i64>,
|
pub scheduled_publish_time: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,9 +53,12 @@ pub struct PostResponse {
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
|
// TODO this should be made into a tagged enum
|
||||||
/// Get a post. Needs either the post id, or comment_id.
|
/// Get a post. Needs either the post id, or comment_id.
|
||||||
pub struct GetPost {
|
pub struct GetPost {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub id: Option<PostId>,
|
pub id: Option<PostId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,23 +81,37 @@ pub struct GetPostResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get a list of posts.
|
/// Get a list of posts.
|
||||||
pub struct GetPosts {
|
pub struct GetPosts {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<PostSortType>,
|
pub sort: Option<PostSortType>,
|
||||||
/// DEPRECATED, use page_cursor
|
/// DEPRECATED, use page_cursor
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub saved_only: Option<bool>,
|
pub saved_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub liked_only: Option<bool>,
|
pub liked_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub disliked_only: Option<bool>,
|
pub disliked_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_hidden: Option<bool>,
|
pub show_hidden: Option<bool>,
|
||||||
/// If true, then show the read posts (even if your user setting is to hide them)
|
/// If true, then show the read posts (even if your user setting is to hide them)
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_read: Option<bool>,
|
pub show_read: Option<bool>,
|
||||||
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
/// If true, then only show posts with no comments
|
/// If true, then only show posts with no comments
|
||||||
pub no_comments_only: Option<bool>,
|
pub no_comments_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +123,7 @@ pub struct GetPosts {
|
||||||
pub struct GetPostsResponse {
|
pub struct GetPostsResponse {
|
||||||
pub posts: Vec<PostView>,
|
pub posts: Vec<PostView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,17 +144,25 @@ pub struct CreatePostLike {
|
||||||
/// Edit a post.
|
/// Edit a post.
|
||||||
pub struct EditPost {
|
pub struct EditPost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
/// An optional body for the post in markdown.
|
/// An optional body for the post in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
/// Instead of fetching a thumbnail, use a custom one.
|
/// Instead of fetching a thumbnail, use a custom one.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub custom_thumbnail: Option<String>,
|
pub custom_thumbnail: Option<String>,
|
||||||
/// Time when this post should be scheduled. Null means publish immediately.
|
/// Time when this post should be scheduled. Null means publish immediately.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub scheduled_publish_time: Option<i64>,
|
pub scheduled_publish_time: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +183,7 @@ pub struct DeletePost {
|
||||||
pub struct RemovePost {
|
pub struct RemovePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,12 +267,18 @@ pub struct ResolvePostReport {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// List post reports.
|
/// List post reports.
|
||||||
pub struct ListPostReports {
|
pub struct ListPostReports {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
/// Only shows the unresolved reports
|
/// Only shows the unresolved reports
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unresolved_only: Option<bool>,
|
pub unresolved_only: Option<bool>,
|
||||||
|
// TODO make into tagged enum at some point
|
||||||
/// if no community is given, it returns reports for all communities moderated by the auth user
|
/// if no community is given, it returns reports for all communities moderated by the auth user
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +314,7 @@ pub struct GetSiteMetadataResponse {
|
||||||
pub struct LinkMetadata {
|
pub struct LinkMetadata {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub opengraph_data: OpenGraphData,
|
pub opengraph_data: OpenGraphData,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub content_type: Option<String>,
|
pub content_type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,9 +324,13 @@ pub struct LinkMetadata {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Site metadata, from its opengraph tags.
|
/// Site metadata, from its opengraph tags.
|
||||||
pub struct OpenGraphData {
|
pub struct OpenGraphData {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub(crate) image: Option<DbUrl>,
|
pub(crate) image: Option<DbUrl>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub embed_video_url: Option<DbUrl>,
|
pub embed_video_url: Option<DbUrl>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +341,9 @@ pub struct OpenGraphData {
|
||||||
/// List post likes. Admins-only.
|
/// List post likes. Admins-only.
|
||||||
pub struct ListPostLikes {
|
pub struct ListPostLikes {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,13 @@ pub struct MarkPrivateMessageAsRead {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Get your private messages.
|
/// Get your private messages.
|
||||||
pub struct GetPrivateMessages {
|
pub struct GetPrivateMessages {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub creator_id: Option<PersonId>,
|
pub creator_id: Option<PersonId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,9 +106,12 @@ pub struct ResolvePrivateMessageReport {
|
||||||
/// List private message reports.
|
/// List private message reports.
|
||||||
// TODO , perhaps GetReports should be a tagged enum list too.
|
// TODO , perhaps GetReports should be a tagged enum list too.
|
||||||
pub struct ListPrivateMessageReports {
|
pub struct ListPrivateMessageReports {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
/// Only shows the unresolved reports
|
/// Only shows the unresolved reports
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unresolved_only: Option<bool>,
|
pub unresolved_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,18 +71,31 @@ use ts_rs::TS;
|
||||||
/// Searches the site, given a query string, and some optional filters.
|
/// Searches the site, given a query string, and some optional filters.
|
||||||
pub struct Search {
|
pub struct Search {
|
||||||
pub q: String,
|
pub q: String,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub creator_id: Option<PersonId>,
|
pub creator_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<SearchType>,
|
pub type_: Option<SearchType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sort: Option<PostSortType>,
|
pub sort: Option<PostSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub listing_type: Option<ListingType>,
|
pub listing_type: Option<ListingType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub title_only: Option<bool>,
|
pub title_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_url_only: Option<bool>,
|
pub post_url_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub saved_only: Option<bool>,
|
pub saved_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub liked_only: Option<bool>,
|
pub liked_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub disliked_only: Option<bool>,
|
pub disliked_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,9 +128,13 @@ pub struct ResolveObject {
|
||||||
// TODO Change this to an enum
|
// TODO Change this to an enum
|
||||||
/// The response of an apub object fetch.
|
/// The response of an apub object fetch.
|
||||||
pub struct ResolveObjectResponse {
|
pub struct ResolveObjectResponse {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment: Option<CommentView>,
|
pub comment: Option<CommentView>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post: Option<PostView>,
|
pub post: Option<PostView>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community: Option<CommunityView>,
|
pub community: Option<CommunityView>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub person: Option<PersonView>,
|
pub person: Option<PersonView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,13 +144,21 @@ pub struct ResolveObjectResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches the modlog.
|
/// Fetches the modlog.
|
||||||
pub struct GetModlog {
|
pub struct GetModlog {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub mod_person_id: Option<PersonId>,
|
pub mod_person_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub type_: Option<ModlogActionType>,
|
pub type_: Option<ModlogActionType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,50 +192,95 @@ pub struct GetModlogResponse {
|
||||||
/// Creates a site. Should be done after first running lemmy.
|
/// Creates a site. Should be done after first running lemmy.
|
||||||
pub struct CreateSite {
|
pub struct CreateSite {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enable_nsfw: Option<bool>,
|
pub enable_nsfw: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_creation_admin_only: Option<bool>,
|
pub community_creation_admin_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub require_email_verification: Option<bool>,
|
pub require_email_verification: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub private_instance: Option<bool>,
|
pub private_instance: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_theme: Option<String>,
|
pub default_theme: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_listing_type: Option<ListingType>,
|
pub default_post_listing_type: Option<ListingType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_listing_mode: Option<PostListingMode>,
|
pub default_post_listing_mode: Option<PostListingMode>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub application_email_admins: Option<bool>,
|
pub application_email_admins: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub hide_modlog_mod_names: Option<bool>,
|
pub hide_modlog_mod_names: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub actor_name_max_length: Option<i32>,
|
pub actor_name_max_length: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_message: Option<i32>,
|
pub rate_limit_message: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_message_per_second: Option<i32>,
|
pub rate_limit_message_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_post: Option<i32>,
|
pub rate_limit_post: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_post_per_second: Option<i32>,
|
pub rate_limit_post_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_register: Option<i32>,
|
pub rate_limit_register: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_register_per_second: Option<i32>,
|
pub rate_limit_register_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_image: Option<i32>,
|
pub rate_limit_image: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_image_per_second: Option<i32>,
|
pub rate_limit_image_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_comment: Option<i32>,
|
pub rate_limit_comment: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_comment_per_second: Option<i32>,
|
pub rate_limit_comment_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_search: Option<i32>,
|
pub rate_limit_search: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_search_per_second: Option<i32>,
|
pub rate_limit_search_per_second: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federation_enabled: Option<bool>,
|
pub federation_enabled: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federation_debug: Option<bool>,
|
pub federation_debug: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_enabled: Option<bool>,
|
pub captcha_enabled: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_difficulty: Option<String>,
|
pub captcha_difficulty: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub allowed_instances: Option<Vec<String>>,
|
pub allowed_instances: Option<Vec<String>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub blocked_instances: Option<Vec<String>>,
|
pub blocked_instances: Option<Vec<String>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub registration_mode: Option<RegistrationMode>,
|
pub registration_mode: Option<RegistrationMode>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub oauth_registration: Option<bool>,
|
pub oauth_registration: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_upvotes: Option<FederationMode>,
|
pub post_upvotes: Option<FederationMode>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_downvotes: Option<FederationMode>,
|
pub post_downvotes: Option<FederationMode>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_upvotes: Option<FederationMode>,
|
pub comment_upvotes: Option<FederationMode>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_downvotes: Option<FederationMode>,
|
pub comment_downvotes: Option<FederationMode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,94 +290,142 @@ pub struct CreateSite {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Edits a site.
|
/// Edits a site.
|
||||||
pub struct EditSite {
|
pub struct EditSite {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
/// A sidebar for the site, in markdown.
|
/// A sidebar for the site, in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your site.
|
/// A shorter, one line description of your site.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// A url for your site's icon.
|
/// A url for your site's icon.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
/// A url for your site's banner.
|
/// A url for your site's banner.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
/// Whether to enable NSFW.
|
/// Whether to enable NSFW.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub enable_nsfw: Option<bool>,
|
pub enable_nsfw: Option<bool>,
|
||||||
/// Limits community creation to admins only.
|
/// Limits community creation to admins only.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_creation_admin_only: Option<bool>,
|
pub community_creation_admin_only: Option<bool>,
|
||||||
/// Whether to require email verification.
|
/// Whether to require email verification.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub require_email_verification: Option<bool>,
|
pub require_email_verification: Option<bool>,
|
||||||
/// Your application question form. This is in markdown, and can be many questions.
|
/// Your application question form. This is in markdown, and can be many questions.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
/// Whether your instance is public, or private.
|
/// Whether your instance is public, or private.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub private_instance: Option<bool>,
|
pub private_instance: Option<bool>,
|
||||||
/// The default theme. Usually "browser"
|
/// The default theme. Usually "browser"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_theme: Option<String>,
|
pub default_theme: Option<String>,
|
||||||
/// The default post listing type, usually "local"
|
/// The default post listing type, usually "local"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_listing_type: Option<ListingType>,
|
pub default_post_listing_type: Option<ListingType>,
|
||||||
/// Default value for listing mode, usually "list"
|
/// Default value for listing mode, usually "list"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_listing_mode: Option<PostListingMode>,
|
pub default_post_listing_mode: Option<PostListingMode>,
|
||||||
/// The default post sort, usually "active"
|
/// The default post sort, usually "active"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
/// The default comment sort, usually "hot"
|
/// The default comment sort, usually "hot"
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
/// An optional page of legal information
|
/// An optional page of legal information
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
/// Whether to email admins when receiving a new application.
|
/// Whether to email admins when receiving a new application.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub application_email_admins: Option<bool>,
|
pub application_email_admins: Option<bool>,
|
||||||
/// Whether to hide moderator names from the modlog.
|
/// Whether to hide moderator names from the modlog.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub hide_modlog_mod_names: Option<bool>,
|
pub hide_modlog_mod_names: Option<bool>,
|
||||||
/// A list of allowed discussion languages.
|
/// A list of allowed discussion languages.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
/// A regex string of items to filter.
|
/// A regex string of items to filter.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
/// The max length of actor names.
|
/// The max length of actor names.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub actor_name_max_length: Option<i32>,
|
pub actor_name_max_length: Option<i32>,
|
||||||
/// The number of messages allowed in a given time frame.
|
/// The number of messages allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_message: Option<i32>,
|
pub rate_limit_message: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_message_per_second: Option<i32>,
|
pub rate_limit_message_per_second: Option<i32>,
|
||||||
/// The number of posts allowed in a given time frame.
|
/// The number of posts allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_post: Option<i32>,
|
pub rate_limit_post: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_post_per_second: Option<i32>,
|
pub rate_limit_post_per_second: Option<i32>,
|
||||||
/// The number of registrations allowed in a given time frame.
|
/// The number of registrations allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_register: Option<i32>,
|
pub rate_limit_register: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_register_per_second: Option<i32>,
|
pub rate_limit_register_per_second: Option<i32>,
|
||||||
/// The number of image uploads allowed in a given time frame.
|
/// The number of image uploads allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_image: Option<i32>,
|
pub rate_limit_image: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_image_per_second: Option<i32>,
|
pub rate_limit_image_per_second: Option<i32>,
|
||||||
/// The number of comments allowed in a given time frame.
|
/// The number of comments allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_comment: Option<i32>,
|
pub rate_limit_comment: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_comment_per_second: Option<i32>,
|
pub rate_limit_comment_per_second: Option<i32>,
|
||||||
/// The number of searches allowed in a given time frame.
|
/// The number of searches allowed in a given time frame.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_search: Option<i32>,
|
pub rate_limit_search: Option<i32>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub rate_limit_search_per_second: Option<i32>,
|
pub rate_limit_search_per_second: Option<i32>,
|
||||||
/// Whether to enable federation.
|
/// Whether to enable federation.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federation_enabled: Option<bool>,
|
pub federation_enabled: Option<bool>,
|
||||||
/// Enables federation debugging.
|
/// Enables federation debugging.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federation_debug: Option<bool>,
|
pub federation_debug: Option<bool>,
|
||||||
/// Whether to enable captchas for signups.
|
/// Whether to enable captchas for signups.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_enabled: Option<bool>,
|
pub captcha_enabled: Option<bool>,
|
||||||
/// The captcha difficulty. Can be easy, medium, or hard
|
/// The captcha difficulty. Can be easy, medium, or hard
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub captcha_difficulty: Option<String>,
|
pub captcha_difficulty: Option<String>,
|
||||||
/// A list of allowed instances. If none are set, federation is open.
|
/// A list of allowed instances. If none are set, federation is open.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub allowed_instances: Option<Vec<String>>,
|
pub allowed_instances: Option<Vec<String>>,
|
||||||
/// A list of blocked instances.
|
/// A list of blocked instances.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub blocked_instances: Option<Vec<String>>,
|
pub blocked_instances: Option<Vec<String>>,
|
||||||
/// A list of blocked URLs
|
/// A list of blocked URLs
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub blocked_urls: Option<Vec<String>>,
|
pub blocked_urls: Option<Vec<String>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub registration_mode: Option<RegistrationMode>,
|
pub registration_mode: Option<RegistrationMode>,
|
||||||
/// Whether to email admins for new reports.
|
/// Whether to email admins for new reports.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reports_email_admins: Option<bool>,
|
pub reports_email_admins: Option<bool>,
|
||||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||||
/// when the site is first opened by a user.
|
/// when the site is first opened by a user.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
/// Whether or not external auth methods can auto-register users.
|
/// Whether or not external auth methods can auto-register users.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub oauth_registration: Option<bool>,
|
pub oauth_registration: Option<bool>,
|
||||||
/// What kind of post upvotes your site allows.
|
/// What kind of post upvotes your site allows.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_upvotes: Option<FederationMode>,
|
pub post_upvotes: Option<FederationMode>,
|
||||||
/// What kind of post downvotes your site allows.
|
/// What kind of post downvotes your site allows.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_downvotes: Option<FederationMode>,
|
pub post_downvotes: Option<FederationMode>,
|
||||||
/// What kind of comment upvotes your site allows.
|
/// What kind of comment upvotes your site allows.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_upvotes: Option<FederationMode>,
|
pub comment_upvotes: Option<FederationMode>,
|
||||||
/// What kind of comment downvotes your site allows.
|
/// What kind of comment downvotes your site allows.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_downvotes: Option<FederationMode>,
|
pub comment_downvotes: Option<FederationMode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +448,7 @@ pub struct GetSiteResponse {
|
||||||
pub site_view: SiteView,
|
pub site_view: SiteView,
|
||||||
pub admins: Vec<PersonView>,
|
pub admins: Vec<PersonView>,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_user: Option<MyUserInfo>,
|
pub my_user: Option<MyUserInfo>,
|
||||||
pub all_languages: Vec<Language>,
|
pub all_languages: Vec<Language>,
|
||||||
pub discussion_languages: Vec<LanguageId>,
|
pub discussion_languages: Vec<LanguageId>,
|
||||||
|
@ -338,9 +457,12 @@ pub struct GetSiteResponse {
|
||||||
/// deprecated, use /api/v3/custom_emoji/list
|
/// deprecated, use /api/v3/custom_emoji/list
|
||||||
pub custom_emojis: Vec<()>,
|
pub custom_emojis: Vec<()>,
|
||||||
/// If the site has any taglines, a random one is included here for displaying
|
/// If the site has any taglines, a random one is included here for displaying
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub tagline: Option<Tagline>,
|
pub tagline: Option<Tagline>,
|
||||||
/// A list of external auth methods your site supports.
|
/// A list of external auth methods your site supports.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub oauth_providers: Option<Vec<PublicOAuthProvider>>,
|
pub oauth_providers: Option<Vec<PublicOAuthProvider>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin_oauth_providers: Option<Vec<OAuthProvider>>,
|
pub admin_oauth_providers: Option<Vec<OAuthProvider>>,
|
||||||
pub blocked_urls: Vec<LocalSiteUrlBlocklist>,
|
pub blocked_urls: Vec<LocalSiteUrlBlocklist>,
|
||||||
}
|
}
|
||||||
|
@ -352,6 +474,7 @@ pub struct GetSiteResponse {
|
||||||
/// A response of federated instances.
|
/// A response of federated instances.
|
||||||
pub struct GetFederatedInstancesResponse {
|
pub struct GetFederatedInstancesResponse {
|
||||||
/// Optional, because federation may be disabled.
|
/// Optional, because federation may be disabled.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federated_instances: Option<FederatedInstances>,
|
pub federated_instances: Option<FederatedInstances>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +510,7 @@ pub struct ReadableFederationState {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
internal_state: FederationQueueState,
|
internal_state: FederationQueueState,
|
||||||
/// timestamp of the next retry attempt (null if fail count is 0)
|
/// timestamp of the next retry attempt (null if fail count is 0)
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
next_retry: Option<DateTime<Utc>>,
|
next_retry: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +535,7 @@ pub struct InstanceWithFederationState {
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
/// if federation to this instance is or was active, show state of outgoing federation to this
|
/// if federation to this instance is or was active, show state of outgoing federation to this
|
||||||
/// instance
|
/// instance
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub federation_state: Option<ReadableFederationState>,
|
pub federation_state: Option<ReadableFederationState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,6 +546,7 @@ pub struct InstanceWithFederationState {
|
||||||
/// Purges a person from the database. This will delete all content attached to that person.
|
/// Purges a person from the database. This will delete all content attached to that person.
|
||||||
pub struct PurgePerson {
|
pub struct PurgePerson {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +557,7 @@ pub struct PurgePerson {
|
||||||
/// Purges a community from the database. This will delete all content attached to that community.
|
/// Purges a community from the database. This will delete all content attached to that community.
|
||||||
pub struct PurgeCommunity {
|
pub struct PurgeCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,6 +568,7 @@ pub struct PurgeCommunity {
|
||||||
/// Purges a post from the database. This will delete all content attached to that post.
|
/// Purges a post from the database. This will delete all content attached to that post.
|
||||||
pub struct PurgePost {
|
pub struct PurgePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,6 +579,7 @@ pub struct PurgePost {
|
||||||
/// Purges a comment from the database. This will delete all content attached to that comment.
|
/// Purges a comment from the database. This will delete all content attached to that comment.
|
||||||
pub struct PurgeComment {
|
pub struct PurgeComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,8 +590,11 @@ pub struct PurgeComment {
|
||||||
/// Fetches a list of registration applications.
|
/// Fetches a list of registration applications.
|
||||||
pub struct ListRegistrationApplications {
|
pub struct ListRegistrationApplications {
|
||||||
/// Only shows the unread applications (IE those without an admin actor)
|
/// Only shows the unread applications (IE those without an admin actor)
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,6 +623,7 @@ pub struct GetRegistrationApplication {
|
||||||
pub struct ApproveRegistrationApplication {
|
pub struct ApproveRegistrationApplication {
|
||||||
pub id: RegistrationApplicationId,
|
pub id: RegistrationApplicationId,
|
||||||
pub approve: bool,
|
pub approve: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub deny_reason: Option<String>,
|
pub deny_reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,8 @@ pub struct ListTaglinesResponse {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Fetches a list of taglines.
|
/// Fetches a list of taglines.
|
||||||
pub struct ListTaglines {
|
pub struct ListTaglines {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,9 @@ pub async fn check_registration_application(
|
||||||
let local_user_id = local_user_view.local_user.id;
|
let local_user_id = local_user_view.local_user.id;
|
||||||
let registration = RegistrationApplication::find_by_local_user_id(pool, local_user_id).await?;
|
let registration = RegistrationApplication::find_by_local_user_id(pool, local_user_id).await?;
|
||||||
if registration.admin_id.is_some() {
|
if registration.admin_id.is_some() {
|
||||||
Err(LemmyErrorType::RegistrationDenied(registration.deny_reason))?
|
Err(LemmyErrorType::RegistrationDenied {
|
||||||
|
reason: registration.deny_reason,
|
||||||
|
})?
|
||||||
} else {
|
} else {
|
||||||
Err(LemmyErrorType::RegistrationApplicationIsPending)?
|
Err(LemmyErrorType::RegistrationApplicationIsPending)?
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,24 @@ impl UrlVerifier for VerifyUrlData {
|
||||||
use FederationError::*;
|
use FederationError::*;
|
||||||
check_apub_id_valid(url, &local_site_data).map_err(|err| match err {
|
check_apub_id_valid(url, &local_site_data).map_err(|err| match err {
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::FederationError(Some(FederationDisabled)),
|
error_type:
|
||||||
|
LemmyErrorType::FederationError {
|
||||||
|
error: Some(FederationDisabled),
|
||||||
|
},
|
||||||
..
|
..
|
||||||
} => ActivityPubError::Other("Federation disabled".into()),
|
} => ActivityPubError::Other("Federation disabled".into()),
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::FederationError(Some(DomainBlocked(domain))),
|
error_type:
|
||||||
|
LemmyErrorType::FederationError {
|
||||||
|
error: Some(DomainBlocked(domain)),
|
||||||
|
},
|
||||||
..
|
..
|
||||||
} => ActivityPubError::Other(format!("Domain {domain:?} is blocked")),
|
} => ActivityPubError::Other(format!("Domain {domain:?} is blocked")),
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::FederationError(Some(DomainNotInAllowList(domain))),
|
error_type:
|
||||||
|
LemmyErrorType::FederationError {
|
||||||
|
error: Some(DomainNotInAllowList(domain)),
|
||||||
|
},
|
||||||
..
|
..
|
||||||
} => ActivityPubError::Other(format!("Domain {domain:?} is not in allowlist")),
|
} => ActivityPubError::Other(format!("Domain {domain:?} is not in allowlist")),
|
||||||
_ => ActivityPubError::Other("Failed validating apub id".into()),
|
_ => ActivityPubError::Other("Failed validating apub id".into()),
|
||||||
|
|
|
@ -174,8 +174,9 @@ pub struct LtreeDef(pub String);
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow))]
|
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow, TS))]
|
||||||
#[cfg_attr(feature = "full", diesel(sql_type = diesel::sql_types::Text))]
|
#[cfg_attr(feature = "full", diesel(sql_type = diesel::sql_types::Text))]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct DbUrl(pub(crate) Box<Url>);
|
pub struct DbUrl(pub(crate) Box<Url>);
|
||||||
|
|
||||||
impl DbUrl {
|
impl DbUrl {
|
||||||
|
@ -248,19 +249,6 @@ impl Deref for DbUrl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
impl TS for DbUrl {
|
|
||||||
fn name() -> String {
|
|
||||||
"string".to_string()
|
|
||||||
}
|
|
||||||
fn dependencies() -> Vec<ts_rs::Dependency> {
|
|
||||||
Vec::new()
|
|
||||||
}
|
|
||||||
fn transparent() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
impl ToSql<Text, Pg> for DbUrl {
|
impl ToSql<Text, Pg> for DbUrl {
|
||||||
fn to_sql(&self, out: &mut Output<Pg>) -> diesel::serialize::Result {
|
fn to_sql(&self, out: &mut Output<Pg>) -> diesel::serialize::Result {
|
||||||
|
|
|
@ -4,8 +4,9 @@ use std::{fmt::Debug, ops::Deref};
|
||||||
use ts_rs::TS;
|
use ts_rs::TS;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
pub struct SensitiveString(String);
|
pub struct SensitiveString(String);
|
||||||
|
|
||||||
impl SensitiveString {
|
impl SensitiveString {
|
||||||
|
@ -39,19 +40,3 @@ impl From<String> for SensitiveString {
|
||||||
SensitiveString(t)
|
SensitiveString(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
|
||||||
impl TS for SensitiveString {
|
|
||||||
fn name() -> String {
|
|
||||||
"string".to_string()
|
|
||||||
}
|
|
||||||
fn name_with_type_args(_args: Vec<String>) -> String {
|
|
||||||
"string".to_string()
|
|
||||||
}
|
|
||||||
fn dependencies() -> Vec<ts_rs::Dependency> {
|
|
||||||
Vec::new()
|
|
||||||
}
|
|
||||||
fn transparent() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ pub struct Comment {
|
||||||
/// Whether the comment has been removed.
|
/// Whether the comment has been removed.
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
/// Whether the comment has been deleted by its creator.
|
/// Whether the comment has been deleted by its creator.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
|
|
|
@ -25,8 +25,10 @@ pub struct CommentReport {
|
||||||
pub original_comment_text: String,
|
pub original_comment_text: String,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,12 @@ pub struct Community {
|
||||||
/// A longer title, that can contain other characters, and doesn't have to be unique.
|
/// A longer title, that can contain other characters, and doesn't have to be unique.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// Whether the community is removed by a mod.
|
/// Whether the community is removed by a mod.
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
/// Whether the community has been deleted by its creator.
|
/// Whether the community has been deleted by its creator.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
|
@ -45,8 +47,10 @@ pub struct Community {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub last_refreshed_at: DateTime<Utc>,
|
pub last_refreshed_at: DateTime<Utc>,
|
||||||
/// A URL for an icon.
|
/// A URL for an icon.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<DbUrl>,
|
pub icon: Option<DbUrl>,
|
||||||
/// A URL for a banner.
|
/// A URL for a banner.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
#[cfg_attr(feature = "full", ts(skip))]
|
#[cfg_attr(feature = "full", ts(skip))]
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
|
@ -67,6 +71,7 @@ pub struct Community {
|
||||||
pub featured_url: Option<DbUrl>,
|
pub featured_url: Option<DbUrl>,
|
||||||
pub visibility: CommunityVisibility,
|
pub visibility: CommunityVisibility,
|
||||||
/// A shorter, one-line description of the site.
|
/// A shorter, one-line description of the site.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub struct CustomEmoji {
|
||||||
pub alt_text: String,
|
pub alt_text: String,
|
||||||
pub category: String,
|
pub category: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,13 @@ use ts_rs::TS;
|
||||||
pub struct FederationQueueState {
|
pub struct FederationQueueState {
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
/// the last successfully sent activity id
|
/// the last successfully sent activity id
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub last_successful_id: Option<ActivityId>,
|
pub last_successful_id: Option<ActivityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub last_successful_published_time: Option<DateTime<Utc>>,
|
pub last_successful_published_time: Option<DateTime<Utc>>,
|
||||||
/// how many failed attempts have been made to send the next activity
|
/// how many failed attempts have been made to send the next activity
|
||||||
pub fail_count: i32,
|
pub fail_count: i32,
|
||||||
/// timestamp of the last retry attempt (when the last failing activity was resent)
|
/// timestamp of the last retry attempt (when the last failing activity was resent)
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub last_retry: Option<DateTime<Utc>>,
|
pub last_retry: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ use ts_rs::TS;
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
||||||
pub struct LocalImage {
|
pub struct LocalImage {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub local_user_id: Option<LocalUserId>,
|
pub local_user_id: Option<LocalUserId>,
|
||||||
pub pictrs_alias: String,
|
pub pictrs_alias: String,
|
||||||
pub pictrs_delete_token: String,
|
pub pictrs_delete_token: String,
|
||||||
|
|
|
@ -19,8 +19,11 @@ pub struct Instance {
|
||||||
pub id: InstanceId,
|
pub id: InstanceId,
|
||||||
pub domain: String,
|
pub domain: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub software: Option<String>,
|
pub software: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub struct LocalSite {
|
||||||
/// Whether emails are required.
|
/// Whether emails are required.
|
||||||
pub require_email_verification: bool,
|
pub require_email_verification: bool,
|
||||||
/// An optional registration application questionnaire in markdown.
|
/// An optional registration application questionnaire in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
/// Whether the instance is private or public.
|
/// Whether the instance is private or public.
|
||||||
pub private_instance: bool,
|
pub private_instance: bool,
|
||||||
|
@ -40,12 +41,14 @@ pub struct LocalSite {
|
||||||
pub default_theme: String,
|
pub default_theme: String,
|
||||||
pub default_post_listing_type: ListingType,
|
pub default_post_listing_type: ListingType,
|
||||||
/// An optional legal disclaimer page.
|
/// An optional legal disclaimer page.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
/// Whether to hide mod names on the modlog.
|
/// Whether to hide mod names on the modlog.
|
||||||
pub hide_modlog_mod_names: bool,
|
pub hide_modlog_mod_names: bool,
|
||||||
/// Whether new applications email admins.
|
/// Whether new applications email admins.
|
||||||
pub application_email_admins: bool,
|
pub application_email_admins: bool,
|
||||||
/// An optional regex to filter words.
|
/// An optional regex to filter words.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
/// The max actor name length.
|
/// The max actor name length.
|
||||||
pub actor_name_max_length: i32,
|
pub actor_name_max_length: i32,
|
||||||
|
@ -56,6 +59,7 @@ pub struct LocalSite {
|
||||||
/// The captcha difficulty.
|
/// The captcha difficulty.
|
||||||
pub captcha_difficulty: String,
|
pub captcha_difficulty: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
pub registration_mode: RegistrationMode,
|
pub registration_mode: RegistrationMode,
|
||||||
/// Whether to email admins on new reports.
|
/// Whether to email admins on new reports.
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub struct LocalSiteRateLimit {
|
||||||
pub search: i32,
|
pub search: i32,
|
||||||
pub search_per_second: i32,
|
pub search_per_second: i32,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
pub import_user_settings: i32,
|
pub import_user_settings: i32,
|
||||||
pub import_user_settings_per_second: i32,
|
pub import_user_settings_per_second: i32,
|
||||||
|
|
|
@ -16,6 +16,7 @@ pub struct LocalSiteUrlBlocklist {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ pub struct LocalUser {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub password_encrypted: Option<SensitiveString>,
|
pub password_encrypted: Option<SensitiveString>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// Whether to show NSFW content.
|
/// Whether to show NSFW content.
|
||||||
pub show_nsfw: bool,
|
pub show_nsfw: bool,
|
||||||
|
|
|
@ -24,7 +24,9 @@ pub struct LoginToken {
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
/// IP address where login was made from, allows invalidating logins by IP address.
|
/// IP address where login was made from, allows invalidating logins by IP address.
|
||||||
/// Could be stored in truncated format, or store derived information for better privacy.
|
/// Could be stored in truncated format, or store derived information for better privacy.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub ip: Option<String>,
|
pub ip: Option<String>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub user_agent: Option<String>,
|
pub user_agent: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub struct ModRemovePost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
|
@ -105,6 +106,7 @@ pub struct ModRemoveComment {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
|
@ -130,6 +132,7 @@ pub struct ModRemoveCommunity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
|
@ -156,8 +159,10 @@ pub struct ModBanFromCommunity {
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<DateTime<Utc>>,
|
pub expires: Option<DateTime<Utc>>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -184,8 +189,10 @@ pub struct ModBan {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub expires: Option<DateTime<Utc>>,
|
pub expires: Option<DateTime<Utc>>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -211,6 +218,7 @@ pub struct ModHideCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
}
|
}
|
||||||
|
@ -303,6 +311,7 @@ pub struct ModAddForm {
|
||||||
pub struct AdminPurgePerson {
|
pub struct AdminPurgePerson {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -324,6 +333,7 @@ pub struct AdminPurgePersonForm {
|
||||||
pub struct AdminPurgeCommunity {
|
pub struct AdminPurgeCommunity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -346,6 +356,7 @@ pub struct AdminPurgePost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -369,6 +380,7 @@ pub struct AdminPurgeComment {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub when_: DateTime<Utc>,
|
pub when_: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub struct OAuthAccount {
|
||||||
pub oauth_provider_id: OAuthProviderId,
|
pub oauth_provider_id: OAuthProviderId,
|
||||||
pub oauth_user_id: String,
|
pub oauth_user_id: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ pub struct OAuthProvider {
|
||||||
/// switch to enable or disable an oauth provider
|
/// switch to enable or disable an oauth provider
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,20 @@ pub struct Person {
|
||||||
pub id: PersonId,
|
pub id: PersonId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// A shorter display name.
|
/// A shorter display name.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
/// A URL for an avatar.
|
/// A URL for an avatar.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub avatar: Option<DbUrl>,
|
pub avatar: Option<DbUrl>,
|
||||||
/// Whether the person is banned.
|
/// Whether the person is banned.
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
/// The federated actor_id.
|
/// The federated actor_id.
|
||||||
pub actor_id: DbUrl,
|
pub actor_id: DbUrl,
|
||||||
/// An optional bio, in markdown.
|
/// An optional bio, in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
/// Whether the person is local to our site.
|
/// Whether the person is local to our site.
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
|
@ -42,6 +46,7 @@ pub struct Person {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub last_refreshed_at: DateTime<Utc>,
|
pub last_refreshed_at: DateTime<Utc>,
|
||||||
/// A URL for a banner.
|
/// A URL for a banner.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
/// Whether the person is deleted.
|
/// Whether the person is deleted.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
|
@ -49,10 +54,12 @@ pub struct Person {
|
||||||
#[serde(skip, default = "placeholder_apub_url")]
|
#[serde(skip, default = "placeholder_apub_url")]
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
/// A matrix id, usually given an @person:matrix.org
|
/// A matrix id, usually given an @person:matrix.org
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub matrix_user_id: Option<String>,
|
pub matrix_user_id: Option<String>,
|
||||||
/// Whether the person is a bot account.
|
/// Whether the person is a bot account.
|
||||||
pub bot_account: bool,
|
pub bot_account: bool,
|
||||||
/// When their ban, if it exists, expires, if at all.
|
/// When their ban, if it exists, expires, if at all.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub ban_expires: Option<DateTime<Utc>>,
|
pub ban_expires: Option<DateTime<Utc>>,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@ use ts_rs::TS;
|
||||||
pub struct Post {
|
pub struct Post {
|
||||||
pub id: PostId,
|
pub id: PostId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
/// An optional link / url for the post.
|
/// An optional link / url for the post.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub url: Option<DbUrl>,
|
pub url: Option<DbUrl>,
|
||||||
/// An optional post body, in markdown.
|
/// An optional post body, in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
pub creator_id: PersonId,
|
pub creator_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
|
@ -29,35 +30,40 @@ pub struct Post {
|
||||||
/// Whether the post is locked.
|
/// Whether the post is locked.
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
/// Whether the post is deleted.
|
/// Whether the post is deleted.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
/// Whether the post is NSFW.
|
/// Whether the post is NSFW.
|
||||||
pub nsfw: bool,
|
pub nsfw: bool,
|
||||||
/// A title for the link.
|
/// A title for the link.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub embed_title: Option<String>,
|
pub embed_title: Option<String>,
|
||||||
/// A description for the link.
|
/// A description for the link.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub embed_description: Option<String>,
|
pub embed_description: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
/// A thumbnail picture url.
|
/// A thumbnail picture url.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub thumbnail_url: Option<DbUrl>,
|
pub thumbnail_url: Option<DbUrl>,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
/// The federated activity id / ap_id.
|
/// The federated activity id / ap_id.
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
/// Whether the post is local.
|
/// Whether the post is local.
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
|
||||||
/// A video url for the link.
|
/// A video url for the link.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub embed_video_url: Option<DbUrl>,
|
pub embed_video_url: Option<DbUrl>,
|
||||||
pub language_id: LanguageId,
|
pub language_id: LanguageId,
|
||||||
/// Whether the post is featured to its community.
|
/// Whether the post is featured to its community.
|
||||||
pub featured_community: bool,
|
pub featured_community: bool,
|
||||||
/// Whether the post is featured to its site.
|
/// Whether the post is featured to its site.
|
||||||
pub featured_local: bool,
|
pub featured_local: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub url_content_type: Option<String>,
|
pub url_content_type: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
/// Time at which the post will be published. None means publish immediately.
|
/// Time at which the post will be published. None means publish immediately.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub scheduled_publish_time: Option<DateTime<Utc>>,
|
pub scheduled_publish_time: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,17 @@ pub struct PostReport {
|
||||||
/// The original post title.
|
/// The original post title.
|
||||||
pub original_post_name: String,
|
pub original_post_name: String,
|
||||||
/// The original post url.
|
/// The original post url.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub original_post_url: Option<DbUrl>,
|
pub original_post_url: Option<DbUrl>,
|
||||||
/// The original post body.
|
/// The original post body.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub original_post_body: Option<String>,
|
pub original_post_body: Option<String>,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ pub struct PrivateMessage {
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
|
|
|
@ -29,8 +29,10 @@ pub struct PrivateMessageReport {
|
||||||
pub original_pm_text: String,
|
pub original_pm_text: String,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ pub struct RegistrationApplication {
|
||||||
pub id: RegistrationApplicationId,
|
pub id: RegistrationApplicationId,
|
||||||
pub local_user_id: LocalUserId,
|
pub local_user_id: LocalUserId,
|
||||||
pub answer: String,
|
pub answer: String,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin_id: Option<PersonId>,
|
pub admin_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub deny_reason: Option<String>,
|
pub deny_reason: Option<String>,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,19 @@ pub struct Site {
|
||||||
pub id: SiteId,
|
pub id: SiteId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// A sidebar for the site in markdown.
|
/// A sidebar for the site in markdown.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
/// An icon URL.
|
/// An icon URL.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub icon: Option<DbUrl>,
|
pub icon: Option<DbUrl>,
|
||||||
/// A banner url.
|
/// A banner url.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
/// A shorter, one-line description of the site.
|
/// A shorter, one-line description of the site.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// The federated actor_id.
|
/// The federated actor_id.
|
||||||
pub actor_id: DbUrl,
|
pub actor_id: DbUrl,
|
||||||
|
@ -43,6 +48,7 @@ pub struct Site {
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||||
/// when the site is first opened by a user.
|
/// when the site is first opened by a user.
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ pub struct Tagline {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub published: DateTime<Utc>,
|
pub published: DateTime<Utc>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ use diesel_async::{
|
||||||
ManagerConfig,
|
ManagerConfig,
|
||||||
},
|
},
|
||||||
AsyncConnection,
|
AsyncConnection,
|
||||||
RunQueryDsl,
|
|
||||||
};
|
};
|
||||||
use futures_util::{future::BoxFuture, Future, FutureExt};
|
use futures_util::{future::BoxFuture, Future, FutureExt};
|
||||||
use i_love_jesus::CursorKey;
|
use i_love_jesus::CursorKey;
|
||||||
|
@ -47,7 +46,7 @@ use rustls::{
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
sync::{Arc, LazyLock},
|
sync::{Arc, LazyLock, OnceLock},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
@ -59,6 +58,8 @@ pub const SITEMAP_LIMIT: i64 = 50000;
|
||||||
pub const SITEMAP_DAYS: Option<TimeDelta> = TimeDelta::try_days(31);
|
pub const SITEMAP_DAYS: Option<TimeDelta> = TimeDelta::try_days(31);
|
||||||
pub const RANK_DEFAULT: f64 = 0.0001;
|
pub const RANK_DEFAULT: f64 = 0.0001;
|
||||||
|
|
||||||
|
/// Some connection options to speed up queries
|
||||||
|
const CONNECTION_OPTIONS: [&str; 1] = ["geqo_threshold=12"];
|
||||||
pub type ActualDbPool = Pool<AsyncPgConnection>;
|
pub type ActualDbPool = Pool<AsyncPgConnection>;
|
||||||
|
|
||||||
/// References a pool or connection. Functions must take `&mut DbPool<'_>` to allow implicit
|
/// References a pool or connection. Functions must take `&mut DbPool<'_>` to allow implicit
|
||||||
|
@ -345,10 +346,37 @@ pub fn diesel_url_create(opt: Option<&str>) -> LemmyResult<Option<DbUrl>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets a few additional config options necessary for starting lemmy
|
||||||
|
fn build_config_options_uri_segment(config: &str) -> String {
|
||||||
|
let mut url = Url::parse(config).expect("Couldn't parse postgres connection URI");
|
||||||
|
|
||||||
|
// Set `lemmy.protocol_and_hostname` so triggers can use it
|
||||||
|
let lemmy_protocol_and_hostname_option =
|
||||||
|
"lemmy.protocol_and_hostname=".to_owned() + &SETTINGS.get_protocol_and_hostname();
|
||||||
|
let mut options = CONNECTION_OPTIONS.to_vec();
|
||||||
|
options.push(&lemmy_protocol_and_hostname_option);
|
||||||
|
|
||||||
|
// Create the connection uri portion
|
||||||
|
let options_segments = options
|
||||||
|
.iter()
|
||||||
|
.map(|o| "-c ".to_owned() + o)
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(" ");
|
||||||
|
|
||||||
|
url.set_query(Some(&format!("options={options_segments}")));
|
||||||
|
url.into()
|
||||||
|
}
|
||||||
|
|
||||||
fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConnection>> {
|
fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConnection>> {
|
||||||
let fut = async {
|
let fut = async {
|
||||||
|
/// Use a once_lock to create the postgres connection config, since this config never changes
|
||||||
|
static POSTGRES_CONFIG_WITH_OPTIONS: OnceLock<String> = OnceLock::new();
|
||||||
|
|
||||||
|
let config =
|
||||||
|
POSTGRES_CONFIG_WITH_OPTIONS.get_or_init(|| build_config_options_uri_segment(config));
|
||||||
|
|
||||||
// We only support TLS with sslmode=require currently
|
// We only support TLS with sslmode=require currently
|
||||||
let mut conn = if config.contains("sslmode=require") {
|
let conn = if config.contains("sslmode=require") {
|
||||||
let rustls_config = DangerousClientConfigBuilder {
|
let rustls_config = DangerousClientConfigBuilder {
|
||||||
cfg: ClientConfig::builder(),
|
cfg: ClientConfig::builder(),
|
||||||
}
|
}
|
||||||
|
@ -369,24 +397,6 @@ fn establish_connection(config: &str) -> BoxFuture<ConnectionResult<AsyncPgConne
|
||||||
AsyncPgConnection::establish(config).await?
|
AsyncPgConnection::establish(config).await?
|
||||||
};
|
};
|
||||||
|
|
||||||
diesel::select((
|
|
||||||
// Change geqo_threshold back to default value if it was changed, so it's higher than the
|
|
||||||
// collapse limits
|
|
||||||
functions::set_config("geqo_threshold", "12", false),
|
|
||||||
// Change collapse limits from 8 to 11 so the query planner can find a better table join
|
|
||||||
// order for more complicated queries
|
|
||||||
functions::set_config("from_collapse_limit", "11", false),
|
|
||||||
functions::set_config("join_collapse_limit", "11", false),
|
|
||||||
// Set `lemmy.protocol_and_hostname` so triggers can use it
|
|
||||||
functions::set_config(
|
|
||||||
"lemmy.protocol_and_hostname",
|
|
||||||
SETTINGS.get_protocol_and_hostname(),
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
))
|
|
||||||
.execute(&mut conn)
|
|
||||||
.await
|
|
||||||
.map_err(ConnectionError::CouldntSetupConfiguration)?;
|
|
||||||
Ok(conn)
|
Ok(conn)
|
||||||
};
|
};
|
||||||
fut.boxed()
|
fut.boxed()
|
||||||
|
@ -498,7 +508,7 @@ static EMAIL_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
});
|
});
|
||||||
|
|
||||||
pub mod functions {
|
pub mod functions {
|
||||||
use diesel::sql_types::{BigInt, Bool, Text, Timestamptz};
|
use diesel::sql_types::{BigInt, Text, Timestamptz};
|
||||||
|
|
||||||
sql_function! {
|
sql_function! {
|
||||||
#[sql_name = "r.hot_rank"]
|
#[sql_name = "r.hot_rank"]
|
||||||
|
@ -521,8 +531,6 @@ pub mod functions {
|
||||||
|
|
||||||
// really this function is variadic, this just adds the two-argument version
|
// really this function is variadic, this just adds the two-argument version
|
||||||
sql_function!(fn coalesce<T: diesel::sql_types::SqlType + diesel::sql_types::SingleValue>(x: diesel::sql_types::Nullable<T>, y: T) -> T);
|
sql_function!(fn coalesce<T: diesel::sql_types::SqlType + diesel::sql_types::SingleValue>(x: diesel::sql_types::Nullable<T>, y: T) -> T);
|
||||||
|
|
||||||
sql_function!(fn set_config(setting_name: Text, new_value: Text, is_local: Bool) -> Text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const DELETED_REPLACEMENT_TEXT: &str = "*Permanently Deleted*";
|
pub const DELETED_REPLACEMENT_TEXT: &str = "*Permanently Deleted*";
|
||||||
|
|
|
@ -734,6 +734,7 @@ mod tests {
|
||||||
structs::LocalUserView,
|
structs::LocalUserView,
|
||||||
};
|
};
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
use diesel_async::SimpleAsyncConnection;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
aggregates::structs::PostAggregates,
|
aggregates::structs::PostAggregates,
|
||||||
impls::actor_language::UNDETERMINED_ID,
|
impls::actor_language::UNDETERMINED_ID,
|
||||||
|
@ -774,7 +775,7 @@ mod tests {
|
||||||
site::Site,
|
site::Site,
|
||||||
},
|
},
|
||||||
traits::{Bannable, Blockable, Crud, Followable, Joinable, Likeable, Saveable},
|
traits::{Bannable, Blockable, Crud, Followable, Joinable, Likeable, Saveable},
|
||||||
utils::{build_db_pool, build_db_pool_for_tests, DbPool, RANK_DEFAULT},
|
utils::{build_db_pool, build_db_pool_for_tests, get_conn, DbPool, RANK_DEFAULT},
|
||||||
CommunityVisibility,
|
CommunityVisibility,
|
||||||
PostSortType,
|
PostSortType,
|
||||||
SubscribedType,
|
SubscribedType,
|
||||||
|
@ -782,7 +783,10 @@ mod tests {
|
||||||
use lemmy_utils::error::LemmyResult;
|
use lemmy_utils::error::LemmyResult;
|
||||||
use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
use std::{collections::HashSet, time::Duration};
|
use std::{
|
||||||
|
collections::HashSet,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
const POST_WITH_ANOTHER_TITLE: &str = "Another title";
|
const POST_WITH_ANOTHER_TITLE: &str = "Another title";
|
||||||
|
@ -1995,6 +1999,62 @@ mod tests {
|
||||||
cleanup(data, pool).await
|
cleanup(data, pool).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
#[serial]
|
||||||
|
async fn speed_check() -> LemmyResult<()> {
|
||||||
|
let pool = &build_db_pool().await?;
|
||||||
|
let pool = &mut pool.into();
|
||||||
|
let data = init_data(pool).await?;
|
||||||
|
|
||||||
|
// Make sure the post_view query is less than this time
|
||||||
|
let duration_max = Duration::from_millis(40);
|
||||||
|
|
||||||
|
// Create some dummy posts
|
||||||
|
let num_posts = 1000;
|
||||||
|
for x in 1..num_posts {
|
||||||
|
let name = format!("post_{x}");
|
||||||
|
let url = Some(Url::parse(&format!("https://google.com/{name}"))?.into());
|
||||||
|
|
||||||
|
let post_form = PostInsertForm {
|
||||||
|
url,
|
||||||
|
..PostInsertForm::new(
|
||||||
|
name,
|
||||||
|
data.local_user_view.person.id,
|
||||||
|
data.inserted_community.id,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
Post::create(pool, &post_form).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manually trigger and wait for a statistics update to ensure consistent and high amount of
|
||||||
|
// accuracy in the statistics used for query planning
|
||||||
|
println!("🧮 updating database statistics");
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
conn.batch_execute("ANALYZE;").await?;
|
||||||
|
|
||||||
|
// Time how fast the query took
|
||||||
|
let now = Instant::now();
|
||||||
|
PostQuery {
|
||||||
|
sort: Some(PostSortType::Active),
|
||||||
|
local_user: Some(&data.local_user_view.local_user),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
.list(&data.site, pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let elapsed = now.elapsed();
|
||||||
|
println!("Elapsed: {:.0?}", elapsed);
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
elapsed.lt(&duration_max),
|
||||||
|
"Query took {:.0?}, longer than the max of {:.0?}",
|
||||||
|
elapsed,
|
||||||
|
duration_max
|
||||||
|
);
|
||||||
|
|
||||||
|
cleanup(data, pool).await
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
#[serial]
|
||||||
async fn post_listings_no_comments_only() -> LemmyResult<()> {
|
async fn post_listings_no_comments_only() -> LemmyResult<()> {
|
||||||
|
|
|
@ -48,7 +48,9 @@ pub struct CommentReportView {
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
pub subscribed: SubscribedType,
|
pub subscribed: SubscribedType,
|
||||||
pub saved: bool,
|
pub saved: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver: Option<Person>,
|
pub resolver: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +73,7 @@ pub struct CommentView {
|
||||||
pub subscribed: SubscribedType,
|
pub subscribed: SubscribedType,
|
||||||
pub saved: bool,
|
pub saved: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +109,11 @@ pub struct PostReportView {
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
pub unread_comments: i64,
|
pub unread_comments: i64,
|
||||||
pub counts: PostAggregates,
|
pub counts: PostAggregates,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver: Option<Person>,
|
pub resolver: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +136,7 @@ pub struct PostView {
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub image_details: Option<ImageDetails>,
|
pub image_details: Option<ImageDetails>,
|
||||||
pub creator_banned_from_community: bool,
|
pub creator_banned_from_community: bool,
|
||||||
pub banned_from_community: bool,
|
pub banned_from_community: bool,
|
||||||
|
@ -142,6 +148,7 @@ pub struct PostView {
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
pub unread_comments: i64,
|
pub unread_comments: i64,
|
||||||
}
|
}
|
||||||
|
@ -168,6 +175,7 @@ pub struct PrivateMessageReportView {
|
||||||
pub private_message: PrivateMessage,
|
pub private_message: PrivateMessage,
|
||||||
pub private_message_creator: Person,
|
pub private_message_creator: Person,
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub resolver: Option<Person>,
|
pub resolver: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +189,7 @@ pub struct RegistrationApplicationView {
|
||||||
pub registration_application: RegistrationApplication,
|
pub registration_application: RegistrationApplication,
|
||||||
pub creator_local_user: LocalUser,
|
pub creator_local_user: LocalUser,
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ pub struct PersonMentionView {
|
||||||
pub subscribed: SubscribedType,
|
pub subscribed: SubscribedType,
|
||||||
pub saved: bool,
|
pub saved: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +134,7 @@ pub struct CommentReplyView {
|
||||||
pub subscribed: SubscribedType,
|
pub subscribed: SubscribedType,
|
||||||
pub saved: bool,
|
pub saved: bool,
|
||||||
pub creator_blocked: bool,
|
pub creator_blocked: bool,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub my_vote: Option<i16>,
|
pub my_vote: Option<i16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ use ts_rs::TS;
|
||||||
/// When someone is added as a community moderator.
|
/// When someone is added as a community moderator.
|
||||||
pub struct ModAddCommunityView {
|
pub struct ModAddCommunityView {
|
||||||
pub mod_add_community: ModAddCommunity,
|
pub mod_add_community: ModAddCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub modded_person: Person,
|
pub modded_person: Person,
|
||||||
|
@ -52,6 +53,7 @@ pub struct ModAddCommunityView {
|
||||||
/// When someone is added as a site moderator.
|
/// When someone is added as a site moderator.
|
||||||
pub struct ModAddView {
|
pub struct ModAddView {
|
||||||
pub mod_add: ModAdd,
|
pub mod_add: ModAdd,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub modded_person: Person,
|
pub modded_person: Person,
|
||||||
}
|
}
|
||||||
|
@ -64,6 +66,7 @@ pub struct ModAddView {
|
||||||
/// When someone is banned from a community.
|
/// When someone is banned from a community.
|
||||||
pub struct ModBanFromCommunityView {
|
pub struct ModBanFromCommunityView {
|
||||||
pub mod_ban_from_community: ModBanFromCommunity,
|
pub mod_ban_from_community: ModBanFromCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub banned_person: Person,
|
pub banned_person: Person,
|
||||||
|
@ -77,6 +80,7 @@ pub struct ModBanFromCommunityView {
|
||||||
/// When someone is banned from the site.
|
/// When someone is banned from the site.
|
||||||
pub struct ModBanView {
|
pub struct ModBanView {
|
||||||
pub mod_ban: ModBan,
|
pub mod_ban: ModBan,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub banned_person: Person,
|
pub banned_person: Person,
|
||||||
}
|
}
|
||||||
|
@ -89,6 +93,7 @@ pub struct ModBanView {
|
||||||
/// When a community is hidden from public view.
|
/// When a community is hidden from public view.
|
||||||
pub struct ModHideCommunityView {
|
pub struct ModHideCommunityView {
|
||||||
pub mod_hide_community: ModHideCommunity,
|
pub mod_hide_community: ModHideCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
@ -101,6 +106,7 @@ pub struct ModHideCommunityView {
|
||||||
/// When a moderator locks a post (prevents new comments being made).
|
/// When a moderator locks a post (prevents new comments being made).
|
||||||
pub struct ModLockPostView {
|
pub struct ModLockPostView {
|
||||||
pub mod_lock_post: ModLockPost,
|
pub mod_lock_post: ModLockPost,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
|
@ -114,6 +120,7 @@ pub struct ModLockPostView {
|
||||||
/// When a moderator removes a comment.
|
/// When a moderator removes a comment.
|
||||||
pub struct ModRemoveCommentView {
|
pub struct ModRemoveCommentView {
|
||||||
pub mod_remove_comment: ModRemoveComment,
|
pub mod_remove_comment: ModRemoveComment,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub comment: Comment,
|
pub comment: Comment,
|
||||||
pub commenter: Person,
|
pub commenter: Person,
|
||||||
|
@ -129,6 +136,7 @@ pub struct ModRemoveCommentView {
|
||||||
/// When a moderator removes a community.
|
/// When a moderator removes a community.
|
||||||
pub struct ModRemoveCommunityView {
|
pub struct ModRemoveCommunityView {
|
||||||
pub mod_remove_community: ModRemoveCommunity,
|
pub mod_remove_community: ModRemoveCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
@ -141,6 +149,7 @@ pub struct ModRemoveCommunityView {
|
||||||
/// When a moderator removes a post.
|
/// When a moderator removes a post.
|
||||||
pub struct ModRemovePostView {
|
pub struct ModRemovePostView {
|
||||||
pub mod_remove_post: ModRemovePost,
|
pub mod_remove_post: ModRemovePost,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
|
@ -154,6 +163,7 @@ pub struct ModRemovePostView {
|
||||||
/// When a moderator features a post on a community (pins it to the top).
|
/// When a moderator features a post on a community (pins it to the top).
|
||||||
pub struct ModFeaturePostView {
|
pub struct ModFeaturePostView {
|
||||||
pub mod_feature_post: ModFeaturePost,
|
pub mod_feature_post: ModFeaturePost,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
|
@ -167,6 +177,7 @@ pub struct ModFeaturePostView {
|
||||||
/// When a moderator transfers a community to a new owner.
|
/// When a moderator transfers a community to a new owner.
|
||||||
pub struct ModTransferCommunityView {
|
pub struct ModTransferCommunityView {
|
||||||
pub mod_transfer_community: ModTransferCommunity,
|
pub mod_transfer_community: ModTransferCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub modded_person: Person,
|
pub modded_person: Person,
|
||||||
|
@ -180,6 +191,7 @@ pub struct ModTransferCommunityView {
|
||||||
/// When an admin purges a comment.
|
/// When an admin purges a comment.
|
||||||
pub struct AdminPurgeCommentView {
|
pub struct AdminPurgeCommentView {
|
||||||
pub admin_purge_comment: AdminPurgeComment,
|
pub admin_purge_comment: AdminPurgeComment,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
}
|
}
|
||||||
|
@ -192,6 +204,7 @@ pub struct AdminPurgeCommentView {
|
||||||
/// When an admin purges a community.
|
/// When an admin purges a community.
|
||||||
pub struct AdminPurgeCommunityView {
|
pub struct AdminPurgeCommunityView {
|
||||||
pub admin_purge_community: AdminPurgeCommunity,
|
pub admin_purge_community: AdminPurgeCommunity,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,6 +216,7 @@ pub struct AdminPurgeCommunityView {
|
||||||
/// When an admin purges a person.
|
/// When an admin purges a person.
|
||||||
pub struct AdminPurgePersonView {
|
pub struct AdminPurgePersonView {
|
||||||
pub admin_purge_person: AdminPurgePerson,
|
pub admin_purge_person: AdminPurgePerson,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,6 +228,7 @@ pub struct AdminPurgePersonView {
|
||||||
/// When an admin purges a post.
|
/// When an admin purges a post.
|
||||||
pub struct AdminPurgePostView {
|
pub struct AdminPurgePostView {
|
||||||
pub admin_purge_post: AdminPurgePost,
|
pub admin_purge_post: AdminPurgePost,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
@ -225,12 +240,19 @@ pub struct AdminPurgePostView {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
/// Querying / filtering the modlog.
|
/// Querying / filtering the modlog.
|
||||||
pub struct ModlogListParams {
|
pub struct ModlogListParams {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub mod_person_id: Option<PersonId>,
|
pub mod_person_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
pub hide_modlog_names: bool,
|
pub hide_modlog_names: bool,
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,10 @@ pub enum LemmyErrorType {
|
||||||
InvalidUrl,
|
InvalidUrl,
|
||||||
EmailSendFailed,
|
EmailSendFailed,
|
||||||
Slurs,
|
Slurs,
|
||||||
RegistrationDenied(Option<String>),
|
RegistrationDenied {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
reason: Option<String>,
|
||||||
|
},
|
||||||
SiteNameRequired,
|
SiteNameRequired,
|
||||||
SiteNameLengthOverflow,
|
SiteNameLengthOverflow,
|
||||||
PermissiveRegex,
|
PermissiveRegex,
|
||||||
|
@ -147,7 +150,10 @@ pub enum LemmyErrorType {
|
||||||
CommunityHasNoFollowers,
|
CommunityHasNoFollowers,
|
||||||
PostScheduleTimeMustBeInFuture,
|
PostScheduleTimeMustBeInFuture,
|
||||||
TooManyScheduledPosts,
|
TooManyScheduledPosts,
|
||||||
FederationError(Option<FederationError>),
|
FederationError {
|
||||||
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
error: Option<FederationError>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Federation related errors, these dont need to be translated.
|
/// Federation related errors, these dont need to be translated.
|
||||||
|
@ -262,7 +268,7 @@ cfg_if! {
|
||||||
fn from(error_type: FederationError) -> Self {
|
fn from(error_type: FederationError) -> Self {
|
||||||
let inner = anyhow::anyhow!("{}", error_type);
|
let inner = anyhow::anyhow!("{}", error_type);
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::FederationError(Some(error_type)),
|
error_type: LemmyErrorType::FederationError { error: Some(error_type) },
|
||||||
inner,
|
inner,
|
||||||
context: Backtrace::capture(),
|
context: Backtrace::capture(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
export PGDATA="$PWD/dev_pgdata"
|
export PGDATA="$PWD/dev_pgdata"
|
||||||
export PGHOST=$PWD
|
export PGHOST=$PWD
|
||||||
|
|
||||||
|
# Necessary to encode the dev db path into proper URL params
|
||||||
|
export ENCODED_HOST=$(printf $PWD | jq -sRr @uri)
|
||||||
|
|
||||||
export PGUSER=postgres
|
export PGUSER=postgres
|
||||||
export DATABASE_URL="postgresql://lemmy:password@/lemmy?host=$PWD"
|
export DATABASE_URL="postgresql://lemmy:password@$ENCODED_HOST/lemmy"
|
||||||
export LEMMY_DATABASE_URL=$DATABASE_URL
|
export LEMMY_DATABASE_URL=$DATABASE_URL
|
||||||
export PGDATABASE=lemmy
|
export PGDATABASE=lemmy
|
||||||
|
|
||||||
|
|
14
scripts/ts_bindings_check.sh
Executable file
14
scripts/ts_bindings_check.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This check is only used for CI.
|
||||||
|
|
||||||
|
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
|
||||||
|
cd "$CWD/../"
|
||||||
|
|
||||||
|
# Export the ts-rs bindings
|
||||||
|
cargo test --workspace export_bindings
|
||||||
|
|
||||||
|
# Make sure no rows are returned
|
||||||
|
! grep -nr --include=\*.ts ' | null' ./crates/
|
Loading…
Reference in a new issue