Added a proxy to Socializer

This commit is contained in:
2019-01-15 16:20:08 -06:00
parent dce50b226f
commit fa4dd48955
4 changed files with 22 additions and 9 deletions

View File

@@ -2,4 +2,5 @@
username = string(default="")
password = string(default="")
language = string(default="system")
use_proxy = boolean(default=False)
use_proxy = boolean(default=False)
first_start = boolean(default=True)

View File

@@ -16,6 +16,7 @@ import keys
import application
sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z)))
from mysc.thread_utils import call_threaded
from wxUI import commonMessages
log = logging.getLogger("main")
@@ -25,12 +26,6 @@ def setup():
global orig_session_init
log.debug("Starting Socializer %s" % (application.version,))
config.setup()
if config.app["app-settings"]["use_proxy"]:
log.debug("Enabling proxy support... ")
import requests
orig_session_init=requests.sessions.Session.__init__
requests.sessions.Session.__init__=patched_session_init
requests.Session.__init__=patched_session_init
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
log.debug("Application path is %s" % (paths.app_path(),))
log.debug("config path is %s" % (paths.config_path(),))
@@ -38,9 +33,22 @@ def setup():
languageHandler.setLanguage(config.app["app-settings"]["language"])
log.debug("Language set to %s" % (languageHandler.getLanguage()))
keys.setup()
app = widgetUtils.mainLoopObject()
if config.app["app-settings"]["first_start"]:
proxy_option = commonMessages.proxy_question()
if proxy_option == widgetUtils.YES:
config.app["app-settings"]["use_proxy"] = True
config.app["app-settings"]["first_start"] = False
config.app.write()
if config.app["app-settings"]["use_proxy"]:
log.debug("Enabling proxy support... ")
import requests
orig_session_init=requests.sessions.Session.__init__
requests.sessions.Session.__init__=patched_session_init
requests.Session.__init__=patched_session_init
from controller import mainController
from sessionmanager import sessionManager
app = widgetUtils.mainLoopObject()
log.debug("Created Application mainloop object")
sm = sessionManager.sessionManagerController()
del sm

View File

@@ -45,4 +45,7 @@ def join_group():
return wx.MessageDialog(None, _("If you like socializer, you can join or community from where you can ask for help, give us your feedback and help other users of the application. New releases are posted in the group too. Would you like to join the Socializer community?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def group_joined():
return wx.MessageDialog(None, _("You have joined the Socializer community."), _("Success")).ShowModal()
return wx.MessageDialog(None, _("You have joined the Socializer community."), _("Success")).ShowModal()
def proxy_question():
return wx.MessageDialog(None, _("If you live in a country where VK is blocked, you can use a proxy to bypass such restrictions. Socializer includes a working proxy to ensure all users can connect to VK. Do you want to use Socializer through the proxy?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()