about summary refs log tree commit diff
path: root/src/database/file
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-03-23 05:01:14 +0300
committerVika <vika@fireburn.ru>2022-03-23 05:01:14 +0300
commit54914782c7632e041919746e80d3f802f6601a63 (patch)
treed54286ddb5424a16921cd0e21cb3917fa47a05a6 /src/database/file
parent8964a0330d77fe5a75d33c504791db601d2b0ac7 (diff)
downloadkittybox-54914782c7632e041919746e80d3f802f6601a63.tar.zst
Make the settings in the database a strong type
Diffstat (limited to 'src/database/file')
-rw-r--r--src/database/file/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/database/file/mod.rs b/src/database/file/mod.rs
index af07c0c..b3856a6 100644
--- a/src/database/file/mod.rs
+++ b/src/database/file/mod.rs
@@ -1,5 +1,5 @@
 //#![warn(clippy::unwrap_used)]
-use crate::database::{filter_post, ErrorKind, Result, Storage, StorageError};
+use crate::database::{filter_post, ErrorKind, Result, Storage, StorageError, Settings};
 use std::fs::{File, OpenOptions};
 use std::io::{ErrorKind as IOErrorKind, Seek, SeekFrom, Read, Write};
 use std::time::Duration;
@@ -387,6 +387,10 @@ impl Storage for FileStorage {
                         {
                             symlink_result = std::os::windows::fs::symlink_file(relative, link);
                         }
+                        #[cfg(all(not(unix), not(windows)))]
+                        {
+                            compile_error!("Don't know how to create symlinks on non-unix non-windows platform");
+                        }
                         if let Err(e) = symlink_result {
                             Err(e.into())
                         } else {
@@ -596,7 +600,7 @@ impl Storage for FileStorage {
         }
     }
 
-    async fn get_setting(&self, setting: &'_ str, user: &'_ str) -> Result<String> {
+    async fn get_setting(&self, setting: Settings, user: &'_ str) -> Result<String> {
         log::debug!("User for getting settings: {}", user);
         let url = warp::http::Uri::try_from(user).expect("Couldn't parse a URL");
         let mut path = relative_path::RelativePathBuf::new();
@@ -626,7 +630,7 @@ impl Storage for FileStorage {
         )).await?.unwrap()
     }
 
-    async fn set_setting(&self, setting: &'_ str, user: &'_ str, value: &'_ str) -> Result<()> {
+    async fn set_setting(&self, setting: Settings, user: &'_ str, value: &'_ str) -> Result<()> {
         let url = warp::http::Uri::try_from(user).expect("Couldn't parse a URL");
         let mut path = relative_path::RelativePathBuf::new();
         path.push(url.authority().unwrap().to_string());