diff options
author | Vika <vika@fireburn.ru> | 2022-03-23 05:01:14 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-03-23 05:01:14 +0300 |
commit | 54914782c7632e041919746e80d3f802f6601a63 (patch) | |
tree | d54286ddb5424a16921cd0e21cb3917fa47a05a6 /src/frontend | |
parent | 8964a0330d77fe5a75d33c504791db601d2b0ac7 (diff) | |
download | kittybox-54914782c7632e041919746e80d3f802f6601a63.tar.zst |
Make the settings in the database a strong type
Diffstat (limited to 'src/frontend')
-rw-r--r-- | src/frontend/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index b594fc6..1069b92 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -270,7 +270,7 @@ pub fn homepage<D: Storage>(db: D, endpoints: IndiewebEndpoints) -> impl Filter< .and(warp::any().map(inject_db)) .then(|content: (Option<serde_json::Value>, Option<serde_json::Value>, StatusCode), endpoints: IndiewebEndpoints, host: Authority, db: D| async move { let owner = format!("https://{}/", host.as_str()); - let blog_name = db.get_setting("site_name", &owner).await + let blog_name = db.get_setting(crate::database::Settings::SiteName, &owner).await .unwrap_or_else(|_| "Kitty Box!".to_string()); let feeds = db.get_channels(&owner).await.unwrap_or_default(); match content { @@ -323,7 +323,7 @@ pub fn onboarding<D: Storage, T: hyper::client::connect::Connect + Clone + Send if body.user["type"][0] != "h-card" || body.first_post["type"][0] != "h-entry" { return Err(FrontendError::with_code(StatusCode::BAD_REQUEST, "user and first_post should be an h-card and an h-entry").into()); } - db.set_setting("site_name", user.me.as_str(), &body.blog_name) + db.set_setting(crate::database::Settings::SiteName, user.me.as_str(), &body.blog_name) .await .map_err(FrontendError::from)?; @@ -401,7 +401,7 @@ pub fn catchall<D: Storage>(db: D, endpoints: IndiewebEndpoints) -> impl Filter< .and(warp::any().map(inject_db)) .then(|content: (String, String, StatusCode), endpoints: IndiewebEndpoints, host: Authority, db: D| async move { let owner = format!("https://{}/", host.as_str()); - let blog_name = db.get_setting("site_name", &owner).await + let blog_name = db.get_setting(crate::database::Settings::SiteName, &owner).await .unwrap_or_else(|_| "Kitty Box!".to_string()); let feeds = db.get_channels(&owner).await.unwrap_or_default(); let (title, content, code) = content; |