Compare commits

...

10 Commits

Author SHA1 Message Date
5b113d725b Merge remote-tracking branch 'origin/main' 2024-03-03 09:47:54 +01:00
9b2cf22892 Update to take markdown formating 2024-03-03 09:47:43 +01:00
Félix MARQUET
34b314d40f Update README.md 2024-03-02 16:57:11 +01:00
Félix MARQUET
7a1808569e Update README.md 2024-03-01 23:07:31 +01:00
Félix MARQUET
063c2db3a9 Update README.md 2024-03-01 21:29:22 +01:00
Félix MARQUET
f68bc12902 Update README.md 2024-03-01 21:29:08 +01:00
c728183bf4 Change db path 2024-03-01 20:10:20 +01:00
6da0b5dac0 Merge remote-tracking branch 'origin/main' 2024-03-01 19:30:19 +01:00
6c714abedd Add a button to go to the github page 2024-03-01 19:30:02 +01:00
Félix MARQUET
ecf162f6ed Update README.md 2024-03-01 18:59:35 +01:00
2 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
# ntfy_alerts
Personal ntfy alerts system
feel free to contribute and to fork
# Python ntfy.py
## Description:
@@ -30,8 +31,13 @@ services:
- GHNTFY_TIMEOUT=timeout # Default is 3600 (1 hour)
- GHREPO=["username/repo1", "username/repo2"] # Default is empty
- GHNTFY_TOKEN= # Default is empty (Github token)
volumes:
- /path/to/github-ntfy:/github-ntfy/
restart: unless-stopped
````
GHNTFY_TOKEN, need to have repo, read:org and read:user
Docker Hub repo: https://hub.docker.com/r/breizhhardware/github-ntfy
## TODO:
- [x] Dockerize the ntfy.py
- [x] Add the watched repos list as a parameter

View File

@@ -22,7 +22,7 @@ if not watched_repos_list:
exit(1)
# Connexion à la base de données pour stocker les versions précédentes
db_path = 'ghntfy_versions.db'
db_path = '/github-ntfy/ghntfy_versions.db'
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
@@ -86,7 +86,12 @@ def send_to_ntfy(releases, auth, url):
(app_name, version_number, changelog))
conn.commit()
headers = {"Authorization": f"Basic {auth}", "Content-Type": "text/plain"}
headers = {
"Authorization": f"Basic {auth}",
"Title": f"New version for {app_name}",
"Priority": "urgent",
"Markdown": "yes",
"Actions": f"view, Update {app_name}, {app_url}, clear=true"}
response = requests.post(f"{url}", headers=headers, data=message)
if response.status_code == 200:
logger.info(f"Message envoyé à Ntfy pour {app_name}")