mirror of https://gitlab.com/bashrc2/epicyon
Option to reverse the sequence of timelines
parent
24e7c7f67c
commit
1b55d693e2
19
daemon.py
19
daemon.py
|
@ -269,6 +269,7 @@ from languages import get_understood_languages
|
|||
from like import update_likes_collection
|
||||
from reaction import update_reaction_collection
|
||||
from utils import load_reverse_timeline
|
||||
from utils import save_reverse_timeline
|
||||
from utils import load_min_images_for_accounts
|
||||
from utils import set_minimize_all_images
|
||||
from utils import get_json_content_from_accept
|
||||
|
@ -7189,6 +7190,21 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'unable to delete ' +
|
||||
bold_reading_filename)
|
||||
|
||||
# reverse timelines checkbox
|
||||
reverse = False
|
||||
if fields.get('reverseTimelines'):
|
||||
if fields['reverseTimelines'] == 'on':
|
||||
reverse = True
|
||||
if nickname not in self.server.reverse_sequence:
|
||||
self.server.reverse_sequence.append(nickname)
|
||||
save_reverse_timeline(base_dir,
|
||||
self.server.reverse_sequence)
|
||||
if not reverse:
|
||||
if nickname in self.server.reverse_sequence:
|
||||
self.server.reverse_sequence.remove(nickname)
|
||||
save_reverse_timeline(base_dir,
|
||||
self.server.reverse_sequence)
|
||||
|
||||
# notify about new Likes
|
||||
if on_final_welcome_screen:
|
||||
# default setting from welcome screen
|
||||
|
@ -15530,7 +15546,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.lists_enabled,
|
||||
self.server.system_language,
|
||||
self.server.min_images_for_accounts,
|
||||
self.server.max_recent_posts)
|
||||
self.server.max_recent_posts,
|
||||
self.server.reverse_sequence)
|
||||
if msg:
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "إرسال",
|
||||
"Minimize all images": "تصغير كل الصور",
|
||||
"Edit post": "تعديل المنشور",
|
||||
"Preview posts on profile screen": "معاينة المشاركات على شاشة الملف الشخصي"
|
||||
"Preview posts on profile screen": "معاينة المشاركات على شاشة الملف الشخصي",
|
||||
"Reverse timelines": "عكس الجداول الزمنية"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "পাঠান",
|
||||
"Minimize all images": "সমস্ত ছবি ছোট করুন",
|
||||
"Edit post": "পোস্ট সম্পাদনা করুন",
|
||||
"Preview posts on profile screen": "প্রোফাইল স্ক্রিনে পোস্টের পূর্বরূপ দেখুন"
|
||||
"Preview posts on profile screen": "প্রোফাইল স্ক্রিনে পোস্টের পূর্বরূপ দেখুন",
|
||||
"Reverse timelines": "বিপরীত সময়রেখা"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Enviar",
|
||||
"Minimize all images": "Minimitzar totes les imatges",
|
||||
"Edit post": "Edita la publicació",
|
||||
"Preview posts on profile screen": "Previsualitza les publicacions a la pantalla del perfil"
|
||||
"Preview posts on profile screen": "Previsualitza les publicacions a la pantalla del perfil",
|
||||
"Reverse timelines": "Cronologia inversa"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Anfon",
|
||||
"Minimize all images": "Lleihau pob delwedd",
|
||||
"Edit post": "Golygu post",
|
||||
"Preview posts on profile screen": "Rhagolwg postiadau ar sgrin proffil"
|
||||
"Preview posts on profile screen": "Rhagolwg postiadau ar sgrin proffil",
|
||||
"Reverse timelines": "Gwrthdroi llinellau amser"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Senden",
|
||||
"Minimize all images": "Alle Bilder minimieren",
|
||||
"Edit post": "Beitrag bearbeiten",
|
||||
"Preview posts on profile screen": "Vorschau von Beiträgen auf dem Profilbildschirm"
|
||||
"Preview posts on profile screen": "Vorschau von Beiträgen auf dem Profilbildschirm",
|
||||
"Reverse timelines": "Umgekehrte Zeitlinien"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Στείλετε",
|
||||
"Minimize all images": "Ελαχιστοποίηση όλων των εικόνων",
|
||||
"Edit post": "Επεξεργασία ανάρτησης",
|
||||
"Preview posts on profile screen": "Προεπισκόπηση αναρτήσεων στην οθόνη προφίλ"
|
||||
"Preview posts on profile screen": "Προεπισκόπηση αναρτήσεων στην οθόνη προφίλ",
|
||||
"Reverse timelines": "Αντίστροφα χρονοδιαγράμματα"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Send",
|
||||
"Minimize all images": "Minimize all images",
|
||||
"Edit post": "Edit post",
|
||||
"Preview posts on profile screen": "Preview posts on profile screen"
|
||||
"Preview posts on profile screen": "Preview posts on profile screen",
|
||||
"Reverse timelines": "Reverse timelines"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Enviar",
|
||||
"Minimize all images": "Minimizar todas las imágenes",
|
||||
"Edit post": "Editar post",
|
||||
"Preview posts on profile screen": "Vista previa de publicaciones en la pantalla de perfil"
|
||||
"Preview posts on profile screen": "Vista previa de publicaciones en la pantalla de perfil",
|
||||
"Reverse timelines": "Líneas de tiempo inversas"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "ارسال",
|
||||
"Minimize all images": "تمام تصاویر را به حداقل برسانید",
|
||||
"Edit post": "ویرایش پست",
|
||||
"Preview posts on profile screen": "پیش نمایش پست ها در صفحه نمایه"
|
||||
"Preview posts on profile screen": "پیش نمایش پست ها در صفحه نمایه",
|
||||
"Reverse timelines": "جدول های زمانی معکوس"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Envoyer",
|
||||
"Minimize all images": "Réduire toutes les images",
|
||||
"Edit post": "Modifier le message",
|
||||
"Preview posts on profile screen": "Prévisualiser les messages sur l'écran de profil"
|
||||
"Preview posts on profile screen": "Prévisualiser les messages sur l'écran de profil",
|
||||
"Reverse timelines": "Chronologies inversées"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Seol",
|
||||
"Minimize all images": "Íoslaghdaigh gach íomhá",
|
||||
"Edit post": "Cuir postáil in eagar",
|
||||
"Preview posts on profile screen": "Réamhamhairc postálacha ar an scáileán próifíle"
|
||||
"Preview posts on profile screen": "Réamhamhairc postálacha ar an scáileán próifíle",
|
||||
"Reverse timelines": "Amlínte droim ar ais"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "भेजना",
|
||||
"Minimize all images": "सभी छवियों को छोटा करें",
|
||||
"Edit post": "संपादित पोस्ट",
|
||||
"Preview posts on profile screen": "प्रोफ़ाइल स्क्रीन पर पोस्ट का पूर्वावलोकन करें"
|
||||
"Preview posts on profile screen": "प्रोफ़ाइल स्क्रीन पर पोस्ट का पूर्वावलोकन करें",
|
||||
"Reverse timelines": "रिवर्स टाइमलाइन"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Inviare",
|
||||
"Minimize all images": "Riduci a icona tutte le immagini",
|
||||
"Edit post": "Modifica post",
|
||||
"Preview posts on profile screen": "Visualizza l'anteprima dei post nella schermata del profilo"
|
||||
"Preview posts on profile screen": "Visualizza l'anteprima dei post nella schermata del profilo",
|
||||
"Reverse timelines": "Invertire le tempistiche"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "送信",
|
||||
"Minimize all images": "すべての画像を最小化",
|
||||
"Edit post": "投稿を編集",
|
||||
"Preview posts on profile screen": "プロフィール画面で投稿をプレビュー"
|
||||
"Preview posts on profile screen": "プロフィール画面で投稿をプレビュー",
|
||||
"Reverse timelines": "逆タイムライン"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "보내기",
|
||||
"Minimize all images": "모든 이미지 최소화",
|
||||
"Edit post": "게시물 수정",
|
||||
"Preview posts on profile screen": "프로필 화면에서 게시물 미리보기"
|
||||
"Preview posts on profile screen": "프로필 화면에서 게시물 미리보기",
|
||||
"Reverse timelines": "역방향 타임라인"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Şandin",
|
||||
"Minimize all images": "Hemî wêneyan kêm bikin",
|
||||
"Edit post": "Biguherîne post",
|
||||
"Preview posts on profile screen": "Mesajên li ser ekrana profîlê pêşdîtin"
|
||||
"Preview posts on profile screen": "Mesajên li ser ekrana profîlê pêşdîtin",
|
||||
"Reverse timelines": "Reverse timelines"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Versturen",
|
||||
"Minimize all images": "Alle afbeeldingen minimaliseren",
|
||||
"Edit post": "Bericht bewerken",
|
||||
"Preview posts on profile screen": "Bekijk berichten op het profielscherm"
|
||||
"Preview posts on profile screen": "Bekijk berichten op het profielscherm",
|
||||
"Reverse timelines": "Omgekeerde tijdlijnen"
|
||||
}
|
||||
|
|
|
@ -597,5 +597,6 @@
|
|||
"Send": "Send",
|
||||
"Minimize all images": "Minimize all images",
|
||||
"Edit post": "Edit post",
|
||||
"Preview posts on profile screen": "Preview posts on profile screen"
|
||||
"Preview posts on profile screen": "Preview posts on profile screen",
|
||||
"Reverse timelines": "Reverse timelines"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Wysłać",
|
||||
"Minimize all images": "Zminimalizuj wszystkie obrazy",
|
||||
"Edit post": "Edytuj post",
|
||||
"Preview posts on profile screen": "Podgląd postów na ekranie profilu"
|
||||
"Preview posts on profile screen": "Podgląd postów na ekranie profilu",
|
||||
"Reverse timelines": "Odwróć ramy czasowe"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Mandar",
|
||||
"Minimize all images": "Minimize todas as imagens",
|
||||
"Edit post": "Editar post",
|
||||
"Preview posts on profile screen": "Visualizar postagens na tela do perfil"
|
||||
"Preview posts on profile screen": "Visualizar postagens na tela do perfil",
|
||||
"Reverse timelines": "Cronogramas reversos"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Отправлять",
|
||||
"Minimize all images": "Свернуть все изображения",
|
||||
"Edit post": "Редактировать сообщение",
|
||||
"Preview posts on profile screen": "Предварительный просмотр сообщений на экране профиля"
|
||||
"Preview posts on profile screen": "Предварительный просмотр сообщений на экране профиля",
|
||||
"Reverse timelines": "Обратные сроки"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Tuma",
|
||||
"Minimize all images": "Punguza picha zote",
|
||||
"Edit post": "Badilisha chapisho",
|
||||
"Preview posts on profile screen": "Hakiki machapisho kwenye skrini ya wasifu"
|
||||
"Preview posts on profile screen": "Hakiki machapisho kwenye skrini ya wasifu",
|
||||
"Reverse timelines": "Обратные сроки"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Göndermek",
|
||||
"Minimize all images": "Tüm görüntüleri simge durumuna küçült",
|
||||
"Edit post": "Gönderiyi düzenle",
|
||||
"Preview posts on profile screen": "Gönderileri profil ekranında önizleyin"
|
||||
"Preview posts on profile screen": "Gönderileri profil ekranında önizleyin",
|
||||
"Reverse timelines": "Обратные сроки"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "Надіслати",
|
||||
"Minimize all images": "Згорнути всі зображення",
|
||||
"Edit post": "Редагувати пост",
|
||||
"Preview posts on profile screen": "Попередній перегляд дописів на екрані профілю"
|
||||
"Preview posts on profile screen": "Попередній перегляд дописів на екрані профілю",
|
||||
"Reverse timelines": "Обратные сроки"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "שיקן",
|
||||
"Minimize all images": "מינאַמייז אַלע בילדער",
|
||||
"Edit post": "רעדאַגירן פּאָסטן",
|
||||
"Preview posts on profile screen": "פאָרויסיקע ווייַזונג אַרטיקלען אויף פּראָפיל פאַרשטעלן"
|
||||
"Preview posts on profile screen": "פאָרויסיקע ווייַזונג אַרטיקלען אויף פּראָפיל פאַרשטעלן",
|
||||
"Reverse timelines": "פאַרקערט טיימליינז"
|
||||
}
|
||||
|
|
|
@ -601,5 +601,6 @@
|
|||
"Send": "发送",
|
||||
"Minimize all images": "最小化所有图像",
|
||||
"Edit post": "编辑帖子",
|
||||
"Preview posts on profile screen": "在个人资料屏幕上预览帖子"
|
||||
"Preview posts on profile screen": "在个人资料屏幕上预览帖子",
|
||||
"Reverse timelines": "倒转时间线"
|
||||
}
|
||||
|
|
30
utils.py
30
utils.py
|
@ -4040,3 +4040,33 @@ def load_reverse_timeline(base_dir: str) -> []:
|
|||
reverse_sequence.append(nickname)
|
||||
break
|
||||
return reverse_sequence
|
||||
|
||||
|
||||
def save_reverse_timeline(base_dir: str, reverse_sequence: []) -> []:
|
||||
"""Saves flags for each user indicating whether they prefer to
|
||||
see reversed timelines
|
||||
"""
|
||||
for _, dirs, _ in os.walk(base_dir + '/accounts'):
|
||||
for acct in dirs:
|
||||
if not is_account_dir(acct):
|
||||
continue
|
||||
nickname = acct.split('@')[0]
|
||||
domain = acct.split('@')[1]
|
||||
reverse_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/.reverse_timeline'
|
||||
if nickname in reverse_sequence:
|
||||
if not os.path.isfile(reverse_filename):
|
||||
try:
|
||||
with open(reverse_filename, 'w+',
|
||||
encoding='utf-8') as fp_reverse:
|
||||
fp_reverse.write('\n')
|
||||
except OSError:
|
||||
print('EX: failed to save reverse ' + reverse_filename)
|
||||
else:
|
||||
if os.path.isfile(reverse_filename):
|
||||
try:
|
||||
os.remove(reverse_filename)
|
||||
except OSError:
|
||||
print('EX: failed to delete reverse ' +
|
||||
reverse_filename)
|
||||
break
|
||||
|
|
|
@ -2157,7 +2157,8 @@ def _html_edit_profile_options(is_admin: bool,
|
|||
hide_reaction_button: str,
|
||||
translate: {}, bold_reading: bool,
|
||||
nickname: str,
|
||||
min_images_for_accounts: []) -> str:
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: []) -> str:
|
||||
"""option checkboxes section of edit profile screen
|
||||
"""
|
||||
edit_profile_form = ' <div class="container">\n'
|
||||
|
@ -2203,6 +2204,14 @@ def _html_edit_profile_options(is_admin: bool,
|
|||
edit_profile_form += \
|
||||
edit_check_box(minimize_all_images_str, 'minimizeAllImages',
|
||||
minimize_all_images)
|
||||
reverse = False
|
||||
if nickname in reverse_sequence:
|
||||
reverse = True
|
||||
reverse_str = \
|
||||
bold_reading_string(translate['Reverse timelines'])
|
||||
edit_profile_form += \
|
||||
edit_check_box(reverse_str, 'reverseTimelines', reverse)
|
||||
|
||||
edit_profile_form += ' </div>\n'
|
||||
return edit_profile_form
|
||||
|
||||
|
@ -2374,7 +2383,8 @@ def html_edit_profile(server, translate: {},
|
|||
cw_lists: {}, lists_enabled: str,
|
||||
system_language: str,
|
||||
min_images_for_accounts: [],
|
||||
max_recent_posts: int) -> str:
|
||||
max_recent_posts: int,
|
||||
reverse_sequence: []) -> str:
|
||||
"""Shows the edit profile screen
|
||||
"""
|
||||
path = path.replace('/inbox', '').replace('/outbox', '')
|
||||
|
@ -2569,7 +2579,8 @@ def html_edit_profile(server, translate: {},
|
|||
notify_likes, notify_reactions,
|
||||
hide_like_button, hide_reaction_button,
|
||||
translate, bold_reading,
|
||||
nickname, min_images_for_accounts)
|
||||
nickname, min_images_for_accounts,
|
||||
reverse_sequence)
|
||||
|
||||
# Contact information
|
||||
edit_profile_form += \
|
||||
|
|
Loading…
Reference in New Issue