mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
4a70315d50
51
daemon.py
51
daemon.py
|
@ -20822,7 +20822,56 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if fields['schedulePost']:
|
||||
return 1
|
||||
print('DEBUG: new reminder to ' +
|
||||
str(message_json['object']['to']))
|
||||
str(message_json['object']['to']) + ' ' +
|
||||
str(edited_postid))
|
||||
if edited_postid:
|
||||
recent_posts_cache = self.server.recent_posts_cache
|
||||
allow_local_network_access = \
|
||||
self.server.allow_local_network_access
|
||||
signing_priv_key_pem = \
|
||||
self.server.signing_priv_key_pem
|
||||
twitter_replacement_domain = \
|
||||
self.server.twitter_replacement_domain
|
||||
show_published_date_only = \
|
||||
self.server.show_published_date_only
|
||||
min_images_for_accounts = \
|
||||
self.server.min_images_for_accounts
|
||||
peertube_instances = \
|
||||
self.server.peertube_instances
|
||||
self._update_edited_post(self.server.base_dir,
|
||||
nickname, self.server.domain,
|
||||
message_json,
|
||||
edited_published,
|
||||
edited_postid,
|
||||
recent_posts_cache,
|
||||
'dm',
|
||||
self.server.max_mentions,
|
||||
self.server.max_emoji,
|
||||
allow_local_network_access,
|
||||
self.server.debug,
|
||||
self.server.system_language,
|
||||
self.server.http_prefix,
|
||||
self.server.domain_full,
|
||||
self.server.person_cache,
|
||||
signing_priv_key_pem,
|
||||
self.server.max_recent_posts,
|
||||
self.server.translate,
|
||||
curr_session,
|
||||
self.server.cached_webfingers,
|
||||
self.server.port,
|
||||
self.server.allow_deletion,
|
||||
self.server.yt_replace_domain,
|
||||
twitter_replacement_domain,
|
||||
show_published_date_only,
|
||||
peertube_instances,
|
||||
self.server.theme_name,
|
||||
self.server.max_like_count,
|
||||
self.server.cw_lists,
|
||||
self.server.dogwhistles,
|
||||
min_images_for_accounts,
|
||||
self.server.max_hashtags)
|
||||
print('DEBUG: sending edited reminder post ' +
|
||||
str(message_json))
|
||||
if self._post_to_outbox(message_json,
|
||||
self.server.project_version,
|
||||
nickname,
|
||||
|
|
14
happening.py
14
happening.py
|
@ -176,7 +176,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str,
|
|||
with open(calendar_filename, 'a+', encoding='utf-8') as calendar_file:
|
||||
calendar_file.write(post_id + '\n')
|
||||
except OSError:
|
||||
print('EX: unable to append ' + calendar_filename)
|
||||
print('EX: unable to append to calendar ' + calendar_filename)
|
||||
|
||||
# create a file which will trigger a notification that
|
||||
# a new event has been added
|
||||
|
@ -332,7 +332,8 @@ def get_todays_events(base_dir: str, nickname: str, domain: str,
|
|||
for post_id in calendar_post_ids:
|
||||
calendar_file.write(post_id + '\n')
|
||||
except OSError:
|
||||
print('EX: unable to write ' + calendar_filename)
|
||||
print('EX: unable to recreate events file 1 ' +
|
||||
calendar_filename)
|
||||
|
||||
return events
|
||||
|
||||
|
@ -656,7 +657,8 @@ def get_this_weeks_events(base_dir: str, nickname: str, domain: str) -> {}:
|
|||
for post_id in calendar_post_ids:
|
||||
calendar_file.write(post_id + '\n')
|
||||
except OSError:
|
||||
print('EX: unable to write ' + calendar_filename)
|
||||
print('EX: unable to recreate events file 2 ' +
|
||||
calendar_filename)
|
||||
|
||||
return events
|
||||
|
||||
|
@ -738,7 +740,8 @@ def get_calendar_events(base_dir: str, nickname: str, domain: str,
|
|||
for post_id in calendar_post_ids:
|
||||
calendar_file.write(post_id + '\n')
|
||||
except OSError:
|
||||
print('EX: unable to write ' + calendar_filename)
|
||||
print('EX: unable to recreate events file 3 ' +
|
||||
calendar_filename)
|
||||
|
||||
return events
|
||||
|
||||
|
@ -768,7 +771,8 @@ def remove_calendar_event(base_dir: str, nickname: str, domain: str,
|
|||
if message_id not in line:
|
||||
fp_cal.write(line)
|
||||
except OSError:
|
||||
print('EX: unable to write ' + calendar_filename)
|
||||
print('EX: unable to remove calendar event ' +
|
||||
calendar_filename)
|
||||
|
||||
|
||||
def _dav_decode_token(token: str) -> (int, int, str):
|
||||
|
|
12
inbox.py
12
inbox.py
|
@ -1262,7 +1262,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
message_id = remove_id_ending(message_json['object']['id'])
|
||||
if '#' in message_id:
|
||||
message_id = message_id.split('#', 1)[0]
|
||||
# find the post which was edited
|
||||
# find the original post which was edited
|
||||
post_filename = locate_post(base_dir, nickname, domain, message_id)
|
||||
if not post_filename:
|
||||
print('EDITPOST: ' + message_id + ' has already expired')
|
||||
|
@ -1276,7 +1276,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
print('EDITPOST: contains invalid content' + str(message_json))
|
||||
return False
|
||||
|
||||
# load the json for the post
|
||||
# load the json for the original post
|
||||
post_json_object = load_json(post_filename, 1)
|
||||
if not post_json_object:
|
||||
return False
|
||||
|
@ -1319,6 +1319,12 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
# Change Update to Create
|
||||
message_json['type'] = 'Create'
|
||||
save_json(message_json, post_filename)
|
||||
# if the post has been saved both within the outbox and inbox
|
||||
# (eg. edited reminder)
|
||||
if '/outbox/' in post_filename:
|
||||
inbox_post_filename = post_filename.replace('/outbox/', '/inbox/')
|
||||
if os.path.isfile(inbox_post_filename):
|
||||
save_json(message_json, inbox_post_filename)
|
||||
# ensure that the cached post is removed if it exists, so
|
||||
# that it then will be recreated
|
||||
cached_post_filename = \
|
||||
|
@ -1347,7 +1353,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {},
|
|||
mitm = True
|
||||
bold_reading = False
|
||||
bold_reading_filename = \
|
||||
base_dir + '/accounts/' + nickname + '@' + domain + '/.boldReading'
|
||||
acct_dir(base_dir, nickname, domain) + '/.boldReading'
|
||||
if os.path.isfile(bold_reading_filename):
|
||||
bold_reading = True
|
||||
timezone = get_account_timezone(base_dir, nickname, domain)
|
||||
|
|
23
posts.py
23
posts.py
|
@ -940,6 +940,29 @@ def save_post_to_box(base_dir: str, http_prefix: str, post_id: str,
|
|||
filename = box_dir + '/' + post_id.replace('/', '#') + '.json'
|
||||
|
||||
save_json(post_json_object, filename)
|
||||
# if this is an outbox post with a duplicate in the inbox then save to both
|
||||
# This happens for edited posts
|
||||
if '/outbox/' in filename:
|
||||
inbox_filename = filename.replace('/outbox/', '/inbox/')
|
||||
if os.path.isfile(inbox_filename):
|
||||
save_json(post_json_object, inbox_filename)
|
||||
base_filename = \
|
||||
filename.replace('/outbox/',
|
||||
'/postcache/').replace('.json', '')
|
||||
ssml_filename = base_filename + '.ssml'
|
||||
if os.path.isfile(ssml_filename):
|
||||
try:
|
||||
os.remove(ssml_filename)
|
||||
except OSError:
|
||||
print('EX: save_post_to_box unable to delete ssml file ' +
|
||||
ssml_filename)
|
||||
html_filename = base_filename + '.html'
|
||||
if os.path.isfile(html_filename):
|
||||
try:
|
||||
os.remove(html_filename)
|
||||
except OSError:
|
||||
print('EX: save_post_to_box unable to delete html file ' +
|
||||
html_filename)
|
||||
return filename
|
||||
|
||||
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "يتحرك",
|
||||
"Inactive": "غير نشط",
|
||||
"Registrations open": "التسجيلات مفتوحة",
|
||||
"Registrations remaining": "التسجيلات المتبقية"
|
||||
"Registrations remaining": "التسجيلات المتبقية",
|
||||
"Edit reminder": "تحرير التذكير"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "সরান",
|
||||
"Inactive": "নিষ্ক্রিয়",
|
||||
"Registrations open": "রেজিস্ট্রেশন খোলা",
|
||||
"Registrations remaining": "রেজিস্ট্রেশন বাকি"
|
||||
"Registrations remaining": "রেজিস্ট্রেশন বাকি",
|
||||
"Edit reminder": "অনুস্মারক সম্পাদনা করুন"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Moure's",
|
||||
"Inactive": "Inactiu",
|
||||
"Registrations open": "Inscripcions obertes",
|
||||
"Registrations remaining": "Inscripcions restants"
|
||||
"Registrations remaining": "Inscripcions restants",
|
||||
"Edit reminder": "Edita el recordatori"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Symud",
|
||||
"Inactive": "Anactif",
|
||||
"Registrations open": "Cofrestriadau yn agor",
|
||||
"Registrations remaining": "Cofrestriadau ar ôl"
|
||||
"Registrations remaining": "Cofrestriadau ar ôl",
|
||||
"Edit reminder": "Golygu nodyn atgoffa"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Bewegen",
|
||||
"Inactive": "Inaktiv",
|
||||
"Registrations open": "Anmeldungen geöffnet",
|
||||
"Registrations remaining": "Anmeldungen verbleiben"
|
||||
"Registrations remaining": "Anmeldungen verbleiben",
|
||||
"Edit reminder": "Erinnerung bearbeiten"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Κίνηση",
|
||||
"Inactive": "Αδρανής",
|
||||
"Registrations open": "Οι εγγραφές ανοίγουν",
|
||||
"Registrations remaining": "Απομένουν οι εγγραφές"
|
||||
"Registrations remaining": "Απομένουν οι εγγραφές",
|
||||
"Edit reminder": "Επεξεργασία υπενθύμισης"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Move",
|
||||
"Inactive": "Inactive",
|
||||
"Registrations open": "Registrations open",
|
||||
"Registrations remaining": "Registrations remaining"
|
||||
"Registrations remaining": "Registrations remaining",
|
||||
"Edit reminder": "Edit reminder"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Muevete",
|
||||
"Inactive": "Αδρανής",
|
||||
"Registrations open": "Inscripciones abiertas",
|
||||
"Registrations remaining": "Registros restantes"
|
||||
"Registrations remaining": "Registros restantes",
|
||||
"Edit reminder": "Editar recordatorio"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "حرکت",
|
||||
"Inactive": "غیر فعال",
|
||||
"Registrations open": "ثبت نام ها باز شد",
|
||||
"Registrations remaining": "ثبت نام باقی مانده است"
|
||||
"Registrations remaining": "ثبت نام باقی مانده است",
|
||||
"Edit reminder": "ویرایش یادآوری"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Déplacer",
|
||||
"Inactive": "Inactive",
|
||||
"Registrations open": "Inscriptions ouvertes",
|
||||
"Registrations remaining": "Inscriptions restantes"
|
||||
"Registrations remaining": "Inscriptions restantes",
|
||||
"Edit reminder": "Modifier le rappel"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Bog",
|
||||
"Inactive": "Neamhghníomhach",
|
||||
"Registrations open": "Clárúcháin oscailte",
|
||||
"Registrations remaining": "Clárúcháin fágtha"
|
||||
"Registrations remaining": "Clárúcháin fágtha",
|
||||
"Edit reminder": "Cuir meabhrúchán in eagar"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "कदम",
|
||||
"Inactive": "निष्क्रिय",
|
||||
"Registrations open": "पंजीकरण खुले हैं",
|
||||
"Registrations remaining": "रजिस्ट्रेशन बाकी हैं"
|
||||
"Registrations remaining": "रजिस्ट्रेशन बाकी हैं",
|
||||
"Edit reminder": "रिमाइंडर संपादित करें"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Spostare",
|
||||
"Inactive": "Non attivo",
|
||||
"Registrations open": "Aperte le iscrizioni",
|
||||
"Registrations remaining": "Iscrizioni rimanenti"
|
||||
"Registrations remaining": "Iscrizioni rimanenti",
|
||||
"Edit reminder": "Modifica promemoria"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "動く",
|
||||
"Inactive": "非活性",
|
||||
"Registrations open": "登録開始",
|
||||
"Registrations remaining": "残りの登録数"
|
||||
"Registrations remaining": "残りの登録数",
|
||||
"Edit reminder": "リマインダーを編集"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "이동하다",
|
||||
"Inactive": "비활성",
|
||||
"Registrations open": "등록 시작",
|
||||
"Registrations remaining": "남은 등록"
|
||||
"Registrations remaining": "남은 등록",
|
||||
"Edit reminder": "알림 수정"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Barkirin",
|
||||
"Inactive": "Bêkar",
|
||||
"Registrations open": "Qeydkirin vedibin",
|
||||
"Registrations remaining": "Registrations maye"
|
||||
"Registrations remaining": "Registrations maye",
|
||||
"Edit reminder": "Bîranîna biguherîne"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Beweging",
|
||||
"Inactive": "Inactief",
|
||||
"Registrations open": "Inschrijvingen geopend",
|
||||
"Registrations remaining": "Resterende inschrijvingen"
|
||||
"Registrations remaining": "Resterende inschrijvingen",
|
||||
"Edit reminder": "Herinnering bewerken"
|
||||
}
|
||||
|
|
|
@ -603,5 +603,6 @@
|
|||
"Move": "Move",
|
||||
"Inactive": "Inactive",
|
||||
"Registrations open": "Registrations open",
|
||||
"Registrations remaining": "Registrations remaining"
|
||||
"Registrations remaining": "Registrations remaining",
|
||||
"Edit reminder": "Edit reminder"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Przenosić",
|
||||
"Inactive": "Nieaktywny",
|
||||
"Registrations open": "Rejestracje otwarte",
|
||||
"Registrations remaining": "Pozostały zapisy"
|
||||
"Registrations remaining": "Pozostały zapisy",
|
||||
"Edit reminder": "Edytuj przypomnienie"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Jogada",
|
||||
"Inactive": "Inativa",
|
||||
"Registrations open": "inscrições abertas",
|
||||
"Registrations remaining": "Inscrições restantes"
|
||||
"Registrations remaining": "Inscrições restantes",
|
||||
"Edit reminder": "Editar lembrete"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Шаг",
|
||||
"Inactive": "Неактивный",
|
||||
"Registrations open": "Регистрация открыта",
|
||||
"Registrations remaining": "Осталось регистраций"
|
||||
"Registrations remaining": "Осталось регистраций",
|
||||
"Edit reminder": "Изменить напоминание"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Sogeza",
|
||||
"Inactive": "Isiyotumika",
|
||||
"Registrations open": "Usajili umefunguliwa",
|
||||
"Registrations remaining": "Usajili uliosalia"
|
||||
"Registrations remaining": "Usajili uliosalia",
|
||||
"Edit reminder": "Badilisha kikumbusho"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "Hareket",
|
||||
"Inactive": "etkin değil",
|
||||
"Registrations open": "kayıtlar açık",
|
||||
"Registrations remaining": "kalan kayıtlar"
|
||||
"Registrations remaining": "kalan kayıtlar",
|
||||
"Edit reminder": "Hatırlatıcıyı düzenle"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "рухатися",
|
||||
"Inactive": "Неактивний",
|
||||
"Registrations open": "Реєстрація відкрита",
|
||||
"Registrations remaining": "Залишилось реєстрацій"
|
||||
"Registrations remaining": "Залишилось реєстрацій",
|
||||
"Edit reminder": "Редагувати нагадування"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "מאַך",
|
||||
"Inactive": "ינאַקטיוו",
|
||||
"Registrations open": "רעדזשיסטריישאַנז עפענען",
|
||||
"Registrations remaining": "רעדזשיסטריישאַנז רוען"
|
||||
"Registrations remaining": "רעדזשיסטריישאַנז רוען",
|
||||
"Edit reminder": "רעדאַגירן דערמאָנונג"
|
||||
}
|
||||
|
|
|
@ -607,5 +607,6 @@
|
|||
"Move": "移动",
|
||||
"Inactive": "无效",
|
||||
"Registrations open": "注册开放",
|
||||
"Registrations remaining": "剩余名额"
|
||||
"Registrations remaining": "剩余名额",
|
||||
"Edit reminder": "编辑提醒"
|
||||
}
|
||||
|
|
22
utils.py
22
utils.py
|
@ -2046,6 +2046,28 @@ def is_dm(post_json_object: {}) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def is_reminder(post_json_object: {}) -> bool:
|
||||
"""Returns true if the given post is a reminder
|
||||
"""
|
||||
if not is_dm(post_json_object):
|
||||
return False
|
||||
if not post_json_object['object'].get('to'):
|
||||
return False
|
||||
if not post_json_object['object'].get('attributedTo'):
|
||||
return False
|
||||
if not post_json_object['object'].get('tag'):
|
||||
return False
|
||||
if len(post_json_object['object']['to']) != 1:
|
||||
return False
|
||||
if post_json_object['object']['to'][0] != \
|
||||
post_json_object['object']['attributedTo']:
|
||||
return False
|
||||
for tag in post_json_object['object']['tag']:
|
||||
if tag['type'] == 'Event':
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _is_remote_dm(domain_full: str, post_json_object: {}) -> bool:
|
||||
"""Is the given post a DM from a different domain?
|
||||
"""
|
||||
|
|
|
@ -40,6 +40,7 @@ from utils import has_object_dict
|
|||
from utils import update_announce_collection
|
||||
from utils import is_pgp_encrypted
|
||||
from utils import is_dm
|
||||
from utils import is_reminder
|
||||
from utils import is_chat_message
|
||||
from utils import reject_post_id
|
||||
from utils import is_recent_post
|
||||
|
@ -612,6 +613,21 @@ def _get_edit_icon_html(base_dir: str, nickname: str, domain_full: str,
|
|||
'<img loading="lazy" decoding="async" title="' + \
|
||||
edit_post_str + '" alt="' + edit_post_str + \
|
||||
' |" src="/icons/edit.png"/></a>\n'
|
||||
elif is_reminder(post_json_object):
|
||||
# Edit a reminder
|
||||
edit_post_str = 'Edit reminder'
|
||||
if translate.get(edit_post_str):
|
||||
edit_post_str = translate[edit_post_str]
|
||||
edit_str += \
|
||||
' ' + \
|
||||
'<a class="imageAnchor" href="/users/' + \
|
||||
nickname + '?postedit=' + \
|
||||
post_id.split('/statuses/')[1] + ';scope=reminder' + \
|
||||
';actor=' + actor_nickname + reply_to + \
|
||||
'" title="' + edit_post_str + '" tabindex="10">' + \
|
||||
'<img loading="lazy" decoding="async" title="' + \
|
||||
edit_post_str + '" alt="' + edit_post_str + \
|
||||
' |" src="/icons/edit.png"/></a>\n'
|
||||
elif is_dm(post_json_object):
|
||||
# Edit a DM
|
||||
edit_post_str = 'Edit post'
|
||||
|
|
|
@ -113,8 +113,6 @@ def csv_following_list(following_filename: str,
|
|||
for following_address in following_list:
|
||||
if not following_address:
|
||||
continue
|
||||
if following_list_csv:
|
||||
following_list_csv += '\n'
|
||||
|
||||
following_nickname = \
|
||||
get_nickname_from_actor(following_address)
|
||||
|
@ -139,9 +137,11 @@ def csv_following_list(following_filename: str,
|
|||
person_notes = person_notes.replace('"', "'")
|
||||
person_notes = person_notes.replace('\n', '<br>')
|
||||
person_notes = person_notes.replace(' ', ' ')
|
||||
if not following_list_csv:
|
||||
following_list_csv = \
|
||||
'Account address,Show boosts,' + \
|
||||
'Notify on new posts,Languages,Notes\n'
|
||||
following_list_csv += \
|
||||
'Account address,Show boosts,' + \
|
||||
'Notify on new posts,Languages,Notes\n' + \
|
||||
following_address + ',' + \
|
||||
str(announce_is_allowed).lower() + ',' + \
|
||||
notify_on_new + ',' + \
|
||||
|
|
Loading…
Reference in New Issue