mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
4555667aa8
|
@ -37,7 +37,7 @@ https://somesite/emoji3.png, :emojiname3:
|
||||||
Then this can be imported with:
|
Then this can be imported with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 epicyon.py --import-emoji [textfile]
|
python3 epicyon.py --import_emoji [textfile]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Themes
|
## Themes
|
||||||
|
|
10
daemon.py
10
daemon.py
|
@ -16518,7 +16518,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._login_headers('text/html', msglen, calling_domain)
|
self._login_headers('text/html', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
elif csv_getreq:
|
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)
|
msglen = len(msg)
|
||||||
self._login_headers('text/csv', msglen, calling_domain)
|
self._login_headers('text/csv', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
|
@ -16553,7 +16556,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._login_headers('text/html', msglen, calling_domain)
|
self._login_headers('text/html', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
elif csv_getreq:
|
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)
|
msglen = len(msg)
|
||||||
self._login_headers('text/csv', msglen, calling_domain)
|
self._login_headers('text/csv', msglen, calling_domain)
|
||||||
self._write(msg.encode('utf-8'))
|
self._write(msg.encode('utf-8'))
|
||||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Core"
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
from utils import acct_dir
|
||||||
from utils import is_account_dir
|
from utils import is_account_dir
|
||||||
from utils import get_nickname_from_actor
|
from utils import get_nickname_from_actor
|
||||||
from utils import get_domain_from_actor
|
from utils import get_domain_from_actor
|
||||||
|
@ -58,9 +59,13 @@ def _update_import_following(base_dir: str,
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
orig_line = line
|
orig_line = line
|
||||||
|
notes = None
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if ',' in line:
|
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('#'):
|
if line.startswith('#'):
|
||||||
continue
|
continue
|
||||||
following_nickname = get_nickname_from_actor(line)
|
following_nickname = get_nickname_from_actor(line)
|
||||||
|
@ -74,6 +79,18 @@ def _update_import_following(base_dir: str,
|
||||||
# don't follow yourself
|
# don't follow yourself
|
||||||
continue
|
continue
|
||||||
following_handle = following_nickname + '@' + following_domain
|
following_handle = following_nickname + '@' + following_domain
|
||||||
|
if notes:
|
||||||
|
notes = notes.replace('<br>', '\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,
|
if is_following_actor(base_dir,
|
||||||
nickname, domain, following_handle):
|
nickname, domain, following_handle):
|
||||||
# remove the followed handle from the import list
|
# remove the followed handle from the import list
|
||||||
|
|
|
@ -63,6 +63,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
||||||
url = content.split('>vimeo.com/')[1]
|
url = content.split('>vimeo.com/')[1]
|
||||||
if '<' in url:
|
if '<' in url:
|
||||||
url = url.split('<')[0]
|
url = url.split('<')[0]
|
||||||
|
if url:
|
||||||
content += \
|
content += \
|
||||||
"<center>\n<span itemprop=\"video\">\n" + \
|
"<center>\n<span itemprop=\"video\">\n" + \
|
||||||
"<iframe loading=\"lazy\" decoding=\"async\" " + \
|
"<iframe loading=\"lazy\" decoding=\"async\" " + \
|
||||||
|
@ -82,7 +83,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
||||||
url = content.split('"' + video_site)[1]
|
url = content.split('"' + video_site)[1]
|
||||||
if '"' in url:
|
if '"' in url:
|
||||||
url = url.split('"')[0]
|
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/')
|
url = url.replace('/watch?v=', '/embed/')
|
||||||
if '&' in url:
|
if '&' in url:
|
||||||
url = url.split('&')[0]
|
url = url.split('&')[0]
|
||||||
|
@ -104,7 +105,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
||||||
url = content.split('"' + video_site)[1]
|
url = content.split('"' + video_site)[1]
|
||||||
if '"' in url:
|
if '"' in url:
|
||||||
url = url.split('"')[0]
|
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
|
url = 'embed/' + url
|
||||||
if '&' in url:
|
if '&' in url:
|
||||||
url = url.split('&')[0]
|
url = url.split('&')[0]
|
||||||
|
@ -140,7 +141,10 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
||||||
if '"' + video_site in content:
|
if '"' + video_site in content:
|
||||||
url = content.split('"' + video_site)[1]
|
url = content.split('"' + video_site)[1]
|
||||||
if '"' in url:
|
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:
|
if '&' in url:
|
||||||
url = url.split('&')[0]
|
url = url.split('&')[0]
|
||||||
if '?utm_' in url:
|
if '?utm_' in url:
|
||||||
|
@ -174,6 +178,7 @@ def _add_embedded_video_from_sites(translate: {}, content: str,
|
||||||
url = content.split('"' + video_site)[1]
|
url = content.split('"' + video_site)[1]
|
||||||
if '"' in url:
|
if '"' in url:
|
||||||
url = url.split('"')[0]
|
url = url.split('"')[0]
|
||||||
|
if url:
|
||||||
video_site_settings = ''
|
video_site_settings = ''
|
||||||
if '#' in url:
|
if '#' in url:
|
||||||
video_site_settings = '#' + url.split('#', 1)[1]
|
video_site_settings = '#' + url.split('#', 1)[1]
|
||||||
|
|
|
@ -726,11 +726,13 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
if website_url:
|
if website_url:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + translate['Website'] + ': <a href="' + \
|
'<p>' + translate['Website'] + ': <a href="' + \
|
||||||
website_url + '" tabindex="1">' + website_url + '</a></p>\n'
|
website_url + '" rel="me" tabindex="1">' + \
|
||||||
|
website_url + '</a></p>\n'
|
||||||
if gemini_link:
|
if gemini_link:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + 'Gemini' + ': <a href="' + \
|
'<p>' + 'Gemini' + ': <a href="' + \
|
||||||
gemini_link + '" tabindex="1">' + gemini_link + '</a></p>\n'
|
gemini_link + '" tabindex="1">' + \
|
||||||
|
gemini_link + '</a></p>\n'
|
||||||
if email_address:
|
if email_address:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + translate['Email'] + ': <a href="mailto:' + \
|
'<p>' + translate['Email'] + ': <a href="mailto:' + \
|
||||||
|
@ -739,7 +741,8 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
if blog_address:
|
if blog_address:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>Blog: <a href="' + \
|
'<p>Blog: <a href="' + \
|
||||||
blog_address + '" tabindex="1">' + blog_address + '</a></p>\n'
|
blog_address + '" rel="me" tabindex="1">' + \
|
||||||
|
blog_address + '</a></p>\n'
|
||||||
if xmpp_address:
|
if xmpp_address:
|
||||||
donate_section += \
|
donate_section += \
|
||||||
'<p>' + translate['XMPP'] + ': <a href="xmpp:' + \
|
'<p>' + translate['XMPP'] + ': <a href="xmpp:' + \
|
||||||
|
|
|
@ -99,7 +99,8 @@ def html_following_list(base_dir: str, following_filename: str) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def csv_following_list(following_filename: str) -> str:
|
def csv_following_list(following_filename: str,
|
||||||
|
base_dir: str, nickname: str, domain: str) -> str:
|
||||||
"""Returns a csv of handles being followed
|
"""Returns a csv of handles being followed
|
||||||
"""
|
"""
|
||||||
with open(following_filename, 'r', encoding='utf-8') as following_file:
|
with open(following_filename, 'r', encoding='utf-8') as following_file:
|
||||||
|
@ -113,8 +114,19 @@ def csv_following_list(following_filename: str) -> str:
|
||||||
continue
|
continue
|
||||||
if following_list_csv:
|
if following_list_csv:
|
||||||
following_list_csv += '\n'
|
following_list_csv += '\n'
|
||||||
following_list_csv += following_address + ',true'
|
following_list_csv += following_address + ',true,'
|
||||||
msg = 'Account address,Show boosts\n' + following_list_csv
|
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', '<br>')
|
||||||
|
person_notes = person_notes.replace(' ', ' ')
|
||||||
|
following_list_csv += person_notes
|
||||||
|
msg = 'Account address,Show boosts,Notes\n' + following_list_csv
|
||||||
return msg
|
return msg
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue