mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-15 17:27:35 -05:00
parent
4e3c32cbff
commit
2b8be2781c
@ -1,4 +1,4 @@
|
|||||||
import os, sys, subprocess, inspect, platform
|
import os, sys, subprocess, inspect, platform, argparse
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
from PyQt4.QtWebKit import *
|
from PyQt4.QtWebKit import *
|
||||||
@ -54,11 +54,9 @@ def alert(msg, icon=QMessageBox.NoIcon):
|
|||||||
dialog.setIcon(icon)
|
dialog.setIcon(icon)
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
|
|
||||||
def select_file(strings):
|
def select_file(strings, filename=None):
|
||||||
# get filename, either from argument or file chooser dialog
|
# get filename, either from argument or file chooser dialog
|
||||||
if len(sys.argv) == 2:
|
if not filename:
|
||||||
filename = sys.argv[1]
|
|
||||||
else:
|
|
||||||
args = {}
|
args = {}
|
||||||
if onionshare.get_platform() == 'Tails':
|
if onionshare.get_platform() == 'Tails':
|
||||||
args['directory'] = '/home/amnesia'
|
args['directory'] = '/home/amnesia'
|
||||||
@ -89,6 +87,19 @@ def main():
|
|||||||
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# parse arguments
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--local-only', action='store_true', dest='local_only', help='Do not attempt to use tor: for development only')
|
||||||
|
parser.add_argument('--stay-open', action='store_true', dest='stay_open', help='Keep hidden service running after download has finished')
|
||||||
|
parser.add_argument('--debug', action='store_true', dest='debug', help='Log errors to disk')
|
||||||
|
parser.add_argument('filename', nargs='?', help='File to share')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
filename = args.filename
|
||||||
|
local_only = args.local_only
|
||||||
|
stay_open = args.stay_open
|
||||||
|
debug = args.debug
|
||||||
|
|
||||||
# create the onionshare icon
|
# create the onionshare icon
|
||||||
global window_icon, onionshare_gui_dir
|
global window_icon, onionshare_gui_dir
|
||||||
window_icon = QIcon("{0}/onionshare-icon.png".format(onionshare_gui_dir))
|
window_icon = QIcon("{0}/onionshare-icon.png".format(onionshare_gui_dir))
|
||||||
@ -103,7 +114,7 @@ def main():
|
|||||||
onionshare.tails_open_port(onionshare_port)
|
onionshare.tails_open_port(onionshare_port)
|
||||||
|
|
||||||
# select file to share
|
# select file to share
|
||||||
filename, basename = select_file(onionshare.strings)
|
filename, basename = select_file(onionshare.strings, filename)
|
||||||
if not filename:
|
if not filename:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user