diff --git a/README_customizations.md b/README_customizations.md index 462ee1cdd..84d4aeac1 100644 --- a/README_customizations.md +++ b/README_customizations.md @@ -37,7 +37,7 @@ https://somesite/emoji3.png, :emojiname3: Then this can be imported with: ```bash -python3 epicyon.py --import-emoji [textfile] +python3 epicyon.py --import_emoji [textfile] ``` ## Themes diff --git a/daemon.py b/daemon.py index a636836fe..d1c84d1c8 100644 --- a/daemon.py +++ b/daemon.py @@ -16518,7 +16518,10 @@ class PubServer(BaseHTTPRequestHandler): self._login_headers('text/html', msglen, calling_domain) self._write(msg.encode('utf-8')) elif csv_getreq: - msg = csv_following_list(following_filename) + msg = csv_following_list(following_filename, + self.server.base_dir, + nickname, + self.server.domain) msglen = len(msg) self._login_headers('text/csv', msglen, calling_domain) self._write(msg.encode('utf-8')) @@ -16553,7 +16556,10 @@ class PubServer(BaseHTTPRequestHandler): self._login_headers('text/html', msglen, calling_domain) self._write(msg.encode('utf-8')) elif csv_getreq: - msg = csv_following_list(followers_filename) + msg = csv_following_list(followers_filename, + self.server.base_dir, + nickname, + self.server.domain) msglen = len(msg) self._login_headers('text/csv', msglen, calling_domain) self._write(msg.encode('utf-8')) diff --git a/importFollowing.py b/importFollowing.py index 021009683..de74ae990 100644 --- a/importFollowing.py +++ b/importFollowing.py @@ -10,6 +10,7 @@ __module_group__ = "Core" import os import time import random +from utils import acct_dir from utils import is_account_dir from utils import get_nickname_from_actor from utils import get_domain_from_actor @@ -58,9 +59,13 @@ def _update_import_following(base_dir: str, domain = handle.split('@')[1] for line in lines: orig_line = line + notes = None line = line.strip() if ',' in line: - line = line.split(',')[0].strip() + fields = line.split(',') + line = fields[0].strip() + if len(fields) >= 3: + notes = fields[2] if line.startswith('#'): continue following_nickname = get_nickname_from_actor(line) @@ -74,6 +79,18 @@ def _update_import_following(base_dir: str, # don't follow yourself continue following_handle = following_nickname + '@' + following_domain + if notes: + notes = notes.replace('
', '\n') + person_notes_filename = \ + acct_dir(base_dir, nickname, domain) + \ + '/notes/' + following_handle + '.txt' + try: + with open(person_notes_filename, 'w+', + encoding='utf-8') as fp_notes: + fp_notes.write(notes) + except OSError: + print('EX: Unable to import notes for ' + + following_handle) if is_following_actor(base_dir, nickname, domain, following_handle): # remove the followed handle from the import list diff --git a/webapp_media.py b/webapp_media.py index f91ae26a2..441fa1f94 100644 --- a/webapp_media.py +++ b/webapp_media.py @@ -63,17 +63,18 @@ def _add_embedded_video_from_sites(translate: {}, content: str, url = content.split('>vimeo.com/')[1] if '<' in url: url = url.split('<')[0] - content += \ - "
\n\n" + \ - "\n" + \ - "\n
\n" - return content + if url: + content += \ + "
\n\n" + \ + "\n" + \ + "\n
\n" + return content video_site = 'https://www.youtube.com' if 'https://m.youtube.com' in content: @@ -82,7 +83,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str, url = content.split('"' + video_site)[1] if '"' in url: url = url.split('"')[0] - if '/channel/' not in url and '/playlist' not in url: + if url and '/channel/' not in url and '/playlist' not in url: url = url.replace('/watch?v=', '/embed/') if '&' in url: url = url.split('&')[0] @@ -104,7 +105,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str, url = content.split('"' + video_site)[1] if '"' in url: url = url.split('"')[0] - if '/channel/' not in url and '/playlist' not in url: + if url and '/channel/' not in url and '/playlist' not in url: url = 'embed/' + url if '&' in url: url = url.split('&')[0] @@ -140,7 +141,10 @@ def _add_embedded_video_from_sites(translate: {}, content: str, if '"' + video_site in content: url = content.split('"' + video_site)[1] if '"' in url: - url = url.split('"')[0].replace('/watch?v=', '/embed/') + url = url.split('"')[0] + if not url: + continue + url = url.replace('/watch?v=', '/embed/') if '&' in url: url = url.split('&')[0] if '?utm_' in url: @@ -174,23 +178,24 @@ def _add_embedded_video_from_sites(translate: {}, content: str, url = content.split('"' + video_site)[1] if '"' in url: url = url.split('"')[0] - video_site_settings = '' - if '#' in url: - video_site_settings = '#' + url.split('#', 1)[1] - url = url.split('#')[0] - if not url.endswith('/oembed'): - url = url + '/oembed' - url += video_site_settings - content += \ - "
\n\n" + \ - "\n" + \ - "\n
\n" - return content + if url: + video_site_settings = '' + if '#' in url: + video_site_settings = '#' + url.split('#', 1)[1] + url = url.split('#')[0] + if not url.endswith('/oembed'): + url = url + '/oembed' + url += video_site_settings + content += \ + "
\n\n" + \ + "\n" + \ + "\n
\n" + return content if '"https://' in content: if peertube_instances: diff --git a/webapp_profile.py b/webapp_profile.py index f780fecba..f7f91dfca 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -726,11 +726,13 @@ def html_profile(signing_priv_key_pem: str, if website_url: donate_section += \ '

' + translate['Website'] + ': ' + website_url + '

\n' + website_url + '" rel="me" tabindex="1">' + \ + website_url + '

\n' if gemini_link: donate_section += \ '

' + 'Gemini' + ': ' + gemini_link + '

\n' + gemini_link + '" tabindex="1">' + \ + gemini_link + '

\n' if email_address: donate_section += \ '

' + translate['Email'] + ': ' + blog_address + '

\n' + blog_address + '" rel="me" tabindex="1">' + \ + blog_address + '

\n' if xmpp_address: donate_section += \ '

' + translate['XMPP'] + ': str: continue if following_list_csv: following_list_csv += '\n' - following_list_csv += following_address + ',true' - msg = 'Account address,Show boosts\n' + following_list_csv + following_list_csv += following_address + ',true,' + person_notes_filename = \ + acct_dir(base_dir, nickname, domain) + \ + '/notes/' + following_address + '.txt' + if os.path.isfile(person_notes_filename): + with open(person_notes_filename, 'r', + encoding='utf-8') as fp_notes: + person_notes = fp_notes.read() + person_notes = person_notes.replace(',', ' ') + person_notes = person_notes.replace('\n', '
') + person_notes = person_notes.replace(' ', ' ') + following_list_csv += person_notes + msg = 'Account address,Show boosts,Notes\n' + following_list_csv return msg return ''