summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-07-15 12:16:57 -0400
committerAAGaming <aa@mail.catvibers.me>2022-07-15 12:16:57 -0400
commitf2fbd399fe875e5aaaaea678d1fb1a824a74932e (patch)
treef66a96b6d821b25152fcdd27325597b69f903100 /backend
parent28b91963a9fba21c8bef0f62ecd603b14cb6284d (diff)
downloaddecky-loader-f2fbd399fe875e5aaaaea678d1fb1a824a74932e.tar.gz
decky-loader-f2fbd399fe875e5aaaaea678d1fb1a824a74932e.zip
allow users to manually check for updates
Diffstat (limited to 'backend')
-rw-r--r--backend/updater.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/backend/updater.py b/backend/updater.py
index d7aed0d7..76c42fe1 100644
--- a/backend/updater.py
+++ b/backend/updater.py
@@ -22,7 +22,8 @@ class Updater:
self.updater_methods = {
"get_version": self.get_version,
"do_update": self.do_update,
- "do_restart": self.do_restart
+ "do_restart": self.do_restart,
+ "check_for_updates": self.check_for_updates
}
self.remoteVer = None
try:
@@ -63,14 +64,18 @@ class Updater:
else:
return {"current": "unknown", "updatable": False}
+ async def check_for_updates(self):
+ async with ClientSession() as web:
+ async with web.request("GET", "https://api.github.com/repos/SteamDeckHomebrew/decky-loader/releases", ssl=helpers.get_ssl_context()) as res:
+ remoteVersions = await res.json()
+ self.remoteVer = next(filter(lambda ver: ver["prerelease"] and ver["tag_name"].startswith("v") and ver["tag_name"].endswith("-pre"), remoteVersions), None)
+ logger.info("Updated remote version information")
+ return await self.get_version()
+
async def version_reloader(self):
while True:
try:
- async with ClientSession() as web:
- async with web.request("GET", "https://api.github.com/repos/SteamDeckHomebrew/decky-loader/releases", ssl=helpers.get_ssl_context()) as res:
- remoteVersions = await res.json()
- self.remoteVer = next(filter(lambda ver: ver["prerelease"] and ver["tag_name"].startswith("v") and ver["tag_name"].endswith("-pre"), remoteVersions), None)
- logger.info("Updated remote version information")
+ await self.check_for_updates()
except:
pass
await sleep(60 * 60) # 1 hour