Add site option for default theme (#2104)

pull/2107/head
Nutomic 2 years ago committed by GitHub
parent 7f9b55e793
commit 9f5183fe98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"

@ -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>,
}

@ -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()
};

@ -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?;

@ -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()
};

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

@ -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>,
}

@ -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>,
}

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

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