Skip to content

Commit

Permalink
chg: [Fedivuln-Publish] Publish the status to the fediverse.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Dec 9, 2024
1 parent d3c3c65 commit bd4933c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ options:
The topic to subscribe to.
```

The authentication to the HTTP event stream is automatically handled by PyVulnerabilityLookup.

For each incoming event, a status will be posted using the configured Mastodon account.
The format of the status is dynamically tailored to the specific event topic.
For instance, executing the command ``FediVuln-Publish -t comment`` will capture all
new comments and share a human-readable summary on the Fediverse, including a link to the
original comment on the Vulnerability-Lookup instance.



### Search

Expand Down
5 changes: 3 additions & 2 deletions fedivuln/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def listen_to_http_event_stream(url, headers=None, params=None, topic="comment")
try:
# Attempt to parse the data as JSON
message = json.loads(data_line)
print("Received JSON message:")
print(message)
# print("Received JSON message:")
# print(message)
publish(create_status_content(message, topic))
except json.JSONDecodeError:
# Handle plain text messages
print(f"Received plain message: {data_line}")
Expand Down

0 comments on commit bd4933c

Please sign in to comment.