Added a proxy to Socializer

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

View File

@ -2,6 +2,7 @@
## changes in this version
* For users from countries where VK is not allowed, Socializer includes a proxy to bypass country restrictions. The first time you start socializer, it will ask you whether you need a proxy or not. It is suggested to use a proxy only if you need it.
* Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button.
* If you are not allowed to post in someone's wall, the post button will not be visible.
* A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post.

View File

@ -3,3 +3,4 @@ username = string(default="")
password = string(default="")
language = string(default="system")
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

@ -46,3 +46,6 @@ def join_group():
def group_joined():
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()