moving platform-specific scripts into install folder, and making onionshare CLI work in OSX (#132)

This commit is contained in:
Micah Lee 2015-05-15 18:52:20 -07:00
parent d6aafd88e7
commit 2ea0c6aef3
7 changed files with 63 additions and 6 deletions

View File

@ -33,3 +33,11 @@ Open OnionShare and drag and drop files and folders you wish to share, and start
Send this URL to the person you're trying to send the files to. If the files you're sending aren't secret, you can use normal means of sending the URL: emailing it, posting it to Facebook or Twitter, etc. If you're trying to send secret files then it's important to send this URL securely. I recommend you use [Off-the-Record encrypted chat](https://pressfreedomfoundation.org/encryption-works#otr) to send the URL.
The person who is receiving the files doesn't need OnionShare. All they need is to open the URL you send them in Tor Browser to be able to download the file.
## Using Command Line in Mac OS X
If you'd like to use the command-line version of OnionShare in Mac OS X, after installing open a terminal and type:
`ln -s /Applications/OnionShare.app/Contents/Resources/onionshare /usr/local/bin/onionshare`
From that point on you can just call `onionshare`, like: `onionshare --help`

25
install/osx_scripts/onionshare Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014 Micah Lee <micah@micahflee.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import zipimport, os, inspect
cwd = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
zi = zipimport.zipimporter(cwd+'/lib/python2.7/site-packages.zip')
onionshare = zi.load_module('onionshare')
onionshare.main()

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014 Micah Lee <micah@micahflee.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import onionshare_gui
onionshare_gui.main()

View File

@ -42,10 +42,12 @@ def get_onionshare_dir():
def get_osx_resources_dir():
# this is hacky, but in it ultimate ends up returning the absolute path to
# OnionShare.app/Contents/Resources
return os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
if get_platform() == 'Darwin':
# this is hacky, but in it ultimate ends up returning the absolute path to
# OnionShare.app/Contents/Resources, based on the location of helpers.py
return os.path.dirname(os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))))
return None
def get_html_path(filename):
p = platform.system()

View File

@ -83,7 +83,7 @@ if system == 'Linux':
keywords='onion, share, onionshare, tor, anonymous, web server',
packages=['onionshare', 'onionshare_gui'],
include_package_data=True,
scripts=['bin/onionshare', 'bin/onionshare-gui'],
scripts=['install/linux_scripts/onionshare', 'install/linux_scripts/onionshare-gui'],
data_files=[
(os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']),
(os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']),
@ -98,7 +98,7 @@ elif system == 'Darwin':
version=version,
description=description,
long_description=long_description,
app=['install/onionshare-launcher.py'],
app=['install/osx_scripts/onionshare-gui'],
data_files=[
('images', images),
('locale', locale),
@ -107,7 +107,8 @@ elif system == 'Darwin':
options={
'py2app': {
'argv_emulation': True,
'iconfile':'install/onionshare.icns',
'iconfile': 'install/onionshare.icns',
'extra_scripts': ['install/osx_scripts/onionshare'],
'includes': [
'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui',
'jinja2', 'jinja2.ext', 'jinja2.ext.autoescape'],