about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/database/file/mod.rs1
-rw-r--r--src/frontend/mod.rs2
-rw-r--r--src/lib.rs4
3 files changed, 5 insertions, 2 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index 82987b5..78b67fb 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -440,6 +440,7 @@ impl Storage for FileStorage {
     }
 
     async fn get_setting<'a>(&self, setting: &'a str, user: &'a str) -> Result<String> {
+        log::debug!("User for getting settings: {}", user);
         let url = http_types::Url::parse(user).expect("Couldn't parse a URL");
         let mut path = relative_path::RelativePathBuf::new();
         path.push(url.origin().ascii_serialization());
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs
index b974a93..37420ac 100644
--- a/src/frontend/mod.rs
+++ b/src/frontend/mod.rs
@@ -368,7 +368,7 @@ where
         let site_name = &request
             .state()
             .storage
-            .get_setting("site_name", &request.url().host().unwrap().to_string())
+            .get_setting("site_name", &(request.url().origin().ascii_serialization().clone() + "/"))
             .await
             .unwrap_or_else(|_| "Kitty Box!".to_string());
         let mut res = next.run(request).await;
diff --git a/src/lib.rs b/src/lib.rs
index 1c6394a..dfcfe6d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -94,12 +94,14 @@ pub async fn get_app_with_file(
     media_endpoint: Option<String>,
     internal_token: Option<String>,
 ) -> App<database::FileStorage> {
+    let folder = backend_uri.strip_prefix("file://").unwrap();
+    let path = std::path::PathBuf::from(folder);
     let app = tide::with_state(ApplicationState {
         token_endpoint,
         media_endpoint,
         authorization_endpoint,
         internal_token,
-        storage: database::FileStorage::new(todo!()).await.unwrap(),
+        storage: database::FileStorage::new(path).await.unwrap(),
         http_client: surf::Client::new(),
     });