Skip to content

Commit

Permalink
Add site option for default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Feb 21, 2022
1 parent 7f9b55e commit f756b3d
Show file tree
Hide file tree
Showing 11 changed files with 649 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/defaults.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions crates/api_common/src/site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}

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

Expand Down
1 change: 1 addition & 0 deletions crates/api_crud/src/site/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand Down
1 change: 1 addition & 0 deletions crates/api_crud/src/site/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down
1 change: 1 addition & 0 deletions crates/api_crud/src/site/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};

Expand Down
1 change: 1 addition & 0 deletions crates/db_schema/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ table! {
inbox_url -> Text,
private_key -> Nullable<Text>,
public_key -> Text,
default_theme -> Text,
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/db_schema/src/source/site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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>,
}
2 changes: 2 additions & 0 deletions crates/utils/src/settings/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}
Loading

0 comments on commit f756b3d

Please sign in to comment.