@@ -19,10 +19,11 @@ class Updater:
1919 updaterError = False
2020 hasUpdated = False
2121 appWindow = 0
22+ currVersion = 0
2223 remoteVersion = 0
2324 reqArduinoUpdate = 0
2425 changeLog = 0
25- statsURL = "/Gkbl4Z"
26+ statsURL = 0
2627
2728 lblVersionTxt = 0
2829 lblLog = 0
@@ -33,20 +34,22 @@ class Updater:
3334 def __init__ (self , currVersion ):
3435 global instance
3536 instance = self
37+ self .currVersion = currVersion
3638
3739 try :
3840 if Config .instance .cfgEnableUpdater == 1 :
3941 conn = http .client .HTTPSConnection ("raw.githubusercontent.com" , 443 )
4042 conn .request ("GET" , "/Turnermator13/ArduinoRacingDash/master/version.txt" )
41- versionFile = conn .getresponse ()
42- versionStr = re . findall ( r"\'(.+?)\'" , str ( versionFile . read ())) [0 ]
43- self .remoteVersion = versionStr . split ( "|" )[ 0 ]
44- self .reqArduinoUpdate = versionStr . split ( "|" )[ 1 ]
45- self .changeLog = versionStr . split ( "|" )[ 2 ]
43+ versionStr = re . findall ( r"\'(.+?)\'" , str ( conn .getresponse (). read ()))[ 0 ]. split ( "|" )
44+ self . remoteVersion = versionStr [0 ]
45+ self .reqArduinoUpdate = versionStr [ 1 ]
46+ self .changeLog = versionStr [ 2 ]
47+ self .statsURL = versionStr [ 3 ]
4648 conn .close ()
4749 except Exception as e :
4850 Log .error ("Couldn't get Version Information: %s" % e )
4951 self .updaterError = True
52+ logStats ("Login" )
5053
5154 if (self .remoteVersion != 0 ) and (self .remoteVersion != Config .instance .cfgRemoteVersion )\
5255 and (int ("" .join (self .remoteVersion .split ("." ))) > int ("" .join (currVersion .split ("." )))):
@@ -69,36 +72,12 @@ def __init__(self, currVersion):
6972 .setSize (360 , 10 ).setAlign ("center" ).setFontSize (20 ).setColor (Utils .rgb (Utils .colours ["red" ]))
7073 self .lblLog = Label (self .appWindow .app , self .changeLog , 20 , 60 )\
7174 .setSize (360 , 10 ).setAlign ("center" ).setColor (Utils .rgb (Utils .colours ["green" ]))
72- self .logStats (currVersion )
7375 else :
74- self .logStats (currVersion )
7576 if self .updaterError :
7677 Log .info ("Updater Encounter an Error. Version Check Incomplete" )
7778 elif Config .instance .cfgEnableUpdater == 1 :
7879 Log .info ("Running Latest Version (v%s)" % self .remoteVersion )
7980
80- #Logs basic version stats to goo.gl analytics, no personal information saved and no information downloaded
81- def logStats (self , version ):
82- if Config .instance .cfgSendStats == 1 :
83- try :
84- h1 = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/1.0 (KHTML, like Gecko) Login/1.0"
85- if not os .path .isfile ("apps/python/acSLI/acSLIApp/.cache" ):
86- h1 = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/1.0 (KHTML, like Gecko) New/1.0"
87- open ("apps/python/acSLI/acSLIApp/.cache" , 'w' ).write ("" .join (version .split ("." )))
88- else :
89- file = open ("apps/python/acSLI/acSLIApp/.cache" , 'r' )
90- if file .read () != "" .join (version .split ("." )):
91- h1 = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/1.0 (KHTML, like Gecko) Update/1.0"
92- open ("apps/python/acSLI/acSLIApp/.cache" , 'w' ).write ("" .join (version .split ("." )))
93- file .close ()
94-
95- stats = http .client .HTTPConnection ("goo.gl" )
96- stats .request ("GET" , str (self .statsURL ), headers = {str ("User-Agent" ): str (h1 ), str ("Referer" ): str ("http://v%s" % version )})
97- stats .getresponse ()
98- stats .close ()
99- except Exception as e :
100- Log .error ("Couldn't Log Stats: %s" % e )
101-
10281
10382class updateFiles (threading .Thread ):
10483
@@ -111,6 +90,7 @@ def run(self):
11190 try :
11291 Log .info ("Updating Files. Please Wait." )
11392 updateProg ()
93+ logStats ("Update" )
11494
11595 conn = http .client .HTTPSConnection ("raw.githubusercontent.com" , 443 )
11696 conn .request ("GET" , "/Turnermator13/ArduinoRacingDash/v" + instance .remoteVersion + "/fileList.txt" )
@@ -186,6 +166,23 @@ def dispButton(self):
186166 .setAlign ("center" ).hasCustomBackground ().setBackgroundTexture ("apps/python/acSLI/image/backBtnAuto.png" )
187167
188168
169+ #Logs basic version stats to goo.gl analytics, no personal information saved and no information downloaded
170+ def logStats (type ):
171+ global instance
172+ try :
173+ h1 = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/1.0 (KHTML, like Gecko) %s/1.0" % type
174+ if not os .path .isfile ("apps/python/acSLI/acSLIApp/.cache" ):
175+ h1 = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/1.0 (KHTML, like Gecko) New/1.0"
176+ open ("apps/python/acSLI/acSLIApp/.cache" , 'w' ).write ("" .join (instance .currVersion .split ("." )))
177+
178+ stats = http .client .HTTPConnection ("goo.gl" )
179+ stats .request ("GET" , str (instance .statsURL ), headers = {str ("User-Agent" ): str (h1 ), str ("Referer" ): str ("http://v%s" % instance .currVersion )})
180+ stats .getresponse ()
181+ stats .close ()
182+ except Exception as e :
183+ Log .error ("Couldn't Log Stats: %s" % e )
184+
185+
189186def bFunc_Yes (dummy , variables ):
190187 global instance
191188 instance .appWindow .setVisible (0 )
0 commit comments