mirror of https://gitlab.com/bashrc2/epicyon
Include unavailable sites within inactive accounts feed
parent
ddcfd2a01d
commit
8f7f4e4224
11
daemon.py
11
daemon.py
|
@ -15564,14 +15564,15 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
domain: str, port: int, getreq_start_time,
|
domain: str, port: int, getreq_start_time,
|
||||||
proxy_type: str, cookie: str,
|
proxy_type: str, cookie: str,
|
||||||
debug: str, curr_session,
|
debug: str, curr_session,
|
||||||
dormant_months: int) -> bool:
|
dormant_months: int,
|
||||||
|
sites_unavailable: []) -> bool:
|
||||||
"""Shows the inactive accounts feed
|
"""Shows the inactive accounts feed
|
||||||
"""
|
"""
|
||||||
following = \
|
following = \
|
||||||
get_inactive_feed(base_dir, domain, port, path,
|
get_inactive_feed(base_dir, domain, port, path,
|
||||||
http_prefix, authorized,
|
http_prefix, authorized,
|
||||||
dormant_months,
|
dormant_months,
|
||||||
FOLLOWS_PER_PAGE)
|
FOLLOWS_PER_PAGE, sites_unavailable)
|
||||||
if following:
|
if following:
|
||||||
if self._request_http():
|
if self._request_http():
|
||||||
page_number = 1
|
page_number = 1
|
||||||
|
@ -15582,7 +15583,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
get_inactive_feed(base_dir, domain, port, path,
|
get_inactive_feed(base_dir, domain, port, path,
|
||||||
http_prefix, authorized,
|
http_prefix, authorized,
|
||||||
dormant_months,
|
dormant_months,
|
||||||
FOLLOWS_PER_PAGE)
|
FOLLOWS_PER_PAGE,
|
||||||
|
sites_unavailable)
|
||||||
else:
|
else:
|
||||||
page_number_str = path.split('?page=')[1]
|
page_number_str = path.split('?page=')[1]
|
||||||
if ';' in page_number_str:
|
if ';' in page_number_str:
|
||||||
|
@ -20994,7 +20996,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
proxy_type,
|
proxy_type,
|
||||||
cookie, self.server.debug,
|
cookie, self.server.debug,
|
||||||
curr_session,
|
curr_session,
|
||||||
self.server.dormant_months):
|
self.server.dormant_months,
|
||||||
|
self.server.sites_unavailable):
|
||||||
self.server.getreq_busy = False
|
self.server.getreq_busy = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -308,7 +308,8 @@ def update_moved_actors(base_dir: str, debug: bool) -> None:
|
||||||
|
|
||||||
|
|
||||||
def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
|
def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
|
||||||
dormant_months: int) -> []:
|
dormant_months: int,
|
||||||
|
sites_unavailable: []) -> []:
|
||||||
"""returns a list of inactive accounts
|
"""returns a list of inactive accounts
|
||||||
"""
|
"""
|
||||||
# get the list of followers
|
# get the list of followers
|
||||||
|
@ -332,6 +333,9 @@ def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
|
||||||
if '@' in handle:
|
if '@' in handle:
|
||||||
follower_nickname = handle.split('@')[0]
|
follower_nickname = handle.split('@')[0]
|
||||||
follower_domain = handle.split('@')[1]
|
follower_domain = handle.split('@')[1]
|
||||||
|
if follower_domain in sites_unavailable:
|
||||||
|
result.append(handle)
|
||||||
|
continue
|
||||||
found = False
|
found = False
|
||||||
for http_prefix in ('https://', 'http://'):
|
for http_prefix in ('https://', 'http://'):
|
||||||
for users_str in users_list:
|
for users_str in users_list:
|
||||||
|
@ -355,16 +359,22 @@ def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
|
||||||
break
|
break
|
||||||
elif '://' in handle:
|
elif '://' in handle:
|
||||||
actor = handle
|
actor = handle
|
||||||
|
follower_domain = actor.split('://')[1]
|
||||||
|
if '/' in follower_domain:
|
||||||
|
follower_domain = follower_domain.split('/')[0]
|
||||||
|
if follower_domain in sites_unavailable:
|
||||||
|
result.append(actor)
|
||||||
|
continue
|
||||||
if is_dormant(base_dir, nickname, domain, actor,
|
if is_dormant(base_dir, nickname, domain, actor,
|
||||||
dormant_months):
|
dormant_months):
|
||||||
result.append(handle)
|
result.append(actor)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def get_inactive_feed(base_dir: str, domain: str, port: int, path: str,
|
def get_inactive_feed(base_dir: str, domain: str, port: int, path: str,
|
||||||
http_prefix: str, authorized: bool,
|
http_prefix: str, authorized: bool,
|
||||||
dormant_months: int,
|
dormant_months: int,
|
||||||
follows_per_page=12) -> {}:
|
follows_per_page: int, sites_unavailable: []) -> {}:
|
||||||
"""Returns the inactive accounts feed from GET requests.
|
"""Returns the inactive accounts feed from GET requests.
|
||||||
"""
|
"""
|
||||||
# Don't show inactive accounts to non-authorized viewers
|
# Don't show inactive accounts to non-authorized viewers
|
||||||
|
@ -410,7 +420,8 @@ def get_inactive_feed(base_dir: str, domain: str, port: int, path: str,
|
||||||
domain = get_full_domain(domain, port)
|
domain = get_full_domain(domain, port)
|
||||||
|
|
||||||
lines = _get_inactive_accounts(base_dir, nickname, domain,
|
lines = _get_inactive_accounts(base_dir, nickname, domain,
|
||||||
dormant_months)
|
dormant_months,
|
||||||
|
sites_unavailable)
|
||||||
|
|
||||||
if header_only:
|
if header_only:
|
||||||
first_str = \
|
first_str = \
|
||||||
|
|
Loading…
Reference in New Issue