Cleaning up.
This commit is contained in:
parent
b41edb35aa
commit
63cf0a8eb6
1 changed files with 6 additions and 13 deletions
|
@ -111,23 +111,16 @@ pub(in crate::api) async fn linked_instances(pool: &DbPool) -> Result<Vec<String
|
|||
instances.push(Url::parse(actor_id)?.host_str().unwrap_or("").to_string());
|
||||
}
|
||||
|
||||
let mut allowed_instances = Settings::get().get_allowed_instances();
|
||||
instances.append(&mut allowed_instances);
|
||||
|
||||
let blocked_instances = Settings::get().get_blocked_instances();
|
||||
for blocked in &blocked_instances {
|
||||
instances.retain(|i| !i.eq(blocked));
|
||||
}
|
||||
instances.extend(Settings::get().get_allowed_instances().into_iter());
|
||||
instances.retain(|a| {
|
||||
!Settings::get().get_blocked_instances().contains(a)
|
||||
&& !a.eq("")
|
||||
&& !a.eq(&Settings::get().hostname)
|
||||
});
|
||||
|
||||
// Sort and remove dupes
|
||||
instances.sort_unstable();
|
||||
instances.dedup();
|
||||
|
||||
// Remove the empties
|
||||
instances.retain(|d| !d.eq(""));
|
||||
|
||||
// Remove the current instance
|
||||
instances.retain(|d| !d.eq(&Settings::get().hostname));
|
||||
}
|
||||
|
||||
Ok(instances)
|
||||
|
|
Loading…
Reference in a new issue