mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
3128c724a1
commit
5ce15ffbed
|
@ -267,7 +267,7 @@ from utils import get_occupation_skills
|
||||||
from utils import get_occupation_name
|
from utils import get_occupation_name
|
||||||
from utils import set_occupation_name
|
from utils import set_occupation_name
|
||||||
from utils import load_translations_from_file
|
from utils import load_translations_from_file
|
||||||
from utils import getLocalNetworkAddresses
|
from utils import get_local_network_addresses
|
||||||
from utils import decoded_host
|
from utils import decoded_host
|
||||||
from utils import isPublicPost
|
from utils import isPublicPost
|
||||||
from utils import get_locked_account
|
from utils import get_locked_account
|
||||||
|
@ -1447,7 +1447,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# sent by an actor on a local network address?
|
# sent by an actor on a local network address?
|
||||||
if not self.server.allow_local_network_access:
|
if not self.server.allow_local_network_access:
|
||||||
localNetworkPatternList = getLocalNetworkAddresses()
|
localNetworkPatternList = get_local_network_addresses()
|
||||||
for localNetworkPattern in localNetworkPatternList:
|
for localNetworkPattern in localNetworkPatternList:
|
||||||
if localNetworkPattern in message_json['actor']:
|
if localNetworkPattern in message_json['actor']:
|
||||||
print('POST actor contains local network address ' +
|
print('POST actor contains local network address ' +
|
||||||
|
|
|
@ -19,7 +19,7 @@ from posts import sendToNamedAddressesThread
|
||||||
from utils import has_object_stringType
|
from utils import has_object_stringType
|
||||||
from utils import get_base_content_from_post
|
from utils import get_base_content_from_post
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import getLocalNetworkAddresses
|
from utils import get_local_network_addresses
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import remove_id_ending
|
from utils import remove_id_ending
|
||||||
from utils import get_domain_from_actor
|
from utils import get_domain_from_actor
|
||||||
|
@ -274,7 +274,7 @@ def postMessageToOutbox(session, translate: {},
|
||||||
|
|
||||||
# sent by an actor on a local network address?
|
# sent by an actor on a local network address?
|
||||||
if not allow_local_network_access:
|
if not allow_local_network_access:
|
||||||
localNetworkPatternList = getLocalNetworkAddresses()
|
localNetworkPatternList = get_local_network_addresses()
|
||||||
for localNetworkPattern in localNetworkPatternList:
|
for localNetworkPattern in localNetworkPatternList:
|
||||||
if localNetworkPattern in message_json['actor']:
|
if localNetworkPattern in message_json['actor']:
|
||||||
return False
|
return False
|
||||||
|
|
12
utils.py
12
utils.py
|
@ -635,14 +635,14 @@ def get_link_prefixes() -> []:
|
||||||
'hyper://', 'gemini://', 'gopher://', 'briar:')
|
'hyper://', 'gemini://', 'gopher://', 'briar:')
|
||||||
|
|
||||||
|
|
||||||
def remove_avatar_from_cache(base_dir: str, actorStr: str) -> None:
|
def remove_avatar_from_cache(base_dir: str, actor_str: str) -> None:
|
||||||
"""Removes any existing avatar entries from the cache
|
"""Removes any existing avatar entries from the cache
|
||||||
This avoids duplicate entries with differing extensions
|
This avoids duplicate entries with differing extensions
|
||||||
"""
|
"""
|
||||||
avatar_filename_extensions = get_image_extensions()
|
avatar_filename_extensions = get_image_extensions()
|
||||||
for extension in avatar_filename_extensions:
|
for extension in avatar_filename_extensions:
|
||||||
avatar_filename = \
|
avatar_filename = \
|
||||||
base_dir + '/cache/avatars/' + actorStr + '.' + extension
|
base_dir + '/cache/avatars/' + actor_str + '.' + extension
|
||||||
if os.path.isfile(avatar_filename):
|
if os.path.isfile(avatar_filename):
|
||||||
try:
|
try:
|
||||||
os.remove(avatar_filename)
|
os.remove(avatar_filename)
|
||||||
|
@ -739,6 +739,8 @@ def get_status_number(published_str: str = None) -> (str, str):
|
||||||
|
|
||||||
|
|
||||||
def evil_incarnate() -> []:
|
def evil_incarnate() -> []:
|
||||||
|
"""Hardcoded blocked domains
|
||||||
|
"""
|
||||||
return ('fedilist.com', 'gab.com', 'gabfed.com', 'spinster.xyz',
|
return ('fedilist.com', 'gab.com', 'gabfed.com', 'spinster.xyz',
|
||||||
'kiwifarms.cc', 'djitter.com')
|
'kiwifarms.cc', 'djitter.com')
|
||||||
|
|
||||||
|
@ -832,7 +834,7 @@ def urlPermitted(url: str, federation_list: []):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def getLocalNetworkAddresses() -> []:
|
def get_local_network_addresses() -> []:
|
||||||
"""Returns patterns for local network address detection
|
"""Returns patterns for local network address detection
|
||||||
"""
|
"""
|
||||||
return ('localhost', '127.0.', '192.168', '10.0.')
|
return ('localhost', '127.0.', '192.168', '10.0.')
|
||||||
|
@ -841,7 +843,7 @@ def getLocalNetworkAddresses() -> []:
|
||||||
def isLocalNetworkAddress(ipAddress: str) -> bool:
|
def isLocalNetworkAddress(ipAddress: str) -> bool:
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
localIPs = getLocalNetworkAddresses()
|
localIPs = get_local_network_addresses()
|
||||||
for ipAddr in localIPs:
|
for ipAddr in localIPs:
|
||||||
if ipAddress.startswith(ipAddr):
|
if ipAddress.startswith(ipAddr):
|
||||||
return True
|
return True
|
||||||
|
@ -862,7 +864,7 @@ def _isDangerousString(content: str, allow_local_network_access: bool,
|
||||||
contentSections = content.split(startChar)
|
contentSections = content.split(startChar)
|
||||||
invalidPartials = ()
|
invalidPartials = ()
|
||||||
if not allow_local_network_access:
|
if not allow_local_network_access:
|
||||||
invalidPartials = getLocalNetworkAddresses()
|
invalidPartials = get_local_network_addresses()
|
||||||
for markup in contentSections:
|
for markup in contentSections:
|
||||||
if endChar not in markup:
|
if endChar not in markup:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue