mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 19:52:50 -03:00
onionshare-gui forces root in Tails now too, and file chooser defaults to ~/ (#42)
This commit is contained in:
parent
28b9140afd
commit
a44216428f
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
import onionshare, webapp
|
import onionshare, webapp
|
||||||
import threading, gtk, gobject, webkit, os, sys
|
import threading, gtk, gobject, webkit, os, sys, subprocess
|
||||||
|
|
||||||
def alert(msg, type=gtk.MESSAGE_INFO):
|
def alert(msg, type=gtk.MESSAGE_INFO):
|
||||||
dialog = gtk.MessageDialog(
|
dialog = gtk.MessageDialog(
|
||||||
|
@ -21,6 +21,8 @@ def select_file(strings):
|
||||||
title="Choose a file to share",
|
title="Choose a file to share",
|
||||||
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
||||||
|
if onionshare.get_platform() == 'Tails':
|
||||||
|
chooser.set_current_folder('/home/amnesia/')
|
||||||
response = chooser.run()
|
response = chooser.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
filename = chooser.get_filename()
|
filename = chooser.get_filename()
|
||||||
|
@ -74,6 +76,11 @@ def launch_window(webapp_port, onionshare_port):
|
||||||
def main():
|
def main():
|
||||||
onionshare.strings = onionshare.load_strings()
|
onionshare.strings = onionshare.load_strings()
|
||||||
|
|
||||||
|
# check for root in Tails
|
||||||
|
if onionshare.get_platform() == 'Tails' and not onionshare.is_root():
|
||||||
|
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
||||||
|
return
|
||||||
|
|
||||||
# try starting hidden service
|
# try starting hidden service
|
||||||
onionshare_port = onionshare.choose_port()
|
onionshare_port = onionshare.choose_port()
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue