Flag to indicate whether shares are shown within profile

main
Bob Mottram 2023-08-20 17:01:05 +01:00
parent ceec79afb7
commit 9765539bd2
3 changed files with 12 additions and 7 deletions

View File

@ -22414,6 +22414,7 @@ class PubServer(BaseHTTPRequestHandler):
else: else:
print('Adding wanted item') print('Adding wanted item')
shares_file_type = 'wanted' shares_file_type = 'wanted'
on_profile = False
add_share(self.server.base_dir, add_share(self.server.base_dir,
self.server.http_prefix, self.server.http_prefix,
nickname, nickname,
@ -22430,7 +22431,8 @@ class PubServer(BaseHTTPRequestHandler):
fields['languagesDropdown'], fields['languagesDropdown'],
self.server.translate, shares_file_type, self.server.translate, shares_file_type,
self.server.low_bandwidth, self.server.low_bandwidth,
self.server.content_license_url) self.server.content_license_url,
on_profile)
if filename: if filename:
if os.path.isfile(filename): if os.path.isfile(filename):
try: try:

View File

@ -3459,7 +3459,7 @@ def _command_options() -> None:
"City", "0", "GBP", "City", "0", "GBP",
"2 months", "2 months",
debug, city, argb.language, {}, 'shares', argb.low_bandwidth, debug, city, argb.language, {}, 'shares', argb.low_bandwidth,
argb.content_license_url) argb.content_license_url, False)
add_share(base_dir, add_share(base_dir,
http_prefix, nickname, domain, port, http_prefix, nickname, domain, port,
"witch hat", "witch hat",
@ -3470,7 +3470,7 @@ def _command_options() -> None:
"City", "0", "GBP", "City", "0", "GBP",
"3 months", "3 months",
debug, city, argb.language, {}, 'shares', argb.low_bandwidth, debug, city, argb.language, {}, 'shares', argb.low_bandwidth,
argb.content_license_url) argb.content_license_url, False)
delete_all_posts(base_dir, nickname, domain, 'inbox') delete_all_posts(base_dir, nickname, domain, 'inbox')
delete_all_posts(base_dir, nickname, domain, 'outbox') delete_all_posts(base_dir, nickname, domain, 'outbox')

View File

@ -312,7 +312,7 @@ def add_share(base_dir: str,
price: str, currency: str, price: str, currency: str,
system_language: str, translate: {}, system_language: str, translate: {},
shares_file_type: str, low_bandwidth: bool, shares_file_type: str, low_bandwidth: bool,
content_license_url: str) -> None: content_license_url: str, on_profile: bool) -> None:
"""Adds a new share """Adds a new share
""" """
if is_filtered_globally(base_dir, if is_filtered_globally(base_dir,
@ -391,7 +391,8 @@ def add_share(base_dir: str,
"published": published, "published": published,
"expire": duration_sec, "expire": duration_sec,
"itemPrice": price, "itemPrice": price,
"itemCurrency": currency "itemCurrency": currency,
"onProfile": on_profile
} }
save_json(shares_json, shares_filename) save_json(shares_json, shares_filename)
@ -1170,7 +1171,8 @@ def outbox_share_upload(base_dir: str, http_prefix: str,
message_json['object']['itemPrice'], message_json['object']['itemPrice'],
message_json['object']['itemCurrency'], message_json['object']['itemCurrency'],
system_language, translate, 'shares', system_language, translate, 'shares',
low_bandwidth, content_license_url) low_bandwidth, content_license_url,
False)
if debug: if debug:
print('DEBUG: shared item received via c2s') print('DEBUG: shared item received via c2s')
@ -1924,7 +1926,8 @@ def _dfc_to_shares_format(catalog_json: {},
"published": start_time_sec, "published": start_time_sec,
"expire": expiry_time_sec, "expire": expiry_time_sec,
"itemPrice": item['DFC:price'].split(' ')[0], "itemPrice": item['DFC:price'].split(' ')[0],
"itemCurrency": item['DFC:price'].split(' ')[1] "itemCurrency": item['DFC:price'].split(' ')[1],
"onProfile": False
} }
return shares_json return shares_json