mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-28 07:17:15 -05:00
Handle UpdateCheckerSOCKSHTTPError exception in the update_checker module
This commit is contained in:
parent
a116d3ae60
commit
ca16600d29
@ -78,7 +78,7 @@ def check_for_updates(force=False, bundled_tor_func=None):
|
|||||||
raise UpdateCheckerTorError
|
raise UpdateCheckerTorError
|
||||||
|
|
||||||
# Download the latest-version file over Tor
|
# Download the latest-version file over Tor
|
||||||
#try:
|
try:
|
||||||
(socks_address, socks_port) = onion.get_tor_socks_port()
|
(socks_address, socks_port) = onion.get_tor_socks_port()
|
||||||
socks.set_default_proxy(socks.SOCKS5, socks_address, socks_port)
|
socks.set_default_proxy(socks.SOCKS5, socks_address, socks_port)
|
||||||
|
|
||||||
@ -96,14 +96,14 @@ def check_for_updates(force=False, bundled_tor_func=None):
|
|||||||
|
|
||||||
# Clean up from Onion
|
# Clean up from Onion
|
||||||
onion.cleanup()
|
onion.cleanup()
|
||||||
#except:
|
except:
|
||||||
# raise UpdateCheckerSOCKSHTTPError
|
raise UpdateCheckerSOCKSHTTPError
|
||||||
|
|
||||||
# Validate that latest_version looks like a version string
|
# Validate that latest_version looks like a version string
|
||||||
# This regex is: 1-3 dot-separated numeric components
|
# This regex is: 1-3 dot-separated numeric components
|
||||||
version_re = r"^(\d+\.)?(\d+\.)?(\d+)$"
|
version_re = r"^(\d+\.)?(\d+\.)?(\d+)$"
|
||||||
if not re.match(version_re, latest_version):
|
if not re.match(version_re, latest_version):
|
||||||
raise UpdateCheckerInvalidLatestVersion
|
raise UpdateCheckerInvalidLatestVersion(latest_version)
|
||||||
|
|
||||||
# Update the last checked timestamp (dropping the seconds and milliseconds)
|
# Update the last checked timestamp (dropping the seconds and milliseconds)
|
||||||
timestamp = datetime.datetime.now().replace(microsecond=0).replace(second=0).timestamp()
|
timestamp = datetime.datetime.now().replace(microsecond=0).replace(second=0).timestamp()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user