mirror of https://gitlab.com/bashrc2/epicyon
Option to only receive replies from followers
parent
a8bfbf417c
commit
49f7673481
28
daemon.py
28
daemon.py
|
@ -7638,6 +7638,34 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('EX: unable to write noVotes file ' +
|
||||
show_vote_file)
|
||||
|
||||
# show replies only from followers checkbox
|
||||
show_replies_followers = False
|
||||
if fields.get('repliesFromFollowersOnly'):
|
||||
if fields['repliesFromFollowersOnly'] == 'on':
|
||||
show_replies_followers = True
|
||||
account_dir = acct_dir(self.server.base_dir,
|
||||
nickname, self.server.domain)
|
||||
show_replies_followers_file = \
|
||||
account_dir + '/.repliesFromFollowersOnly'
|
||||
if os.path.isfile(show_replies_followers_file):
|
||||
if not show_replies_followers:
|
||||
try:
|
||||
os.remove(show_replies_followers_file)
|
||||
except OSError:
|
||||
print('EX: unable to remove ' +
|
||||
'repliesFromFollowersOnly file ' +
|
||||
show_replies_followers_file)
|
||||
else:
|
||||
if show_replies_followers:
|
||||
try:
|
||||
with open(show_replies_followers_file, 'w+',
|
||||
encoding='utf-8') as fp_replies:
|
||||
fp_replies.write('\n')
|
||||
except OSError:
|
||||
print('EX: unable to write ' +
|
||||
'repliesFromFollowersOnly file ' +
|
||||
show_replies_followers_file)
|
||||
|
||||
# notify about new Likes
|
||||
if on_final_welcome_screen:
|
||||
# default setting from welcome screen
|
||||
|
|
35
inbox.py
35
inbox.py
|
@ -621,6 +621,32 @@ def inbox_permitted_message(domain: str, message_json: {},
|
|||
return True
|
||||
|
||||
|
||||
def _deny_non_follower(base_dir: str, nickname: str, domain: str,
|
||||
reply_nickname: str, reply_domain: str,
|
||||
sending_actor: str):
|
||||
"""Returns true if replying to an account which is not a follower.
|
||||
This only applies if 'Only replies from followers' is selected on
|
||||
the edit profile secreen
|
||||
"""
|
||||
# Is this a reply to something written from this account?
|
||||
if reply_nickname != nickname or reply_domain != domain:
|
||||
return False
|
||||
|
||||
# has this account specified to only receive replies from followers?
|
||||
account_dir = acct_dir(base_dir, nickname, domain)
|
||||
if not os.path.isfile(account_dir + '/.repliesFromFollowersOnly'):
|
||||
return False
|
||||
|
||||
# is the sending actor a follower?
|
||||
follower_nickname = get_nickname_from_actor(sending_actor)
|
||||
follower_domain, _ = get_domain_from_actor(sending_actor)
|
||||
if not is_follower_of_person(base_dir, nickname, domain,
|
||||
follower_nickname, follower_domain):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
post_json_object: {},
|
||||
|
@ -727,6 +753,15 @@ def save_post_to_inbox_queue(base_dir: str, http_prefix: str,
|
|||
' to a blocked account: ' +
|
||||
reply_nickname + '@' + reply_domain)
|
||||
return None
|
||||
if _deny_non_follower(base_dir, nickname, domain,
|
||||
reply_nickname, reply_domain,
|
||||
actor):
|
||||
if debug:
|
||||
print('WARN: post contains reply from ' +
|
||||
str(actor) +
|
||||
' who is not a follower of ' +
|
||||
nickname + '@' + domain)
|
||||
return None
|
||||
|
||||
# filter on the content of the post
|
||||
if content_str:
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "نص",
|
||||
"Show vote posts": "إظهار مشاركات التصويت",
|
||||
"Featured hashtags": "علامات التجزئة المميزة",
|
||||
"Proxy": "الوكيل"
|
||||
"Proxy": "الوكيل",
|
||||
"Only allow replies from followers": "السماح فقط بالردود من المتابعين"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "প্রতিলিপি",
|
||||
"Show vote posts": "ভোট পোস্ট দেখান",
|
||||
"Featured hashtags": "বৈশিষ্ট্যযুক্ত হ্যাশট্যাগ",
|
||||
"Proxy": "প্রক্সি"
|
||||
"Proxy": "প্রক্সি",
|
||||
"Only allow replies from followers": "শুধুমাত্র অনুসরণকারীদের কাছ থেকে উত্তরের অনুমতি দিন"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcripció",
|
||||
"Show vote posts": "Mostra les publicacions de vot",
|
||||
"Featured hashtags": "Hashtags destacats",
|
||||
"Proxy": "Proxy"
|
||||
"Proxy": "Proxy",
|
||||
"Only allow replies from followers": "Només permet respostes dels seguidors"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Trawsgrifiad",
|
||||
"Show vote posts": "Dangos postiadau pleidlais",
|
||||
"Featured hashtags": "Hashtags dan sylw",
|
||||
"Proxy": "Dirprwy"
|
||||
"Proxy": "Dirprwy",
|
||||
"Only allow replies from followers": "Caniatewch atebion gan ddilynwyr yn unig"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Abschrift",
|
||||
"Show vote posts": "Abstimmungsbeiträge anzeigen",
|
||||
"Featured hashtags": "Ausgewählte Hashtags",
|
||||
"Proxy": "Stellvertreterin"
|
||||
"Proxy": "Stellvertreterin",
|
||||
"Only allow replies from followers": "Erlauben Sie nur Antworten von Followern"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Αντίγραφο",
|
||||
"Show vote posts": "Εμφάνιση ψηφοφοριακών αναρτήσεων",
|
||||
"Featured hashtags": "Επιλεγμένα hashtag",
|
||||
"Proxy": "Πληρεξούσιο"
|
||||
"Proxy": "Πληρεξούσιο",
|
||||
"Only allow replies from followers": "Επιτρέπονται μόνο οι απαντήσεις από τους ακόλουθους"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcript",
|
||||
"Show vote posts": "Show vote posts",
|
||||
"Featured hashtags": "Featured hashtags",
|
||||
"Proxy": "Proxy"
|
||||
"Proxy": "Proxy",
|
||||
"Only allow replies from followers": "Only allow replies from followers"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcripción",
|
||||
"Show vote posts": "Mostrar publicaciones de votos",
|
||||
"Featured hashtags": "Hashtags destacados",
|
||||
"Proxy": "Apoderada"
|
||||
"Proxy": "Apoderada",
|
||||
"Only allow replies from followers": "Permitir solo respuestas de seguidores"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "رونوشت",
|
||||
"Show vote posts": "نمایش پست های رای",
|
||||
"Featured hashtags": "هشتگ های ویژه",
|
||||
"Proxy": "پروکسی"
|
||||
"Proxy": "پروکسی",
|
||||
"Only allow replies from followers": "فقط اجازه پاسخ از طرفداران را بدهید"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcription",
|
||||
"Show vote posts": "Afficher les messages de vote",
|
||||
"Featured hashtags": "Mots-clics en vedette",
|
||||
"Proxy": "Procuration"
|
||||
"Proxy": "Procuration",
|
||||
"Only allow replies from followers": "Autoriser uniquement les réponses des abonnés"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Athscríbhinn",
|
||||
"Show vote posts": "Taispeáin postálacha vótaí",
|
||||
"Featured hashtags": "Hashtags faoi thrácht",
|
||||
"Proxy": "Seachfhreastalaí"
|
||||
"Proxy": "Seachfhreastalaí",
|
||||
"Only allow replies from followers": "Ná ceadaigh ach freagraí ó leantóirí"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "प्रतिलिपि",
|
||||
"Show vote posts": "वोट पोस्ट दिखाएं",
|
||||
"Featured hashtags": "विशेष रुप से प्रदर्शित हैशटैग",
|
||||
"Proxy": "प्रतिनिधि"
|
||||
"Proxy": "प्रतिनिधि",
|
||||
"Only allow replies from followers": "केवल अनुयायियों के उत्तरों की अनुमति दें"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Trascrizione",
|
||||
"Show vote posts": "Mostra messaggi di voto",
|
||||
"Featured hashtags": "Hashtag in primo piano",
|
||||
"Proxy": "Delega"
|
||||
"Proxy": "Delega",
|
||||
"Only allow replies from followers": "Consenti solo risposte dai follower"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "成績証明書",
|
||||
"Show vote posts": "投票投稿を表示",
|
||||
"Featured hashtags": "注目のハッシュタグ",
|
||||
"Proxy": "プロキシー"
|
||||
"Proxy": "プロキシー",
|
||||
"Only allow replies from followers": "フォロワーからの返信のみを許可する"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "성적 증명서",
|
||||
"Show vote posts": "투표 게시물 표시",
|
||||
"Featured hashtags": "추천 해시태그",
|
||||
"Proxy": "대리"
|
||||
"Proxy": "대리",
|
||||
"Only allow replies from followers": "팔로어의 답글만 허용"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcript",
|
||||
"Show vote posts": "Mesajên dengdanê nîşan bide",
|
||||
"Featured hashtags": "Hashtagên taybetmendî",
|
||||
"Proxy": "Proxy"
|
||||
"Proxy": "Proxy",
|
||||
"Only allow replies from followers": "Tenê destûr bidin bersivên ji şagirtan"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Vertaling",
|
||||
"Show vote posts": "Toon stemberichten",
|
||||
"Featured hashtags": "Aanbevolen hashtags",
|
||||
"Proxy": "Volmacht"
|
||||
"Proxy": "Volmacht",
|
||||
"Only allow replies from followers": "Sta alleen reacties van volgers toe"
|
||||
}
|
||||
|
|
|
@ -619,5 +619,6 @@
|
|||
"Transcript": "Transcript",
|
||||
"Show vote posts": "Show vote posts",
|
||||
"Featured hashtags": "Featured hashtags",
|
||||
"Proxy": "Proxy"
|
||||
"Proxy": "Proxy",
|
||||
"Only allow replies from followers": "Only allow replies from followers"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transkrypcja",
|
||||
"Show vote posts": "Pokaż posty z głosowaniem",
|
||||
"Featured hashtags": "Polecane hashtagi",
|
||||
"Proxy": "Pełnomocnik"
|
||||
"Proxy": "Pełnomocnik",
|
||||
"Only allow replies from followers": "Zezwalaj tylko na odpowiedzi od obserwujących"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Transcrição",
|
||||
"Show vote posts": "Mostrar postagens de votação",
|
||||
"Featured hashtags": "Hashtags em destaque",
|
||||
"Proxy": "Proxy"
|
||||
"Proxy": "Proxy",
|
||||
"Only allow replies from followers": "Permitir apenas respostas de seguidores"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Стенограмма",
|
||||
"Show vote posts": "Показать сообщения для голосования",
|
||||
"Featured hashtags": "Избранные хэштеги",
|
||||
"Proxy": "Прокси"
|
||||
"Proxy": "Прокси",
|
||||
"Only allow replies from followers": "Разрешить ответы только от подписчиков"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Nakala",
|
||||
"Show vote posts": "Onyesha machapisho ya kura",
|
||||
"Featured hashtags": "Reli zilizoangaziwa",
|
||||
"Proxy": "Wakala"
|
||||
"Proxy": "Wakala",
|
||||
"Only allow replies from followers": "Ruhusu tu majibu kutoka kwa wafuasi"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Deşifre metni",
|
||||
"Show vote posts": "Oy gönderilerini göster",
|
||||
"Featured hashtags": "Öne çıkan etiketler",
|
||||
"Proxy": "Vekil"
|
||||
"Proxy": "Vekil",
|
||||
"Only allow replies from followers": "Yalnızca takipçilerden gelen yanıtlara izin ver"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "Стенограма",
|
||||
"Show vote posts": "Показати повідомлення про голосування",
|
||||
"Featured hashtags": "Рекомендовані хештеги",
|
||||
"Proxy": "Проксі"
|
||||
"Proxy": "Проксі",
|
||||
"Only allow replies from followers": "Дозволити відповіді лише від підписників"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "טראַנסקריפּט",
|
||||
"Show vote posts": "ווייַזן שטימען אַרטיקלען",
|
||||
"Featured hashtags": "פֿעיִקייטן פון hashtags",
|
||||
"Proxy": "פראקסי"
|
||||
"Proxy": "פראקסי",
|
||||
"Only allow replies from followers": "נאָר לאָזן ענטפֿערס פון אנהענגערס"
|
||||
}
|
||||
|
|
|
@ -623,5 +623,6 @@
|
|||
"Transcript": "成绩单",
|
||||
"Show vote posts": "显示投票帖子",
|
||||
"Featured hashtags": "特色标签",
|
||||
"Proxy": "代理人"
|
||||
"Proxy": "代理人",
|
||||
"Only allow replies from followers": "只允许关注者回复"
|
||||
}
|
||||
|
|
|
@ -2443,7 +2443,8 @@ def _html_edit_profile_options(is_admin: bool,
|
|||
nickname: str,
|
||||
min_images_for_accounts: [],
|
||||
reverse_sequence: [],
|
||||
show_vote_posts: bool) -> str:
|
||||
show_vote_posts: bool,
|
||||
show_replies_followers: bool) -> str:
|
||||
"""option checkboxes section of edit profile screen
|
||||
"""
|
||||
edit_profile_form = ' <div class="container">\n'
|
||||
|
@ -2497,6 +2498,10 @@ def _html_edit_profile_options(is_admin: bool,
|
|||
show_vote_posts_str = translate['Show vote posts']
|
||||
edit_profile_form += \
|
||||
edit_check_box(show_vote_posts_str, 'showVotes', show_vote_posts)
|
||||
show_replies_followers_str = translate['Only allow replies from followers']
|
||||
edit_profile_form += \
|
||||
edit_check_box(show_replies_followers_str, 'repliesFromFollowersOnly',
|
||||
show_replies_followers)
|
||||
|
||||
edit_profile_form += ' </div>\n'
|
||||
return edit_profile_form
|
||||
|
@ -2869,6 +2874,11 @@ def html_edit_profile(server, translate: {},
|
|||
if os.path.isfile(account_dir + '/.noVotes'):
|
||||
show_vote_posts = False
|
||||
|
||||
# only show replies from followers
|
||||
show_replies_followers = False
|
||||
if os.path.isfile(account_dir + '/.repliesFromFollowersOnly'):
|
||||
show_replies_followers = False
|
||||
|
||||
# Option checkboxes
|
||||
edit_profile_form += \
|
||||
_html_edit_profile_options(is_admin, manually_approves_followers,
|
||||
|
@ -2879,7 +2889,8 @@ def html_edit_profile(server, translate: {},
|
|||
hide_like_button, hide_reaction_button,
|
||||
translate, bold_reading,
|
||||
nickname, min_images_for_accounts,
|
||||
reverse_sequence, show_vote_posts)
|
||||
reverse_sequence, show_vote_posts,
|
||||
show_replies_followers)
|
||||
|
||||
# Contact information
|
||||
edit_profile_form += \
|
||||
|
|
Loading…
Reference in New Issue