diff --git a/android/main.py b/android/main.py index 5ce50b0..06fe418 100644 --- a/android/main.py +++ b/android/main.py @@ -52,10 +52,11 @@ APP_VERSION = "0.1" # keep in sync with buildozer.spec's `version =` by hand # Forgejo repo this app checks for updates against (ported from # android-app-template — see that repo for the original writeup on each -# piece of this). Leave FORGEJO_TOKEN blank to disable update checking — -# the button still shows, but tells the user clearly that updates aren't -# configured rather than failing silently or crashing. Use a read-only -# token scoped to just this repo, never a general account token. +# piece of this). This repo is public, so FORGEJO_TOKEN is left blank — +# Forgejo's releases API and asset downloads both work unauthenticated +# for a public repo. Only set it if this repo ever goes private again; +# if so, use a read-only token scoped to just this repo, never a +# general account token. FORGEJO_BASE_URL = "https://repo.tas-tech.net" FORGEJO_OWNER = "tas-tech.net" FORGEJO_REPO = "event-tracker" @@ -154,14 +155,9 @@ def check_latest_release(): """ import certifi - if not FORGEJO_TOKEN: - raise RuntimeError( - "Update checking isn't configured — set FORGEJO_TOKEN at " - "the top of main.py." - ) - url = f"{FORGEJO_BASE_URL}/api/v1/repos/{FORGEJO_OWNER}/{FORGEJO_REPO}/releases/latest" - req = urllib.request.Request(url, headers={"Authorization": f"token {FORGEJO_TOKEN}"}) + headers = {"Authorization": f"token {FORGEJO_TOKEN}"} if FORGEJO_TOKEN else {} + req = urllib.request.Request(url, headers=headers) ctx = ssl.create_default_context(cafile=certifi.where()) with urllib.request.urlopen(req, context=ctx, timeout=15) as resp: data = json.load(resp)