Add site option for default theme (#2104)

This commit is contained in:
Nutomic 2022-02-23 16:40:36 +00:00 committed by GitHub
parent 7f9b55e793
commit 9f5183fe98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 13 additions and 0 deletions

View file

@ -101,6 +101,7 @@
require_application: true
application_question: "string"
private_instance: true
default_theme: "string"
}
# the domain name of your instance (mandatory)
hostname: "unset"

View file

@ -106,6 +106,7 @@ pub struct CreateSite {
pub require_application: Option<bool>,
pub application_question: Option<String>,
pub private_instance: Option<bool>,
pub default_theme: Option<String>,
pub auth: Sensitive<String>,
}
@ -124,6 +125,7 @@ pub struct EditSite {
pub require_application: Option<bool>,
pub application_question: Option<String>,
pub private_instance: Option<bool>,
pub default_theme: Option<String>,
pub auth: Sensitive<String>,
}

View file

@ -80,6 +80,7 @@ impl PerformCrud for CreateSite {
inbox_url,
private_key: Some(Some(keypair.private_key)),
public_key: Some(keypair.public_key),
default_theme: data.default_theme.clone(),
..SiteForm::default()
};

View file

@ -68,6 +68,7 @@ impl PerformCrud for GetSite {
require_application: setup.require_application,
application_question: setup.application_question.to_owned(),
private_instance: setup.private_instance,
default_theme: setup.default_theme.to_owned(),
auth: admin_jwt,
};
create_site.perform(context, websocket_id).await?;

View file

@ -69,6 +69,7 @@ impl PerformCrud for EditSite {
require_application: data.require_application,
application_question,
private_instance: data.private_instance,
default_theme: data.default_theme.clone(),
..SiteForm::default()
};

View file

@ -460,6 +460,7 @@ table! {
inbox_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,
default_theme -> Text,
}
}

View file

@ -25,6 +25,7 @@ pub struct Site {
pub inbox_url: DbUrl,
pub private_key: Option<String>,
pub public_key: String,
pub default_theme: String,
}
#[derive(Insertable, AsChangeset, Default)]
@ -50,4 +51,5 @@ pub struct SiteForm {
pub inbox_url: Option<DbUrl>,
pub private_key: Option<Option<String>>,
pub public_key: Option<String>,
pub default_theme: Option<String>,
}

View file

@ -205,4 +205,6 @@ pub struct SetupConfig {
pub application_question: Option<String>,
#[default(None)]
pub private_instance: Option<bool>,
#[default(None)]
pub default_theme: Option<String>,
}

View file

@ -0,0 +1 @@
alter table site drop column default_theme;

View file

@ -0,0 +1 @@
alter table site add column default_theme text not null default 'browser';