mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-18 16:40:41 -06:00
Apply proxy settings before TWBlue main components start loading
This commit is contained in:
parent
7f4a13231f
commit
b59d262dca
@ -9,7 +9,7 @@ log = logging.getLogger("config")
|
|||||||
|
|
||||||
MAINFILE = "twblue.conf"
|
MAINFILE = "twblue.conf"
|
||||||
MAINSPEC = "app-configuration.defaults"
|
MAINSPEC = "app-configuration.defaults"
|
||||||
proxyTypes = [_("System default"), _("HTTP"), _("SOCKS v4"), _("SOCKS v5"), _("SOCKS v5 with DNS support")]
|
proxyTypes = ["system", "HTTP", "SOCKS4", "SOCKS5", "SOCKS5H"]
|
||||||
app = None
|
app = None
|
||||||
keymap=None
|
keymap=None
|
||||||
changed_keymap = False
|
changed_keymap = False
|
||||||
|
@ -74,7 +74,8 @@ class globalSettingsController(object):
|
|||||||
self.dialog.set_value("general", "update_period", config.app["app-settings"]["update_period"])
|
self.dialog.set_value("general", "update_period", config.app["app-settings"]["update_period"])
|
||||||
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
|
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
|
||||||
self.dialog.set_value("general", "remember_mention_and_longtweet", config.app["app-settings"]["remember_mention_and_longtweet"])
|
self.dialog.set_value("general", "remember_mention_and_longtweet", config.app["app-settings"]["remember_mention_and_longtweet"])
|
||||||
self.dialog.create_proxy(config.proxyTypes)
|
proxyTypes = [_("System default"), _("HTTP"), _("SOCKS v4"), _("SOCKS v5"), _("SOCKS v5 with DNS support")]
|
||||||
|
self.dialog.create_proxy(proxyTypes)
|
||||||
try:
|
try:
|
||||||
self.dialog.proxy.type.SetSelection(config.app["proxy"]["type"])
|
self.dialog.proxy.type.SetSelection(config.app["proxy"]["type"])
|
||||||
except:
|
except:
|
||||||
|
11
src/main.py
11
src/main.py
@ -65,6 +65,7 @@ log = logging.getLogger("main")
|
|||||||
def setup():
|
def setup():
|
||||||
log.debug("Starting " + application.name + " %s" % (application.version,))
|
log.debug("Starting " + application.name + " %s" % (application.version,))
|
||||||
config.setup()
|
config.setup()
|
||||||
|
proxy_setup()
|
||||||
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
|
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
|
||||||
log.debug("Application path is %s" % (paths.app_path(),))
|
log.debug("Application path is %s" % (paths.app_path(),))
|
||||||
log.debug("config path is %s" % (paths.config_path(),))
|
log.debug("config path is %s" % (paths.config_path(),))
|
||||||
@ -101,6 +102,16 @@ def setup():
|
|||||||
GLib.idle_add(r.start)
|
GLib.idle_add(r.start)
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
|
def proxy_setup():
|
||||||
|
if config.app["proxy"]["server"] != "" and config.app["proxy"]["type"] > 0:
|
||||||
|
log.debug("Loading proxy settings")
|
||||||
|
proxy_url = config.app["proxy"]["server"] + ":" + str(config.app["proxy"]["port"])
|
||||||
|
if config.app["proxy"]["user"] != "" and config.app["proxy"]["password"] != "":
|
||||||
|
proxy_url = config.app["proxy"]["user"] + ":" + config.app["proxy"]["password"] + "@" + proxy_url
|
||||||
|
proxy_url = config.proxyTypes[config.app["proxy"]["type"]] + "://" + proxy_url
|
||||||
|
os.environ["HTTP_PROXY"] = proxy_url
|
||||||
|
os.environ["HTTPS_PROXY"] = proxy_url
|
||||||
|
|
||||||
def donation():
|
def donation():
|
||||||
dlg = commonMessageDialogs.donation()
|
dlg = commonMessageDialogs.donation()
|
||||||
if dlg == widgetUtils.YES:
|
if dlg == widgetUtils.YES:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user