diff --git a/tools/README.md b/tools/README.md index 1170193..ed71781 100644 --- a/tools/README.md +++ b/tools/README.md @@ -5,7 +5,7 @@ This tool is used to check - with a set registred project - for: - available online latest version - current installed version -This tool, writtent in python and under GPLv3 Licence assumes project is +This tool, written in python and under GPLv3 Licence assumes project is installed using git in an admin project name owner on the system. It is configured here for "mastodon" project, but you can copy and use it, diff --git a/tools/has_update b/tools/has_update index 486a44f..5e396a2 100644 --- a/tools/has_update +++ b/tools/has_update @@ -42,8 +42,10 @@ import requests, subprocess, sys #------------ owner = "mastodon" # Also used for sudo -u {owner} name = "mastodon" +repo = f"https://api.github.com/repos/{owner}/{name}/releases/latest" +# VLH (Very Little Help) helps = """Usage: has_update [argument] -h : This help ! -v : Show both versions (online, and installed) @@ -53,8 +55,7 @@ helps = """Usage: has_update [argument] # Check available version using Git API with requests # #-----------------------------------------------------# def get_available_release(): - url = f"https://api.github.com/repos/{owner}/{name}/releases/latest" - response = requests.get(url) + response = requests.get(repo) if response.status_code == 200: latest_release = response.json() return latest_release['tag_name']