mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
99d3558a46
commit
f1ab81b853
22
daemon.py
22
daemon.py
|
@ -119,7 +119,7 @@ from inbox import run_inbox_queue_watchdog
|
||||||
from inbox import save_post_to_inbox_queue
|
from inbox import save_post_to_inbox_queue
|
||||||
from inbox import populate_replies
|
from inbox import populate_replies
|
||||||
from inbox import receive_edit_to_post
|
from inbox import receive_edit_to_post
|
||||||
from follow import get_followers_for_domain
|
from follow import get_followers_sync_json
|
||||||
from follow import follower_approval_active
|
from follow import follower_approval_active
|
||||||
from follow import is_following_actor
|
from follow import is_following_actor
|
||||||
from follow import get_following_feed
|
from follow import get_following_feed
|
||||||
|
@ -16917,20 +16917,12 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# check authorized fetch
|
# check authorized fetch
|
||||||
if self._secure_mode(curr_session, proxy_type):
|
if self._secure_mode(curr_session, proxy_type):
|
||||||
nickname = get_nickname_from_actor(self.path)
|
nickname = get_nickname_from_actor(self.path)
|
||||||
sync_list = \
|
sync_json = \
|
||||||
get_followers_for_domain(self.server.base_dir,
|
get_followers_sync_json(self.server.base_dir,
|
||||||
nickname, self.server.domain,
|
nickname, self.server.domain,
|
||||||
calling_domain)
|
self.server.http_prefix,
|
||||||
id_str = self.server.http_prefix + '://' + \
|
self.server.domain_full,
|
||||||
self.server.domain_full + \
|
calling_domain)
|
||||||
self.path.replace('/followers_synchronization',
|
|
||||||
'/followers?domain=' + calling_domain)
|
|
||||||
sync_json = {
|
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
||||||
'id': id_str,
|
|
||||||
'orderedItems': sync_list,
|
|
||||||
'type': 'OrderedCollection'
|
|
||||||
}
|
|
||||||
msg_str = json.dumps(sync_json, ensure_ascii=False)
|
msg_str = json.dumps(sync_json, ensure_ascii=False)
|
||||||
msg_str = self._convert_domains(calling_domain, referer_domain,
|
msg_str = self._convert_domains(calling_domain, referer_domain,
|
||||||
msg_str)
|
msg_str)
|
||||||
|
|
29
follow.py
29
follow.py
|
@ -28,7 +28,6 @@ from posts import get_person_box
|
||||||
from utils import load_json
|
from utils import load_json
|
||||||
from utils import save_json
|
from utils import save_json
|
||||||
from utils import is_account_dir
|
from utils import is_account_dir
|
||||||
from utils import get_user_paths
|
|
||||||
from utils import acct_dir
|
from utils import acct_dir
|
||||||
from utils import has_group_type
|
from utils import has_group_type
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
|
@ -1361,9 +1360,9 @@ def deny_follow_request_via_server(session,
|
||||||
return deny_html
|
return deny_html
|
||||||
|
|
||||||
|
|
||||||
def get_followers_for_domain(base_dir: str,
|
def _get_followers_for_domain(base_dir: str,
|
||||||
nickname: str, domain: str,
|
nickname: str, domain: str,
|
||||||
search_domain: str) -> []:
|
search_domain: str) -> []:
|
||||||
"""Returns the followers for a given domain
|
"""Returns the followers for a given domain
|
||||||
this is used for followers synchronization
|
this is used for followers synchronization
|
||||||
"""
|
"""
|
||||||
|
@ -1405,6 +1404,28 @@ def get_followers_for_domain(base_dir: str,
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def get_followers_sync_json(base_dir: str,
|
||||||
|
nickname: str, domain: str,
|
||||||
|
http_prefix: str, domain_full: str,
|
||||||
|
search_domain: str) -> {}:
|
||||||
|
"""Returns a response for followers synchronization
|
||||||
|
See https://github.com/mastodon/mastodon/pull/14510
|
||||||
|
"""
|
||||||
|
sync_list = \
|
||||||
|
_get_followers_for_domain(base_dir,
|
||||||
|
nickname, domain,
|
||||||
|
search_domain)
|
||||||
|
id_str = http_prefix + '://' + domain_full + \
|
||||||
|
'/users/' + nickname + '/followers?domain=' + search_domain
|
||||||
|
sync_json = {
|
||||||
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
|
'id': id_str,
|
||||||
|
'orderedItems': sync_list,
|
||||||
|
'type': 'OrderedCollection'
|
||||||
|
}
|
||||||
|
return sync_json
|
||||||
|
|
||||||
|
|
||||||
def get_followers_of_actor(base_dir: str, actor: str, debug: bool) -> {}:
|
def get_followers_of_actor(base_dir: str, actor: str, debug: bool) -> {}:
|
||||||
"""In a shared inbox if we receive a post we know who it's from
|
"""In a shared inbox if we receive a post we know who it's from
|
||||||
and if it's addressed to followers then we need to get a list of those.
|
and if it's addressed to followers then we need to get a list of those.
|
||||||
|
|
Loading…
Reference in New Issue