From 9765539bd2446c97fa92092b9be0ecfb8526b3b5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 20 Aug 2023 17:01:05 +0100 Subject: [PATCH] Flag to indicate whether shares are shown within profile --- daemon.py | 4 +++- epicyon.py | 4 ++-- shares.py | 11 +++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/daemon.py b/daemon.py index c757eb5b1..bc67f7515 100644 --- a/daemon.py +++ b/daemon.py @@ -22414,6 +22414,7 @@ class PubServer(BaseHTTPRequestHandler): else: print('Adding wanted item') shares_file_type = 'wanted' + on_profile = False add_share(self.server.base_dir, self.server.http_prefix, nickname, @@ -22430,7 +22431,8 @@ class PubServer(BaseHTTPRequestHandler): fields['languagesDropdown'], self.server.translate, shares_file_type, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + on_profile) if filename: if os.path.isfile(filename): try: diff --git a/epicyon.py b/epicyon.py index 63401a97d..b65f42a1f 100644 --- a/epicyon.py +++ b/epicyon.py @@ -3459,7 +3459,7 @@ def _command_options() -> None: "City", "0", "GBP", "2 months", debug, city, argb.language, {}, 'shares', argb.low_bandwidth, - argb.content_license_url) + argb.content_license_url, False) add_share(base_dir, http_prefix, nickname, domain, port, "witch hat", @@ -3470,7 +3470,7 @@ def _command_options() -> None: "City", "0", "GBP", "3 months", 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, 'outbox') diff --git a/shares.py b/shares.py index 02eb2337a..1d289832c 100644 --- a/shares.py +++ b/shares.py @@ -312,7 +312,7 @@ 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) -> None: + content_license_url: str, on_profile: bool) -> None: """Adds a new share """ if is_filtered_globally(base_dir, @@ -391,7 +391,8 @@ def add_share(base_dir: str, "published": published, "expire": duration_sec, "itemPrice": price, - "itemCurrency": currency + "itemCurrency": currency, + "onProfile": on_profile } 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']['itemCurrency'], system_language, translate, 'shares', - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + False) if debug: print('DEBUG: shared item received via c2s') @@ -1924,7 +1926,8 @@ def _dfc_to_shares_format(catalog_json: {}, "published": start_time_sec, "expire": expiry_time_sec, "itemPrice": item['DFC:price'].split(' ')[0], - "itemCurrency": item['DFC:price'].split(' ')[1] + "itemCurrency": item['DFC:price'].split(' ')[1], + "onProfile": False } return shares_json