Change endpoint to btclock git

This commit is contained in:
Djuri Baars 2024-11-26 01:06:00 +01:00
parent 7dfed6af6c
commit c820fb9421

View file

@ -11,7 +11,7 @@ from app.utils import get_app_data_folder, keep_latest_versions
CACHE_FILE = get_app_data_folder() + '/cache.json'
CACHE_DURATION = timedelta(minutes=30)
LATEST_RELEASE_ENDPOINT = "https://git.rof.tools/api/v1/repos/mirrors/btclock_v3/tags"
LATEST_RELEASE_ENDPOINT = "https://git.btclock.dev/api/v1/repos/btclock/btclock_v3/tags"
class ReleaseChecker:
'''Release Checker for firmware updates'''
@ -35,7 +35,7 @@ class ReleaseChecker:
def fetch_latest_release(self):
'''Fetch latest firmware release from GitHub'''
repo = "mirrors/btclock_v3"
repo = "btclock/btclock_v3"
cache = self.load_cache()
now = datetime.now()
@ -44,7 +44,7 @@ class ReleaseChecker:
latest_release = cache['latest_release']['data']
else:
# url = f"https://api.github.com/repos/{repo}/releases/latest"
url = f"https://git.rof.tools/api/v1/repos/{repo}/releases/latest"
url = f"https://git.btclock.dev/api/v1/repos/{repo}/releases/latest"
try:
response = requests.get(url)
response.raise_for_status()
@ -74,7 +74,7 @@ class ReleaseChecker:
for asset_url in asset_urls:
self.download_file(asset_url, release_name)
ref_url = f"https://git.rof.tools/api/v1/repos/{repo}/tags/{release_name}"
ref_url = f"https://git.btclock.dev/api/v1/repos/{repo}/tags/{release_name}"
#ref_url = f"https://api.github.com/repos/{
# repo}/git/ref/tags/{release_name}"
if ref_url in cache and (now - datetime.fromisoformat(cache[ref_url]['timestamp'])) < CACHE_DURATION: