Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-12-18 23:00:54 +00:00
commit 170617b6a2
16 changed files with 144 additions and 108 deletions

View File

@ -176,6 +176,7 @@ from webapp_podcast import html_podcast_episode
from webapp_theme_designer import html_theme_designer from webapp_theme_designer import html_theme_designer
from webapp_minimalbutton import set_minimal from webapp_minimalbutton import set_minimal
from webapp_minimalbutton import is_minimal from webapp_minimalbutton import is_minimal
from webapp_utils import get_default_path
from webapp_utils import get_avatar_image_url from webapp_utils import get_avatar_image_url
from webapp_utils import html_hashtag_blocked from webapp_utils import html_hashtag_blocked
from webapp_utils import html_following_list from webapp_utils import html_following_list
@ -272,6 +273,7 @@ from languages import set_actor_languages
from languages import get_understood_languages from languages import get_understood_languages
from like import update_likes_collection from like import update_likes_collection
from reaction import update_reaction_collection from reaction import update_reaction_collection
from utils import acct_handle_dir
from utils import load_reverse_timeline from utils import load_reverse_timeline
from utils import save_reverse_timeline from utils import save_reverse_timeline
from utils import load_min_images_for_accounts from utils import load_min_images_for_accounts
@ -18225,16 +18227,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain, nickname) self.server.domain, nickname)
set_minimal(self.server.base_dir, set_minimal(self.server.base_dir,
self.server.domain, nickname, not_min) self.server.domain, nickname, not_min)
if not (self.server.media_instance or self.path = get_default_path(self.server.media_instance,
self.server.blogs_instance): self.server.blogs_instance,
self.path = '/users/' + nickname + '/inbox' nickname)
else:
if self.server.blogs_instance:
self.path = '/users/' + nickname + '/tlblogs'
elif self.server.media_instance:
self.path = '/users/' + nickname + '/tlmedia'
else:
self.path = '/users/' + nickname + '/tlfeatures'
# search for a fediverse address, shared item or emoji # search for a fediverse address, shared item or emoji
# from the web interface by selecting search icon # from the web interface by selecting search icon
@ -21254,7 +21249,7 @@ class PubServer(BaseHTTPRequestHandler):
if not handle: if not handle:
return False return False
if isinstance(handle, str): if isinstance(handle, str):
person_dir = self.server.base_dir + '/accounts/' + handle person_dir = acct_handle_dir(self.server.base_dir, handle)
if not os.path.isdir(person_dir + '/devices'): if not os.path.isdir(person_dir + '/devices'):
return False return False
devices_list = [] devices_list = []
@ -22310,7 +22305,7 @@ def load_tokens(base_dir: str, tokens_dict: {}, tokens_lookup: {}) -> None:
for _, dirs, _ in os.walk(base_dir + '/accounts'): for _, dirs, _ in os.walk(base_dir + '/accounts'):
for handle in dirs: for handle in dirs:
if '@' in handle: if '@' in handle:
token_filename = base_dir + '/accounts/' + handle + '/.token' token_filename = acct_handle_dir(base_dir, handle) + '/.token'
if not os.path.isfile(token_filename): if not os.path.isfile(token_filename):
continue continue
nickname = handle.split('@')[0] nickname = handle.split('@')[0]

View File

@ -9,6 +9,7 @@ __module_group__ = "ActivityPub"
from pprint import pprint from pprint import pprint
import os import os
from utils import acct_handle_dir
from utils import has_object_string_object from utils import has_object_string_object
from utils import has_object_string_type from utils import has_object_string_type
from utils import remove_domain_port from utils import remove_domain_port
@ -304,8 +305,9 @@ def unfollow_account(base_dir: str, nickname: str, domain: str,
handle_to_unfollow = '!' + handle_to_unfollow handle_to_unfollow = '!' + handle_to_unfollow
if not os.path.isdir(base_dir + '/accounts'): if not os.path.isdir(base_dir + '/accounts'):
os.mkdir(base_dir + '/accounts') os.mkdir(base_dir + '/accounts')
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
os.mkdir(base_dir + '/accounts/' + handle) if not os.path.isdir(handle_dir):
os.mkdir(handle_dir)
accounts_dir = acct_dir(base_dir, nickname, domain) accounts_dir = acct_dir(base_dir, nickname, domain)
filename = accounts_dir + '/' + follow_file filename = accounts_dir + '/' + follow_file

View File

@ -13,6 +13,7 @@ from hashlib import md5
from datetime import datetime from datetime import datetime
from datetime import timedelta from datetime import timedelta
from utils import acct_handle_dir
from utils import is_public_post from utils import is_public_post
from utils import load_json from utils import load_json
from utils import save_json from utils import save_json
@ -94,10 +95,10 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
See https://framagit.org/framasoft/mobilizon/-/blob/ See https://framagit.org/framasoft/mobilizon/-/blob/
master/lib/federation/activity_stream/converter/event.ex master/lib/federation/activity_stream/converter/event.ex
""" """
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
print('WARN: Account does not exist at ' + if not os.path.isdir(handle_dir):
base_dir + '/accounts/' + handle) print('WARN: Account does not exist at ' + handle_dir)
calendar_path = base_dir + '/accounts/' + handle + '/calendar' calendar_path = handle_dir + '/calendar'
if not os.path.isdir(calendar_path): if not os.path.isdir(calendar_path):
os.mkdir(calendar_path) os.mkdir(calendar_path)
@ -121,11 +122,11 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
print('Mobilizon type event') print('Mobilizon type event')
# if this is a full description of an event then save it # if this is a full description of an event then save it
# as a separate json file # as a separate json file
events_path = base_dir + '/accounts/' + handle + '/events' events_path = handle_dir + '/events'
if not os.path.isdir(events_path): if not os.path.isdir(events_path):
os.mkdir(events_path) os.mkdir(events_path)
events_year_path = \ events_year_path = \
base_dir + '/accounts/' + handle + '/events/' + str(event_year) handle_dir + '/events/' + str(event_year)
if not os.path.isdir(events_year_path): if not os.path.isdir(events_year_path):
os.mkdir(events_year_path) os.mkdir(events_year_path)
event_id = str(event_year) + '-' + event_time.strftime("%m") + '-' + \ event_id = str(event_year) + '-' + event_time.strftime("%m") + '-' + \
@ -134,7 +135,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
save_json(event_json, event_filename) save_json(event_json, event_filename)
# save to the events timeline # save to the events timeline
tl_events_filename = base_dir + '/accounts/' + handle + '/events.txt' tl_events_filename = handle_dir + '/events.txt'
if os.path.isfile(tl_events_filename): if os.path.isfile(tl_events_filename):
_remove_event_from_timeline(event_id, tl_events_filename) _remove_event_from_timeline(event_id, tl_events_filename)
@ -180,7 +181,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
# create a file which will trigger a notification that # create a file which will trigger a notification that
# a new event has been added # a new event has been added
cal_notify_filename = base_dir + '/accounts/' + handle + '/.newCalendar' cal_notify_filename = handle_dir + '/.newCalendar'
notify_str = \ notify_str = \
'/calendar?year=' + str(event_year) + '?month=' + \ '/calendar?year=' + str(event_year) + '?month=' + \
str(event_month_number) + '?day=' + str(event_day_of_month) str(event_month_number) + '?day=' + str(event_day_of_month)
@ -962,7 +963,8 @@ def _dav_store_event(base_dir: str, nickname: str, domain: str,
"name": location "name": location
}) })
handle = nickname + '@' + domain handle = nickname + '@' + domain
outbox_dir = base_dir + '/accounts/' + handle + '/outbox' handle_dir = acct_handle_dir(base_dir, handle)
outbox_dir = handle_dir + '/outbox'
if not os.path.isdir(outbox_dir): if not os.path.isdir(outbox_dir):
return False return False
filename = outbox_dir + '/' + post_id.replace('/', '#') + '.json' filename = outbox_dir + '/' + post_id.replace('/', '#') + '.json'

View File

@ -18,6 +18,7 @@ from languages import understood_post_language
from like import update_likes_collection from like import update_likes_collection
from reaction import update_reaction_collection from reaction import update_reaction_collection
from reaction import valid_emoji_content from reaction import valid_emoji_content
from utils import acct_handle_dir
from utils import is_account_dir from utils import is_account_dir
from utils import remove_eol from utils import remove_eol
from utils import text_in_file from utils import text_in_file
@ -800,7 +801,8 @@ def _inbox_post_recipients_add(base_dir: str, http_prefix: str, to_list: [],
# get the handle for the account on this instance # get the handle for the account on this instance
nickname = recipient.split(domain_match)[1] nickname = recipient.split(domain_match)[1]
handle = nickname + '@' + domain handle = nickname + '@' + domain
if os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if os.path.isdir(handle_dir):
recipients_dict[handle] = None recipients_dict[handle] = None
else: else:
if debug: if debug:
@ -1518,7 +1520,8 @@ def _receive_like(recent_posts_cache: {},
print('DEBUG: "statuses" missing from object in ' + print('DEBUG: "statuses" missing from object in ' +
message_json['type']) message_json['type'])
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of like - ' + handle) print('DEBUG: unknown recipient of like - ' + handle)
# if this post in the outbox of the person? # if this post in the outbox of the person?
handle_name = handle.split('@')[0] handle_name = handle.split('@')[0]
@ -1652,7 +1655,8 @@ def _receive_undo_like(recent_posts_cache: {},
print('DEBUG: "statuses" missing from like object in ' + print('DEBUG: "statuses" missing from like object in ' +
message_json['type']) message_json['type'])
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of undo like - ' + handle) print('DEBUG: unknown recipient of undo like - ' + handle)
# if this post in the outbox of the person? # if this post in the outbox of the person?
handle_name = handle.split('@')[0] handle_name = handle.split('@')[0]
@ -1785,10 +1789,10 @@ def _receive_reaction(recent_posts_cache: {},
print('DEBUG: "statuses" missing from object in ' + print('DEBUG: "statuses" missing from object in ' +
message_json['type']) message_json['type'])
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of emoji reaction - ' + handle) print('DEBUG: unknown recipient of emoji reaction - ' + handle)
if os.path.isfile(base_dir + '/accounts/' + handle + if os.path.isfile(handle_dir + '/.hideReactionButton'):
'/.hideReactionButton'):
print('Emoji reaction rejected by ' + handle + print('Emoji reaction rejected by ' + handle +
' due to their settings') ' due to their settings')
return True return True
@ -1965,10 +1969,10 @@ def _receive_zot_reaction(recent_posts_cache: {},
print('DEBUG: "statuses" missing from inReplyTo in ' + print('DEBUG: "statuses" missing from inReplyTo in ' +
message_json['object']['type']) message_json['object']['type'])
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of zot emoji reaction - ' + handle) print('DEBUG: unknown recipient of zot emoji reaction - ' + handle)
if os.path.isfile(base_dir + '/accounts/' + handle + if os.path.isfile(handle_dir + '/.hideReactionButton'):
'/.hideReactionButton'):
print('Zot emoji reaction rejected by ' + handle + print('Zot emoji reaction rejected by ' + handle +
' due to their settings') ' due to their settings')
return True return True
@ -2124,7 +2128,8 @@ def _receive_undo_reaction(recent_posts_cache: {},
print('DEBUG: "statuses" missing from reaction object in ' + print('DEBUG: "statuses" missing from reaction object in ' +
message_json['type']) message_json['type'])
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of undo reaction - ' + handle) print('DEBUG: unknown recipient of undo reaction - ' + handle)
# if this post in the outbox of the person? # if this post in the outbox of the person?
handle_name = handle.split('@')[0] handle_name = handle.split('@')[0]
@ -2504,7 +2509,8 @@ def _receive_delete(session, handle: str, is_group: bool, base_dir: str,
if message_json['actor'] not in message_json['object']: if message_json['actor'] not in message_json['object']:
if debug: if debug:
print('DEBUG: actor is not the owner of the post to be deleted') print('DEBUG: actor is not the owner of the post to be deleted')
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of like - ' + handle) print('DEBUG: unknown recipient of like - ' + handle)
# if this post in the outbox of the person? # if this post in the outbox of the person?
message_id = remove_id_ending(message_json['object']) message_id = remove_id_ending(message_json['object'])
@ -2604,7 +2610,8 @@ def _receive_announce(recent_posts_cache: {},
if debug: if debug:
print('DEBUG: announced domain is blocked') print('DEBUG: announced domain is blocked')
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of announce - ' + handle) print('DEBUG: unknown recipient of announce - ' + handle)
# is the announce actor blocked? # is the announce actor blocked?
@ -2825,7 +2832,8 @@ def _receive_undo_announce(recent_posts_cache: {},
print('DEBUG: "users" or "profile" missing from actor in ' + print('DEBUG: "users" or "profile" missing from actor in ' +
message_json['type'] + ' announce') message_json['type'] + ' announce')
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('DEBUG: unknown recipient of undo announce - ' + handle) print('DEBUG: unknown recipient of undo announce - ' + handle)
# if this post in the outbox of the person? # if this post in the outbox of the person?
handle_name = handle.split('@')[0] handle_name = handle.split('@')[0]
@ -3176,7 +3184,7 @@ def _obtain_avatar_for_reply_post(session, base_dir: str, http_prefix: str,
def _dm_notify(base_dir: str, handle: str, url: str) -> None: def _dm_notify(base_dir: str, handle: str, url: str) -> None:
"""Creates a notification that a new DM has arrived """Creates a notification that a new DM has arrived
""" """
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
return return
dm_file = account_dir + '/.newDM' dm_file = account_dir + '/.newDM'
@ -3272,7 +3280,7 @@ def _like_notify(base_dir: str, domain: str,
if not i2p_domain and not onion_domain: if not i2p_domain and not onion_domain:
return return
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
# are like notifications enabled? # are like notifications enabled?
notify_likes_enabled_filename = account_dir + '/.notifyLikes' notify_likes_enabled_filename = account_dir + '/.notifyLikes'
@ -3335,7 +3343,7 @@ def _reaction_notify(base_dir: str, domain: str, onion_domain: str,
if '/' + onion_domain + '/users/' + nickname not in url: if '/' + onion_domain + '/users/' + nickname not in url:
return return
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
# are reaction notifications enabled? # are reaction notifications enabled?
notify_reaction_enabled_filename = account_dir + '/.notifyReactions' notify_reaction_enabled_filename = account_dir + '/.notifyReactions'
@ -3388,7 +3396,7 @@ def _notify_post_arrival(base_dir: str, handle: str, url: str) -> None:
This is for followed accounts with the notify checkbox enabled This is for followed accounts with the notify checkbox enabled
on the person options screen on the person options screen
""" """
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
return return
notify_file = account_dir + '/.newNotifiedPost' notify_file = account_dir + '/.newNotifiedPost'
@ -3408,7 +3416,7 @@ def _notify_post_arrival(base_dir: str, handle: str, url: str) -> None:
def _reply_notify(base_dir: str, handle: str, url: str) -> None: def _reply_notify(base_dir: str, handle: str, url: str) -> None:
"""Creates a notification that a new reply has arrived """Creates a notification that a new reply has arrived
""" """
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
return return
reply_file = account_dir + '/.newReply' reply_file = account_dir + '/.newReply'
@ -3424,7 +3432,7 @@ def _git_patch_notify(base_dir: str, handle: str, subject: str,
from_nickname: str, from_domain: str) -> None: from_nickname: str, from_domain: str) -> None:
"""Creates a notification that a new git patch has arrived """Creates a notification that a new git patch has arrived
""" """
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
return return
patch_file = account_dir + '/.newPatch' patch_file = account_dir + '/.newPatch'
@ -3440,7 +3448,7 @@ def _git_patch_notify(base_dir: str, handle: str, subject: str,
def _group_handle(base_dir: str, handle: str) -> bool: def _group_handle(base_dir: str, handle: str) -> bool:
"""Is the given account handle a group? """Is the given account handle a group?
""" """
actor_file = base_dir + '/accounts/' + handle + '.json' actor_file = acct_handle_dir(base_dir, handle) + '.json'
if not os.path.isfile(actor_file): if not os.path.isfile(actor_file):
return False return False
actor_json = load_json(actor_file) actor_json = load_json(actor_file)
@ -3478,7 +3486,7 @@ def _send_to_group_members(server, session, session_onion, session_i2p,
domain_str = shared_federated_domain.strip() domain_str = shared_federated_domain.strip()
shared_items_federated_domains.append(domain_str) shared_items_federated_domains.append(domain_str)
followers_file = base_dir + '/accounts/' + handle + '/followers.txt' followers_file = acct_handle_dir(base_dir, handle) + '/followers.txt'
if not os.path.isfile(followers_file): if not os.path.isfile(followers_file):
return return
if not post_json_object.get('to'): if not post_json_object.get('to'):
@ -3572,7 +3580,7 @@ def inbox_update_index(boxname: str, base_dir: str, handle: str,
The new entry is added to the top of the file The new entry is added to the top of the file
""" """
index_filename = \ index_filename = \
base_dir + '/accounts/' + handle + '/' + boxname + '.index' acct_handle_dir(base_dir, handle) + '/' + boxname + '.index'
if debug: if debug:
print('DEBUG: Updating index ' + index_filename) print('DEBUG: Updating index ' + index_filename)
@ -5124,10 +5132,11 @@ def _receive_follow_request(session, session_onion, session_i2p,
return True return True
handle_to_follow = nickname_to_follow + '@' + domain_to_follow handle_to_follow = nickname_to_follow + '@' + domain_to_follow
if domain_to_follow == domain: if domain_to_follow == domain:
if not os.path.isdir(base_dir + '/accounts/' + handle_to_follow): handle_dir = acct_handle_dir(base_dir, handle_to_follow)
if not os.path.isdir(handle_dir):
if debug: if debug:
print('DEBUG: followed account not found - ' + print('DEBUG: followed account not found - ' +
base_dir + '/accounts/' + handle_to_follow) handle_dir)
return True return True
is_already_follower = False is_already_follower = False
@ -5891,7 +5900,7 @@ def run_inbox_queue(server,
mitm = True mitm = True
bold_reading = False bold_reading = False
bold_reading_filename = \ bold_reading_filename = \
base_dir + '/accounts/' + handle + '/.boldReading' acct_handle_dir(base_dir, handle) + '/.boldReading'
if os.path.isfile(bold_reading_filename): if os.path.isfile(bold_reading_filename):
bold_reading = True bold_reading = True
_inbox_after_initial(server, inbox_start_time, _inbox_after_initial(server, inbox_start_time,

View File

@ -11,6 +11,7 @@ import os
from follow import followed_account_accepts from follow import followed_account_accepts
from follow import followed_account_rejects from follow import followed_account_rejects
from follow import remove_from_follow_requests from follow import remove_from_follow_requests
from utils import acct_handle_dir
from utils import load_json from utils import load_json
from utils import remove_domain_port from utils import remove_domain_port
from utils import get_port_from_domain from utils import get_port_from_domain
@ -149,7 +150,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
handle = nickname + '@' + domain handle = nickname + '@' + domain
print('Manual follow accept: ' + handle + print('Manual follow accept: ' + handle +
' approving follow request from ' + approve_handle) ' approving follow request from ' + approve_handle)
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
approve_follows_filename = account_dir + '/followrequests.txt' approve_follows_filename = account_dir + '/followrequests.txt'
if not os.path.isfile(approve_follows_filename): if not os.path.isfile(approve_follows_filename):
print('Manual follow accept: follow requests file ' + print('Manual follow accept: follow requests file ' +

View File

@ -20,6 +20,7 @@ from datetime import timezone
from collections import OrderedDict from collections import OrderedDict
from utils import valid_post_date from utils import valid_post_date
from categories import set_hashtag_category from categories import set_hashtag_category
from utils import acct_handle_dir
from utils import remove_eol from utils import remove_eol
from utils import get_domain_from_actor from utils import get_domain_from_actor
from utils import valid_hash_tag from utils import valid_hash_tag
@ -1538,8 +1539,8 @@ def _add_blogs_to_newswire(base_dir: str, domain: str, newswire: {},
if is_suspended(base_dir, nickname): if is_suspended(base_dir, nickname):
continue continue
if os.path.isfile(base_dir + '/accounts/' + handle + handle_dir = acct_handle_dir(base_dir, handle)
'/.nonewswire'): if os.path.isfile(handle_dir + '/.nonewswire'):
continue continue
# is there a blogs timeline for this account? # is there a blogs timeline for this account?

View File

@ -38,6 +38,7 @@ from roles import set_role
from roles import actor_roles_from_list from roles import actor_roles_from_list
from roles import get_actor_roles_list from roles import get_actor_roles_list
from media import process_meta_data from media import process_meta_data
from utils import acct_handle_dir
from utils import safe_system_string from utils import safe_system_string
from utils import get_attachment_property_value from utils import get_attachment_property_value
from utils import get_nickname_from_actor from utils import get_nickname_from_actor
@ -117,12 +118,13 @@ def set_profile_image(base_dir: str, http_prefix: str,
full_domain = get_full_domain(domain, port) full_domain = get_full_domain(domain, port)
handle = nickname + '@' + domain handle = nickname + '@' + domain
person_filename = base_dir + '/accounts/' + handle + '.json' person_filename = acct_handle_dir(base_dir, handle) + '.json'
if not os.path.isfile(person_filename): if not os.path.isfile(person_filename):
print('person definition not found: ' + person_filename) print('person definition not found: ' + person_filename)
return False return False
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
print('Account not found: ' + base_dir + '/accounts/' + handle) if not os.path.isdir(handle_dir):
print('Account not found: ' + handle_dir)
return False return False
icon_filename_base = 'icon' icon_filename_base = 'icon'
@ -155,7 +157,7 @@ def set_profile_image(base_dir: str, http_prefix: str,
elif image_filename.endswith('.svg'): elif image_filename.endswith('.svg'):
media_type = 'image/svg+xml' media_type = 'image/svg+xml'
icon_filename = icon_filename_base + '.svg' icon_filename = icon_filename_base + '.svg'
profile_filename = base_dir + '/accounts/' + handle + '/' + icon_filename profile_filename = acct_handle_dir(base_dir, handle) + '/' + icon_filename
person_json = load_json(person_filename) person_json = load_json(person_filename)
if person_json: if person_json:
@ -957,7 +959,7 @@ def person_lookup(domain: str, path: str, base_dir: str) -> {}:
return None return None
domain = remove_domain_port(domain) domain = remove_domain_port(domain)
handle = nickname + '@' + domain handle = nickname + '@' + domain
filename = base_dir + '/accounts/' + handle + '.json' filename = acct_handle_dir(base_dir, handle) + '.json'
if not os.path.isfile(filename): if not os.path.isfile(filename):
return None return None
person_json = load_json(filename) person_json = load_json(filename)
@ -1087,7 +1089,7 @@ def set_display_nickname(base_dir: str, nickname: str, domain: str,
if len(display_name) > 32: if len(display_name) > 32:
return False return False
handle = nickname + '@' + domain handle = nickname + '@' + domain
filename = base_dir + '/accounts/' + handle + '.json' filename = acct_handle_dir(base_dir, handle) + '.json'
if not os.path.isfile(filename): if not os.path.isfile(filename):
return False return False
@ -1105,7 +1107,7 @@ def set_bio(base_dir: str, nickname: str, domain: str, bio: str) -> bool:
if len(bio) > 32: if len(bio) > 32:
return False return False
handle = nickname + '@' + domain handle = nickname + '@' + domain
filename = base_dir + '/accounts/' + handle + '.json' filename = acct_handle_dir(base_dir, handle) + '.json'
if not os.path.isfile(filename): if not os.path.isfile(filename):
return False return False
@ -1280,15 +1282,16 @@ def remove_account(base_dir: str, nickname: str,
if os.path.isdir(base_dir + '/deactivated/' + handle): if os.path.isdir(base_dir + '/deactivated/' + handle):
shutil.rmtree(base_dir + '/deactivated/' + handle, shutil.rmtree(base_dir + '/deactivated/' + handle,
ignore_errors=False, onerror=None) ignore_errors=False, onerror=None)
if os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
shutil.rmtree(base_dir + '/accounts/' + handle, if os.path.isdir(handle_dir):
shutil.rmtree(handle_dir,
ignore_errors=False, onerror=None) ignore_errors=False, onerror=None)
if os.path.isfile(base_dir + '/accounts/' + handle + '.json'): if os.path.isfile(handle_dir + '.json'):
try: try:
os.remove(base_dir + '/accounts/' + handle + '.json') os.remove(handle_dir + '.json')
except OSError: except OSError:
print('EX: remove_account unable to delete ' + print('EX: remove_account unable to delete ' +
base_dir + '/accounts/' + handle + '.json') handle_dir + '.json')
if os.path.isfile(base_dir + '/wfendpoints/' + handle + '.json'): if os.path.isfile(base_dir + '/wfendpoints/' + handle + '.json'):
try: try:
os.remove(base_dir + '/wfendpoints/' + handle + '.json') os.remove(base_dir + '/wfendpoints/' + handle + '.json')
@ -1330,7 +1333,7 @@ def deactivate_account(base_dir: str, nickname: str, domain: str) -> bool:
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
return False return False
deactivated_dir = base_dir + '/deactivated' deactivated_dir = base_dir + '/deactivated'
@ -1365,7 +1368,7 @@ def activate_account(base_dir: str, nickname: str, domain: str) -> None:
deactivated_dir = base_dir + '/deactivated' deactivated_dir = base_dir + '/deactivated'
deactivated_account_dir = deactivated_dir + '/' + handle deactivated_account_dir = deactivated_dir + '/' + handle
if os.path.isdir(deactivated_account_dir): if os.path.isdir(deactivated_account_dir):
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(account_dir): if not os.path.isdir(account_dir):
shutil.move(deactivated_account_dir, account_dir) shutil.move(deactivated_account_dir, account_dir)

View File

@ -32,6 +32,7 @@ from webfinger import webfinger_handle
from httpsig import create_signed_header from httpsig import create_signed_header
from siteactive import site_is_active from siteactive import site_is_active
from languages import understood_post_language from languages import understood_post_language
from utils import acct_handle_dir
from utils import is_dm from utils import is_dm
from utils import remove_eol from utils import remove_eol
from utils import text_in_file from utils import text_in_file
@ -134,7 +135,7 @@ def no_of_followers_on_domain(base_dir: str, handle: str,
"""Returns the number of followers of the given handle from the """Returns the number of followers of the given handle from the
given domain given domain
""" """
filename = base_dir + '/accounts/' + handle + '/' + follow_file filename = acct_handle_dir(base_dir, handle) + '/' + follow_file
if not os.path.isfile(filename): if not os.path.isfile(filename):
return 0 return 0
@ -1022,7 +1023,7 @@ def _add_schedule_post(base_dir: str, nickname: str, domain: str,
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
schedule_index_filename = \ schedule_index_filename = \
base_dir + '/accounts/' + handle + '/schedule.index' acct_handle_dir(base_dir, handle) + '/schedule.index'
index_str = event_date_str + ' ' + post_id.replace('/', '#') index_str = event_date_str + ' ' + post_id.replace('/', '#')
if os.path.isfile(schedule_index_filename): if os.path.isfile(schedule_index_filename):
@ -2150,7 +2151,8 @@ def get_mentioned_people(base_dir: str, http_prefix: str,
print('DEBUG: mentioned handle ' + handle) print('DEBUG: mentioned handle ' + handle)
if '@' not in handle: if '@' not in handle:
handle = handle + '@' + domain handle = handle + '@' + domain
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
continue continue
else: else:
external_domain = handle.split('@')[1] external_domain = handle.split('@')[1]
@ -2322,7 +2324,7 @@ def create_report_post(base_dir: str,
# save a notification file so that the moderator # save a notification file so that the moderator
# knows something new has appeared # knows something new has appeared
new_report_file = base_dir + '/accounts/' + handle + '/.newReport' new_report_file = acct_handle_dir(base_dir, handle) + '/.newReport'
if os.path.isfile(new_report_file): if os.path.isfile(new_report_file):
continue continue
try: try:
@ -2745,7 +2747,7 @@ def group_followers_by_domain(base_dir: str, nickname: str, domain: str) -> {}:
"""Returns a dictionary with followers grouped by domain """Returns a dictionary with followers grouped by domain
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
followers_filename = base_dir + '/accounts/' + handle + '/followers.txt' followers_filename = acct_handle_dir(base_dir, handle) + '/followers.txt'
if not os.path.isfile(followers_filename): if not os.path.isfile(followers_filename):
return None return None
grouped = {} grouped = {}
@ -4353,18 +4355,14 @@ def archive_posts(base_dir: str, http_prefix: str, archive_dir: str,
domain = handle.split('@')[1] domain = handle.split('@')[1]
archive_subdir = None archive_subdir = None
if archive_dir: if archive_dir:
if not os.path.isdir(archive_dir + '/accounts/' + handle): archive_handle_dir = acct_handle_dir(archive_dir, handle)
os.mkdir(archive_dir + '/accounts/' + handle) if not os.path.isdir(archive_handle_dir):
if not os.path.isdir(archive_dir + '/accounts/' + os.mkdir(archive_handle_dir)
handle + '/inbox'): if not os.path.isdir(archive_handle_dir + '/inbox'):
os.mkdir(archive_dir + '/accounts/' + os.mkdir(archive_handle_dir + '/inbox')
handle + '/inbox') if not os.path.isdir(archive_handle_dir + '/outbox'):
if not os.path.isdir(archive_dir + '/accounts/' + os.mkdir(archive_handle_dir + '/outbox')
handle + '/outbox'): archive_subdir = archive_handle_dir + '/inbox'
os.mkdir(archive_dir + '/accounts/' +
handle + '/outbox')
archive_subdir = archive_dir + '/accounts/' + \
handle + '/inbox'
archive_posts_for_person(http_prefix, archive_posts_for_person(http_prefix,
nickname, domain, base_dir, nickname, domain, base_dir,
'inbox', archive_subdir, 'inbox', archive_subdir,
@ -4443,7 +4441,7 @@ def get_post_expiry_keep_dms(base_dir: str, nickname: str, domain: str) -> int:
keep_dms = True keep_dms = True
handle = nickname + '@' + domain handle = nickname + '@' + domain
expire_dms_filename = \ expire_dms_filename = \
base_dir + '/accounts/' + handle + '/.expire_posts_dms' acct_handle_dir(base_dir, handle) + '/.expire_posts_dms'
if os.path.isfile(expire_dms_filename): if os.path.isfile(expire_dms_filename):
keep_dms = False keep_dms = False
return keep_dms return keep_dms
@ -4455,7 +4453,7 @@ def set_post_expiry_keep_dms(base_dir: str, nickname: str, domain: str,
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
expire_dms_filename = \ expire_dms_filename = \
base_dir + '/accounts/' + handle + '/.expire_posts_dms' acct_handle_dir(base_dir, handle) + '/.expire_posts_dms'
if keep_dms: if keep_dms:
if os.path.isfile(expire_dms_filename): if os.path.isfile(expire_dms_filename):
try: try:
@ -4484,7 +4482,7 @@ def expire_posts(base_dir: str, http_prefix: str,
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
domain = handle.split('@')[1] domain = handle.split('@')[1]
expire_posts_filename = \ expire_posts_filename = \
base_dir + '/accounts/' + handle + '/.expire_posts_days' acct_handle_dir(base_dir, handle) + '/.expire_posts_days'
if not os.path.isfile(expire_posts_filename): if not os.path.isfile(expire_posts_filename):
continue continue
keep_dms = get_post_expiry_keep_dms(base_dir, nickname, domain) keep_dms = get_post_expiry_keep_dms(base_dir, nickname, domain)
@ -4519,7 +4517,7 @@ def get_post_expiry_days(base_dir: str, nickname: str, domain: str) -> int:
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
expire_posts_filename = \ expire_posts_filename = \
base_dir + '/accounts/' + handle + '/.expire_posts_days' acct_handle_dir(base_dir, handle) + '/.expire_posts_days'
if not os.path.isfile(expire_posts_filename): if not os.path.isfile(expire_posts_filename):
return 0 return 0
days_str = None days_str = None
@ -4542,7 +4540,7 @@ def set_post_expiry_days(base_dir: str, nickname: str, domain: str,
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
expire_posts_filename = \ expire_posts_filename = \
base_dir + '/accounts/' + handle + '/.expire_posts_days' acct_handle_dir(base_dir, handle) + '/.expire_posts_days'
try: try:
with open(expire_posts_filename, 'w+', encoding='utf-8') as fp_expire: with open(expire_posts_filename, 'w+', encoding='utf-8') as fp_expire:
fp_expire.write(str(max_age_days)) fp_expire.write(str(max_age_days))
@ -4577,7 +4575,7 @@ def archive_posts_for_person(http_prefix: str, nickname: str, domain: str,
# remove entries from the index # remove entries from the index
handle = nickname + '@' + domain handle = nickname + '@' + domain
index_filename = \ index_filename = \
base_dir + '/accounts/' + handle + '/' + boxname + '.index' acct_handle_dir(base_dir, handle) + '/' + boxname + '.index'
if os.path.isfile(index_filename): if os.path.isfile(index_filename):
index_ctr = 0 index_ctr = 0
# get the existing index entries as a string # get the existing index entries as a string

View File

@ -10,6 +10,7 @@ __module_group__ = "Calendar"
import os import os
import time import time
import datetime import datetime
from utils import acct_handle_dir
from utils import has_object_dict from utils import has_object_dict
from utils import get_status_number from utils import get_status_number
from utils import load_json from utils import load_json
@ -27,7 +28,7 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
the outbox the outbox
""" """
schedule_index_filename = \ schedule_index_filename = \
base_dir + '/accounts/' + handle + '/schedule.index' acct_handle_dir(base_dir, handle) + '/schedule.index'
if not os.path.isfile(schedule_index_filename): if not os.path.isfile(schedule_index_filename):
return return
@ -35,7 +36,7 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
curr_time = datetime.datetime.utcnow() curr_time = datetime.datetime.utcnow()
days_since_epoch = (curr_time - datetime.datetime(1970, 1, 1)).days days_since_epoch = (curr_time - datetime.datetime(1970, 1, 1)).days
schedule_dir = base_dir + '/accounts/' + handle + '/scheduled/' schedule_dir = acct_handle_dir(base_dir, handle) + '/scheduled/'
index_lines = [] index_lines = []
delete_schedule_post = False delete_schedule_post = False
nickname = handle.split('@')[0] nickname = handle.split('@')[0]
@ -168,7 +169,7 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
# write the new schedule index file # write the new schedule index file
schedule_index_file = \ schedule_index_file = \
base_dir + '/accounts/' + handle + '/schedule.index' acct_handle_dir(base_dir, handle) + '/schedule.index'
with open(schedule_index_file, 'w+', encoding='utf-8') as schedule_file: with open(schedule_index_file, 'w+', encoding='utf-8') as schedule_file:
for line in index_lines: for line in index_lines:
schedule_file.write(line) schedule_file.write(line)

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
journalctl -u epicyon | grep 'getJson Forbidden ' > .blocked_events.txt journalctl -u epicyon | grep 'get_json Forbidden ' > .blocked_events.txt
if [ ! -f .blocked_events.txt ]; then if [ ! -f .blocked_events.txt ]; then
echo 'No blocking events' echo 'No blocking events'
else else

View File

@ -22,6 +22,7 @@ from posts import get_person_box
from session import post_json from session import post_json
from session import post_image from session import post_image
from session import create_session from session import create_session
from utils import acct_handle_dir
from utils import remove_eol from utils import remove_eol
from utils import has_object_string_type from utils import has_object_string_type
from utils import date_string_to_seconds from utils import date_string_to_seconds
@ -275,7 +276,7 @@ def _indicate_new_share_available(base_dir: str, http_prefix: str,
for handle in dirs: for handle in dirs:
if not is_account_dir(handle): if not is_account_dir(handle):
continue continue
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
if shares_file_type == 'shares': if shares_file_type == 'shares':
new_share_file = account_dir + '/.newShare' new_share_file = account_dir + '/.newShare'
else: else:
@ -421,7 +422,7 @@ def _expire_shares_for_account(base_dir: str, nickname: str, domain: str,
handle_domain = remove_domain_port(domain) handle_domain = remove_domain_port(domain)
handle = nickname + '@' + handle_domain handle = nickname + '@' + handle_domain
shares_filename = \ shares_filename = \
base_dir + '/accounts/' + handle + '/' + shares_file_type + '.json' acct_handle_dir(base_dir, handle) + '/' + shares_file_type + '.json'
if not os.path.isfile(shares_filename): if not os.path.isfile(shares_filename):
return return
shares_json = load_json(shares_filename, 1, 2) shares_json = load_json(shares_filename, 1, 2)

View File

@ -290,6 +290,10 @@ def acct_dir(base_dir: str, nickname: str, domain: str) -> str:
return base_dir + '/accounts/' + nickname + '@' + domain return base_dir + '/accounts/' + nickname + '@' + domain
def acct_handle_dir(base_dir: str, handle: str) -> str:
return base_dir + '/accounts/' + handle
def is_featured_writer(base_dir: str, nickname: str, domain: str) -> bool: def is_featured_writer(base_dir: str, nickname: str, domain: str) -> bool:
"""Is the given account a featured writer, appearing in the features """Is the given account a featured writer, appearing in the features
timeline on news instances? timeline on news instances?
@ -749,7 +753,8 @@ def get_followers_of_person(base_dir: str,
followers = [] followers = []
domain = remove_domain_port(domain) domain = remove_domain_port(domain)
handle = nickname + '@' + domain handle = nickname + '@' + domain
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
return followers return followers
for subdir, dirs, _ in os.walk(base_dir + '/accounts'): for subdir, dirs, _ in os.walk(base_dir + '/accounts'):
for account in dirs: for account in dirs:
@ -981,9 +986,10 @@ def create_person_dir(nickname: str, domain: str, base_dir: str,
"""Create a directory for a person """Create a directory for a person
""" """
handle = nickname + '@' + domain handle = nickname + '@' + domain
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
os.mkdir(base_dir + '/accounts/' + handle) if not os.path.isdir(handle_dir):
box_dir = base_dir + '/accounts/' + handle + '/' + dir_name os.mkdir(handle_dir)
box_dir = acct_handle_dir(base_dir, handle) + '/' + dir_name
if not os.path.isdir(box_dir): if not os.path.isdir(box_dir):
os.mkdir(box_dir) os.mkdir(box_dir)
return box_dir return box_dir
@ -1450,7 +1456,8 @@ def follow_person(base_dir: str, nickname: str, domain: str,
else: else:
handle = nickname + '@' + domain handle = nickname + '@' + domain
if not os.path.isdir(base_dir + '/accounts/' + handle): handle_dir = acct_handle_dir(base_dir, handle)
if not os.path.isdir(handle_dir):
print('WARN: account for ' + handle + ' does not exist') print('WARN: account for ' + handle + ' does not exist')
return False return False
@ -1464,7 +1471,7 @@ def follow_person(base_dir: str, nickname: str, domain: str,
handle_to_follow = '!' + handle_to_follow handle_to_follow = '!' + handle_to_follow
# was this person previously unfollowed? # was this person previously unfollowed?
unfollowed_filename = base_dir + '/accounts/' + handle + '/unfollowed.txt' unfollowed_filename = acct_handle_dir(base_dir, handle) + '/unfollowed.txt'
if os.path.isfile(unfollowed_filename): if os.path.isfile(unfollowed_filename):
if text_in_file(handle_to_follow, unfollowed_filename): if text_in_file(handle_to_follow, unfollowed_filename):
# remove them from the unfollowed file # remove them from the unfollowed file
@ -1484,7 +1491,7 @@ def follow_person(base_dir: str, nickname: str, domain: str,
handle_to_follow = follow_nickname + '@' + follow_domain handle_to_follow = follow_nickname + '@' + follow_domain
if group_account: if group_account:
handle_to_follow = '!' + handle_to_follow handle_to_follow = '!' + handle_to_follow
filename = base_dir + '/accounts/' + handle + '/' + follow_file filename = acct_handle_dir(base_dir, handle) + '/' + follow_file
if os.path.isfile(filename): if os.path.isfile(filename):
if text_in_file(handle_to_follow, filename): if text_in_file(handle_to_follow, filename):
if debug: if debug:
@ -3816,7 +3823,7 @@ def get_account_timezone(base_dir: str, nickname: str, domain: str) -> str:
"""Returns the timezone for the given account """Returns the timezone for the given account
""" """
tz_filename = \ tz_filename = \
base_dir + '/accounts/' + nickname + '@' + domain + '/timezone.txt' acct_dir(base_dir, nickname, domain) + '/timezone.txt'
if not os.path.isfile(tz_filename): if not os.path.isfile(tz_filename):
return None return None
timezone = None timezone = None
@ -3830,7 +3837,7 @@ def set_account_timezone(base_dir: str, nickname: str, domain: str,
"""Sets the timezone for the given account """Sets the timezone for the given account
""" """
tz_filename = \ tz_filename = \
base_dir + '/accounts/' + nickname + '@' + domain + '/timezone.txt' acct_dir(base_dir, nickname, domain) + '/timezone.txt'
timezone = timezone.strip() timezone = timezone.strip()
with open(tz_filename, 'w+', encoding='utf-8') as fp_timezone: with open(tz_filename, 'w+', encoding='utf-8') as fp_timezone:
fp_timezone.write(timezone) fp_timezone.write(timezone)

View File

@ -2158,9 +2158,9 @@ def _html_edit_notifications(base_dir: str, nickname: str, domain: str,
ntfy_topic = '' ntfy_topic = ''
ntfy_url_file = \ ntfy_url_file = \
base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_url' acct_dir(base_dir, nickname, domain) + '/.ntfy_url'
ntfy_topic_file = \ ntfy_topic_file = \
base_dir + '/accounts/' + nickname + '@' + domain + '/.ntfy_topic' acct_dir(base_dir, nickname, domain) + '/.ntfy_topic'
if os.path.isfile(ntfy_url_file): if os.path.isfile(ntfy_url_file):
try: try:
with open(ntfy_url_file, 'r', encoding='utf-8') as fp_ntfy: with open(ntfy_url_file, 'r', encoding='utf-8') as fp_ntfy:

View File

@ -11,6 +11,7 @@ import os
from shutil import copyfile from shutil import copyfile
import urllib.parse import urllib.parse
from datetime import datetime from datetime import datetime
from utils import acct_handle_dir
from utils import get_base_content_from_post from utils import get_base_content_from_post
from utils import is_account_dir from utils import is_account_dir
from utils import get_config_param from utils import get_config_param
@ -299,7 +300,7 @@ def html_search_shared_items(translate: {},
if not is_account_dir(handle): if not is_account_dir(handle):
continue continue
contact_nickname = handle.split('@')[0] contact_nickname = handle.split('@')[0]
shares_filename = base_dir + '/accounts/' + handle + \ shares_filename = acct_handle_dir(base_dir, handle) + \
'/' + shares_file_type + '.json' '/' + shares_file_type + '.json'
if not os.path.isfile(shares_filename): if not os.path.isfile(shares_filename):
continue continue

View File

@ -11,6 +11,7 @@ import os
from shutil import copyfile from shutil import copyfile
from collections import OrderedDict from collections import OrderedDict
from session import get_json from session import get_json
from utils import acct_handle_dir
from utils import remove_id_ending from utils import remove_id_ending
from utils import get_attachment_property_value from utils import get_attachment_property_value
from utils import is_account_dir from utils import is_account_dir
@ -464,7 +465,7 @@ def shares_timeline_json(actor: str, pageNumber: int, items_per_page: int,
for handle in dirs: for handle in dirs:
if not is_account_dir(handle): if not is_account_dir(handle):
continue continue
account_dir = base_dir + '/accounts/' + handle account_dir = acct_handle_dir(base_dir, handle)
shares_filename = account_dir + '/' + shares_file_type + '.json' shares_filename = account_dir + '/' + shares_file_type + '.json'
if not os.path.isfile(shares_filename): if not os.path.isfile(shares_filename):
continue continue
@ -1953,3 +1954,16 @@ def language_right_to_left(language: str) -> bool:
if language in rtl_languages: if language in rtl_languages:
return True return True
return False return False
def get_default_path(media_instance: bool, blogs_instance: bool,
nickname: str) -> str:
"""Returns the default timeline
"""
if blogs_instance:
path = '/users/' + nickname + '/tlblogs'
elif media_instance:
path = '/users/' + nickname + '/tlmedia'
else:
path = '/users/' + nickname + '/inbox'
return path

View File

@ -12,6 +12,7 @@ import urllib.parse
from session import get_json from session import get_json
from cache import store_webfinger_in_cache from cache import store_webfinger_in_cache
from cache import get_webfinger_from_cache from cache import get_webfinger_from_cache
from utils import acct_handle_dir
from utils import get_attachment_property_value from utils import get_attachment_property_value
from utils import get_full_domain from utils import get_full_domain
from utils import load_json from utils import load_json
@ -520,7 +521,7 @@ def webfinger_update(base_dir: str, nickname: str, domain: str,
if not wf_json: if not wf_json:
return return
actor_filename = base_dir + '/accounts/' + handle + '.json' actor_filename = acct_handle_dir(base_dir, handle) + '.json'
actor_json = load_json(actor_filename) actor_json = load_json(actor_filename)
if not actor_json: if not actor_json:
return return