Merge branch 'master' of https://github.com/jvoisin/onionshare into jvoisin-master

Conflicts:
	onionshare/socks.py
This commit is contained in:
Micah Lee 2015-11-08 15:53:41 -08:00
commit 34591b5634
4 changed files with 15 additions and 14 deletions

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import os, sys, subprocess, time, argparse, inspect, shutil, socket, threading, urllib2, httplib, tempfile import os, sys, subprocess, time, argparse, shutil, socket, threading, urllib2, httplib, tempfile
import socks import socks
from stem.control import Controller from stem.control import Controller
@ -52,6 +52,7 @@ class OnionShare(object):
self.port = None self.port = None
self.controller = None self.controller = None
self.hidserv_dir = None self.hidserv_dir = None
self.onion_host = None
# debug mode # debug mode
if debug: if debug:
@ -119,7 +120,7 @@ class OnionShare(object):
print 'Got onion_host: {0:s}'.format(self.onion_host) print 'Got onion_host: {0:s}'.format(self.onion_host)
else: else:
if p.poll() == -1: if p.poll() == -1:
raise TailsError(o.stderr.read()) raise TailsError(sys.stderr.read())
else: else:
raise TailsError(strings._("error_tails_unknown_root")) raise TailsError(strings._("error_tails_unknown_root"))

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import json, locale, sys, os, inspect import json, locale, sys, os
import helpers import helpers
strings = {} strings = {}
@ -40,22 +40,22 @@ def load_strings(default="en"):
locale_dir = os.path.join(os.path.dirname(helpers.get_onionshare_dir()), 'locale') locale_dir = os.path.join(os.path.dirname(helpers.get_onionshare_dir()), 'locale')
# load all translations # load all translations
translated = {} translations = {}
for filename in os.listdir(locale_dir): for filename in os.listdir(locale_dir):
abs_filename = os.path.join(locale_dir, filename) abs_filename = os.path.join(locale_dir, filename)
lang, ext = os.path.splitext(filename) lang, ext = os.path.splitext(filename)
if abs_filename.endswith('.json'): if abs_filename.endswith('.json'):
translated[lang] = json.loads(open(abs_filename).read()) translations[lang] = json.loads(open(abs_filename).read())
strings = translated[default] strings = translations[default]
lc, enc = locale.getdefaultlocale() lc, enc = locale.getdefaultlocale()
if lc: if lc:
lang = lc[:2] lang = lc[:2]
if lang in translated: if lang in translations:
# if a string doesn't exist, fallback to English # if a string doesn't exist, fallback to English
for key in translated[default]: for key in translations[default]:
if key in translated[lang]: if key in translations[lang]:
strings[key] = translated[lang][key] strings[key] = translations[lang][key]
def translated(k, gui=False): def translated(k, gui=False):

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import Queue, mimetypes, platform, os, sys, zipfile, urllib2 import Queue, mimetypes, platform, os, sys, urllib2
from flask import Flask, Response, request, render_template_string, abort from flask import Flask, Response, request, render_template_string, abort
import strings, helpers import strings, helpers
@ -70,10 +70,10 @@ REQUEST_CANCELED = 4
q = Queue.Queue() q = Queue.Queue()
def add_request(type, path, data=None): def add_request(request_type, path, data=None):
global q global q
q.put({ q.put({
'type': type, 'type': request_type,
'path': path, 'path': path,
'data': data 'data': data
}) })

View File

@ -123,5 +123,5 @@ elif system == 'Darwin':
'PyQt4.QtSvg', 'PyQt4.QtXmlPatterns'] 'PyQt4.QtSvg', 'PyQt4.QtXmlPatterns']
} }
}, },
setup_requires=['py2app'], setup_requires=['py2app', 'flask', 'stem'],
) )