mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
452fdfe263
240
blocking.py
240
blocking.py
|
@ -39,10 +39,205 @@ from conversation import mute_conversation
|
|||
from conversation import unmute_conversation
|
||||
|
||||
|
||||
def get_global_block_reason(search_text: str,
|
||||
blocking_reasons_filename: str) -> str:
|
||||
"""Returns the reason why a domain was globally blocked
|
||||
"""
|
||||
if not text_in_file(search_text, blocking_reasons_filename):
|
||||
return ''
|
||||
|
||||
reasons_str = ''
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'r',
|
||||
encoding='utf-8') as fp_reas:
|
||||
reasons_str = fp_reas.read()
|
||||
except OSError:
|
||||
print('WARN: Failed to raed blocking reasons ' +
|
||||
blocking_reasons_filename)
|
||||
if not reasons_str:
|
||||
return ''
|
||||
|
||||
reasons_lines = reasons_str.split('\n')
|
||||
for line in reasons_lines:
|
||||
if line.startswith(search_text):
|
||||
if ' ' in line:
|
||||
return line.split(' ', 1)[1]
|
||||
return ''
|
||||
|
||||
|
||||
def get_account_blocks(base_dir: str,
|
||||
nickname: str, domain: str) -> str:
|
||||
"""Returne the text for the textarea for "blocked accounts"
|
||||
when editing profile
|
||||
"""
|
||||
account_directory = acct_dir(base_dir, nickname, domain)
|
||||
blocking_filename = \
|
||||
account_directory + '/blocking.txt'
|
||||
blocking_reasons_filename = \
|
||||
account_directory + '/blocking_reasons.txt'
|
||||
|
||||
if not os.path.isfile(blocking_filename):
|
||||
return ''
|
||||
|
||||
blocked_accounts_textarea = ''
|
||||
blocking_file_text = ''
|
||||
try:
|
||||
with open(blocking_filename, 'r', encoding='utf-8') as fp_block:
|
||||
blocking_file_text = fp_block.read()
|
||||
except OSError:
|
||||
print('EX: Failed to read ' + blocking_filename)
|
||||
return ''
|
||||
|
||||
blocklist = blocking_file_text.split('\n')
|
||||
for handle in blocklist:
|
||||
handle = handle.strip()
|
||||
if not handle:
|
||||
continue
|
||||
reason = \
|
||||
get_global_block_reason(handle,
|
||||
blocking_reasons_filename)
|
||||
if reason:
|
||||
blocked_accounts_textarea += \
|
||||
handle + ' - ' + reason + '\n'
|
||||
continue
|
||||
blocked_accounts_textarea += handle + '\n'
|
||||
|
||||
return blocked_accounts_textarea
|
||||
|
||||
|
||||
def add_account_blocks(base_dir: str,
|
||||
nickname: str, domain: str,
|
||||
blocked_accounts_textarea: str) -> bool:
|
||||
"""Update the blockfile for an account after editing their
|
||||
profile and changing "blocked accounts"
|
||||
"""
|
||||
if blocked_accounts_textarea is None:
|
||||
return False
|
||||
blocklist = blocked_accounts_textarea.split('\n')
|
||||
blocking_file_text = ''
|
||||
blocking_reasons_file_text = ''
|
||||
for line in blocklist:
|
||||
line = line.strip()
|
||||
reason = None
|
||||
if ' - ' in line:
|
||||
block_id = line.split(' - ', 1)[0]
|
||||
reason = line.split(' - ', 1)[1]
|
||||
blocking_reasons_file_text += block_id + ' ' + reason + '\n'
|
||||
elif ' ' in line:
|
||||
block_id = line.split(' ', 1)[0]
|
||||
reason = line.split(' ', 1)[1]
|
||||
blocking_reasons_file_text += block_id + ' ' + reason + '\n'
|
||||
else:
|
||||
block_id = line
|
||||
blocking_file_text += block_id + '\n'
|
||||
|
||||
account_directory = acct_dir(base_dir, nickname, domain)
|
||||
blocking_filename = \
|
||||
account_directory + '/blocking.txt'
|
||||
blocking_reasons_filename = \
|
||||
account_directory + '/blocking_reasons.txt'
|
||||
|
||||
if not blocking_file_text:
|
||||
if os.path.isfile(blocking_filename):
|
||||
try:
|
||||
os.remove(blocking_filename)
|
||||
except OSError:
|
||||
print('EX: _profile_edit unable to delete blocking ' +
|
||||
blocking_filename)
|
||||
if os.path.isfile(blocking_reasons_filename):
|
||||
try:
|
||||
os.remove(blocking_reasons_filename)
|
||||
except OSError:
|
||||
print('EX: _profile_edit unable to delete blocking reasons' +
|
||||
blocking_reasons_filename)
|
||||
return True
|
||||
|
||||
try:
|
||||
with open(blocking_filename, 'w+', encoding='utf-8') as fp_block:
|
||||
fp_block.write(blocking_file_text)
|
||||
except OSError:
|
||||
print('EX: Failed to write ' + blocking_filename)
|
||||
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'w+',
|
||||
encoding='utf-8') as fp_block:
|
||||
fp_block.write(blocking_reasons_file_text)
|
||||
except OSError:
|
||||
print('EX: Failed to write ' + blocking_reasons_filename)
|
||||
return True
|
||||
|
||||
|
||||
def _add_global_block_reason(base_dir: str,
|
||||
block_nickname: str, block_domain: str,
|
||||
reason: str) -> bool:
|
||||
"""Store a global block reason
|
||||
"""
|
||||
if not reason:
|
||||
return False
|
||||
|
||||
blocking_reasons_filename = \
|
||||
base_dir + '/accounts/blocking_reasons.txt'
|
||||
|
||||
if not block_nickname.startswith('#'):
|
||||
# is the handle already blocked?
|
||||
block_id = block_nickname + '@' + block_domain
|
||||
else:
|
||||
block_id = block_nickname
|
||||
|
||||
reason = reason.replace('\n', '').strip()
|
||||
reason_line = block_id + ' ' + reason + '\n'
|
||||
|
||||
if os.path.isfile(blocking_reasons_filename):
|
||||
if not text_in_file(block_id,
|
||||
blocking_reasons_filename):
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'a+',
|
||||
encoding='utf-8') as reas_file:
|
||||
reas_file.write(reason_line)
|
||||
except OSError:
|
||||
print('EX: unable to add blocking reason ' +
|
||||
block_id)
|
||||
else:
|
||||
reasons_str = ''
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'r',
|
||||
encoding='utf-8') as reas_file:
|
||||
reasons_str = reas_file.read()
|
||||
except OSError:
|
||||
print('EX: unable to read blocking reasons')
|
||||
reasons_lines = reasons_str.split('\n')
|
||||
new_reasons_str = ''
|
||||
for line in reasons_lines:
|
||||
if not line.startswith(block_id + ' '):
|
||||
new_reasons_str += line + '\n'
|
||||
continue
|
||||
new_reasons_str += reason_line
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'w+',
|
||||
encoding='utf-8') as reas_file:
|
||||
reas_file.write(new_reasons_str)
|
||||
except OSError:
|
||||
print('EX: unable to save blocking reasons' +
|
||||
blocking_reasons_filename)
|
||||
else:
|
||||
try:
|
||||
with open(blocking_reasons_filename, 'w+',
|
||||
encoding='utf-8') as reas_file:
|
||||
reas_file.write(reason_line)
|
||||
except OSError:
|
||||
print('EX: unable to save blocking reason ' +
|
||||
block_id + ' ' + blocking_reasons_filename)
|
||||
|
||||
|
||||
def add_global_block(base_dir: str,
|
||||
block_nickname: str, block_domain: str) -> bool:
|
||||
block_nickname: str, block_domain: str,
|
||||
reason: str) -> bool:
|
||||
"""Global block which applies to all accounts
|
||||
"""
|
||||
_add_global_block_reason(base_dir,
|
||||
block_nickname, block_domain,
|
||||
reason)
|
||||
|
||||
blocking_filename = base_dir + '/accounts/blocking.txt'
|
||||
if not block_nickname.startswith('#'):
|
||||
# is the handle already blocked?
|
||||
|
@ -147,11 +342,54 @@ def add_block(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
|
||||
|
||||
def _remove_global_block_reason(base_dir: str,
|
||||
unblock_nickname: str,
|
||||
unblock_domain: str) -> bool:
|
||||
"""Remove a globla block reason
|
||||
"""
|
||||
unblocking_filename = base_dir + '/accounts/blocking_reasons.txt'
|
||||
if not os.path.isfile(unblocking_filename):
|
||||
return False
|
||||
|
||||
if not unblock_nickname.startswith('#'):
|
||||
unblock_id = unblock_nickname + '@' + unblock_domain
|
||||
else:
|
||||
unblock_id = unblock_nickname
|
||||
|
||||
if not text_in_file(unblock_id + ' ', unblocking_filename):
|
||||
return False
|
||||
|
||||
reasons_str = ''
|
||||
try:
|
||||
with open(unblocking_filename, 'r',
|
||||
encoding='utf-8') as reas_file:
|
||||
reasons_str = reas_file.read()
|
||||
except OSError:
|
||||
print('EX: unable to read blocking reasons 2')
|
||||
reasons_lines = reasons_str.split('\n')
|
||||
new_reasons_str = ''
|
||||
for line in reasons_lines:
|
||||
if line.startswith(unblock_id + ' '):
|
||||
continue
|
||||
new_reasons_str += line + '\n'
|
||||
try:
|
||||
with open(unblocking_filename, 'w+',
|
||||
encoding='utf-8') as reas_file:
|
||||
reas_file.write(new_reasons_str)
|
||||
except OSError:
|
||||
print('EX: unable to save blocking reasons 2' +
|
||||
unblocking_filename)
|
||||
|
||||
|
||||
def remove_global_block(base_dir: str,
|
||||
unblock_nickname: str,
|
||||
unblock_domain: str) -> bool:
|
||||
"""Unblock the given global block
|
||||
"""
|
||||
_remove_global_block_reason(base_dir,
|
||||
unblock_nickname,
|
||||
unblock_domain)
|
||||
|
||||
unblocking_filename = base_dir + '/accounts/blocking.txt'
|
||||
if not unblock_nickname.startswith('#'):
|
||||
unblock_handle = unblock_nickname + '@' + unblock_domain
|
||||
|
|
81
daemon.py
81
daemon.py
|
@ -142,6 +142,7 @@ from media import replace_twitter
|
|||
from media import attach_media
|
||||
from media import path_is_video
|
||||
from media import path_is_audio
|
||||
from blocking import add_account_blocks
|
||||
from blocking import get_cw_list_variable
|
||||
from blocking import load_cw_lists
|
||||
from blocking import update_blocked_cache
|
||||
|
@ -2611,45 +2612,63 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
remove_global_filter(base_dir, moderation_text)
|
||||
if moderation_button == 'block':
|
||||
full_block_domain = None
|
||||
if moderation_text.startswith('http') or \
|
||||
moderation_text.startswith('ipfs') or \
|
||||
moderation_text.startswith('ipns') or \
|
||||
moderation_text.startswith('hyper'):
|
||||
moderation_text = moderation_text.strip()
|
||||
moderation_reason = None
|
||||
if ' ' in moderation_text:
|
||||
moderation_domain = moderation_text.split(' ', 1)[0]
|
||||
moderation_reason = moderation_text.split(' ', 1)[1]
|
||||
else:
|
||||
moderation_domain = moderation_text
|
||||
if moderation_domain.startswith('http') or \
|
||||
moderation_domain.startswith('ipfs') or \
|
||||
moderation_domain.startswith('ipns') or \
|
||||
moderation_domain.startswith('hyper'):
|
||||
# https://domain
|
||||
block_domain, block_port = \
|
||||
get_domain_from_actor(moderation_text)
|
||||
get_domain_from_actor(moderation_domain)
|
||||
full_block_domain = \
|
||||
get_full_domain(block_domain, block_port)
|
||||
if '@' in moderation_text:
|
||||
if '@' in moderation_domain:
|
||||
# nick@domain or *@domain
|
||||
full_block_domain = moderation_text.split('@')[1]
|
||||
full_block_domain = \
|
||||
moderation_domain.split('@')[1]
|
||||
else:
|
||||
# assume the text is a domain name
|
||||
if not full_block_domain and '.' in moderation_text:
|
||||
if not full_block_domain and '.' in moderation_domain:
|
||||
nickname = '*'
|
||||
full_block_domain = moderation_text.strip()
|
||||
full_block_domain = \
|
||||
moderation_domain.strip()
|
||||
if full_block_domain or nickname.startswith('#'):
|
||||
add_global_block(base_dir, nickname, full_block_domain)
|
||||
if nickname.startswith('#') and ' ' in nickname:
|
||||
nickname = nickname.split(' ')[0]
|
||||
add_global_block(base_dir, nickname,
|
||||
full_block_domain, moderation_reason)
|
||||
if moderation_button == 'unblock':
|
||||
full_block_domain = None
|
||||
if moderation_text.startswith('http') or \
|
||||
moderation_text.startswith('ipfs') or \
|
||||
moderation_text.startswith('ipns') or \
|
||||
moderation_text.startswith('hyper'):
|
||||
if ' ' in moderation_text:
|
||||
moderation_domain = moderation_text.split(' ', 1)[0]
|
||||
else:
|
||||
moderation_domain = moderation_text
|
||||
if moderation_domain.startswith('http') or \
|
||||
moderation_domain.startswith('ipfs') or \
|
||||
moderation_domain.startswith('ipns') or \
|
||||
moderation_domain.startswith('hyper'):
|
||||
# https://domain
|
||||
block_domain, block_port = \
|
||||
get_domain_from_actor(moderation_text)
|
||||
get_domain_from_actor(moderation_domain)
|
||||
full_block_domain = \
|
||||
get_full_domain(block_domain, block_port)
|
||||
if '@' in moderation_text:
|
||||
if '@' in moderation_domain:
|
||||
# nick@domain or *@domain
|
||||
full_block_domain = moderation_text.split('@')[1]
|
||||
full_block_domain = moderation_domain.split('@')[1]
|
||||
else:
|
||||
# assume the text is a domain name
|
||||
if not full_block_domain and '.' in moderation_text:
|
||||
if not full_block_domain and '.' in moderation_domain:
|
||||
nickname = '*'
|
||||
full_block_domain = moderation_text.strip()
|
||||
full_block_domain = moderation_domain.strip()
|
||||
if full_block_domain or nickname.startswith('#'):
|
||||
if nickname.startswith('#') and ' ' in nickname:
|
||||
nickname = nickname.split(' ')[0]
|
||||
remove_global_block(base_dir, nickname,
|
||||
full_block_domain)
|
||||
if moderation_button == 'remove':
|
||||
|
@ -7395,25 +7414,13 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
auto_cw_filename)
|
||||
|
||||
# save blocked accounts list
|
||||
blocked_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + \
|
||||
'/blocking.txt'
|
||||
if fields.get('blocked'):
|
||||
try:
|
||||
with open(blocked_filename, 'w+',
|
||||
encoding='utf-8') as blockedfile:
|
||||
blockedfile.write(fields['blocked'])
|
||||
except OSError:
|
||||
print('EX: unable to write blocked accounts ' +
|
||||
blocked_filename)
|
||||
add_account_blocks(base_dir,
|
||||
nickname, domain,
|
||||
fields['blocked'])
|
||||
else:
|
||||
if os.path.isfile(blocked_filename):
|
||||
try:
|
||||
os.remove(blocked_filename)
|
||||
except OSError:
|
||||
print('EX: _profile_edit ' +
|
||||
'unable to delete ' +
|
||||
blocked_filename)
|
||||
add_account_blocks(base_dir,
|
||||
nickname, domain, '')
|
||||
|
||||
# Save DM allowed instances list.
|
||||
# The allow list for incoming DMs,
|
||||
|
@ -18880,7 +18887,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
block_domain = urllib.parse.unquote_plus(block_domain.strip())
|
||||
if '?' in block_domain:
|
||||
block_domain = block_domain.split('?')[0]
|
||||
add_global_block(self.server.base_dir, '*', block_domain)
|
||||
add_global_block(self.server.base_dir, '*', block_domain, None)
|
||||
msg = \
|
||||
html_account_info(self.server.translate,
|
||||
self.server.base_dir,
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
--pageslist-color: #dddddd;
|
||||
--pageslist-selected-color: white;
|
||||
--main-fg-color: #dddddd;
|
||||
--block-reason-color: lightgreen;
|
||||
--verified-site-color: lightgreen;
|
||||
--cw-color: #dddddd;
|
||||
--cw-style: normal;
|
||||
|
@ -296,6 +297,10 @@ mark {
|
|||
color: var(--diff-remove);
|
||||
}
|
||||
|
||||
.blockreason {
|
||||
color: var(--block-reason-color);
|
||||
}
|
||||
|
||||
.accesskeys {
|
||||
border: 0;
|
||||
width: 100%;
|
||||
|
|
Binary file not shown.
|
@ -786,11 +786,15 @@ and then selecting the <strong>Suspend</strong> button. Accounts are
|
|||
usually suspended pending investigation into some terms of service
|
||||
violation. You can use the <strong>Unsuspend</strong> button to
|
||||
re-enable an account.</p>
|
||||
<h3 id="instance-level-blocking">Instance level blocking</h3>
|
||||
<h3 id="instance-level-blocking-of-handles-or-domains">Instance level
|
||||
blocking of handles or domains</h3>
|
||||
<p>To block a fediverse handle (nickname@domain), hashtag or domain
|
||||
enter the thing that you wish to block and then select the
|
||||
<strong>Block</strong> button. You can do the same with the
|
||||
<strong>Unblock</strong> button to reverse your decision.</p>
|
||||
<p>When creating a block you can also add a space followed by any text
|
||||
describing the reason for the block. Such as:</p>
|
||||
<pre class="text"><code>annoyingdomain.com A spam instance</code></pre>
|
||||
<p>If you want to see what is being blocked at the instance level then
|
||||
select the <strong>Info</strong> button.</p>
|
||||
<h3 id="web-crawlers-and-search-bots">Web crawlers and search bots</h3>
|
||||
|
@ -818,9 +822,15 @@ their bio contains particular words.</p>
|
|||
<h3 id="blocking-accounts-or-domains">Blocking accounts or domains</h3>
|
||||
<p>From the main timeline select the top banner to go to your profile,
|
||||
then select the <strong>edit</strong> icon. Open the <strong>Filtering
|
||||
and blocking</strong> section and then you can specify blocked accounts
|
||||
or domains (one per line). Be sure to select <strong>Publish</strong> to
|
||||
finalize your settings.</p>
|
||||
and blocking</strong> section and then you can specify <strong>blocked
|
||||
accounts</strong> or domains (one per line).</p>
|
||||
<p>When creating a block you can also add a space followed by any text
|
||||
describing the reason for the block. This can help as a reminder as to
|
||||
why you blocked someone. Such as:</p>
|
||||
<pre class="text"><code>chud@chuddydomain.com Slobbering. Ferocious. Carnivorous. Underground.
|
||||
sealion@endlessreplies.net Another bad faith "debater"</code></pre>
|
||||
<p>Be sure to select <strong>Publish</strong> to finalize your
|
||||
settings.</p>
|
||||
<h3 id="replacing-words">Replacing words</h3>
|
||||
<p>Sometimes you may want to replace words within received posts. This
|
||||
can be for added clarity, to dissipate annoyance or just for fun.</p>
|
||||
|
|
|
@ -581,9 +581,14 @@ If a post made on your instance has been reported as violating the terms of serv
|
|||
### Suspending an account
|
||||
You can suspend an account on the instance by entering the nickname and then selecting the **Suspend** button. Accounts are usually suspended pending investigation into some terms of service violation. You can use the **Unsuspend** button to re-enable an account.
|
||||
|
||||
### Instance level blocking
|
||||
### Instance level blocking of handles or domains
|
||||
To block a fediverse handle (nickname@domain), hashtag or domain enter the thing that you wish to block and then select the **Block** button. You can do the same with the **Unblock** button to reverse your decision.
|
||||
|
||||
When creating a block you can also add a space followed by any text describing the reason for the block. Such as:
|
||||
``` text
|
||||
annoyingdomain.com A spam instance
|
||||
```
|
||||
|
||||
If you want to see what is being blocked at the instance level then select the **Info** button.
|
||||
|
||||
### Web crawlers and search bots
|
||||
|
@ -598,7 +603,15 @@ From the main timeline select the top banner to go to your profile, then select
|
|||
You can also filter words within the bio of users making follow requests. This allows unwanted followers to be automatically rejected if their bio contains particular words.
|
||||
|
||||
### Blocking accounts or domains
|
||||
From the main timeline select the top banner to go to your profile, then select the **edit** icon. Open the **Filtering and blocking** section and then you can specify blocked accounts or domains (one per line). Be sure to select **Publish** to finalize your settings.
|
||||
From the main timeline select the top banner to go to your profile, then select the **edit** icon. Open the **Filtering and blocking** section and then you can specify **blocked accounts** or domains (one per line).
|
||||
|
||||
When creating a block you can also add a space followed by any text describing the reason for the block. This can help as a reminder as to why you blocked someone. Such as:
|
||||
``` text
|
||||
chud@chuddydomain.com Slobbering. Ferocious. Carnivorous. Underground.
|
||||
sealion@endlessreplies.net Another bad faith "debater"
|
||||
```
|
||||
|
||||
Be sure to select **Publish** to finalize your settings.
|
||||
|
||||
### Replacing words
|
||||
Sometimes you may want to replace words within received posts. This can be for added clarity, to dissipate annoyance or just for fun.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "white",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"diff-add": "#111",
|
||||
|
|
|
@ -221,6 +221,7 @@
|
|||
"pageslist-color": "#dddddd",
|
||||
"pageslist-selected-color": "white",
|
||||
"main-fg-color": "#dddddd",
|
||||
"block-reason-color": "lightgreen",
|
||||
"day-number": "#dddddd",
|
||||
"day-number2": "#bbbbbb",
|
||||
"cw-color": "#dddddd",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"diff-add": "#111",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "white",
|
||||
"code-color": "blue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"verified-site-color": "lightgreen",
|
||||
"block-reason-color": "green",
|
||||
"verified-site-color": "green",
|
||||
"diff-add": "#111",
|
||||
"diff-remove": "#333",
|
||||
"code-color": "blue",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"diff-add": "#111",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "lightblue",
|
||||
"pwa-theme-color": "apple-mobile-web-app-status-bar-style",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"block-reason-color": "lightgreen",
|
||||
"verified-site-color": "lightgreen",
|
||||
"code-color": "blue",
|
||||
"font-size-header": "18px",
|
||||
|
|
|
@ -27,6 +27,7 @@ from webapp_utils import get_banner_file
|
|||
from webapp_utils import get_content_warning_button
|
||||
from webapp_utils import html_header_with_external_style
|
||||
from webapp_utils import html_footer
|
||||
from blocking import get_global_block_reason
|
||||
from blocking import is_blocked_domain
|
||||
from blocking import is_blocked
|
||||
from session import create_session
|
||||
|
@ -414,6 +415,11 @@ def html_moderation_info(translate: {}, base_dir: str,
|
|||
|
||||
blocking_filename = base_dir + '/accounts/blocking.txt'
|
||||
if os.path.isfile(blocking_filename):
|
||||
blocking_reasons_filename = \
|
||||
base_dir + '/accounts/blocking_reasons.txt'
|
||||
blocking_reasons_exist = False
|
||||
if os.path.isfile(blocking_reasons_filename):
|
||||
blocking_reasons_exist = True
|
||||
with open(blocking_filename, 'r', encoding='utf-8') as fp_block:
|
||||
blocked_lines = fp_block.readlines()
|
||||
blocked_str = ''
|
||||
|
@ -423,6 +429,14 @@ def html_moderation_info(translate: {}, base_dir: str,
|
|||
if not line:
|
||||
continue
|
||||
line = remove_eol(line).strip()
|
||||
if blocking_reasons_exist:
|
||||
reason = \
|
||||
get_global_block_reason(line,
|
||||
blocking_reasons_filename)
|
||||
if reason:
|
||||
blocked_str += \
|
||||
line + ' - ' + reason + '\n'
|
||||
continue
|
||||
blocked_str += line + '\n'
|
||||
info_form += '<div class="container">\n'
|
||||
info_form += \
|
||||
|
|
|
@ -80,6 +80,7 @@ from blog import get_blog_address
|
|||
from webapp_post import individual_post_as_html
|
||||
from webapp_timeline import html_individual_share
|
||||
from webapp_timeline import page_number_buttons
|
||||
from blocking import get_account_blocks
|
||||
from blocking import get_cw_list_variable
|
||||
from blocking import is_blocked
|
||||
from content import bold_reading_string
|
||||
|
@ -1787,12 +1788,7 @@ def _html_edit_profile_filtering(base_dir: str, nickname: str, domain: str,
|
|||
with open(auto_cw_filename, 'r', encoding='utf-8') as cw_file:
|
||||
auto_cw = cw_file.read()
|
||||
|
||||
blocked_str = ''
|
||||
blocked_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||
if os.path.isfile(blocked_filename):
|
||||
with open(blocked_filename, 'r', encoding='utf-8') as blockedfile:
|
||||
blocked_str = blockedfile.read()
|
||||
blocked_str = get_account_blocks(base_dir, nickname, domain)
|
||||
|
||||
dm_allowed_instances_str = ''
|
||||
dm_allowed_instances_filename = \
|
||||
|
|
Loading…
Reference in New Issue