mirror of https://gitlab.com/bashrc2/epicyon
Improve support for federated blocks
parent
16d98f5fe3
commit
e2ee8d994a
|
@ -1851,7 +1851,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.max_recent_books,
|
||||
self.server.books_cache,
|
||||
self.server.max_cached_readers,
|
||||
self.server.auto_cw_cache)
|
||||
self.server.auto_cw_cache,
|
||||
self.server.block_federated)
|
||||
|
||||
def _get_outbox_thread_index(self, nickname: str,
|
||||
max_outbox_threads_per_account: int) -> int:
|
||||
|
@ -23357,7 +23358,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.translate, shares_file_type,
|
||||
self.server.low_bandwidth,
|
||||
self.server.content_license_url,
|
||||
share_on_profile)
|
||||
share_on_profile,
|
||||
self.server.block_federated)
|
||||
if post_type == 'newshare':
|
||||
# add shareOnProfile items to the actor attachments
|
||||
# https://codeberg.org/fediverse/fep/src/branch/main/fep/0837/fep-0837.md
|
||||
|
|
|
@ -3531,6 +3531,7 @@ def _command_options() -> None:
|
|||
set_role(base_dir, nickname, domain, 'admin')
|
||||
set_availability(base_dir, nickname, domain, 'busy')
|
||||
|
||||
block_federated = []
|
||||
add_share(base_dir,
|
||||
http_prefix, nickname, domain, port,
|
||||
"spanner",
|
||||
|
@ -3541,7 +3542,7 @@ def _command_options() -> None:
|
|||
"City", "0", "GBP",
|
||||
"2 months",
|
||||
debug, city, argb.language, {}, 'shares', argb.low_bandwidth,
|
||||
argb.content_license_url, False)
|
||||
argb.content_license_url, False, block_federated)
|
||||
add_share(base_dir,
|
||||
http_prefix, nickname, domain, port,
|
||||
"witch hat",
|
||||
|
@ -3552,7 +3553,7 @@ def _command_options() -> None:
|
|||
"City", "0", "GBP",
|
||||
"3 months",
|
||||
debug, city, argb.language, {}, 'shares', argb.low_bandwidth,
|
||||
argb.content_license_url, False)
|
||||
argb.content_license_url, False, block_federated)
|
||||
|
||||
delete_all_posts(base_dir, nickname, domain, 'inbox')
|
||||
delete_all_posts(base_dir, nickname, domain, 'outbox')
|
||||
|
|
|
@ -253,7 +253,8 @@ def post_message_to_outbox(session, translate: {},
|
|||
max_recent_books: int,
|
||||
books_cache: {},
|
||||
max_cached_readers: int,
|
||||
auto_cw_cache: {}) -> bool:
|
||||
auto_cw_cache: {},
|
||||
block_federated: []) -> bool:
|
||||
"""post is received by the outbox
|
||||
Client to server message post
|
||||
https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery
|
||||
|
@ -778,7 +779,7 @@ def post_message_to_outbox(session, translate: {},
|
|||
outbox_share_upload(base_dir, http_prefix, post_to_nickname, domain,
|
||||
port, message_json, debug, city,
|
||||
system_language, translate, low_bandwidth,
|
||||
content_license_url)
|
||||
content_license_url, block_federated)
|
||||
|
||||
if debug:
|
||||
print('DEBUG: handle undo share uploads')
|
||||
|
|
|
@ -156,7 +156,8 @@ def _update_post_schedule(base_dir: str, handle: str, httpd,
|
|||
httpd.max_recent_books,
|
||||
httpd.books_cache,
|
||||
httpd.max_cached_readers,
|
||||
httpd.auto_cw_cache):
|
||||
httpd.auto_cw_cache,
|
||||
httpd.block_federated):
|
||||
index_lines.remove(line)
|
||||
try:
|
||||
os.remove(post_filename)
|
||||
|
|
16
shares.py
16
shares.py
|
@ -278,7 +278,8 @@ def _getshare_type_from_dfc_id(dfc_uri: str, dfc_ids: {}) -> str:
|
|||
def _indicate_new_share_available(base_dir: str, http_prefix: str,
|
||||
nickname: str, domain: str,
|
||||
domain_full: str,
|
||||
shares_file_type: str) -> None:
|
||||
shares_file_type: str,
|
||||
block_federated: []) -> None:
|
||||
"""Indicate to each account that a new share is available
|
||||
"""
|
||||
for _, dirs, _ in os.walk(base_dir + '/accounts'):
|
||||
|
@ -296,7 +297,7 @@ def _indicate_new_share_available(base_dir: str, http_prefix: str,
|
|||
# does this account block you?
|
||||
if account_nickname != nickname:
|
||||
if is_blocked(base_dir, account_nickname, domain,
|
||||
nickname, domain, None, None):
|
||||
nickname, domain, None, block_federated):
|
||||
continue
|
||||
local_actor = \
|
||||
local_actor_url(http_prefix, account_nickname, domain_full)
|
||||
|
@ -320,7 +321,8 @@ def add_share(base_dir: str,
|
|||
price: str, currency: str,
|
||||
system_language: str, translate: {},
|
||||
shares_file_type: str, low_bandwidth: bool,
|
||||
content_license_url: str, share_on_profile: bool) -> None:
|
||||
content_license_url: str, share_on_profile: bool,
|
||||
block_federated: []) -> None:
|
||||
"""Adds a new share
|
||||
"""
|
||||
if is_filtered_globally(base_dir,
|
||||
|
@ -407,7 +409,8 @@ def add_share(base_dir: str,
|
|||
|
||||
_indicate_new_share_available(base_dir, http_prefix,
|
||||
nickname, domain, domain_full,
|
||||
shares_file_type)
|
||||
shares_file_type,
|
||||
block_federated)
|
||||
|
||||
|
||||
def expire_shares(base_dir: str, max_shares_on_profile: int,
|
||||
|
@ -1151,7 +1154,8 @@ def outbox_share_upload(base_dir: str, http_prefix: str,
|
|||
message_json: {}, debug: bool, city: str,
|
||||
system_language: str, translate: {},
|
||||
low_bandwidth: bool,
|
||||
content_license_url: str) -> None:
|
||||
content_license_url: str,
|
||||
block_federated: []) -> None:
|
||||
""" When a shared item is received by the outbox from c2s
|
||||
"""
|
||||
if not message_json.get('type'):
|
||||
|
@ -1214,7 +1218,7 @@ def outbox_share_upload(base_dir: str, http_prefix: str,
|
|||
message_json['object']['itemCurrency'],
|
||||
system_language, translate, 'shares',
|
||||
low_bandwidth, content_license_url,
|
||||
False)
|
||||
False, block_federated)
|
||||
if debug:
|
||||
print('DEBUG: shared item received via c2s')
|
||||
|
||||
|
|
Loading…
Reference in New Issue