Merge branch 'SSL_fix'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
pandas>=0.24.2
|
||||
certifi>=2019.6.16
|
||||
aiohttp>=3.5.4
|
||||
urllib3>=1.25.3
|
||||
urllib3==1.24.3
|
||||
pygame>=1.9.6
|
||||
QtAwesome>=0.5.7
|
||||
PyQt5==5.12.2
|
||||
@@ -5,6 +5,7 @@ block_cipher = None
|
||||
import glob, os
|
||||
|
||||
data_file = [(f, '.') for f in glob.glob('*.[pu][yi]') if f != "artemis.py"]
|
||||
data_file.append(('cacert.pem', '.'))
|
||||
|
||||
a = Analysis(['artemis.py'],
|
||||
pathex=[os.getcwd()],
|
||||
@@ -5,6 +5,7 @@ block_cipher = None
|
||||
import glob,os
|
||||
|
||||
data_file = [(f, '.') for f in glob.glob('*.[pu][yi]') if f != "artemis.py"]
|
||||
data_file.append(('cacert.pem', '.'))
|
||||
|
||||
a = Analysis(['artemis.py'],
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
@@ -5,6 +5,7 @@ import glob, os
|
||||
|
||||
data_file = [(f, '.') for f in glob.glob('*.[pu][yi]') if f != "artemis.py"]
|
||||
data_file.append(('themes','./themes'))
|
||||
data_file.append(('cacert.pem', '.'))
|
||||
|
||||
a = Analysis(['artemis.py'],
|
||||
pathex=[os.getcwd()],
|
||||
|
||||
@@ -43,7 +43,8 @@ from utilities import (checksum_ok,
|
||||
is_undef_band,
|
||||
format_numbers,
|
||||
resource_path,
|
||||
safe_cast)
|
||||
safe_cast,
|
||||
is_mac_os)
|
||||
|
||||
# import default_imgs_rc
|
||||
|
||||
@@ -1627,7 +1628,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
|
||||
|
||||
if __name__ == '__main__':
|
||||
# For executables running on Mac Os systems.
|
||||
if hasattr(sys, "_MEIPASS") and sys.platform == 'darwin':
|
||||
if hasattr(sys, "_MEIPASS") and is_mac_os():
|
||||
os.chdir(sys._MEIPASS)
|
||||
|
||||
my_app = QApplication(sys.argv)
|
||||
|
||||
4619
src/cacert.pem
Normal file
4619
src/cacert.pem
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,10 +7,9 @@ from shutil import rmtree
|
||||
from time import perf_counter
|
||||
from zipfile import ZipFile
|
||||
import aiohttp
|
||||
import urllib3
|
||||
from PyQt5.QtCore import QThread, pyqtSignal
|
||||
from constants import Constants, Database, ChecksumWhat
|
||||
from utilities import checksum_ok
|
||||
from utilities import checksum_ok, get_pool_manager
|
||||
|
||||
# Needed for pyinstaller compilation.
|
||||
import encodings.idna
|
||||
@@ -87,7 +86,7 @@ class DownloadThread(BaseDownloadThread):
|
||||
raw_data = bytes(0)
|
||||
sub_data = bytes(0)
|
||||
try:
|
||||
self._db = urllib3.PoolManager().request(
|
||||
self._db = get_pool_manager().request(
|
||||
'GET',
|
||||
Database.LINK_LOC,
|
||||
preload_content=False,
|
||||
|
||||
@@ -2,10 +2,8 @@ from functools import partial
|
||||
import hashlib
|
||||
import sys
|
||||
import os
|
||||
from pandas import read_csv
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
|
||||
import urllib3
|
||||
from constants import Constants, Signal, Database, ChecksumWhat
|
||||
|
||||
|
||||
@@ -51,6 +49,20 @@ def pop_up(cls, title, text,
|
||||
return msg
|
||||
|
||||
|
||||
def is_mac_os():
|
||||
"""Return True if running OS is Mac."""
|
||||
return sys.platform == 'darwin'
|
||||
|
||||
|
||||
def get_pool_manager():
|
||||
"""Return a urllib3.PoolManager object."""
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
ca_certs = os.path.join(sys._MEIPASS, 'cacert.pem')
|
||||
else:
|
||||
ca_certs = 'cacert.pem'
|
||||
return urllib3.PoolManager(ca_certs=ca_certs)
|
||||
|
||||
|
||||
def checksum_ok(data, what):
|
||||
"""Check whether the checksum of the 'data' argument is correct."""
|
||||
code = hashlib.sha256()
|
||||
@@ -62,10 +74,13 @@ def checksum_ok(data, what):
|
||||
else:
|
||||
raise ValueError("Wrong entry name.")
|
||||
try:
|
||||
reference = read_csv(
|
||||
# The downloaded file is a csv file with columns (last version == last line):
|
||||
# data.zip_SHA256 | db.csv_SHA256 | Version | Creation_date
|
||||
reference = get_pool_manager().request(
|
||||
'GET',
|
||||
Database.LINK_REF,
|
||||
delimiter=Database.DELIMITER
|
||||
).iat[-1, n]
|
||||
timeout=4.0
|
||||
).data.decode("utf-8").splitlines()[-1].split(Database.DELIMITER)[n]
|
||||
except Exception:
|
||||
raise
|
||||
return code.hexdigest() == reference
|
||||
|
||||
Reference in New Issue
Block a user