Check new version from github releases
Instead of using my own website. So I no longer need to update it to reflect the latest version.
This commit is contained in:
parent
bd8dd1f03c
commit
390fc42a2c
@ -64,20 +64,17 @@ def check_latest_version() -> Optional[str]:
|
|||||||
'''Returns the latest version available.
|
'''Returns the latest version available.
|
||||||
Heavely dependent on server and server configurations
|
Heavely dependent on server and server configurations
|
||||||
not granted to work forever.'''
|
not granted to work forever.'''
|
||||||
from http.client import HTTPConnection
|
import json
|
||||||
connection = HTTPConnection('feedback-ltworf.appspot.com')
|
import urllib.request
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.request("GET", "/version/relational")
|
req = urllib.request.Request('https://api.github.com/repos/ltworf/relational/releases')
|
||||||
r = connection.getresponse()
|
with urllib.request.urlopen(req) as f:
|
||||||
|
data = json.load(f)
|
||||||
|
return data[0]['name']
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# html
|
|
||||||
s = r.read()
|
|
||||||
if len(s) == 0:
|
|
||||||
return None
|
|
||||||
return s.decode().strip()
|
|
||||||
|
|
||||||
|
|
||||||
class UserInterface:
|
class UserInterface:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user