commit
087b78c414
@ -1,3 +1,6 @@
|
|||||||
|
3.1
|
||||||
|
- Fix version check
|
||||||
|
|
||||||
3.0
|
3.0
|
||||||
- UI shows different colours for different types
|
- UI shows different colours for different types
|
||||||
- Better documentation on the website
|
- Better documentation on the website
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#
|
#
|
||||||
# Stuff non-related to relational algebra, but used for maintenance.
|
# Stuff non-related to relational algebra, but used for maintenance.
|
||||||
|
|
||||||
import http.client
|
|
||||||
import urllib.parse
|
|
||||||
import os.path
|
import os.path
|
||||||
import pickle
|
import pickle
|
||||||
import base64
|
import base64
|
||||||
@ -30,15 +28,16 @@ from relational import parser
|
|||||||
from relational.rtypes import is_valid_relation_name
|
from relational.rtypes import is_valid_relation_name
|
||||||
|
|
||||||
|
|
||||||
SWEARWORDS = {'fuck', 'shit', 'suck', 'merda', 'mierda', 'merde'}
|
|
||||||
|
|
||||||
|
|
||||||
def send_survey(data) -> int:
|
def send_survey(data) -> int:
|
||||||
'''Sends the survey. Data must be a dictionary.
|
'''Sends the survey. Data must be a dictionary.
|
||||||
returns the http response.
|
returns the http response.
|
||||||
|
|
||||||
returns 0 in case of error
|
returns 0 in case of error
|
||||||
returns -1 in case of swearwords'''
|
returns -1 in case of swearwords'''
|
||||||
|
import urllib.parse
|
||||||
|
from http.client import HTTPConnection
|
||||||
|
|
||||||
|
SWEARWORDS = {'fuck', 'shit', 'suck', 'merda', 'mierda', 'merde'}
|
||||||
|
|
||||||
post = ''
|
post = ''
|
||||||
for i in data.keys():
|
for i in data.keys():
|
||||||
@ -53,7 +52,7 @@ def send_survey(data) -> int:
|
|||||||
params = urllib.parse.urlencode({'survey': post})
|
params = urllib.parse.urlencode({'survey': post})
|
||||||
headers = {"Content-type":
|
headers = {"Content-type":
|
||||||
"application/x-www-form-urlencoded", "Accept": "text/plain"}
|
"application/x-www-form-urlencoded", "Accept": "text/plain"}
|
||||||
connection = http.client.HTTPConnection('feedback-ltworf.appspot.com')
|
connection = HTTPConnection('feedback-ltworf.appspot.com')
|
||||||
try:
|
try:
|
||||||
connection.request("POST", "/feedback/relational", params, headers)
|
connection.request("POST", "/feedback/relational", params, headers)
|
||||||
return connection.getresponse().status
|
return connection.getresponse().status
|
||||||
@ -65,19 +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.'''
|
||||||
connection = http.client.HTTPConnection('feedback-ltworf.appspot.com')
|
import json
|
||||||
|
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…
Reference in New Issue
Block a user