From 62b0bc76a87902c956ec55d1fd7f542959b19da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 4 Feb 2015 17:00:03 -0600 Subject: [PATCH] A new library for storing app keys is added --- mysc/keys/api_keys.c | 23 ++++++++++++++++ mysc/keys/api_keys.h | 12 ++++++++ src/application.py | 4 --- src/controller/mainController.py | 4 +-- src/extra/AudioUploader/dropbox_transfer.py | 5 ++-- src/keys/__init__.py | 29 ++++++++++++++++++++ src/keys/lib/api_keys32.dll | Bin 0 -> 44250 bytes src/main.py | 2 ++ src/sessionmanager/session.py | 6 ++-- src/twitter/twitter.py | 9 +++--- 10 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 mysc/keys/api_keys.c create mode 100644 mysc/keys/api_keys.h create mode 100644 src/keys/__init__.py create mode 100644 src/keys/lib/api_keys32.dll diff --git a/mysc/keys/api_keys.c b/mysc/keys/api_keys.c new file mode 100644 index 00000000..a3c5ad09 --- /dev/null +++ b/mysc/keys/api_keys.c @@ -0,0 +1,23 @@ +#include "api_keys.h" +char *get_api_key(){ +return "key\0"; +} +char *get_api_secret(){ +return "secret_key\0"; +} +char *get_dropbox_api_key(){ +return "key\0"; +} +char *get_dropbox_api_secret(){ +return "secret_key\0"; +} +char *get_twishort_api_key(){ +return "key\0"; +} +char *get_bts_user(){ +return "user\0"; +} +char *get_bts_password(){ +return "pass\0"; +} + diff --git a/mysc/keys/api_keys.h b/mysc/keys/api_keys.h new file mode 100644 index 00000000..963403ce --- /dev/null +++ b/mysc/keys/api_keys.h @@ -0,0 +1,12 @@ +#ifndef _API_KEYS_H +#define API_KEYS_H + +char *get_api_key(); +char *get_api_secret(); +char *get_dropbox_api_key(); +char *get_dropbox_api_secret(); +char *get_twishort_api_key(); +char *get_bts_user(); +char *get_bts_password(); + +#endif diff --git a/src/application.py b/src/application.py index 66eff230..4ce1a0a2 100644 --- a/src/application.py +++ b/src/application.py @@ -14,7 +14,3 @@ description = u"TW Blue is an app designed to use Twitter in a simple and fast w translators = [u"Bryner Villalobos (English)", u"Mohammed Al Shara (Arabic)", u"Salva Doménech, Juan Carlos Rivilla(Catalan)", u"Manuel cortéz(Spanish)", u"Sukil Etxenike Arizaleta(Basque)", u"Jani Kinnunen(finnish)", u"Javier Currás, José Manuel Delicado, Alba Quinteiro(Galician)", u"Robert Osztolykan(Hungarian)", u"Paweł Masarczyk(Polish)", u"Odenilton Júnior Santos(Portuguese)", u"Alexander Jaszyn(Russian)", u"Burak (Turkish)"] url = u"http://twblue.com.mx" report_bugs_url = "http://twblue.com.mx/errores/api/soap/mantisconnect.php?wsdl" - -# Tokens -app_key = '8pDLbyOW3saYnvSZ4uLFg' -app_secret = 'YsgdrzY9B4yyYvYsyee78rKI3GshjHpenVS9LnFJXY' \ No newline at end of file diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 063adfb1..ee2a314a 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -88,7 +88,7 @@ class Controller(object): pub.subscribe(self.manage_blocked_user, "blocked-user") pub.subscribe(self.manage_unblocked_user, "unblocked-user") pub.subscribe(self.manage_item_in_timeline, "item-in-timeline") - widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit) + widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit_) def bind_other_events(self): log.debug("Binding other application events...") @@ -104,7 +104,7 @@ class Controller(object): widgetUtils.connect_event(self.view, widgetUtils.MENU, self.exit, menuitem=self.view.close) if widgetUtils.toolkit == "wx": log.debug("Binding the exit function...") - widgetUtils.connectExitFunction(self.exit) + widgetUtils.connectExitFunction(self.exit_) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_tweet, self.view.compose) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_reply, self.view.reply) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.post_retweet, self.view.retweet) diff --git a/src/extra/AudioUploader/dropbox_transfer.py b/src/extra/AudioUploader/dropbox_transfer.py index e7aa5f42..5d68fc10 100644 --- a/src/extra/AudioUploader/dropbox_transfer.py +++ b/src/extra/AudioUploader/dropbox_transfer.py @@ -5,6 +5,7 @@ import os import exceptions import dropbox import logging +from keys import keyring from utils import * from dropbox.rest import ErrorResponse from StringIO import StringIO @@ -42,13 +43,11 @@ class dropboxLogin(object): def __init__(self, config): log.debug("Trying to login in Dropbox...") self.logged = False - self.app_key = "c8ikm0gexqvovol" - self.app_secret = "gvvi6fzfecooast" self.config = config def get_url(self): log.debug("Getting autorisation URL...") - self.flow = dropbox.client.DropboxOAuth2FlowNoRedirect(self.app_key, self.app_secret) + self.flow = dropbox.client.DropboxOAuth2FlowNoRedirect(keyring.get("dropbox_app_key"), keyring.get("dropbox_app_secret")) return self.flow.start() def authorise(self, code): diff --git a/src/keys/__init__.py b/src/keys/__init__.py new file mode 100644 index 00000000..d5c44272 --- /dev/null +++ b/src/keys/__init__.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +import platform +import exceptions +from ctypes import c_char_p +from libloader import load_library +import paths +if platform.architecture()[0][:2] == "32": + lib = load_library("api_keys32", x86_path=paths.app_path("keys/lib")) +else: + lib = load_library("api_keys64", x64_path=paths.app_path("keys/lib")) + +keyring = None + +def setup(): + global keyring + if keyring == None: + keyring = Keyring() + +class Keyring(object): + def __init__(self): + super(Keyring, self).__init__() + + def _call_method(self, function): + result = getattr(lib, function) + result = c_char_p(result.__call__()) + return result.value + + def get(self, func): + return getattr(self, "_call_method")("get_"+func) \ No newline at end of file diff --git a/src/keys/lib/api_keys32.dll b/src/keys/lib/api_keys32.dll new file mode 100644 index 0000000000000000000000000000000000000000..8e9749f8ef45ee25eb198348d1e64b9b65100c88 GIT binary patch literal 44250 zcmeHw4SbwMwf8*xJezKlZIZU>cT2ZzN-MN!k|t?VizH3bHYIICl9sl7Z1b^6L(?Sg zZqgPIifMrmiYcO?Rw&BV`ifq>Afj-wT0Rw(%SA*`FDh!FeX#-;QP8~q|IG8bn*^yB zeqLXm{mnizXU?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D@WC($!0(je2>I#kg)Px z*5D=Nv2=cG#cET|!RjO97RX$ogyq*u5-KR$VT89zniNe(mv_I>dJ{BD4LL%x3aFmN zd3e)u3+NfCMtCo#-Gvk9LPA#E!HJ{in6WhW0xUgy{`LQ~yyTz@p=+sFy#t4RKS%>tT#Qy_p>OZ;w literal 0 HcmV?d00001 diff --git a/src/main.py b/src/main.py index c2b0d412..a721bdc5 100644 --- a/src/main.py +++ b/src/main.py @@ -10,6 +10,7 @@ from logger import logger import logging import platform import application +import keys from mysc.thread_utils import call_threaded log = logging.getLogger("main") @@ -22,6 +23,7 @@ def setup(): sound.setup() output.setup() languageHandler.setLanguage(config.app["app-settings"]["language"]) + keys.setup() from controller import mainController from sessionmanager import sessionManager app = wx.App() diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 29c868e6..80d1f10e 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -2,7 +2,7 @@ """ The main session object. Here are the twitter functions to interact with the "model" of TWBlue.""" import urllib2 import twitter -import application +from keys import keyring import session_exceptions as Exceptions import paths import output @@ -285,12 +285,12 @@ class Session(object): def get_main_stream(self): log.debug("Starting the main stream...") - self.main_stream = twitter.buffers.stream.streamer(application.app_key, application.app_secret, self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], self) + self.main_stream = twitter.buffers.stream.streamer(keyring.get("api_key"), keyring.get("api_secret"), self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], self) stream_threaded(self.main_stream.user, self.session_id) def get_timelines(self): log.debug("Starting the timelines stream...") - self.timelinesStream = twitter.buffers.indibidual.timelinesStreamer(application.app_key, application.app_secret, self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], session=self) + self.timelinesStream = twitter.buffers.indibidual.timelinesStreamer(keyring.get("api_key"), keyring.get("api_secret"), self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], session=self) ids = "" for i in self.settings["other_buffers"]["timelines"]: ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"]) diff --git a/src/twitter/twitter.py b/src/twitter/twitter.py index b27c77d6..cc45c6d9 100644 --- a/src/twitter/twitter.py +++ b/src/twitter/twitter.py @@ -2,24 +2,25 @@ import BaseHTTPServer import webbrowser from twython import Twython, TwythonError -import application +from keys import keyring import authorisationHandler + class twitter(object): def login(self, user_key, user_secret): - self.twitter = Twython(application.app_key, application.app_secret, user_key, user_secret) + self.twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), user_key, user_secret) self.credentials = self.twitter.verify_credentials() def authorise(self, settings): httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8080), authorisationHandler.handler) - twitter = Twython(application.app_key, application.app_secret, auth_endpoint='authorize') + twitter = Twython(keyring.get("app_key"), keyring.get("app_secret"), auth_endpoint='authorize') auth = twitter.get_authentication_tokens("http://127.0.0.1:8080") webbrowser.open_new_tab(auth['auth_url']) # global logged, verifier while authorisationHandler.logged == False: httpd.handle_request() - self.twitter = Twython(application.app_key, application.app_secret, auth['oauth_token'], auth['oauth_token_secret']) + self.twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), auth['oauth_token'], auth['oauth_token_secret']) final = self.twitter.get_authorized_tokens(authorisationHandler.verifier) self.save_configuration(settings, final["oauth_token"], final["oauth_token_secret"])