@@ -135,11 +135,11 @@ async def create_status_content(event_data: str, topic: str) -> str:
135135# ### Streaming functions
136136
137137
138- def publish (message : str ) -> None :
138+ def publish (message : str , visibility : str = "public" ) -> None :
139139 if message :
140140 print (message )
141141 try :
142- mastodon .status_post (message )
142+ mastodon .status_post (message , visibility )
143143 except MastodonAPIError as e :
144144 print (
145145 f"Mastodon instance returned MastodonAPIError - the server has decided it can't fulfil your request: { str (e )} "
@@ -178,7 +178,10 @@ def listen_to_http_event_stream(url, headers=None, params=None, topic="comment")
178178 event_data = json .loads (data_line )
179179 # print("Received JSON message:")
180180 # print(message)
181- publish (create_status_content_sync (event_data , topic ))
181+ publish (
182+ create_status_content_sync (event_data , topic ),
183+ config .status_visibility [topic ],
184+ )
182185 except json .JSONDecodeError :
183186 # Handle plain text messages
184187 print (f"Received plain message: { data_line } " )
@@ -244,7 +247,10 @@ def main():
244247 if arguments .valkey :
245248 for elem in listen_to_valkey_stream (topic = arguments .topic ):
246249 event_data = json .loads (elem )
247- publish (create_status_content_sync (event_data , arguments .topic ))
250+ publish (
251+ create_status_content_sync (event_data , arguments .topic ),
252+ config .status_visibility [arguments .topic ],
253+ )
248254 else :
249255 combined = urljoin (config .vulnerability_lookup_base_url , "pubsub/subscribe/" )
250256 full_url = urljoin (combined , arguments .topic )
0 commit comments