diff --git a/README.md b/README.md index eedd120..b90125c 100644 --- a/README.md +++ b/README.md @@ -12,33 +12,71 @@ Why using configuration?... ------------------------ ...instead use stared project of your Github account? Cause I've got about 80 "stared" projects and I don't wan't to be alerted for new releases of each of these project. -But, perhaps I'll add such a feature later on... And, Github API limits is at 60 requests by seconds, and I want to write this script really quickly in a first time. +But, perhaps I'll add such a feature later on... + How to use? ----------- Really simple! -* Edit conf.ini file to set `[config]` section +* Install dependances: `pip install -r requirements.txt` +* Edit conf.ini file to set `[config]` section: * your SMTP server configuration (host and port) * sender mail * receiver mail (:warning: not tested with more than 1 receiver) -* Add the projects you want to follow in the section `[project]` +* ...or use environment variable - same name but in upper case e.g. `SMTP_PORT` +* Add projects you want to follow in the section `[project]` * Be careful to follow a JSON valid syntax as in the provided file, i.e. coma after each `autor/project` except the last one. +Execute the script: `python notifier.py` + After first execution, the `conf.ini` file will be filled with last release tag found by the script, as you can see in the provided file. Hope you like, and have fun to read your mail! +Hey, what is this API? +-------------------------- +Since it's not really conveniant to go on a VM and edit the config.ini every time I find a cool new project whose new versions I want to keep track of, there is an API to do this. + +This is a really simple thing with no verification: you can add everything that you want! + +Just one endpoint: `subscription`, and two method: GET and PUT. +PUT take three parameters: +* `project`: full project name e.g. `MaxenceG2M/github-release-notifier` or "short" name (without author) e.g. `github-release-notifier` +* (optionnal) `author`: the author of the repository +* (optionnal) `credentials`: just the TOTP check code. + +Indeed, to have a minimal better-than-nothing protection, I opted for a simple TOTP code. No user/password or wathever. +You can disable-it in the `config.ini`, or specify a custom key. +If you don't specify a key, information will be displayed at startup (URL and the actual code. Be quick to check if it's ok!). + +To start the API: +```sh +$ uvicorn notifier:app +TOTP enabled. + Information: otpauth://totp/Secret?secret=mysuperkey + TOTP check: 377826 +INFO: Started server process [28264] +INFO: Waiting for application startup. +INFO: Application startup complete. +INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) +``` + +Cron-it with [ofelia](https://github.com/mcuadros/ofelia) +--------------------------------------------------------- +Ofelia is very conveniant for croning the verification part while letting the API run continuously. +So the `docker-compose.yml` use it to do this :) + +<3 + Problems I have to solve really quickly --------------------------------------- -I wrote this script really quickly, certainly faster than this README. So I already have two big proglems: -* The script sends mail even if no new projets or release has been detected -* The biggest, you have to edit script to specify absolute path... -* A lot of other little problems, like the code that's disgusting and so on. +One script to do all things. -For who's asking: yes, it's normal that I have put all code in one main function [like a blind gunner.](https://media.giphy.com/media/1yMexL5rkwYhuiVEmZ/giphy.gif). Really quickly I said! +For who's asking: yes, it's normal that I have put all code in ~~one main function~~ one main script [like a blind gunner.](https://media.giphy.com/media/1yMexL5rkwYhuiVEmZ/giphy.gif). +I want to keep this script as simple as possible. But overall, the script works and sends mail!