Move settings to database (#79)

* Adding site settings to DB.

* v0.17.0-rc.47

* Forgot some fields

* v0.17.0-rc.48

* Fixing some missing fields.

* v0.17.0-rc.49

* Fixing some missing fields.

* v0.17.0-rc.50

* Fixing some missing fields 3.

* v0.17.0-rc.51
This commit is contained in:
Dessalines 2022-11-05 15:50:19 -04:00 committed by GitHub
parent 00189a6462
commit ad5be5ce3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 271 additions and 20 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "lemmy-js-client", "name": "lemmy-js-client",
"description": "A javascript / typescript client for Lemmy", "description": "A javascript / typescript client for Lemmy",
"version": "0.17.0-rc.46", "version": "0.17.0-rc.51",
"author": "Dessalines <tyhou13@gmx.com>", "author": "Dessalines <tyhou13@gmx.com>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./dist/index.js", "main": "./dist/index.js",

View file

@ -221,8 +221,111 @@ export class CreateSite {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
application_email_admins: Option<boolean>; application_email_admins: Option<boolean>;
hide_modlog_mod_names: Option<boolean>;
auth: string; auth: string;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
hide_modlog_mod_names: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
discussion_languages: Option<number[]>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
legal_information: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
slur_filter_regex: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
actor_name_max_length: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_message: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_message_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_post: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_post_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_register: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_register_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_image: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_image_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_comment: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_comment_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_search: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_search_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_enabled: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_debug: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_strict_allowlist: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_http_fetch_retry_limit: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_worker_count: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
captcha_enabled: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
captcha_difficulty: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
allowed_instances: Option<string[]>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
blocked_instances: Option<string[]>;
constructor(init: CreateSite) { constructor(init: CreateSite) {
Object.assign(this, init); Object.assign(this, init);
} }
@ -288,11 +391,11 @@ export class EditSite {
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
legal_information: Option<string>; default_post_listing_type: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
default_post_listing_type: Option<string>; legal_information: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
@ -301,6 +404,102 @@ export class EditSite {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
hide_modlog_mod_names: Option<boolean>; hide_modlog_mod_names: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
discussion_languages: Option<number[]>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
slur_filter_regex: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
actor_name_max_length: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_message: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_message_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_post: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_post_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_register: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_register_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_image: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_image_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_comment: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_comment_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_search: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
rate_limit_search_per_second: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_enabled: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_debug: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_strict_allowlist: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_http_fetch_retry_limit: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
federation_worker_count: Option<number>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
captcha_enabled: Option<boolean>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
captcha_difficulty: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
allowed_instances: Option<string[]>;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
blocked_instances: Option<string[]>;
auth: string; auth: string;
constructor(init: EditSite) { constructor(init: EditSite) {
@ -325,14 +524,8 @@ export class SiteResponse {
} }
export class GetSiteResponse { export class GetSiteResponse {
/**
* Optional, because the site might not be set up yet.
*/
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
@Type(() => SiteView) @Type(() => SiteView)
site_view: Option<SiteView>; site_view: SiteView;
@Type(() => PersonViewSafe) @Type(() => PersonViewSafe)
admins: PersonViewSafe[]; admins: PersonViewSafe[];
online: number; online: number;
@ -352,6 +545,7 @@ export class GetSiteResponse {
federated_instances: Option<FederatedInstances>; federated_instances: Option<FederatedInstances>;
@Type(() => Language) @Type(() => Language)
all_languages: Language[]; all_languages: Language[];
discussion_languages: number[];
} }
/** /**

View file

@ -16,6 +16,7 @@ export class LocalUserSettings {
interface_language: string; interface_language: string;
show_avatars: boolean; show_avatars: boolean;
send_notifications_to_email: boolean; send_notifications_to_email: boolean;
validator_time: string;
show_bot_accounts: boolean; show_bot_accounts: boolean;
show_scores: boolean; show_scores: boolean;
show_read_posts: boolean; show_read_posts: boolean;
@ -53,7 +54,10 @@ export class PersonSafe {
banner: Option<string>; banner: Option<string>;
deleted: boolean; deleted: boolean;
inbox_url: string; inbox_url: string;
shared_inbox_url: string; @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
shared_inbox_url: Option<string>;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
@ -64,6 +68,7 @@ export class PersonSafe {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
ban_expires: Option<string>; ban_expires: Option<string>;
instance_id: number;
} }
export class Site { export class Site {
@ -78,9 +83,6 @@ export class Site {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
updated: Option<string>; updated: Option<string>;
enable_downvotes: boolean;
open_registration: boolean;
enable_nsfw: boolean;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
@ -93,6 +95,21 @@ export class Site {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
description: Option<string>; description: Option<string>;
actor_id: string;
last_refreshed_at: string;
inbox_url: string;
private_key: Option<string>;
public_key: string;
instance_id: number;
}
export class LocalSite {
id: number;
site_id: number;
site_setup: boolean;
enable_downvotes: boolean;
open_registration: boolean;
enable_nsfw: boolean;
community_creation_admin_only: boolean; community_creation_admin_only: boolean;
require_email_verification: boolean; require_email_verification: boolean;
require_application: boolean; require_application: boolean;
@ -103,19 +120,51 @@ export class Site {
private_instance: boolean; private_instance: boolean;
default_theme: string; default_theme: string;
default_post_listing_type: string; default_post_listing_type: string;
actor_id: string;
last_refreshed_at: string;
inbox_url: string;
public_key: string;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
legal_information: Option<string>; legal_information: Option<string>;
hide_modlog_mod_names: boolean;
application_email_admins: boolean; application_email_admins: boolean;
@Transform(({ value }) => toOption(value), { toClassOnly: true }) @Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
hide_modlog_mod_names: Option<boolean>; slur_filter_regex: Option<string>;
actor_name_max_length: number;
federation_enabled: boolean;
federation_debug: boolean;
federation_strict_allowlist: boolean;
federation_http_fetch_retry_limit: number;
federation_worker_count: number;
captcha_enabled: boolean;
captcha_difficulty: string;
published: string;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
updated: Option<string>;
}
export class LocalSiteRateLimit {
id: number;
local_site_id: number;
message: number;
message_per_second: number;
post: number;
post_per_second: number;
register: number;
register_per_second: number;
image: number;
image_per_second: number;
comment: number;
comment_per_second: number;
search: number;
search_per_second: number;
published: string;
@Transform(({ value }) => toOption(value), { toClassOnly: true })
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose()
updated: Option<string>;
} }
export class PrivateMessage { export class PrivateMessage {
@ -424,7 +473,9 @@ export class CommunitySafe {
@Transform(({ value }) => toUndefined(value), { toPlainOnly: true }) @Transform(({ value }) => toUndefined(value), { toPlainOnly: true })
@Expose() @Expose()
banner: Option<string>; banner: Option<string>;
hidden: boolean;
posting_restricted_to_mods: boolean; posting_restricted_to_mods: boolean;
instance_id: number;
} }
export class CommentReport { export class CommentReport {

View file

@ -19,6 +19,8 @@ import {
CommentReply, CommentReply,
CommentReport, CommentReport,
CommunitySafe, CommunitySafe,
LocalSite,
LocalSiteRateLimit,
LocalUserSettings, LocalUserSettings,
ModAdd, ModAdd,
ModAddCommunity, ModAddCommunity,
@ -81,6 +83,10 @@ export class LocalUserSettingsView {
export class SiteView { export class SiteView {
@Type(() => Site) @Type(() => Site)
site: Site; site: Site;
@Type(() => LocalSite)
local_site: LocalSite;
@Type(() => LocalSiteRateLimit)
local_site_rate_limit: LocalSiteRateLimit;
counts: SiteAggregates; counts: SiteAggregates;
} }