mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
f9e6efd385
commit
4970b16aca
|
@ -18937,7 +18937,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
content_str = \
|
content_str = \
|
||||||
get_base_content_from_post(message_json,
|
get_base_content_from_post(message_json,
|
||||||
sys_language)
|
sys_language)
|
||||||
followers_only = False
|
|
||||||
pin_post(self.server.base_dir,
|
pin_post(self.server.base_dir,
|
||||||
nickname, self.server.domain, content_str)
|
nickname, self.server.domain, content_str)
|
||||||
return 1
|
return 1
|
||||||
|
@ -18988,7 +18987,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
print('WARN: blog posts must have content')
|
print('WARN: blog posts must have content')
|
||||||
return -1
|
return -1
|
||||||
# submit button on newblog screen
|
# submit button on newblog screen
|
||||||
followers_only = False
|
|
||||||
save_to_file = False
|
save_to_file = False
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
city = None
|
city = None
|
||||||
|
@ -19006,7 +19004,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.domain, self.server.port,
|
self.server.domain, self.server.port,
|
||||||
self.server.http_prefix,
|
self.server.http_prefix,
|
||||||
fields['message'],
|
fields['message'],
|
||||||
followers_only, save_to_file,
|
save_to_file,
|
||||||
client_to_server, comments_enabled,
|
client_to_server, comments_enabled,
|
||||||
filename, attachment_media_type,
|
filename, attachment_media_type,
|
||||||
fields['imageDescription'],
|
fields['imageDescription'],
|
||||||
|
@ -19148,7 +19146,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain)
|
self.server.domain)
|
||||||
followers_only = False
|
|
||||||
save_to_file = False
|
save_to_file = False
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
|
|
||||||
|
@ -19208,7 +19205,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain)
|
self.server.domain)
|
||||||
followers_only = True
|
|
||||||
save_to_file = False
|
save_to_file = False
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
|
|
||||||
|
@ -19273,7 +19269,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain)
|
self.server.domain)
|
||||||
followers_only = True
|
|
||||||
save_to_file = False
|
save_to_file = False
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
|
|
||||||
|
@ -19351,7 +19346,6 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.base_dir,
|
self.server.base_dir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain)
|
self.server.domain)
|
||||||
followers_only = True
|
|
||||||
save_to_file = False
|
save_to_file = False
|
||||||
client_to_server = False
|
client_to_server = False
|
||||||
comments_enabled = False
|
comments_enabled = False
|
||||||
|
|
24
posts.py
24
posts.py
|
@ -813,7 +813,7 @@ def get_post_domains(session, outbox_url: str, max_posts: int, debug: bool,
|
||||||
tag_type = tag_item['type'].lower()
|
tag_type = tag_item['type'].lower()
|
||||||
if tag_type == 'mention':
|
if tag_type == 'mention':
|
||||||
if tag_item.get('href'):
|
if tag_item.get('href'):
|
||||||
post_domain, post_port = \
|
post_domain, _ = \
|
||||||
get_domain_from_actor(tag_item['href'])
|
get_domain_from_actor(tag_item['href'])
|
||||||
if post_domain not in post_domains:
|
if post_domain not in post_domains:
|
||||||
post_domains.append(post_domain)
|
post_domains.append(post_domain)
|
||||||
|
@ -822,10 +822,6 @@ def get_post_domains(session, outbox_url: str, max_posts: int, debug: bool,
|
||||||
|
|
||||||
def _get_posts_for_blocked_domains(base_dir: str,
|
def _get_posts_for_blocked_domains(base_dir: str,
|
||||||
session, outbox_url: str, max_posts: int,
|
session, outbox_url: str, max_posts: int,
|
||||||
max_mentions: int,
|
|
||||||
max_emoji: int, max_attachments: int,
|
|
||||||
federation_list: [],
|
|
||||||
person_cache: {},
|
|
||||||
debug: bool,
|
debug: bool,
|
||||||
project_version: str, http_prefix: str,
|
project_version: str, http_prefix: str,
|
||||||
domain: str,
|
domain: str,
|
||||||
|
@ -863,7 +859,7 @@ def _get_posts_for_blocked_domains(base_dir: str,
|
||||||
continue
|
continue
|
||||||
if item['object'].get('inReplyTo'):
|
if item['object'].get('inReplyTo'):
|
||||||
if isinstance(item['object']['inReplyTo'], str):
|
if isinstance(item['object']['inReplyTo'], str):
|
||||||
post_domain, post_port = \
|
post_domain, _ = \
|
||||||
get_domain_from_actor(item['object']['inReplyTo'])
|
get_domain_from_actor(item['object']['inReplyTo'])
|
||||||
if is_blocked_domain(base_dir, post_domain):
|
if is_blocked_domain(base_dir, post_domain):
|
||||||
if item['object'].get('url'):
|
if item['object'].get('url'):
|
||||||
|
@ -882,7 +878,7 @@ def _get_posts_for_blocked_domains(base_dir: str,
|
||||||
continue
|
continue
|
||||||
tag_type = tag_item['type'].lower()
|
tag_type = tag_item['type'].lower()
|
||||||
if tag_type == 'mention' and tag_item.get('href'):
|
if tag_type == 'mention' and tag_item.get('href'):
|
||||||
post_domain, post_port = \
|
post_domain, _ = \
|
||||||
get_domain_from_actor(tag_item['href'])
|
get_domain_from_actor(tag_item['href'])
|
||||||
if is_blocked_domain(base_dir, post_domain):
|
if is_blocked_domain(base_dir, post_domain):
|
||||||
if item['object'].get('url'):
|
if item['object'].get('url'):
|
||||||
|
@ -1910,7 +1906,7 @@ def _append_citations_to_blog_post(base_dir: str,
|
||||||
|
|
||||||
def create_blog_post(base_dir: str,
|
def create_blog_post(base_dir: str,
|
||||||
nickname: str, domain: str, port: int, http_prefix: str,
|
nickname: str, domain: str, port: int, http_prefix: str,
|
||||||
content: str, followers_only: bool, save_to_file: bool,
|
content: str, save_to_file: bool,
|
||||||
client_to_server: bool, comments_enabled: bool,
|
client_to_server: bool, comments_enabled: bool,
|
||||||
attach_image_filename: str, media_type: str,
|
attach_image_filename: str, media_type: str,
|
||||||
image_description: str, city: str,
|
image_description: str, city: str,
|
||||||
|
@ -2315,7 +2311,7 @@ def thread_send_post(session, post_json_str: str, federation_list: [],
|
||||||
post_json_string(session, post_json_str, federation_list,
|
post_json_string(session, post_json_str, federation_list,
|
||||||
inbox_url, signature_header_json,
|
inbox_url, signature_header_json,
|
||||||
debug, http_prefix, domain_full)
|
debug, http_prefix, domain_full)
|
||||||
if return_code >= 500 and return_code < 600:
|
if return_code in range(500, 600):
|
||||||
# if an instance is returning a code which indicates that
|
# if an instance is returning a code which indicates that
|
||||||
# it might have a runtime error, like 503, then don't
|
# it might have a runtime error, like 503, then don't
|
||||||
# continue to post to it
|
# continue to post to it
|
||||||
|
@ -2337,7 +2333,7 @@ def thread_send_post(session, post_json_str: str, federation_list: [],
|
||||||
post_json_string(session, post_json_str, federation_list,
|
post_json_string(session, post_json_str, federation_list,
|
||||||
inbox_url, signature_header_json_ld,
|
inbox_url, signature_header_json_ld,
|
||||||
debug, http_prefix, domain_full)
|
debug, http_prefix, domain_full)
|
||||||
if return_code >= 500 and return_code < 600:
|
if return_code in range(500, 600):
|
||||||
# if an instance is returning a code which indicates that
|
# if an instance is returning a code which indicates that
|
||||||
# it might have a runtime error, like 503, then don't
|
# it might have a runtime error, like 503, then don't
|
||||||
# continue to post to it
|
# continue to post to it
|
||||||
|
@ -4546,7 +4542,6 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str,
|
||||||
return {}
|
return {}
|
||||||
person_cache = {}
|
person_cache = {}
|
||||||
cached_webfingers = {}
|
cached_webfingers = {}
|
||||||
federation_list = []
|
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
handle = http_prefix + "://" + domain_full + "/@" + nickname
|
||||||
|
@ -4569,9 +4564,6 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str,
|
||||||
project_version, http_prefix,
|
project_version, http_prefix,
|
||||||
nickname, domain, 'outbox',
|
nickname, domain, 'outbox',
|
||||||
13863)
|
13863)
|
||||||
max_mentions = 99
|
|
||||||
max_emoji = 99
|
|
||||||
max_attachments = 5
|
|
||||||
max_posts = 64
|
max_posts = 64
|
||||||
post_domains = \
|
post_domains = \
|
||||||
get_post_domains(session, person_url, max_posts, debug,
|
get_post_domains(session, person_url, max_posts, debug,
|
||||||
|
@ -4587,10 +4579,6 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str,
|
||||||
blocked_posts = \
|
blocked_posts = \
|
||||||
_get_posts_for_blocked_domains(base_dir, session,
|
_get_posts_for_blocked_domains(base_dir, session,
|
||||||
person_url, max_posts,
|
person_url, max_posts,
|
||||||
max_mentions,
|
|
||||||
max_emoji, max_attachments,
|
|
||||||
federation_list,
|
|
||||||
person_cache,
|
|
||||||
debug,
|
debug,
|
||||||
project_version, http_prefix,
|
project_version, http_prefix,
|
||||||
domain, signing_priv_key_pem)
|
domain, signing_priv_key_pem)
|
||||||
|
|
Loading…
Reference in New Issue