about summary refs log tree commit diff
path: root/src/micropub
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/micropub
parent8399371adc5c48e1847061deee1936c0d64f2a85 (diff)
Relaxed anti-takeover URL check to simply not place redirects at foreign URLs
Diffstat (limited to 'src/micropub')
-rw-r--r--src/micropub/post.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/micropub/post.rs b/src/micropub/post.rs
index 639346b..eaa603a 100644
--- a/src/micropub/post.rs
+++ b/src/micropub/post.rs
@@ -171,12 +171,7 @@ pub async fn new_post<S: Storage>(
     // This software might also be used in a multi-user setting
     // where several users or identities share one Micropub server
     // (maybe a family website or a shitpost sideblog?)
-    if post["properties"]["url"]
-        .as_array()
-        .unwrap()
-        .iter()
-        .any(|url| !url.as_str().unwrap().starts_with(user.me.as_str()))
-        || !post["properties"]["uid"][0]
+    if !post["properties"]["uid"][0]
             .as_str()
             .unwrap()
             .starts_with(user.me.as_str())
@@ -209,7 +204,7 @@ pub async fn new_post<S: Storage>(
         Err(err) => return Ok(err.into()),
     }
 
-    if let Err(err) = storage.put_post(&post).await {
+    if let Err(err) = storage.put_post(&post, user.me.as_str()).await {
         return error_json!(500, "database_error", format!("{}", err));
     }
 
@@ -303,7 +298,7 @@ async fn create_feed(
         }),
         &user,
     );
-    storage.put_post(&feed).await
+    storage.put_post(&feed, user.me.as_str()).await
 }
 
 async fn post_process_new_post<S: Storage>(