Skip to content

Commit

Permalink
chg: [RELEASE] Bumped version to 0.5.5. Templates are now in the conf…
Browse files Browse the repository at this point in the history
…iguration file.
  • Loading branch information
cedricbonhomme committed Dec 11, 2024
1 parent 9c29b49 commit a04f178
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
11 changes: 11 additions & 0 deletions fedivuln/conf_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@

vulnerability_lookup_base_url = "https://vulnerability.circl.lu/"
vulnerability_auth_token = ""


# Templates used when publishing status
templates = {
"vulnerability": "You can now share your thoughts on vulnerability "
"<VULNID> in Vulnerability-Lookup:\n<LINK>\n\n#VulnerabilityLookup #Vulnerability #Cybersecurity #bot",
"comment": "Vulnerability <VULNID> has received a comment on "
"Vulnerability-Lookup:\n\n<TITLE>\n<LINK>\n\n#VulnerabilityLookup #Vulnerability #Cybersecurity #bot",
"bundle": "A new bundle, <BUNDLETITLE>, has been published "
"on Vulnerability-Lookup:\n<LINK>\n\n#VulnerabilityLookup #Vulnerability #Cybersecurity #bot",
}
1 change: 1 addition & 0 deletions fedivuln/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def load_config(path):
app_name = conf.app_name
mastodon_clientcred = conf.mastodon_clientcred
mastodon_usercred = conf.mastodon_usercred
templates = conf.templates

# For PyVulnerabilityLookup
vulnerability_lookup_base_url = conf.vulnerability_lookup_base_url
Expand Down
14 changes: 1 addition & 13 deletions fedivuln/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,10 @@
)


# ### Templates

TEMPLATES = {
"vulnerability": "You can now share your thoughts on vulnerability "
"<VULNID> in Vulnerability-Lookup:\n<LINK>\n\n#VulnerabilityLookup #Vulnerability",
"comment": "Vulnerability <VULNID> has received a comment on "
"Vulnerability-Lookup:\n\n<TITLE>\n<LINK>\n\n#VulnerabilityLookup #Vulnerability",
"bundle": "A new bundle, <BUNDLETITLE>, has been published "
"on Vulnerability-Lookup:\n<LINK>\n\n#VulnerabilityLookup #Vulnerability",
}


def create_status_content(event_data: str, topic: str) -> str:
"""Generates a status update for posting based on the monitored topic."""
event_dict = json.loads(event_data)
status = TEMPLATES.get(topic, "")
status = config.templates.get(topic, "")
match topic:
case "vulnerability":
status = status.replace("<VULNID>", event_dict["payload"]["vulnerability"])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "FediVuln"
version = "0.5.4"
version = "0.5.5"
description = "A client to gather vulnerability-related information from the Fediverse."
authors = ["Cédric Bonhomme <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down

0 comments on commit a04f178

Please sign in to comment.