summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/federation-test/docker-compose.yml4
-rw-r--r--server/src/apub/community.rs2
-rw-r--r--server/src/apub/puller.rs28
3 files changed, 17 insertions, 17 deletions
diff --git a/docker/federation-test/docker-compose.yml b/docker/federation-test/docker-compose.yml
index 39079d10..464d7081 100644
--- a/docker/federation-test/docker-compose.yml
+++ b/docker/federation-test/docker-compose.yml
@@ -6,7 +6,7 @@ services:
ports:
- "127.0.0.1:8540:8540"
environment:
- - LEMMY_HOSTNAME=localhost:8540
+ - LEMMY_HOSTNAME=lemmy_alpha:8540
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_alpha:5432/lemmy
- LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
@@ -32,7 +32,7 @@ services:
ports:
- "127.0.0.1:8541:8541"
environment:
- - LEMMY_HOSTNAME=localhost:8541
+ - LEMMY_HOSTNAME=lemmy_beta:8541
- LEMMY_DATABASE_URL=postgres://lemmy:password@postgres_beta:5432/lemmy
- LEMMY_JWT_SECRET=changeme
- LEMMY_FRONT_END_DIR=/app/dist
diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs
index bbb9da6e..b5b365d0 100644
--- a/server/src/apub/community.rs
+++ b/server/src/apub/community.rs
@@ -15,7 +15,7 @@ use serde::Deserialize;
impl Community {
pub fn as_group(&self) -> Result<Group, Error> {
- let base_url = make_apub_endpoint("c", &self.id);
+ let base_url = make_apub_endpoint("c", &self.name);
let mut group = Group::default();
let oprops: &mut ObjectProperties = group.as_mut();
diff --git a/server/src/apub/puller.rs b/server/src/apub/puller.rs
index 1465415b..aa34ce50 100644
--- a/server/src/apub/puller.rs
+++ b/server/src/apub/puller.rs
@@ -2,10 +2,10 @@ extern crate reqwest;
use crate::api::community::{GetCommunityResponse, ListCommunitiesResponse};
use crate::api::post::GetPosts;
-use crate::apub::parse_apub_endpoint;
use crate::db::community_view::CommunityView;
use crate::settings::Settings;
use activitystreams::actor::apub::Group;
+use activitystreams::collection::apub::UnorderedCollection;
use failure::Error;
// TODO: right now all of the data is requested on demand, for production we will need to store
@@ -38,6 +38,12 @@ pub fn get_remote_community(identifier: String) -> Result<GetCommunityResponse,
let instance = x[1];
let community_uri = format!("http://{}/federation/c/{}", instance, name);
let community: Group = reqwest::get(&community_uri)?.json()?;
+ let followers_uri = &community
+ .ap_actor_props
+ .get_followers()
+ .unwrap()
+ .to_string();
+ let followers: UnorderedCollection = reqwest::get(followers_uri)?.json()?;
// TODO: looks like a bunch of data is missing from the activitypub response
// TODO: i dont think simple numeric ids are going to work, we probably need something like uuids
@@ -46,9 +52,7 @@ pub fn get_remote_community(identifier: String) -> Result<GetCommunityResponse,
admins: vec![],
community: CommunityView {
// TODO: we need to merge id and name into a single thing (stuff like @user@instance.com)
- id: parse_apub_endpoint(&community.object_props.get_id().unwrap().to_string())?
- .1
- .parse::<i32>()?,
+ id: -1, //community.object_props.get_id()
name,
title: community
.object_props
@@ -60,15 +64,7 @@ pub fn get_remote_community(identifier: String) -> Result<GetCommunityResponse,
.get_summary_xsd_string()
.map(|s| s.to_string()),
category_id: -1,
- creator_id: parse_apub_endpoint(
- &community
- .object_props
- .get_attributed_to_xsd_any_uri()
- .unwrap()
- .to_string(),
- )?
- .1
- .parse::<i32>()?,
+ creator_id: -1, //community.object_props.get_attributed_to_xsd_any_uri()
removed: false,
published: community
.object_props
@@ -86,7 +82,11 @@ pub fn get_remote_community(identifier: String) -> Result<GetCommunityResponse,
creator_name: "".to_string(),
creator_avatar: None,
category_name: "".to_string(),
- number_of_subscribers: -1,
+ number_of_subscribers: *followers
+ .collection_props
+ .get_total_items()
+ .unwrap()
+ .as_ref() as i64, // TODO: need to use the same type
number_of_posts: -1,
number_of_comments: -1,
hot_rank: -1,