mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 10:51:03 +00:00
Upgrading ts_rs to 10.0.0 (#5163)
* Upgrading ts_rs to 10.0.0 * Adding ts_option directives, and woodpecker test. * Fixing ts_options.
This commit is contained in:
parent
d162ec1638
commit
df664d9d9a
44 changed files with 492 additions and 56 deletions
|
@ -181,6 +181,15 @@ steps:
|
|||
- cargo test --workspace --no-fail-fast
|
||||
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:
|
||||
# TODO: use willsquire/diesel-cli image when shared libraries become optional in lemmy_server
|
||||
image: *rust_image
|
||||
|
|
17
Cargo.lock
generated
17
Cargo.lock
generated
|
@ -2,12 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "Inflector"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
||||
|
||||
[[package]]
|
||||
name = "accept-language"
|
||||
version = "3.1.0"
|
||||
|
@ -5255,22 +5249,23 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|||
|
||||
[[package]]
|
||||
name = "ts-rs"
|
||||
version = "7.1.1"
|
||||
version = "10.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc2cae1fc5d05d47aa24b64f9a4f7cba24cdc9187a2084dd97ac57bef5eccae6"
|
||||
checksum = "3a2f31991cee3dce1ca4f929a8a04fdd11fd8801aac0f2030b0fa8a0a3fef6b9"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"lazy_static",
|
||||
"thiserror",
|
||||
"ts-rs-macros",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ts-rs-macros"
|
||||
version = "7.1.1"
|
||||
version = "10.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73f7f9b821696963053a89a7bd8b292dc34420aea8294d7b225274d488f3ec92"
|
||||
checksum = "0ea0b99e8ec44abd6f94a18f28f7934437809dd062820797c52401298116f70e"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.77",
|
||||
|
|
|
@ -142,10 +142,11 @@ itertools = "0.13.0"
|
|||
futures = "0.3.30"
|
||||
http = "1.1"
|
||||
rosetta-i18n = "0.1.3"
|
||||
ts-rs = { version = "7.1.1", features = [
|
||||
ts-rs = { version = "10.0.0", features = [
|
||||
"serde-compat",
|
||||
"chrono-impl",
|
||||
"no-serde-warnings",
|
||||
"url-impl",
|
||||
] }
|
||||
rustls = { version = "0.23.12", features = ["ring"] }
|
||||
futures-util = "0.3.30"
|
||||
|
|
|
@ -17,7 +17,9 @@ use ts_rs::TS;
|
|||
pub struct CreateComment {
|
||||
pub content: String,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub parent_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
}
|
||||
|
||||
|
@ -37,7 +39,9 @@ pub struct GetComment {
|
|||
/// Edit a comment.
|
||||
pub struct EditComment {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
}
|
||||
|
||||
|
@ -69,6 +73,7 @@ pub struct DeleteComment {
|
|||
pub struct RemoveComment {
|
||||
pub comment_id: CommentId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -107,17 +112,29 @@ pub struct CreateCommentLike {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get a list of comments.
|
||||
pub struct GetComments {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub max_depth: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub parent_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub saved_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub liked_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disliked_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -161,12 +178,17 @@ pub struct ResolveCommentReport {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// List comment reports.
|
||||
pub struct ListCommentReports {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
/// Only shows the unresolved reports
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unresolved_only: Option<bool>,
|
||||
/// 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>,
|
||||
}
|
||||
|
||||
|
@ -185,7 +207,9 @@ pub struct ListCommentReportsResponse {
|
|||
/// List comment likes. Admins-only.
|
||||
pub struct ListCommentLikes {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@ use ts_rs::TS;
|
|||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
// TODO make this into a tagged enum
|
||||
/// Get a community. Must provide either an id, or a name.
|
||||
pub struct GetCommunity {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id: Option<CommunityId>,
|
||||
/// Example: star_trek , or star_trek@xyz.tld
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -33,6 +36,7 @@ pub struct GetCommunity {
|
|||
/// The community response.
|
||||
pub struct GetCommunityResponse {
|
||||
pub community_view: CommunityView,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub site: Option<Site>,
|
||||
pub moderators: Vec<CommunityModeratorView>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
|
@ -49,18 +53,26 @@ pub struct CreateCommunity {
|
|||
/// A longer title.
|
||||
pub title: String,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// An icon URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<String>,
|
||||
/// A banner URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
/// Whether its an NSFW community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
/// Whether to restrict posting only to moderators.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub posting_restricted_to_mods: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub visibility: Option<CommunityVisibility>,
|
||||
}
|
||||
|
||||
|
@ -79,10 +91,15 @@ pub struct CommunityResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Fetches a list of communities.
|
||||
pub struct ListCommunities {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommunitySortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -105,11 +122,14 @@ pub struct BanFromCommunity {
|
|||
pub ban: bool,
|
||||
/// 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.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub remove_or_restore_data: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
/// A time that the ban will expire, in unix epoch seconds.
|
||||
///
|
||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -148,20 +168,29 @@ pub struct AddModToCommunityResponse {
|
|||
pub struct EditCommunity {
|
||||
pub community_id: CommunityId,
|
||||
/// A longer title.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title: Option<String>,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// An icon URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<String>,
|
||||
/// A banner URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
/// Whether its an NSFW community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
/// Whether to restrict posting only to moderators.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub posting_restricted_to_mods: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub visibility: Option<CommunityVisibility>,
|
||||
}
|
||||
|
||||
|
@ -173,6 +202,7 @@ pub struct EditCommunity {
|
|||
pub struct HideCommunity {
|
||||
pub community_id: CommunityId,
|
||||
pub hidden: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -194,6 +224,7 @@ pub struct DeleteCommunity {
|
|||
pub struct RemoveCommunity {
|
||||
pub community_id: CommunityId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -240,5 +271,6 @@ pub struct TransferCommunity {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Fetches a random community
|
||||
pub struct GetRandomCommunity {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
}
|
||||
|
|
|
@ -62,8 +62,12 @@ pub struct ListCustomEmojisResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Fetches a list of custom emojis.
|
||||
pub struct ListCustomEmojis {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub category: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ignore_page_limits: Option<bool>,
|
||||
}
|
||||
|
|
|
@ -20,8 +20,11 @@ pub struct CreateOAuthProvider {
|
|||
pub client_id: String,
|
||||
pub client_secret: String,
|
||||
pub scopes: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub auto_verify_email: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub account_linking_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -32,15 +35,25 @@ pub struct CreateOAuthProvider {
|
|||
/// Edit an external auth method.
|
||||
pub struct EditOAuthProvider {
|
||||
pub id: OAuthProviderId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub display_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub authorization_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub token_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub userinfo_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id_claim: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub client_secret: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scopes: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub auto_verify_email: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub account_linking_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -59,13 +72,14 @@ pub struct DeleteOAuthProvider {
|
|||
/// Logging in with an OAuth 2.0 authorization
|
||||
pub struct AuthenticateWithOauth {
|
||||
pub code: String,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
pub oauth_provider_id: OAuthProviderId,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
pub redirect_uri: Url,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Username is mandatory at registration time
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub username: Option<String>,
|
||||
/// An answer is mandatory if require application is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub answer: Option<String>,
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ pub struct Login {
|
|||
pub username_or_email: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
/// May be required, if totp is enabled for their account.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub totp_2fa_token: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -40,16 +41,22 @@ pub struct Register {
|
|||
pub username: String,
|
||||
pub password: SensitiveString,
|
||||
pub password_verify: SensitiveString,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// email is mandatory if email verification is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// The UUID of the captcha item.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_uuid: Option<String>,
|
||||
/// Your captcha answer.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_answer: Option<String>,
|
||||
/// A form field to trick signup bots. Should be None.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub honeypot: Option<String>,
|
||||
/// An answer is mandatory if require application is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub answer: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -60,6 +67,7 @@ pub struct Register {
|
|||
/// A wrapper for the captcha response.
|
||||
pub struct GetCaptchaResponse {
|
||||
/// Will be None if captchas are disabled.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ok: Option<CaptchaResponse>,
|
||||
}
|
||||
|
||||
|
@ -83,60 +91,89 @@ pub struct CaptchaResponse {
|
|||
/// Saves settings for your user.
|
||||
pub struct SaveUserSettings {
|
||||
/// Show nsfw posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Blur nsfw posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blur_nsfw: Option<bool>,
|
||||
/// Your user's theme.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_listing_type: Option<ListingType>,
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// The default comment sort, usually "hot"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// The language of the lemmy interface
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub interface_language: Option<String>,
|
||||
/// A URL for your avatar.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub avatar: Option<String>,
|
||||
/// A URL for your banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
/// 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>,
|
||||
/// Your email.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Your bio / info, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub bio: Option<String>,
|
||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether to show or hide avatars.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_avatars: Option<bool>,
|
||||
/// Sends notifications to your email.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub send_notifications_to_email: Option<bool>,
|
||||
/// 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>,
|
||||
/// Whether to show bot accounts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_bot_accounts: Option<bool>,
|
||||
/// Whether to show read posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_read_posts: Option<bool>,
|
||||
/// A list of languages you are able to see discussion in.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
/// Open links in a new tab
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub open_links_in_new_tab: Option<bool>,
|
||||
/// Enable infinite scroll
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub infinite_scroll_enabled: Option<bool>,
|
||||
/// 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>,
|
||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||
/// should be paused
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_animated_images: Option<bool>,
|
||||
/// Whether to auto-collapse bot comments.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub collapse_bot_comments: Option<bool>,
|
||||
/// Some vote display mode settings
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_scores: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_upvotes: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_downvotes: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_upvote_percentage: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -158,6 +195,7 @@ pub struct ChangePassword {
|
|||
pub struct LoginResponse {
|
||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||
/// requires registration applications.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub jwt: Option<SensitiveString>,
|
||||
/// If registration applications are required, this will return true for a signup response.
|
||||
pub registration_created: bool,
|
||||
|
@ -173,13 +211,20 @@ pub struct LoginResponse {
|
|||
///
|
||||
/// Either person_id, or username are required.
|
||||
pub struct GetPersonDetails {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_id: Option<PersonId>,
|
||||
/// Example: dessalines , or dessalines@xyz.tld
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub username: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<PostSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub saved_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -190,6 +235,7 @@ pub struct GetPersonDetails {
|
|||
/// A person's details response.
|
||||
pub struct GetPersonDetailsResponse {
|
||||
pub person_view: PersonView,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub site: Option<Site>,
|
||||
pub comments: Vec<CommentView>,
|
||||
pub posts: Vec<PostView>,
|
||||
|
@ -223,11 +269,14 @@ pub struct BanPerson {
|
|||
pub ban: bool,
|
||||
/// 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.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub remove_or_restore_data: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
/// A time that the ban will expire, in unix epoch seconds.
|
||||
///
|
||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -273,9 +322,13 @@ pub struct BlockPersonResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get comment replies.
|
||||
pub struct GetReplies {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -294,9 +347,13 @@ pub struct GetRepliesResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get mentions for your user.
|
||||
pub struct GetPersonMentions {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -375,6 +432,7 @@ pub struct PasswordChangeAfterReset {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get a count of the number of reports.
|
||||
pub struct GetReportCount {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
}
|
||||
|
||||
|
@ -384,9 +442,11 @@ pub struct GetReportCount {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// A response for the number of reports.
|
||||
pub struct GetReportCountResponse {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
pub comment_reports: i64,
|
||||
pub post_reports: i64,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub private_message_reports: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -436,7 +496,9 @@ pub struct UpdateTotpResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get your user's image / media uploads.
|
||||
pub struct ListMedia {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,18 +19,26 @@ use ts_rs::TS;
|
|||
pub struct CreatePost {
|
||||
pub name: String,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<String>,
|
||||
/// An optional body for the post in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
/// A honeypot to catch bots. Should be None.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub honeypot: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
/// Instead of fetching a thumbnail, use a custom one.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub custom_thumbnail: Option<String>,
|
||||
/// Time when this post should be scheduled. Null means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -45,9 +53,12 @@ pub struct PostResponse {
|
|||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[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.
|
||||
pub struct GetPost {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
}
|
||||
|
||||
|
@ -70,23 +81,37 @@ pub struct GetPostResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get a list of posts.
|
||||
pub struct GetPosts {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<PostSortType>,
|
||||
/// DEPRECATED, use page_cursor
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub saved_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub liked_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disliked_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_hidden: Option<bool>,
|
||||
/// 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>,
|
||||
/// 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>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// If true, then only show posts with no comments
|
||||
pub no_comments_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
|
@ -98,6 +123,7 @@ pub struct GetPosts {
|
|||
pub struct GetPostsResponse {
|
||||
pub posts: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
|
@ -118,17 +144,25 @@ pub struct CreatePostLike {
|
|||
/// Edit a post.
|
||||
pub struct EditPost {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<String>,
|
||||
/// An optional body for the post in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
/// Instead of fetching a thumbnail, use a custom one.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub custom_thumbnail: Option<String>,
|
||||
/// Time when this post should be scheduled. Null means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -149,6 +183,7 @@ pub struct DeletePost {
|
|||
pub struct RemovePost {
|
||||
pub post_id: PostId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -232,12 +267,18 @@ pub struct ResolvePostReport {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// List post reports.
|
||||
pub struct ListPostReports {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
/// Only shows the unresolved reports
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
}
|
||||
|
||||
|
@ -273,6 +314,7 @@ pub struct GetSiteMetadataResponse {
|
|||
pub struct LinkMetadata {
|
||||
#[serde(flatten)]
|
||||
pub opengraph_data: OpenGraphData,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_type: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -282,9 +324,13 @@ pub struct LinkMetadata {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Site metadata, from its opengraph tags.
|
||||
pub struct OpenGraphData {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub(crate) image: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_video_url: Option<DbUrl>,
|
||||
}
|
||||
|
||||
|
@ -295,7 +341,9 @@ pub struct OpenGraphData {
|
|||
/// List post likes. Admins-only.
|
||||
pub struct ListPostLikes {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,13 @@ pub struct MarkPrivateMessageAsRead {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Get your private messages.
|
||||
pub struct GetPrivateMessages {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_id: Option<PersonId>,
|
||||
}
|
||||
|
||||
|
@ -102,9 +106,12 @@ pub struct ResolvePrivateMessageReport {
|
|||
/// List private message reports.
|
||||
// TODO , perhaps GetReports should be a tagged enum list too.
|
||||
pub struct ListPrivateMessageReports {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
/// Only shows the unresolved reports
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unresolved_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
|
|
@ -71,18 +71,31 @@ use ts_rs::TS;
|
|||
/// Searches the site, given a query string, and some optional filters.
|
||||
pub struct Search {
|
||||
pub q: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<SearchType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<PostSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub listing_type: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_url_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub saved_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub liked_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disliked_only: Option<bool>,
|
||||
}
|
||||
|
||||
|
@ -115,9 +128,13 @@ pub struct ResolveObject {
|
|||
// TODO Change this to an enum
|
||||
/// The response of an apub object fetch.
|
||||
pub struct ResolveObjectResponse {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment: Option<CommentView>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post: Option<PostView>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community: Option<CommunityView>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person: Option<PersonView>,
|
||||
}
|
||||
|
||||
|
@ -127,13 +144,21 @@ pub struct ResolveObjectResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Fetches the modlog.
|
||||
pub struct GetModlog {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub mod_person_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ModlogActionType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub other_person_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
}
|
||||
|
||||
|
@ -167,50 +192,95 @@ pub struct GetModlogResponse {
|
|||
/// Creates a site. Should be done after first running lemmy.
|
||||
pub struct CreateSite {
|
||||
pub name: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_creation_admin_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub require_email_verification: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub private_instance: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_theme: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_type: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_email_admins: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub hide_modlog_mod_names: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub actor_name_max_length: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_debug: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_difficulty: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub allowed_instances: Option<Vec<String>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blocked_instances: Option<Vec<String>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub oauth_registration: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_upvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_downvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_upvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_downvotes: Option<FederationMode>,
|
||||
}
|
||||
|
||||
|
@ -220,94 +290,142 @@ pub struct CreateSite {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Edits a site.
|
||||
pub struct EditSite {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
/// A sidebar for the site, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// A url for your site's icon.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<String>,
|
||||
/// A url for your site's banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
/// Whether to enable NSFW.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_nsfw: Option<bool>,
|
||||
/// Limits community creation to admins only.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_creation_admin_only: Option<bool>,
|
||||
/// Whether to require email verification.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub require_email_verification: Option<bool>,
|
||||
/// Your application question form. This is in markdown, and can be many questions.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
/// Whether your instance is public, or private.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub private_instance: Option<bool>,
|
||||
/// The default theme. Usually "browser"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_type: Option<ListingType>,
|
||||
/// Default value for listing mode, usually "list"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// The default comment sort, usually "hot"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// An optional page of legal information
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
/// Whether to email admins when receiving a new application.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_email_admins: Option<bool>,
|
||||
/// Whether to hide moderator names from the modlog.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub hide_modlog_mod_names: Option<bool>,
|
||||
/// A list of allowed discussion languages.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
/// A regex string of items to filter.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
/// The max length of actor names.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub actor_name_max_length: Option<i32>,
|
||||
/// The number of messages allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message_per_second: Option<i32>,
|
||||
/// The number of posts allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post_per_second: Option<i32>,
|
||||
/// The number of registrations allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register_per_second: Option<i32>,
|
||||
/// The number of image uploads allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image_per_second: Option<i32>,
|
||||
/// The number of comments allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment_per_second: Option<i32>,
|
||||
/// The number of searches allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search_per_second: Option<i32>,
|
||||
/// Whether to enable federation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_enabled: Option<bool>,
|
||||
/// Enables federation debugging.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_debug: Option<bool>,
|
||||
/// Whether to enable captchas for signups.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_enabled: Option<bool>,
|
||||
/// The captcha difficulty. Can be easy, medium, or hard
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_difficulty: Option<String>,
|
||||
/// A list of allowed instances. If none are set, federation is open.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub allowed_instances: Option<Vec<String>>,
|
||||
/// A list of blocked instances.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blocked_instances: Option<Vec<String>>,
|
||||
/// A list of blocked URLs
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blocked_urls: Option<Vec<String>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
/// Whether to email admins for new reports.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reports_email_admins: Option<bool>,
|
||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
/// Whether or not external auth methods can auto-register users.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub oauth_registration: Option<bool>,
|
||||
/// What kind of post upvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_upvotes: Option<FederationMode>,
|
||||
/// What kind of post downvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_downvotes: Option<FederationMode>,
|
||||
/// What kind of comment upvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_upvotes: Option<FederationMode>,
|
||||
/// What kind of comment downvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_downvotes: Option<FederationMode>,
|
||||
}
|
||||
|
||||
|
@ -330,6 +448,7 @@ pub struct GetSiteResponse {
|
|||
pub site_view: SiteView,
|
||||
pub admins: Vec<PersonView>,
|
||||
pub version: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_user: Option<MyUserInfo>,
|
||||
pub all_languages: Vec<Language>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
|
@ -338,9 +457,12 @@ pub struct GetSiteResponse {
|
|||
/// deprecated, use /api/v3/custom_emoji/list
|
||||
pub custom_emojis: Vec<()>,
|
||||
/// If the site has any taglines, a random one is included here for displaying
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub tagline: Option<Tagline>,
|
||||
/// A list of external auth methods your site supports.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub oauth_providers: Option<Vec<PublicOAuthProvider>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin_oauth_providers: Option<Vec<OAuthProvider>>,
|
||||
pub blocked_urls: Vec<LocalSiteUrlBlocklist>,
|
||||
}
|
||||
|
@ -352,6 +474,7 @@ pub struct GetSiteResponse {
|
|||
/// A response of federated instances.
|
||||
pub struct GetFederatedInstancesResponse {
|
||||
/// Optional, because federation may be disabled.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federated_instances: Option<FederatedInstances>,
|
||||
}
|
||||
|
||||
|
@ -387,6 +510,7 @@ pub struct ReadableFederationState {
|
|||
#[serde(flatten)]
|
||||
internal_state: FederationQueueState,
|
||||
/// timestamp of the next retry attempt (null if fail count is 0)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
next_retry: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -411,6 +535,7 @@ pub struct InstanceWithFederationState {
|
|||
pub instance: Instance,
|
||||
/// if federation to this instance is or was active, show state of outgoing federation to this
|
||||
/// instance
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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.
|
||||
pub struct PurgePerson {
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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.
|
||||
pub struct PurgeCommunity {
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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.
|
||||
pub struct PurgePost {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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.
|
||||
pub struct PurgeComment {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -461,8 +590,11 @@ pub struct PurgeComment {
|
|||
/// Fetches a list of registration applications.
|
||||
pub struct ListRegistrationApplications {
|
||||
/// Only shows the unread applications (IE those without an admin actor)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
|
@ -491,6 +623,7 @@ pub struct GetRegistrationApplication {
|
|||
pub struct ApproveRegistrationApplication {
|
||||
pub id: RegistrationApplicationId,
|
||||
pub approve: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub deny_reason: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ pub struct ListTaglinesResponse {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Fetches a list of taglines.
|
||||
pub struct ListTaglines {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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 registration = RegistrationApplication::find_by_local_user_id(pool, local_user_id).await?;
|
||||
if registration.admin_id.is_some() {
|
||||
Err(LemmyErrorType::RegistrationDenied(registration.deny_reason))?
|
||||
Err(LemmyErrorType::RegistrationDenied {
|
||||
reason: registration.deny_reason,
|
||||
})?
|
||||
} else {
|
||||
Err(LemmyErrorType::RegistrationApplicationIsPending)?
|
||||
}
|
||||
|
|
|
@ -54,15 +54,24 @@ impl UrlVerifier for VerifyUrlData {
|
|||
use FederationError::*;
|
||||
check_apub_id_valid(url, &local_site_data).map_err(|err| match err {
|
||||
LemmyError {
|
||||
error_type: LemmyErrorType::FederationError(Some(FederationDisabled)),
|
||||
error_type:
|
||||
LemmyErrorType::FederationError {
|
||||
error: Some(FederationDisabled),
|
||||
},
|
||||
..
|
||||
} => ActivityPubError::Other("Federation disabled".into()),
|
||||
LemmyError {
|
||||
error_type: LemmyErrorType::FederationError(Some(DomainBlocked(domain))),
|
||||
error_type:
|
||||
LemmyErrorType::FederationError {
|
||||
error: Some(DomainBlocked(domain)),
|
||||
},
|
||||
..
|
||||
} => ActivityPubError::Other(format!("Domain {domain:?} is blocked")),
|
||||
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("Failed validating apub id".into()),
|
||||
|
|
|
@ -174,8 +174,9 @@ pub struct LtreeDef(pub String);
|
|||
|
||||
#[repr(transparent)]
|
||||
#[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", ts(export))]
|
||||
pub struct DbUrl(pub(crate) Box<Url>);
|
||||
|
||||
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")]
|
||||
impl ToSql<Text, Pg> for DbUrl {
|
||||
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;
|
||||
|
||||
#[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)]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
pub struct SensitiveString(String);
|
||||
|
||||
impl SensitiveString {
|
||||
|
@ -39,19 +40,3 @@ impl From<String> for SensitiveString {
|
|||
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.
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
/// Whether the comment has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
|
|
|
@ -25,8 +25,10 @@ pub struct CommentReport {
|
|||
pub original_comment_text: String,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
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.
|
||||
pub title: String,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// Whether the community is removed by a mod.
|
||||
pub removed: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
/// Whether the community has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
|
@ -45,8 +47,10 @@ pub struct Community {
|
|||
#[serde(skip)]
|
||||
pub last_refreshed_at: DateTime<Utc>,
|
||||
/// A URL for an icon.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<DbUrl>,
|
||||
/// A URL for a banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(skip))]
|
||||
#[serde(skip)]
|
||||
|
@ -67,6 +71,7 @@ pub struct Community {
|
|||
pub featured_url: Option<DbUrl>,
|
||||
pub visibility: CommunityVisibility,
|
||||
/// A shorter, one-line description of the site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ pub struct CustomEmoji {
|
|||
pub alt_text: String,
|
||||
pub category: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,13 @@ use ts_rs::TS;
|
|||
pub struct FederationQueueState {
|
||||
pub instance_id: InstanceId,
|
||||
/// the last successfully sent activity id
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_id: Option<ActivityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_published_time: Option<DateTime<Utc>>,
|
||||
/// how many failed attempts have been made to send the next activity
|
||||
pub fail_count: i32,
|
||||
/// 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>>,
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ use ts_rs::TS;
|
|||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
||||
pub struct LocalImage {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub local_user_id: Option<LocalUserId>,
|
||||
pub pictrs_alias: String,
|
||||
pub pictrs_delete_token: String,
|
||||
|
|
|
@ -19,8 +19,11 @@ pub struct Instance {
|
|||
pub id: InstanceId,
|
||||
pub domain: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub software: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub version: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ pub struct LocalSite {
|
|||
/// Whether emails are required.
|
||||
pub require_email_verification: bool,
|
||||
/// An optional registration application questionnaire in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
/// Whether the instance is private or public.
|
||||
pub private_instance: bool,
|
||||
|
@ -40,12 +41,14 @@ pub struct LocalSite {
|
|||
pub default_theme: String,
|
||||
pub default_post_listing_type: ListingType,
|
||||
/// An optional legal disclaimer page.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
/// Whether to hide mod names on the modlog.
|
||||
pub hide_modlog_mod_names: bool,
|
||||
/// Whether new applications email admins.
|
||||
pub application_email_admins: bool,
|
||||
/// An optional regex to filter words.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
/// The max actor name length.
|
||||
pub actor_name_max_length: i32,
|
||||
|
@ -56,6 +59,7 @@ pub struct LocalSite {
|
|||
/// The captcha difficulty.
|
||||
pub captcha_difficulty: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub registration_mode: RegistrationMode,
|
||||
/// Whether to email admins on new reports.
|
||||
|
|
|
@ -34,6 +34,7 @@ pub struct LocalSiteRateLimit {
|
|||
pub search: i32,
|
||||
pub search_per_second: i32,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub import_user_settings: i32,
|
||||
pub import_user_settings_per_second: i32,
|
||||
|
|
|
@ -16,6 +16,7 @@ pub struct LocalSiteUrlBlocklist {
|
|||
pub id: i32,
|
||||
pub url: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ pub struct LocalUser {
|
|||
pub person_id: PersonId,
|
||||
#[serde(skip)]
|
||||
pub password_encrypted: Option<SensitiveString>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Whether to show NSFW content.
|
||||
pub show_nsfw: bool,
|
||||
|
|
|
@ -24,7 +24,9 @@ pub struct LoginToken {
|
|||
pub published: DateTime<Utc>,
|
||||
/// 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.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ip: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub user_agent: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ pub struct ModRemovePost {
|
|||
pub id: i32,
|
||||
pub mod_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub when_: DateTime<Utc>,
|
||||
|
@ -105,6 +106,7 @@ pub struct ModRemoveComment {
|
|||
pub id: i32,
|
||||
pub mod_person_id: PersonId,
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub when_: DateTime<Utc>,
|
||||
|
@ -130,6 +132,7 @@ pub struct ModRemoveCommunity {
|
|||
pub id: i32,
|
||||
pub mod_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub when_: DateTime<Utc>,
|
||||
|
@ -156,8 +159,10 @@ pub struct ModBanFromCommunity {
|
|||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
@ -184,8 +189,10 @@ pub struct ModBan {
|
|||
pub id: i32,
|
||||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires: Option<DateTime<Utc>>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
@ -211,6 +218,7 @@ pub struct ModHideCommunity {
|
|||
pub community_id: CommunityId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub when_: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub hidden: bool,
|
||||
}
|
||||
|
@ -303,6 +311,7 @@ pub struct ModAddForm {
|
|||
pub struct AdminPurgePerson {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
@ -324,6 +333,7 @@ pub struct AdminPurgePersonForm {
|
|||
pub struct AdminPurgeCommunity {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
@ -346,6 +356,7 @@ pub struct AdminPurgePost {
|
|||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
@ -369,6 +380,7 @@ pub struct AdminPurgeComment {
|
|||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ pub struct OAuthAccount {
|
|||
pub oauth_provider_id: OAuthProviderId,
|
||||
pub oauth_user_id: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ pub struct OAuthProvider {
|
|||
/// switch to enable or disable an oauth provider
|
||||
pub enabled: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -22,16 +22,20 @@ pub struct Person {
|
|||
pub id: PersonId,
|
||||
pub name: String,
|
||||
/// A shorter display name.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub display_name: Option<String>,
|
||||
/// A URL for an avatar.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub avatar: Option<DbUrl>,
|
||||
/// Whether the person is banned.
|
||||
pub banned: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
/// The federated actor_id.
|
||||
pub actor_id: DbUrl,
|
||||
/// An optional bio, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub bio: Option<String>,
|
||||
/// Whether the person is local to our site.
|
||||
pub local: bool,
|
||||
|
@ -42,6 +46,7 @@ pub struct Person {
|
|||
#[serde(skip)]
|
||||
pub last_refreshed_at: DateTime<Utc>,
|
||||
/// A URL for a banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
/// Whether the person is deleted.
|
||||
pub deleted: bool,
|
||||
|
@ -49,10 +54,12 @@ pub struct Person {
|
|||
#[serde(skip, default = "placeholder_apub_url")]
|
||||
pub inbox_url: DbUrl,
|
||||
/// A matrix id, usually given an @person:matrix.org
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether the person is a bot account.
|
||||
pub bot_account: bool,
|
||||
/// When their ban, if it exists, expires, if at all.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ban_expires: Option<DateTime<Utc>>,
|
||||
pub instance_id: InstanceId,
|
||||
}
|
||||
|
|
|
@ -17,10 +17,11 @@ use ts_rs::TS;
|
|||
pub struct Post {
|
||||
pub id: PostId,
|
||||
pub name: String,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
/// An optional link / url for the post.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<DbUrl>,
|
||||
/// An optional post body, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
pub creator_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
|
@ -29,35 +30,40 @@ pub struct Post {
|
|||
/// Whether the post is locked.
|
||||
pub locked: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
/// Whether the post is deleted.
|
||||
pub deleted: bool,
|
||||
/// Whether the post is NSFW.
|
||||
pub nsfw: bool,
|
||||
/// A title for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_title: Option<String>,
|
||||
/// A description for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
/// A thumbnail picture url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub thumbnail_url: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
/// The federated activity id / ap_id.
|
||||
pub ap_id: DbUrl,
|
||||
/// Whether the post is local.
|
||||
pub local: bool,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
/// A video url for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_video_url: Option<DbUrl>,
|
||||
pub language_id: LanguageId,
|
||||
/// Whether the post is featured to its community.
|
||||
pub featured_community: bool,
|
||||
/// Whether the post is featured to its site.
|
||||
pub featured_local: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url_content_type: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
/// 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>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,17 @@ pub struct PostReport {
|
|||
/// The original post title.
|
||||
pub original_post_name: String,
|
||||
/// The original post url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_post_url: Option<DbUrl>,
|
||||
/// The original post body.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_post_body: Option<String>,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ pub struct PrivateMessage {
|
|||
pub deleted: bool,
|
||||
pub read: bool,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
pub ap_id: DbUrl,
|
||||
pub local: bool,
|
||||
|
|
|
@ -29,8 +29,10 @@ pub struct PrivateMessageReport {
|
|||
pub original_pm_text: String,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@ pub struct RegistrationApplication {
|
|||
pub id: RegistrationApplicationId,
|
||||
pub local_user_id: LocalUserId,
|
||||
pub answer: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub deny_reason: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
}
|
||||
|
|
|
@ -21,14 +21,19 @@ pub struct Site {
|
|||
pub id: SiteId,
|
||||
pub name: String,
|
||||
/// A sidebar for the site in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
/// An icon URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<DbUrl>,
|
||||
/// A banner url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
/// A shorter, one-line description of the site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// The federated actor_id.
|
||||
pub actor_id: DbUrl,
|
||||
|
@ -43,6 +48,7 @@ pub struct Site {
|
|||
pub instance_id: InstanceId,
|
||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ pub struct Tagline {
|
|||
pub id: i32,
|
||||
pub content: String,
|
||||
pub published: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,9 @@ pub struct CommentReportView {
|
|||
pub creator_blocked: bool,
|
||||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver: Option<Person>,
|
||||
}
|
||||
|
||||
|
@ -71,6 +73,7 @@ pub struct CommentView {
|
|||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
pub creator_blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
}
|
||||
|
||||
|
@ -106,9 +109,11 @@ pub struct PostReportView {
|
|||
pub read: bool,
|
||||
pub hidden: bool,
|
||||
pub creator_blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
pub unread_comments: i64,
|
||||
pub counts: PostAggregates,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver: Option<Person>,
|
||||
}
|
||||
|
||||
|
@ -131,6 +136,7 @@ pub struct PostView {
|
|||
pub post: Post,
|
||||
pub creator: Person,
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub image_details: Option<ImageDetails>,
|
||||
pub creator_banned_from_community: bool,
|
||||
pub banned_from_community: bool,
|
||||
|
@ -142,6 +148,7 @@ pub struct PostView {
|
|||
pub read: bool,
|
||||
pub hidden: bool,
|
||||
pub creator_blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
pub unread_comments: i64,
|
||||
}
|
||||
|
@ -168,6 +175,7 @@ pub struct PrivateMessageReportView {
|
|||
pub private_message: PrivateMessage,
|
||||
pub private_message_creator: Person,
|
||||
pub creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver: Option<Person>,
|
||||
}
|
||||
|
||||
|
@ -181,6 +189,7 @@ pub struct RegistrationApplicationView {
|
|||
pub registration_application: RegistrationApplication,
|
||||
pub creator_local_user: LocalUser,
|
||||
pub creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ pub struct PersonMentionView {
|
|||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
pub creator_blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
}
|
||||
|
||||
|
@ -133,6 +134,7 @@ pub struct CommentReplyView {
|
|||
pub subscribed: SubscribedType,
|
||||
pub saved: bool,
|
||||
pub creator_blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_vote: Option<i16>,
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ use ts_rs::TS;
|
|||
/// When someone is added as a community moderator.
|
||||
pub struct ModAddCommunityView {
|
||||
pub mod_add_community: ModAddCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub modded_person: Person,
|
||||
|
@ -52,6 +53,7 @@ pub struct ModAddCommunityView {
|
|||
/// When someone is added as a site moderator.
|
||||
pub struct ModAddView {
|
||||
pub mod_add: ModAdd,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub modded_person: Person,
|
||||
}
|
||||
|
@ -64,6 +66,7 @@ pub struct ModAddView {
|
|||
/// When someone is banned from a community.
|
||||
pub struct ModBanFromCommunityView {
|
||||
pub mod_ban_from_community: ModBanFromCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub banned_person: Person,
|
||||
|
@ -77,6 +80,7 @@ pub struct ModBanFromCommunityView {
|
|||
/// When someone is banned from the site.
|
||||
pub struct ModBanView {
|
||||
pub mod_ban: ModBan,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub banned_person: Person,
|
||||
}
|
||||
|
@ -89,6 +93,7 @@ pub struct ModBanView {
|
|||
/// When a community is hidden from public view.
|
||||
pub struct ModHideCommunityView {
|
||||
pub mod_hide_community: ModHideCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
@ -101,6 +106,7 @@ pub struct ModHideCommunityView {
|
|||
/// When a moderator locks a post (prevents new comments being made).
|
||||
pub struct ModLockPostView {
|
||||
pub mod_lock_post: ModLockPost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub post: Post,
|
||||
pub community: Community,
|
||||
|
@ -114,6 +120,7 @@ pub struct ModLockPostView {
|
|||
/// When a moderator removes a comment.
|
||||
pub struct ModRemoveCommentView {
|
||||
pub mod_remove_comment: ModRemoveComment,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub comment: Comment,
|
||||
pub commenter: Person,
|
||||
|
@ -129,6 +136,7 @@ pub struct ModRemoveCommentView {
|
|||
/// When a moderator removes a community.
|
||||
pub struct ModRemoveCommunityView {
|
||||
pub mod_remove_community: ModRemoveCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
@ -141,6 +149,7 @@ pub struct ModRemoveCommunityView {
|
|||
/// When a moderator removes a post.
|
||||
pub struct ModRemovePostView {
|
||||
pub mod_remove_post: ModRemovePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub post: Post,
|
||||
pub community: Community,
|
||||
|
@ -154,6 +163,7 @@ pub struct ModRemovePostView {
|
|||
/// When a moderator features a post on a community (pins it to the top).
|
||||
pub struct ModFeaturePostView {
|
||||
pub mod_feature_post: ModFeaturePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub post: Post,
|
||||
pub community: Community,
|
||||
|
@ -167,6 +177,7 @@ pub struct ModFeaturePostView {
|
|||
/// When a moderator transfers a community to a new owner.
|
||||
pub struct ModTransferCommunityView {
|
||||
pub mod_transfer_community: ModTransferCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub modded_person: Person,
|
||||
|
@ -180,6 +191,7 @@ pub struct ModTransferCommunityView {
|
|||
/// When an admin purges a comment.
|
||||
pub struct AdminPurgeCommentView {
|
||||
pub admin_purge_comment: AdminPurgeComment,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
pub post: Post,
|
||||
}
|
||||
|
@ -192,6 +204,7 @@ pub struct AdminPurgeCommentView {
|
|||
/// When an admin purges a community.
|
||||
pub struct AdminPurgeCommunityView {
|
||||
pub admin_purge_community: AdminPurgeCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
|
@ -203,6 +216,7 @@ pub struct AdminPurgeCommunityView {
|
|||
/// When an admin purges a person.
|
||||
pub struct AdminPurgePersonView {
|
||||
pub admin_purge_person: AdminPurgePerson,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
|
@ -214,6 +228,7 @@ pub struct AdminPurgePersonView {
|
|||
/// When an admin purges a post.
|
||||
pub struct AdminPurgePostView {
|
||||
pub admin_purge_post: AdminPurgePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
@ -225,12 +240,19 @@ pub struct AdminPurgePostView {
|
|||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Querying / filtering the modlog.
|
||||
pub struct ModlogListParams {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub mod_person_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub other_person_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
pub hide_modlog_names: bool,
|
||||
}
|
||||
|
|
|
@ -119,7 +119,10 @@ pub enum LemmyErrorType {
|
|||
InvalidUrl,
|
||||
EmailSendFailed,
|
||||
Slurs,
|
||||
RegistrationDenied(Option<String>),
|
||||
RegistrationDenied {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
reason: Option<String>,
|
||||
},
|
||||
SiteNameRequired,
|
||||
SiteNameLengthOverflow,
|
||||
PermissiveRegex,
|
||||
|
@ -147,7 +150,10 @@ pub enum LemmyErrorType {
|
|||
CommunityHasNoFollowers,
|
||||
PostScheduleTimeMustBeInFuture,
|
||||
TooManyScheduledPosts,
|
||||
FederationError(Option<FederationError>),
|
||||
FederationError {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
error: Option<FederationError>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Federation related errors, these dont need to be translated.
|
||||
|
@ -262,7 +268,7 @@ cfg_if! {
|
|||
fn from(error_type: FederationError) -> Self {
|
||||
let inner = anyhow::anyhow!("{}", error_type);
|
||||
LemmyError {
|
||||
error_type: LemmyErrorType::FederationError(Some(error_type)),
|
||||
error_type: LemmyErrorType::FederationError { error: Some(error_type) },
|
||||
inner,
|
||||
context: Backtrace::capture(),
|
||||
}
|
||||
|
|
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