about summary refs log tree commit diff
path: root/src/database/redis
diff options
context:
space:
mode:
authorVika Shleina <vika@fireburn.ru>2021-07-19 10:32:42 +0300
committerVika Shleina <vika@fireburn.ru>2021-07-19 10:55:32 +0300
commit47c3b54d1d0b276fb87d1b4b71a584e0e0c7b43d (patch)
tree9b9b9d2512a91da502187d17cb9c1e5dce398009 /src/database/redis
parent8399371adc5c48e1847061deee1936c0d64f2a85 (diff)
downloadkittybox-47c3b54d1d0b276fb87d1b4b71a584e0e0c7b43d.tar.zst
Relaxed anti-takeover URL check to simply not place redirects at foreign URLs
Diffstat (limited to 'src/database/redis')
-rw-r--r--src/database/redis/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/database/redis/mod.rs b/src/database/redis/mod.rs
index e64120f..c331e47 100644
--- a/src/database/redis/mod.rs
+++ b/src/database/redis/mod.rs
@@ -180,7 +180,7 @@ impl Storage for RedisStorage {
         .collect::<Vec<_>>())
     }
 
-    async fn put_post<'a>(&self, post: &'a serde_json::Value) -> Result<()> {
+    async fn put_post<'a>(&self, post: &'a serde_json::Value, user: &'a str) -> Result<()> {
         let mut conn = self.redis.get().await?;
         let key: &str;
         match post["properties"]["uid"][0].as_str() {
@@ -201,7 +201,7 @@ impl Storage for RedisStorage {
                 .iter()
                 .map(|i| i.as_str().unwrap().to_string())
             {
-                if url != key {
+                if url != key && url.starts_with(user) {
                     conn.hset::<&str, &str, String, ()>(
                         &"posts",
                         &url,