mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
3daa879299
|
@ -1474,7 +1474,11 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
||||||
elif extension == 'wav4':
|
elif extension == 'wav4':
|
||||||
extension = 'wav'
|
extension = 'wav'
|
||||||
if filename_base:
|
if filename_base:
|
||||||
filename = filename_base + '.' + extension
|
if not filename_base.endswith('.' + extension):
|
||||||
|
filename = filename_base + '.' + extension
|
||||||
|
else:
|
||||||
|
# already has the extension
|
||||||
|
filename = filename_base
|
||||||
search_lst = search_str.decode().split('/', maxsplit=1)
|
search_lst = search_str.decode().split('/', maxsplit=1)
|
||||||
attachment_media_type = \
|
attachment_media_type = \
|
||||||
search_lst[0].replace('Content-Type: ', '')
|
search_lst[0].replace('Content-Type: ', '')
|
||||||
|
|
|
@ -10,6 +10,7 @@ __module_group__ = "Core"
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
from utils import get_full_domain
|
||||||
from utils import acct_dir
|
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
|
||||||
|
@ -55,17 +56,21 @@ def _update_import_following(base_dir: str,
|
||||||
main_session = None
|
main_session = None
|
||||||
lines = following_str.split('\n')
|
lines = following_str.split('\n')
|
||||||
random.shuffle(lines)
|
random.shuffle(lines)
|
||||||
|
print('FOLLOW: ' + handle + ' attempting to follow ' + str(lines))
|
||||||
nickname = handle.split('@')[0]
|
nickname = handle.split('@')[0]
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
if '://' not in line and '@' not in line:
|
||||||
|
continue
|
||||||
|
if ',' not in line:
|
||||||
|
continue
|
||||||
orig_line = line
|
orig_line = line
|
||||||
notes = None
|
notes = None
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if ',' in line:
|
fields = line.split(',')
|
||||||
fields = line.split(',')
|
line = fields[0].strip()
|
||||||
line = fields[0].strip()
|
if len(fields) >= 5:
|
||||||
if len(fields) >= 5:
|
notes = fields[4]
|
||||||
notes = fields[4]
|
|
||||||
if line.startswith('#'):
|
if line.startswith('#'):
|
||||||
# comment
|
# comment
|
||||||
continue
|
continue
|
||||||
|
@ -80,6 +85,8 @@ 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
|
||||||
|
following_handle_full = following_nickname + '@' + \
|
||||||
|
get_full_domain(following_domain, following_port)
|
||||||
if notes:
|
if notes:
|
||||||
notes = notes.replace('<br>', '\n')
|
notes = notes.replace('<br>', '\n')
|
||||||
person_notes_filename = \
|
person_notes_filename = \
|
||||||
|
@ -92,8 +99,8 @@ def _update_import_following(base_dir: str,
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: Unable to import notes for ' +
|
print('EX: Unable to import notes for ' +
|
||||||
following_handle)
|
following_handle)
|
||||||
if is_following_actor(base_dir,
|
if is_following_actor(base_dir, nickname, domain,
|
||||||
nickname, domain, following_handle):
|
following_handle_full):
|
||||||
# remove the followed handle from the import list
|
# remove the followed handle from the import list
|
||||||
following_str = following_str.replace(orig_line + '\n', '')
|
following_str = following_str.replace(orig_line + '\n', '')
|
||||||
try:
|
try:
|
||||||
|
@ -110,9 +117,6 @@ def _update_import_following(base_dir: str,
|
||||||
curr_port = httpd.port
|
curr_port = httpd.port
|
||||||
curr_http_prefix = httpd.http_prefix
|
curr_http_prefix = httpd.http_prefix
|
||||||
following_actor = following_handle
|
following_actor = following_handle
|
||||||
if ':' in following_domain:
|
|
||||||
following_port = following_handle.split(':')[1]
|
|
||||||
following_domain = following_domain.split(':')[0]
|
|
||||||
|
|
||||||
# get the appropriate session
|
# get the appropriate session
|
||||||
curr_session = main_session
|
curr_session = main_session
|
||||||
|
@ -177,6 +181,8 @@ def _update_import_following(base_dir: str,
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: unable to remove import 2 ' + line +
|
print('EX: unable to remove import 2 ' + line +
|
||||||
' from ' + import_filename)
|
' from ' + import_filename)
|
||||||
|
print('FOLLOW: import sent follow to ' + line +
|
||||||
|
' from ' + import_filename)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue