Merge branch 'master' of github.com:micahflee/onionshare

This commit is contained in:
Micah Lee 2014-08-26 15:22:23 -07:00
commit 28a05d9de2
3 changed files with 21 additions and 9 deletions

View File

@ -1,13 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, mimetypes, hmac import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, mimetypes, hmac
from random import randint
from functools import wraps
from itertools import izip from itertools import izip
from stem.control import Controller from stem.control import Controller
from stem import SocketError from stem import SocketError
from flask import Flask, Markup, Response, request, make_response, send_from_directory, render_template_string, abort from flask import Flask, Response, request, render_template_string, abort
class NoTor(Exception): pass class NoTor(Exception): pass
@ -52,6 +50,9 @@ def set_stay_open(new_stay_open):
global stay_open global stay_open
stay_open = new_stay_open stay_open = new_stay_open
def get_stay_open():
return stay_open
app = Flask(__name__) app = Flask(__name__)
def debug_mode(): def debug_mode():

View File

@ -106,7 +106,15 @@
"close_on_finish": "Sluit automatisch", "close_on_finish": "Sluit automatisch",
"close_countdown": "Sluit in {0} seconden...", "close_countdown": "Sluit in {0} seconden...",
"choose_file": "Kies betsand om te delen", "choose_file": "Kies betsand om te delen",
"copy_url": "Kopieer URL" "copy_url": "Kopieer URL",
"closing_automatically": "Sluit nu automatisch omdat download gereed is",
"error_tails_invalid_port": "Ongeldige waarde, poort moet een integer zijn",
"error_tails_unknown_root": "Onbekende fout met het Tails root proces",
"help_tails_port": "Alleen Tails: poort voor het openen van firewall, starten verborgen service",
"help_local_only": "Maak geen gebruik van Tor, alleen voor ontwikkeling",
"help_stay_open": "Laat verborgen service draaien nadat download gereed is",
"help_debug": "Log fouten naar harde schrijf",
"help_filename": "Bestand om te delen"
}, "pt": { }, "pt": {
"calculating_sha1": "Calculando checksum SHA1.", "calculating_sha1": "Calculando checksum SHA1.",
"connecting_ctrlport": "Conectando-se à porta de controle Tor para configurar serviço escondido na porta {0}.", "connecting_ctrlport": "Conectando-se à porta de controle Tor para configurar serviço escondido na porta {0}.",

View File

@ -127,7 +127,7 @@ class OnionShareGui(QtGui.QWidget):
# close automatically checkbox # close automatically checkbox
self.closeAutomatically = QtGui.QCheckBox(self.widget) self.closeAutomatically = QtGui.QCheckBox(self.widget)
self.closeAutomatically.setCheckState(QtCore.Qt.Checked) self.closeAutomatically.setCheckState(QtCore.Qt.Checked)
if onionshare.stay_open: if onionshare.get_stay_open():
self.closeAutomatically.setCheckState(QtCore.Qt.Unchecked) self.closeAutomatically.setCheckState(QtCore.Qt.Unchecked)
self.closeAutomatically.setStyleSheet("font-size: 12px") self.closeAutomatically.setStyleSheet("font-size: 12px")
@ -218,7 +218,7 @@ class OnionShareGui(QtGui.QWidget):
if event["data"]["bytes"] == onionshare.filesize: if event["data"]["bytes"] == onionshare.filesize:
self.update_log(event, translated("download_finished")) self.update_log(event, translated("download_finished"))
# close on finish? # close on finish?
if not onionshare.stay_open: if not onionshare.get_stay_open():
time.sleep(1) time.sleep(1)
def close_countdown(i): def close_countdown(i):
if i > 0: if i > 0:
@ -275,7 +275,8 @@ class OnionShareGui(QtGui.QWidget):
def stay_open_changed(self, state): def stay_open_changed(self, state):
if state > 0: if state > 0:
onionshare.set_stay_open(False) onionshare.set_stay_open(False)
onionshare.set_stay_open(True) else:
onionshare.set_stay_open(True)
return return
def alert(msg, icon=QtGui.QMessageBox.NoIcon): def alert(msg, icon=QtGui.QMessageBox.NoIcon):
@ -326,11 +327,11 @@ def main():
stay_open = bool(args.stay_open) stay_open = bool(args.stay_open)
debug = bool(args.debug) debug = bool(args.debug)
onionshare.set_stay_open(stay_open)
if debug: if debug:
onionshare.debug_mode() onionshare.debug_mode()
onionshare.set_stay_open(stay_open)
# create the onionshare icon # create the onionshare icon
global window_icon, onionshare_gui_dir global window_icon, onionshare_gui_dir
window_icon = QtGui.QIcon("{0}/static/logo.png".format(onionshare_gui_dir)) window_icon = QtGui.QIcon("{0}/static/logo.png".format(onionshare_gui_dir))
@ -362,6 +363,8 @@ def main():
except onionshare.NoTor as e: except onionshare.NoTor as e:
alert(e.args[0], QtGui.QMessageBox.Warning) alert(e.args[0], QtGui.QMessageBox.Warning)
return return
else:
onion_host = local_host
# select file to share # select file to share
filename, basename = select_file(onionshare.strings, filename) filename, basename = select_file(onionshare.strings, filename)