mirror of https://gitlab.com/bashrc2/epicyon
Remove follower when blocking
parent
36ec6ae397
commit
7ad89d79f3
|
@ -122,6 +122,7 @@ from follow import is_following_actor
|
||||||
from follow import get_following_feed
|
from follow import get_following_feed
|
||||||
from follow import send_follow_request
|
from follow import send_follow_request
|
||||||
from follow import unfollow_account
|
from follow import unfollow_account
|
||||||
|
from follow import remove_follower
|
||||||
from follow import create_initial_last_seen
|
from follow import create_initial_last_seen
|
||||||
from skills import get_skills_from_list
|
from skills import get_skills_from_list
|
||||||
from skills import no_of_actor_skills
|
from skills import no_of_actor_skills
|
||||||
|
@ -4057,6 +4058,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
blocker_nickname, domain_full,
|
blocker_nickname, domain_full,
|
||||||
blocking_nickname, blocking_domain_full,
|
blocking_nickname, blocking_domain_full,
|
||||||
curr_session, proxy_type)
|
curr_session, proxy_type)
|
||||||
|
remove_follower(base_dir, blocker_nickname,
|
||||||
|
domain,
|
||||||
|
blocking_nickname,
|
||||||
|
blocking_domain_full)
|
||||||
if calling_domain.endswith('.onion') and onion_domain:
|
if calling_domain.endswith('.onion') and onion_domain:
|
||||||
origin_path_str = 'http://' + onion_domain + users_path
|
origin_path_str = 'http://' + onion_domain + users_path
|
||||||
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
elif (calling_domain.endswith('.i2p') and i2p_domain):
|
||||||
|
|
29
follow.py
29
follow.py
|
@ -1474,3 +1474,32 @@ def follower_approval_active(base_dir: str,
|
||||||
manually_approves_followers = \
|
manually_approves_followers = \
|
||||||
actor_json['manuallyApprovesFollowers']
|
actor_json['manuallyApprovesFollowers']
|
||||||
return manually_approves_followers
|
return manually_approves_followers
|
||||||
|
|
||||||
|
|
||||||
|
def remove_follower(base_dir: str,
|
||||||
|
nickname: str, domain: str,
|
||||||
|
remove_nickname: str, remove_domain: str) -> bool:
|
||||||
|
"""Removes a follower
|
||||||
|
"""
|
||||||
|
followers_filename = \
|
||||||
|
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
|
if not os.path.isfile(followers_filename):
|
||||||
|
return False
|
||||||
|
followers_str = ''
|
||||||
|
try:
|
||||||
|
with open(followers_filename, 'r', encoding='utf-8') as fp_foll:
|
||||||
|
followers_str = fp_foll.read()
|
||||||
|
except OSError:
|
||||||
|
print('EX: remove_follower unable to read followers ' +
|
||||||
|
followers_filename)
|
||||||
|
handle = remove_nickname + '@' + remove_domain + '\n'
|
||||||
|
if handle not in followers_str:
|
||||||
|
return False
|
||||||
|
followers_str = followers_str.replace(handle, '')
|
||||||
|
try:
|
||||||
|
with open(followers_filename, 'w+', encoding='utf-8') as fp_foll:
|
||||||
|
fp_foll.write(followers_str)
|
||||||
|
except OSError:
|
||||||
|
print('EX: remove_follower unable to write followers ' +
|
||||||
|
followers_filename)
|
||||||
|
return True
|
||||||
|
|
Loading…
Reference in New Issue