mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
85cc2eb22d
commit
a9f49879ce
|
@ -10,6 +10,7 @@ __module_group__ = "Core"
|
|||
import os
|
||||
import urllib.parse
|
||||
from hashlib import md5
|
||||
from utils import string_contains
|
||||
from utils import get_instance_url
|
||||
|
||||
|
||||
|
@ -121,9 +122,7 @@ def _set_headers_base(self, file_format: str, length: int, cookie: str,
|
|||
calling_domain: str, permissive: bool) -> None:
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', file_format)
|
||||
if 'image/' in file_format or \
|
||||
'audio/' in file_format or \
|
||||
'video/' in file_format:
|
||||
if string_contains(file_format, ('image/', 'audio/', 'video/')):
|
||||
cache_control = 'public, max-age=84600, immutable'
|
||||
self.send_header('Cache-Control', cache_control)
|
||||
else:
|
||||
|
|
|
@ -8,6 +8,7 @@ __status__ = "Production"
|
|||
__module_group__ = "API"
|
||||
|
||||
import os
|
||||
from utils import string_contains
|
||||
from utils import get_url_from_post
|
||||
from utils import load_json
|
||||
from utils import get_config_param
|
||||
|
@ -346,12 +347,9 @@ def masto_api_v1_response(path: str, calling_domain: str,
|
|||
path_nickname = get_nickname_from_masto_api_v1id(masto_id)
|
||||
if path_nickname:
|
||||
original_path = path
|
||||
if '/followers?' in path or \
|
||||
'/following?' in path or \
|
||||
'/streaming/' in path or \
|
||||
'/search?' in path or \
|
||||
'/relationships?' in path or \
|
||||
'/statuses?' in path:
|
||||
if string_contains(path,
|
||||
('/followers?', '/following?', '/streaming/',
|
||||
'/search?', '/relationships?', '/statuses?')):
|
||||
path = path.split('?')[0]
|
||||
if '/streaming/' in path:
|
||||
streaming_msg = \
|
||||
|
|
|
@ -19,6 +19,7 @@ from datetime import timezone
|
|||
from collections import OrderedDict
|
||||
from utils import valid_post_date
|
||||
from categories import set_hashtag_category
|
||||
from utils import string_contains
|
||||
from utils import image_mime_types_dict
|
||||
from utils import resembles_url
|
||||
from utils import get_url_from_post
|
||||
|
@ -667,9 +668,9 @@ def xml_podcast_to_dict(base_dir: str, xml_item: str, xml_str: str) -> {}:
|
|||
podcast_properties['image'] = podcast_episode_image
|
||||
podcast_properties['categories'] = podcast_categories
|
||||
|
||||
if '<itunes:explicit>Y' in xml_item or \
|
||||
'<itunes:explicit>T' in xml_item or \
|
||||
'<itunes:explicit>1' in xml_item:
|
||||
if string_contains(xml_item,
|
||||
('<itunes:explicit>Y', '<itunes:explicit>T',
|
||||
'<itunes:explicit>1')):
|
||||
podcast_properties['explicit'] = True
|
||||
else:
|
||||
podcast_properties['explicit'] = False
|
||||
|
|
18
posts.py
18
posts.py
|
@ -34,6 +34,7 @@ from webfinger import webfinger_handle
|
|||
from httpsig import create_signed_header
|
||||
from siteactive import site_is_active
|
||||
from languages import understood_post_language
|
||||
from utils import string_contains
|
||||
from utils import get_post_attachments
|
||||
from utils import is_premium_account
|
||||
from utils import contains_private_key
|
||||
|
@ -793,12 +794,7 @@ def _update_word_frequency(content: str, word_frequency: {}) -> None:
|
|||
if word_len < 4:
|
||||
if word.upper() != word:
|
||||
continue
|
||||
if '&' in word or \
|
||||
'"' in word or \
|
||||
'@' in word or \
|
||||
"'" in word or \
|
||||
"--" in word or \
|
||||
'//' in word:
|
||||
if string_contains(word, ('&', '"', '@', "'", "--", '//')):
|
||||
continue
|
||||
if word.lower() in common_words:
|
||||
continue
|
||||
|
@ -4447,13 +4443,9 @@ def _add_post_string_to_timeline(post_str: str, boxname: str,
|
|||
""" is this a valid timeline post?
|
||||
"""
|
||||
# must be a recognized ActivityPub type
|
||||
if ('"Note"' in post_str or
|
||||
'"EncryptedMessage"' in post_str or
|
||||
'"ChatMessage"' in post_str or
|
||||
'"Event"' in post_str or
|
||||
'"Article"' in post_str or
|
||||
'"Patch"' in post_str or
|
||||
'"Announce"' in post_str or
|
||||
if (string_contains(post_str,
|
||||
('"Note"', '"EncryptedMessage"', '"ChatMessage"',
|
||||
'"Event"', '"Article"', '"Patch"', '"Announce"')) or
|
||||
('"Question"' in post_str and
|
||||
('"Create"' in post_str or '"Update"' in post_str))):
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ from shutil import copyfile
|
|||
from collections import OrderedDict
|
||||
from session import get_json
|
||||
from session import get_json_valid
|
||||
from utils import string_contains
|
||||
from utils import get_post_attachments
|
||||
from utils import image_mime_types_dict
|
||||
from utils import get_url_from_post
|
||||
|
@ -2338,9 +2339,7 @@ def get_buy_links(post_json_object: str, translate: {}, buy_sites: {}) -> {}:
|
|||
if remove_html(item_name) != item_name:
|
||||
continue
|
||||
# there should be no html in the link
|
||||
if '<' in item['href'] or \
|
||||
'://' not in item['href'] or \
|
||||
' ' in item['href']:
|
||||
if string_contains(item['href'], ('<', '://', ' ')):
|
||||
continue
|
||||
if item.get('rel'):
|
||||
if isinstance(item['rel'], str):
|
||||
|
|
Loading…
Reference in New Issue