main
Bob Mottram 2024-04-10 13:36:17 +01:00
parent d03aeba532
commit d3e343c231
3 changed files with 8 additions and 13 deletions

View File

@ -354,9 +354,7 @@ def receive_search_query(self, calling_domain: str, cookie: str,
if search_str.endswith(';remote'): if search_str.endswith(';remote'):
search_str = search_str.replace(';remote', '') search_str = search_str.replace(';remote', '')
remote_only = True remote_only = True
if search_str.endswith(':') or \ if string_ends_with(search_str, (':', ';', '.')):
search_str.endswith(';') or \
search_str.endswith('.'):
actor_str = \ actor_str = \
get_instance_url(calling_domain, http_prefix, get_instance_url(calling_domain, http_prefix,
domain_full, onion_domain, domain_full, onion_domain,

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Web Interface" __module_group__ = "Web Interface"
import os import os
from utils import string_ends_with
from utils import is_account_dir from utils import is_account_dir
from utils import load_json from utils import load_json
from utils import save_json from utils import save_json
@ -653,10 +654,7 @@ def _set_theme_fonts(base_dir: str, theme_name: str) -> None:
return return
for _, _, files in os.walk(theme_fonts_dir): for _, _, files in os.walk(theme_fonts_dir):
for filename in files: for filename in files:
if filename.endswith('.woff2') or \ if string_ends_with(filename, ('.woff2', '.woff', '.ttf', '.otf')):
filename.endswith('.woff') or \
filename.endswith('.ttf') or \
filename.endswith('.otf'):
dest_filename = fonts_dir + '/' + filename dest_filename = fonts_dir + '/' + filename
if os.path.isfile(dest_filename): if os.path.isfile(dest_filename):
# font already exists in the destination location # font already exists in the destination location

View File

@ -8,6 +8,7 @@ __status__ = "Production"
__module_group__ = "Timeline" __module_group__ = "Timeline"
import os import os
from utils import string_ends_with
from utils import valid_url_prefix from utils import valid_url_prefix
@ -250,12 +251,10 @@ def _add_embedded_video_from_sites(content: str,
url = url.split('"')[0] url = url.split('"')[0]
if not url: if not url:
continue continue
if url.endswith('/trending') or \ possible_endings = (
url.endswith('/home') or \ '/trending', '/home', '/overview',
url.endswith('/overview') or \ '/recently-added', '/local', '/about')
url.endswith('/recently-added') or \ if string_ends_with(url, possible_endings):
url.endswith('/local') or \
url.endswith('/about'):
# ignore various peertube endpoints # ignore various peertube endpoints
continue continue
if '/c/' in url or '/m/' in url: if '/c/' in url or '/m/' in url: