Ability to hide recent posts preview on profile

main
Bob Mottram 2025-02-13 11:30:35 +00:00
parent ff2b08f954
commit c7442a0c5f
36 changed files with 209 additions and 61 deletions

View File

@ -60,6 +60,7 @@ from utils import load_account_timezones
from utils import load_translations_from_file
from utils import load_bold_reading
from utils import load_hide_follows
from utils import load_hide_recent_posts
from utils import get_full_domain
from utils import set_config_param
from utils import get_config_param
@ -327,6 +328,7 @@ class EpicyonServer(ThreadingHTTPServer):
preferred_podcast_formats: list[str] = []
bold_reading = {}
hide_follows = {}
hide_recent_posts = {}
account_timezone = None
post_to_nickname = None
nodeinfo_is_active = False
@ -856,6 +858,9 @@ def run_daemon(accounts_data_dir: str,
# whether to hide follows on profile screen for each account
httpd.hide_follows = load_hide_follows(base_dir)
# whether to hide recent public posts on profile screen for each account
httpd.hide_recent_posts = load_hide_recent_posts(base_dir)
httpd.account_timezone = load_account_timezones(base_dir)
httpd.post_to_nickname = None

View File

@ -4706,7 +4706,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -4764,7 +4765,8 @@ def daemon_http_get(self) -> None:
self.server.domain_full,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5622,7 +5624,8 @@ def daemon_http_get(self) -> None:
self.server.onion_domain,
self.server.i2p_domain,
self.server.hide_announces,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5741,7 +5744,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5799,7 +5803,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5856,7 +5861,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5914,7 +5920,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -5972,7 +5979,8 @@ def daemon_http_get(self) -> None:
self.server.fitness,
self.server.onion_domain,
self.server.i2p_domain,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return
@ -6029,7 +6037,8 @@ def daemon_http_get(self) -> None:
self.server.buy_sites,
self.server.no_of_books,
self.server.auto_cw_cache,
self.server.mitm_servers):
self.server.mitm_servers,
self.server.hide_recent_posts):
self.server.getreq_busy = False
return

View File

@ -70,7 +70,8 @@ def show_shares_feed(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the shares feed for a particular account/actor
"""
shares = \
@ -174,7 +175,8 @@ def show_shares_feed(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software)
instance_software,
hide_recent_posts)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -257,7 +259,8 @@ def show_following_feed(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the following feed for a particular account/actor
"""
following = \
@ -368,7 +371,8 @@ def show_following_feed(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software).encode('utf-8')
instance_software,
hide_recent_posts).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -457,7 +461,8 @@ def show_moved_feed(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the moved feed for a particular account/actor
"""
following = \
@ -563,7 +568,8 @@ def show_moved_feed(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software).encode('utf-8')
instance_software,
hide_recent_posts).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -644,7 +650,8 @@ def show_inactive_feed(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the inactive accounts feed for a particular account/actor
"""
following = \
@ -751,7 +758,8 @@ def show_inactive_feed(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software).encode('utf-8')
instance_software,
hide_recent_posts).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html',
msglen, cookie, calling_domain, False)
@ -834,7 +842,8 @@ def show_followers_feed(self, authorized: bool,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the followers feed for a particular account/actor
"""
followers = \
@ -942,7 +951,8 @@ def show_followers_feed(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software).encode('utf-8')
instance_software,
hide_recent_posts).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
cookie, calling_domain, False)

View File

@ -79,7 +79,8 @@ def show_person_profile(self, authorized: bool,
buy_sites: [],
no_of_books: int,
auto_cw_cache: {},
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the profile for a person
"""
# look up a person
@ -155,7 +156,8 @@ def show_person_profile(self, authorized: bool,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software).encode('utf-8')
instance_software,
hide_recent_posts).encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
cookie, calling_domain, False)
@ -239,7 +241,8 @@ def show_roles(self, calling_domain: str, referer_domain: str,
fitness: {},
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Show roles within profile screen
"""
named_status = path.split('/users/')[1]
@ -318,7 +321,8 @@ def show_roles(self, calling_domain: str, referer_domain: str,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software)
instance_software,
hide_recent_posts)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
@ -394,7 +398,8 @@ def show_skills(self, calling_domain: str, referer_domain: str,
domain_full: str,
onion_domain: str,
i2p_domain: str,
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Show skills on the profile screen
"""
named_status = path.split('/users/')[1]
@ -475,7 +480,8 @@ def show_skills(self, calling_domain: str, referer_domain: str,
auto_cw_cache,
known_epicyon_instances,
mitm_servers,
instance_software)
instance_software,
hide_recent_posts)
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,

View File

@ -1459,9 +1459,19 @@ def show_outbox_timeline(self, authorized: bool,
onion_domain: str,
i2p_domain: str,
hide_announces: {},
mitm_servers: []) -> bool:
mitm_servers: [],
hide_recent_posts: {}) -> bool:
"""Shows the outbox timeline
"""
nickname = \
path.replace('/users/', '').replace('/outbox', '')
# if recent posts are hidden then return 404
if nickname:
if not authorized and hide_recent_posts.get(nickname):
http_404(self, 77)
return True
# get outbox feed for a person
outbox_feed = \
person_box_json(recent_posts_cache,
@ -1472,8 +1482,6 @@ def show_outbox_timeline(self, authorized: bool,
positive_voting,
voting_time_mins)
if outbox_feed:
nickname = \
path.replace('/users/', '').replace('/outbox', '')
page_number = 0
if '?page=' in nickname:
page_number = nickname.split('?page=')[1]

View File

@ -1037,12 +1037,52 @@ def _profile_post_hide_follows(base_dir: str, nickname: str, domain: str,
try:
os.remove(hide_follows_filename)
except OSError:
print('EX: _profile_edit ' +
print('EX: _profile_post_hide_follows ' +
'unable to delete ' +
hide_follows_filename)
return actor_changed
def _profile_post_hide_recent_posts(base_dir: str, nickname: str, domain: str,
actor_json: {}, fields: {}, self,
actor_changed: bool,
premium: bool) -> bool:
""" HTTP POST hide recent public posts checkbox
This hides public posts from unauthorized viewers
"""
hide_recent_posts_filename = \
acct_dir(base_dir, nickname, domain) + '/.hideRecentPosts'
hide_recent_posts = premium
if fields.get('hideRecentPosts'):
if fields['hideRecentPosts'] == 'on':
hide_recent_posts = True
if hide_recent_posts:
self.server.hide_recent_posts[nickname] = True
actor_json['hideRecentPosts'] = True
actor_changed = True
if not os.path.isfile(hide_recent_posts_filename):
try:
with open(hide_recent_posts_filename, 'w+',
encoding='utf-8') as fp_hide:
fp_hide.write('\n')
except OSError:
print('EX: unable to write hideRecentPosts ' +
hide_recent_posts_filename)
if not hide_recent_posts:
actor_json['hideRecentPosts'] = False
if self.server.hide_recent_posts.get(nickname):
del self.server.hide_recent_posts[nickname]
actor_changed = True
if os.path.isfile(hide_recent_posts_filename):
try:
os.remove(hide_recent_posts_filename)
except OSError:
print('EX: _profile_post_hide_recent_posts ' +
'unable to delete ' +
hide_recent_posts_filename)
return actor_changed
def _profile_post_mutuals_replies(account_dir: str, fields: {}) -> None:
""" HTTP POST show replies only from mutuals checkbox
"""
@ -3325,6 +3365,10 @@ def profile_edit(self, calling_domain: str, cookie: str,
_profile_post_hide_follows(base_dir, nickname, domain,
actor_json, fields, self,
actor_changed, premium)
actor_changed = \
_profile_post_hide_recent_posts(base_dir, nickname, domain,
actor_json, fields, self,
actor_changed, premium)
_profile_post_block_military(nickname, fields, self)
_profile_post_block_government(nickname, fields, self)
_profile_post_block_bluesky(nickname, fields, self)

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "وسائل الإعلام الممولة من الدولة الروسية",
"Satire": "هجاء",
"UK Right Wing Think Tank": "مركز أبحاث يميني متطرف في المملكة المتحدة",
"DeltaChat": "دعوة إلى DeltaChat"
"DeltaChat": "دعوة إلى DeltaChat",
"Don't show recent public posts on your profile": "لا تعرض المنشورات العامة الأخيرة على ملفك الشخصي"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "রাশিয়ান রাষ্ট্র অর্থায়ন মিডিয়া",
"Satire": "ব্যঙ্গ",
"UK Right Wing Think Tank": "ইউকে রাইট উইং থিঙ্ক ট্যাঙ্ক",
"DeltaChat": "ডেল্টাচ্যাট আমন্ত্রণ"
"DeltaChat": "ডেল্টাচ্যাট আমন্ত্রণ",
"Don't show recent public posts on your profile": "আপনার প্রোফাইলে সাম্প্রতিক পাবলিক পোস্টগুলি দেখাবেন না"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Mitjans de comunicació finançats per l'estat rus",
"Satire": "Sàtira",
"UK Right Wing Think Tank": "Think Tank de la dreta del Regne Unit",
"DeltaChat": "Invitació de DeltaChat"
"DeltaChat": "Invitació de DeltaChat",
"Don't show recent public posts on your profile": "No mostris publicacions públiques recents al teu perfil"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Cyfryngau a Ariennir gan Wladwriaeth Rwseg",
"Satire": "Dychan",
"UK Right Wing Think Tank": "Melin Drafod Adain Dde y DU",
"DeltaChat": "Gwahoddiad DeltaChat"
"DeltaChat": "Gwahoddiad DeltaChat",
"Don't show recent public posts on your profile": "Peidiwch â dangos postiadau cyhoeddus diweddar ar eich proffil"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Russische staatlich finanzierte Medien",
"Satire": "Satire",
"UK Right Wing Think Tank": "Britischer Thinktank mit rechter Front",
"DeltaChat": "DeltaChat-Einladung"
"DeltaChat": "DeltaChat-Einladung",
"Don't show recent public posts on your profile": "Zeigen Sie keine aktuellen öffentlichen Beiträge in Ihrem Profil an"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Ρωσικά κρατικά χρηματοδοτούμενα ΜΜΕ",
"Satire": "Σάτυρα",
"UK Right Wing Think Tank": "Δεξαμενή Σκέψης Δεξιάς στο Ηνωμένο Βασίλειο",
"DeltaChat": "Πρόσκληση DeltaChat"
"DeltaChat": "Πρόσκληση DeltaChat",
"Don't show recent public posts on your profile": "Μην εμφανίζετε πρόσφατες δημόσιες αναρτήσεις στο προφίλ σας"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Russian State Funded Media",
"Satire": "Satire",
"UK Right Wing Think Tank": "UK Right Wing Think Tank",
"DeltaChat": "DeltaChat invite"
"DeltaChat": "DeltaChat invite",
"Don't show recent public posts on your profile": "Don't show recent public posts on your profile"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Medios de comunicación financiados por el Estado ruso",
"Satire": "Sátira",
"UK Right Wing Think Tank": "Centro de estudios de derecha del Reino Unido",
"DeltaChat": "Invitación a DeltaChat"
"DeltaChat": "Invitación a DeltaChat",
"Don't show recent public posts on your profile": "No mostrar publicaciones públicas recientes en tu perfil"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "رسانه های دولتی روسیه",
"Satire": "طنز",
"UK Right Wing Think Tank": "اتاق فکر جناح راست انگلستان",
"DeltaChat": "دعوت از دلتا چت"
"DeltaChat": "دعوت از دلتا چت",
"Don't show recent public posts on your profile": "پست های عمومی اخیر را در نمایه خود نشان ندهید"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Venäjän valtion rahoittama media",
"Satire": "Satiiri",
"UK Right Wing Think Tank": "Ison-Britannian oikeanpuoleinen ajatushautomo",
"DeltaChat": "DeltaChat-kutsu"
"DeltaChat": "DeltaChat-kutsu",
"Don't show recent public posts on your profile": "Älä näytä viimeisimmät julkiset viestit profiilissasi"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Médias financés par l'État russe",
"Satire": "Satire",
"UK Right Wing Think Tank": "Groupe de réflexion de droite britannique",
"DeltaChat": "Invitation DeltaChat"
"DeltaChat": "Invitation DeltaChat",
"Don't show recent public posts on your profile": "Ne pas afficher les publications publiques récentes sur votre profil"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Meáin Mhaoinithe Stáit na Rúise",
"Satire": "Aoir",
"UK Right Wing Think Tank": "Umar Smaointeoireachta Sciathán Deis na Ríochta Aontaithe",
"DeltaChat": "Cuireadh DeltaChat"
"DeltaChat": "Cuireadh DeltaChat",
"Don't show recent public posts on your profile": "Ná taispeáin postálacha poiblí le déanaí ar do phróifíl"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "מדיה במימון המדינה הרוסית",
"Satire": "סָאטִירָה",
"UK Right Wing Think Tank": "טנק חשיבה ימני בבריטניה",
"DeltaChat": "הזמנת DeltaChat"
"DeltaChat": "הזמנת DeltaChat",
"Don't show recent public posts on your profile": "אל תציג פוסטים ציבוריים אחרונים בפרופיל שלך"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "रूसी राज्य वित्तपोषित मीडिया",
"Satire": "हास्य व्यंग्य",
"UK Right Wing Think Tank": "यू.के. दक्षिणपंथी थिंक टैंक",
"DeltaChat": "डेल्टाचैट आमंत्रण"
"DeltaChat": "डेल्टाचैट आमंत्रण",
"Don't show recent public posts on your profile": "अपनी प्रोफ़ाइल पर हाल ही की सार्वजनिक पोस्ट न दिखाएँ"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Media finanziati dallo Stato russo",
"Satire": "Satira",
"UK Right Wing Think Tank": "Think Tank di destra nel Regno Unito",
"DeltaChat": "Invito DeltaChat"
"DeltaChat": "Invito DeltaChat",
"Don't show recent public posts on your profile": "Non mostrare i post pubblici recenti sul tuo profilo"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "ロシアの国営メディア",
"Satire": "風刺",
"UK Right Wing Think Tank": "英国右派シンクタンク",
"DeltaChat": "DeltaChat 招待"
"DeltaChat": "DeltaChat 招待",
"Don't show recent public posts on your profile": "プロフィールに最近の公開投稿を表示しない"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "러시아 국가가 자금을 지원하는 미디어",
"Satire": "풍자",
"UK Right Wing Think Tank": "영국 우익 싱크탱크",
"DeltaChat": "DeltaChat 초대"
"DeltaChat": "DeltaChat 초대",
"Don't show recent public posts on your profile": "프로필에 최근 공개 게시물을 표시하지 마세요"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Medyaya Fînansekirî ya Dewleta Rûsyayê",
"Satire": "Satire",
"UK Right Wing Think Tank": "Tanka Fikirê ya Rastê ya Brîtanyayê",
"DeltaChat": "vexwendina DeltaChat"
"DeltaChat": "vexwendina DeltaChat",
"Don't show recent public posts on your profile": "Mesajên giştî yên dawî li ser profîla xwe nîşan nedin"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Russische staatsgefinancierde media",
"Satire": "Satire",
"UK Right Wing Think Tank": "Britse rechtse denktank",
"DeltaChat": "DeltaChat-uitnodiging"
"DeltaChat": "DeltaChat-uitnodiging",
"Don't show recent public posts on your profile": "Toon geen recente openbare berichten op uw profiel"
}

View File

@ -716,5 +716,6 @@
"Russian State Funded Media": "Russian State Funded Media",
"Satire": "Satire",
"UK Right Wing Think Tank": "UK Right Wing Think Tank",
"DeltaChat": "DeltaChat invite"
"DeltaChat": "DeltaChat invite",
"Don't show recent public posts on your profile": "Don't show recent public posts on your profile"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Rosyjskie media finansowane przez państwo",
"Satire": "Satyra",
"UK Right Wing Think Tank": "Brytyjski prawicowy think tank",
"DeltaChat": "Zaproszenie do DeltaChat"
"DeltaChat": "Zaproszenie do DeltaChat",
"Don't show recent public posts on your profile": "Nie pokazuj ostatnich publicznych postów na swoim profilu"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Comunicação social financiada pelo Estado russo",
"Satire": "Sátira",
"UK Right Wing Think Tank": "Think Tank de direita do Reino Unido",
"DeltaChat": "Convite DeltaChat"
"DeltaChat": "Convite DeltaChat",
"Don't show recent public posts on your profile": "Não mostrar publicações públicas recentes no seu perfil"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Российские государственные СМИ",
"Satire": "Сатира",
"UK Right Wing Think Tank": "Британский правый аналитический центр",
"DeltaChat": "Приглашение DeltaChat"
"DeltaChat": "Приглашение DeltaChat",
"Don't show recent public posts on your profile": "Не показывать последние публичные публикации в вашем профиле"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Vyombo vya Habari vinavyofadhiliwa na Serikali ya Urusi",
"Satire": "Satire",
"UK Right Wing Think Tank": "Uingereza Right Wing Think Tank",
"DeltaChat": "mwaliko wa DeltaChat"
"DeltaChat": "mwaliko wa DeltaChat",
"Don't show recent public posts on your profile": "Usionyeshe machapisho ya hivi majuzi ya umma kwenye wasifu wako"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Rusya Devleti Tarafından Finanse Edilen Medya",
"Satire": "Hiciv",
"UK Right Wing Think Tank": "İngiltere Sağ Kanat Düşünce Kuruluşu",
"DeltaChat": "DeltaChat daveti"
"DeltaChat": "DeltaChat daveti",
"Don't show recent public posts on your profile": "Profilinizde son genel paylaşımları göstermeyin"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "Російські державні ЗМІ",
"Satire": "Сатира",
"UK Right Wing Think Tank": "Британський правий мозковий центр",
"DeltaChat": "Запрошення DeltaChat"
"DeltaChat": "Запрошення DeltaChat",
"Don't show recent public posts on your profile": "Не показувати останні загальнодоступні публікації у своєму профілі"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "רוסיש שטאַט פאַנדאַד מידיאַ",
"Satire": "סאַטירע",
"UK Right Wing Think Tank": "וק רעכט פליגל טראַכטן טאַנק",
"DeltaChat": "דעלטאַטשאַט פאַרבעטן"
"DeltaChat": "דעלטאַטשאַט פאַרבעטן",
"Don't show recent public posts on your profile": "צי ניט ווייַזן לעצטע עפנטלעך הודעות אויף דיין פּראָפיל"
}

View File

@ -720,5 +720,6 @@
"Russian State Funded Media": "俄罗斯国家资助的媒体",
"Satire": "讽刺",
"UK Right Wing Think Tank": "英国右翼智库",
"DeltaChat": "DeltaChat 邀请"
"DeltaChat": "DeltaChat 邀请",
"Don't show recent public posts on your profile": "不要在你的个人资料上显示最近的公开帖子"
}

View File

@ -4262,6 +4262,27 @@ def load_hide_follows(base_dir: str) -> {}:
return hide_follows
def load_hide_recent_posts(base_dir: str) -> {}:
"""Returns a dictionary containing the hide recent posts status
for each account
"""
hide_recent_posts = {}
dir_str = data_dir(base_dir)
for _, dirs, _ in os.walk(dir_str):
for acct in dirs:
if '@' not in acct:
continue
if acct.startswith('inbox@') or acct.startswith('Actor@'):
continue
hide_recent_posts_filename = \
dir_str + '/' + acct + '/.hideRecentPosts'
if os.path.isfile(hide_recent_posts_filename):
nickname = acct.split('@')[0]
hide_recent_posts[nickname] = True
break
return hide_recent_posts
def get_account_timezone(base_dir: str, nickname: str, domain: str) -> str:
"""Returns the timezone for the given account
"""

View File

@ -1045,7 +1045,8 @@ def html_profile(signing_priv_key_pem: str,
auto_cw_cache: {},
known_epicyon_instances: [],
mitm_servers: [],
instance_software: {}) -> str:
instance_software: {},
hide_recent_posts: {}) -> str:
"""Show the profile page as html
"""
show_moved_accounts = False
@ -1637,8 +1638,11 @@ def html_profile(signing_priv_key_pem: str,
translate['Get the source code'] + '" src="/icons/agpl.png" /></a>'
if selected == 'posts' and not premium:
max_profile_posts = \
get_max_profile_posts(base_dir, nickname, domain, 20)
if hide_recent_posts.get(nickname):
max_profile_posts = 0
else:
max_profile_posts = \
get_max_profile_posts(base_dir, nickname, domain, 20)
min_images_for_accounts: list[str] = []
profile_str += \
_html_profile_posts(recent_posts_cache, max_profile_posts,
@ -3055,6 +3059,7 @@ def _html_edit_profile_options(is_admin: bool,
show_quote_toots: bool,
show_vote_posts: bool,
hide_follows: bool,
hide_recent_posts: bool,
premium: bool,
no_seen_posts: bool,
watermark_enabled: bool) -> str:
@ -3128,6 +3133,12 @@ def _html_edit_profile_options(is_admin: bool,
edit_profile_form += \
edit_check_box(hide_follows_str, 'hideFollows', hide_follows)
hide_recent_posts_str = \
translate["Don't show recent public posts on your profile"]
edit_profile_form += \
edit_check_box(hide_recent_posts_str, 'hideRecentPosts',
hide_recent_posts)
no_seen_posts_str = translate["Don't show already seen posts"]
edit_profile_form += \
edit_check_box(no_seen_posts_str, 'noSeenPosts', no_seen_posts)
@ -3574,6 +3585,11 @@ def html_edit_profile(server, translate: {},
if os.path.isfile(account_dir + '/.hideFollows'):
hide_follows = True
# don't show recent public posts on profile
hide_recent_posts = False
if os.path.isfile(account_dir + '/.hideRecentPosts'):
hide_recent_posts = True
# is this a premium account?
premium = is_premium_account(base_dir, nickname, domain)
@ -3606,7 +3622,8 @@ def html_edit_profile(server, translate: {},
min_images_for_accounts,
reverse_sequence, show_quote_toots,
show_vote_posts, hide_follows,
premium, no_seen_posts, watermark_enabled)
hide_recent_posts, premium,
no_seen_posts, watermark_enabled)
# reply controls
edit_profile_form += \