Write unified release documentation, move licenses into the root, and delete some unnecessary files from desktop/install

This commit is contained in:
Micah Lee 2020-11-04 16:51:48 -08:00
parent 7a0436a216
commit 4f0154d698
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
22 changed files with 320 additions and 1133 deletions

1
.gitignore vendored
View file

@ -61,3 +61,4 @@ desktop/src/onionshare/resources/tor
desktop/*.whl
desktop/linux
desktop/windows
desktop/macOS

150
RELEASE.md Normal file
View file

@ -0,0 +1,150 @@
# OnionShare Release Process
Unless you're a core OnionShare developer making a release, you'll probably never need to follow it.
## Changelog, version, docs, and signed git tag
Before making a release, you must update the version in these places:
- [ ] `cli/pyproject.toml`
- [ ] `cli/setup.py`
- [ ] `cli/onionshare_cli/resources/version.txt`
- [ ] `desktop/pyproject.toml` (under `version` and the `./onionshare_cli-$VERSION-py3-none-any.whl` dependency)
- [ ] `desktop/src/setup.py`
- [ ] `docs/source/conf.py`
You also must edit these files:
- [ ] `desktop/install/org.onionshare.OnionShare.appdata.xml` should have the correct release date, and links to correct screenshots
- [ ] Update all of the documentation in `docs` to cover new features, including taking new screenshots if necessary.
- [ ] In `snap/snapcraft.yaml`, the `tor`, `libevent`, and `obfs4` parts should be updated if necessary, and all python packages should be updated to match `cli/pyproject.toml` and `desktop/pyproject.toml`
- [ ] `CHANGELOG.md` should be updated to include a list of all major changes since the last release
- [ ] There must be a PGP-signed git tag for the version, e.g. for OnionShare 2.1, the tag must be `v2.1`
The first step for the Linux, macOS, and Windows releases is the same.
Verify the release git tag:
```sh
git fetch
git tag -v v$VERSION
```
If the tag verifies successfully, check it out:
```sh
git checkout v$VERSION
```
## PyPi release
The CLI version of OnionShare gets published on PyPi. To make a release:
```sh
cd cli
poetry install
poetry publish --build
```
## Linux Flatpak release
See instructions for the Flatpak release here: https://github.com/micahflee/org.onionshare.OnionShare
## Linux Snapcraft release
You must have `snap` and `snapcraft` (`snap install snapcraft --classic`) installed.
Build and test the snap before publishing:
```sh
snapcraft
snap install --devmode ./onionshare_*.snap
```
Run the OnionShare snap:
```sh
/snap/bin/onionshare # GUI version
/snap/bin/onionshare.cli # CLI version
```
## Linux AppImage release
_Note: AppImage packages are currently broken due to [this briefcase bug](https://github.com/beeware/briefcase/issues/504). Until it's fixed, OnionShare for Linux will only be available in Flatpak and Snapcraft._
Build a wheel package for OnionShare CLI:
```sh
cd cli
poetry install
poetry build
```
This will make a file like `dist/onionshare_cli-$VERSION-py3-none-any.whl` (except with your specific version number). Move it into `../desktop/linux`:
```sh
mkdir -p ../desktop/linux
mv dist/onionshare_cli-*-py3-none-any.whl ../desktop/linux
# change back to the desktop directory
cd ../desktop
```
Make sure the virtual environment is active, and then run briefcase create and briefcase build:
```sh
. venv/bin/activate
briefcase create
briefcase build
```
### Windows
Build a wheel package for OnionShare CLI (including Tor binaries, from Tor Browser):
```sh
cd cli
poetry install
poetry build
```
This will make a file like `dist\onionshare_cli-$VERSION-py3-none-any.whl` (except with your specific version number). Move it into `..\desktop`:
```
move dist\onionshare_cli-*-py3-none-any.whl ..\desktop
cd ..\desktop
```
Make sure the virtual environment is active, and then run `briefcase create`:
```sh
venv\Scripts\activate.bat
briefcase create
briefcase package
```
_TODO: Codesign_
### macOS
Build a wheel package for OnionShare CLI (including Tor binaries, from Tor Browser):
```sh
cd cli
poetry install
poetry build
```
This will make a file like `dist\onionshare_cli-$VERSION-py3-none-any.whl` (except with your specific version number). Move it into `..\desktop`:
```
cp dist/onionshare_cli-*-py3-none-any.whl ../desktop
cd ../desktop
```
Make sure the virtual environment is active, and then run `briefcase create`:
```sh
. venv/bin/activate
briefcase create
briefcase package -i "Developer ID Application: Micah Lee"
```

View file

@ -66,16 +66,3 @@ poetry build
```
This will create `dist/onionshare_cli-$VERSION-py3-none-any.whl`.
### Making a release
Before making a release, update the version in these places:
- `pyproject.toml`
- `onionshare_cli/resources/version.txt`
Build and publish to PyPi:
```
poetry publish --build
```

View file

@ -17,7 +17,7 @@ If you're using Linux, install `tor` and `obfs4proxy` from either the [official
#### macOS
Download and install Python 3.9.0 from https://www.python.org/downloads/release/python-390/. I downloaded `python-3.9.0-macosx10.9.pkg`. (You may need to also run `/Applications/Python\ 3.9/Install\ Certificates.command`.)
Download and install Python 3.8.6 from https://www.python.org/downloads/release/python-386/. I downloaded `python-3.8.6-macosx10.9.pkg`. (You may need to also run `/Applications/Python\ 3.8/Install\ Certificates.command`.)
Install some python dependencies:
@ -106,92 +106,3 @@ If you want to run tests while hiding the GUI, you must have the `xvfb` package
```sh
xvfb-run ./tests/run.sh
```
## Making a release
Before making a release, update the version in these places:
- `pyproject.toml`
- `src/setup.py`
### Flatpak packaging
See: https://github.com/micahflee/org.onionshare.OnionShare
### Snapcraft packaging
This folder contains files to build a [snap package](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`).
Build and install the snap::
```sh
snapcraft
snap install --devmode ./onionshare_*.snap
``
Run the OnionShare snap:
```sh
/snap/bin/onionshare # GUI version
/snap/bin/onionshare.cli # CLI version
```
Delete the snap:
```sh
snap remove onionshare
```
### Linux
Build a wheel package for OnionShare CLI:
```sh
cd onionshare/cli
poetry install
poetry build
```
This will make a file like `dist/onionshare_cli-$VERSION-py3-none-any.whl` (except with your specific version number). Move it into `../desktop/linux`:
```
mkdir -p ../desktop/linux
mv dist/onionshare_cli-*-py3-none-any.whl ../desktop/linux
# change back to the desktop directory
cd ../desktop
```
Make sure the virtual environment is active, and then run `briefcase create` and `briefcase build`:
```sh
. venv/bin/activate
briefcase create
briefcase build
```
### Windows
Build a wheel package for OnionShare CLI (including Tor binaries, from Tor Browser):
```sh
cd onionshare\cli
poetry install
poetry build
```
This will make a file like `dist\onionshare_cli-$VERSION-py3-none-any.whl` (except with your specific version number). Move it into `..\desktop`:
```
move dist\onionshare_cli-*-py3-none-any.whl ..\desktop
cd ..\desktop
```
Make sure the virtual environment is active, and then run `briefcase create`:
```sh
venv\Scripts\activate.bat
briefcase create
briefcase package
```
TODO: Codesign

View file

@ -0,0 +1,168 @@
/* vim:set noet ts=8 sw=8 : */
/* Greenlet object interface */
#ifndef Py_GREENLETOBJECT_H
#define Py_GREENLETOBJECT_H
#include <Python.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GREENLET_VERSION "0.4.17"
#if PY_VERSION_HEX >= 0x030700A3
# define GREENLET_USE_EXC_INFO
#endif
#ifndef GREENLET_USE_CONTEXT_VARS
#ifdef Py_CONTEXT_H
#define GREENLET_USE_CONTEXT_VARS 1
#else
#define GREENLET_USE_CONTEXT_VARS 0
#endif
#endif
typedef struct _greenlet {
PyObject_HEAD
char* stack_start;
char* stack_stop;
char* stack_copy;
intptr_t stack_saved;
struct _greenlet* stack_prev;
struct _greenlet* parent;
PyObject* run_info;
struct _frame* top_frame;
int recursion_depth;
PyObject* weakreflist;
#ifdef GREENLET_USE_EXC_INFO
_PyErr_StackItem* exc_info;
_PyErr_StackItem exc_state;
#else
PyObject* exc_type;
PyObject* exc_value;
PyObject* exc_traceback;
#endif
PyObject* dict;
#if GREENLET_USE_CONTEXT_VARS
PyObject* context;
#endif
} PyGreenlet;
#define PyGreenlet_Check(op) PyObject_TypeCheck(op, &PyGreenlet_Type)
#define PyGreenlet_MAIN(op) (((PyGreenlet*)(op))->stack_stop == (char*) -1)
#define PyGreenlet_STARTED(op) (((PyGreenlet*)(op))->stack_stop != NULL)
#define PyGreenlet_ACTIVE(op) (((PyGreenlet*)(op))->stack_start != NULL)
#define PyGreenlet_GET_PARENT(op) (((PyGreenlet*)(op))->parent)
#if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 1) || PY_MAJOR_VERSION > 3
#define GREENLET_USE_PYCAPSULE
#endif
/* C API functions */
/* Total number of symbols that are exported */
#define PyGreenlet_API_pointers 8
#define PyGreenlet_Type_NUM 0
#define PyExc_GreenletError_NUM 1
#define PyExc_GreenletExit_NUM 2
#define PyGreenlet_New_NUM 3
#define PyGreenlet_GetCurrent_NUM 4
#define PyGreenlet_Throw_NUM 5
#define PyGreenlet_Switch_NUM 6
#define PyGreenlet_SetParent_NUM 7
#ifndef GREENLET_MODULE
/* This section is used by modules that uses the greenlet C API */
static void **_PyGreenlet_API = NULL;
#define PyGreenlet_Type (*(PyTypeObject *) _PyGreenlet_API[PyGreenlet_Type_NUM])
#define PyExc_GreenletError \
((PyObject *) _PyGreenlet_API[PyExc_GreenletError_NUM])
#define PyExc_GreenletExit \
((PyObject *) _PyGreenlet_API[PyExc_GreenletExit_NUM])
/*
* PyGreenlet_New(PyObject *args)
*
* greenlet.greenlet(run, parent=None)
*/
#define PyGreenlet_New \
(* (PyGreenlet * (*)(PyObject *run, PyGreenlet *parent)) \
_PyGreenlet_API[PyGreenlet_New_NUM])
/*
* PyGreenlet_GetCurrent(void)
*
* greenlet.getcurrent()
*/
#define PyGreenlet_GetCurrent \
(* (PyGreenlet * (*)(void)) _PyGreenlet_API[PyGreenlet_GetCurrent_NUM])
/*
* PyGreenlet_Throw(
* PyGreenlet *greenlet,
* PyObject *typ,
* PyObject *val,
* PyObject *tb)
*
* g.throw(...)
*/
#define PyGreenlet_Throw \
(* (PyObject * (*) \
(PyGreenlet *self, PyObject *typ, PyObject *val, PyObject *tb)) \
_PyGreenlet_API[PyGreenlet_Throw_NUM])
/*
* PyGreenlet_Switch(PyGreenlet *greenlet, PyObject *args)
*
* g.switch(*args, **kwargs)
*/
#define PyGreenlet_Switch \
(* (PyObject * (*)(PyGreenlet *greenlet, PyObject *args, PyObject *kwargs)) \
_PyGreenlet_API[PyGreenlet_Switch_NUM])
/*
* PyGreenlet_SetParent(PyObject *greenlet, PyObject *new_parent)
*
* g.parent = new_parent
*/
#define PyGreenlet_SetParent \
(* (int (*)(PyGreenlet *greenlet, PyGreenlet *nparent)) \
_PyGreenlet_API[PyGreenlet_SetParent_NUM])
/* Macro that imports greenlet and initializes C API */
#ifdef GREENLET_USE_PYCAPSULE
#define PyGreenlet_Import() \
{ \
_PyGreenlet_API = (void**)PyCapsule_Import("greenlet._C_API", 0); \
}
#else
#define PyGreenlet_Import() \
{ \
PyObject *module = PyImport_ImportModule("greenlet"); \
if (module != NULL) { \
PyObject *c_api_object = PyObject_GetAttrString( \
module, "_C_API"); \
if (c_api_object != NULL && PyCObject_Check(c_api_object)) { \
_PyGreenlet_API = \
(void **) PyCObject_AsVoidPtr(c_api_object); \
Py_DECREF(c_api_object); \
} \
Py_DECREF(module); \
} \
}
#endif
#endif /* GREENLET_MODULE */
#ifdef __cplusplus
}
#endif
#endif /* !Py_GREENLETOBJECT_H */

View file

@ -1,25 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd $DIR
VERSION=`cat share/version.txt`
# clean up from last build
rm -r deb_dist >/dev/null 2>&1
# build binary package
python3 setup.py --command-packages=stdeb.command bdist_deb
# return install instructions if onionshare builds properly
if [[ $? -eq 0 ]]; then
# The build process in stdeb's util.py renames .dev to ~dev
# Adjust it here for the purposes of displaying the right filename
VERSION="${VERSION/.dev/~dev}"
echo ""
echo "To install, run:"
echo "sudo dpkg -i deb_dist/onionshare_$VERSION-1_all.deb"
else
echo "OnionShare failed to build!"
exit 1
fi

View file

@ -1,17 +0,0 @@
REM delete old dist files
rmdir /s /q dist
REM build onionshare-gui.exe
pyinstaller install\pyinstaller.spec -y
REM download tor
python install\get-tor-windows.py
REM sign onionshare-gui.exe
signtool.exe sign /v /d "OnionShare" /a /tr http://time.certum.pl/ dist\onionshare\onionshare-gui.exe
REM build an installer, dist\onionshare-setup.exe
makensis.exe install\onionshare.nsi
REM sign onionshare-setup.exe
signtool.exe sign /v /d "OnionShare" /a /tr http://time.certum.pl/ dist\onionshare-setup.exe

View file

@ -1,57 +0,0 @@
#!/bin/bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd $ROOT
# deleting dist
echo Deleting dist folder
rm -rf $ROOT/dist &>/dev/null 2>&1
# build the .app
echo Building OnionShare.app
pyinstaller $ROOT/install/pyinstaller.spec
python3 $ROOT/install/get-tor-osx.py
# create a symlink of onionshare-gui called onionshare, for the CLI version
cd $ROOT/dist/OnionShare.app/Contents/MacOS
ln -s onionshare-gui onionshare
cd $ROOT
if [ "$1" = "--release" ]; then
mkdir -p dist
APP_PATH="$ROOT/dist/OnionShare.app"
IDENTITY_NAME_APPLICATION="Developer ID Application: Micah Lee (N9B95FDWH4)"
ENTITLEMENTS_CHILD_PATH="$ROOT/install/macos_sandbox/child.plist"
ENTITLEMENTS_PARENT_PATH="$ROOT/install/macos_sandbox/parent.plist"
echo "Codesigning the app bundle"
codesign \
--deep \
-s "$IDENTITY_NAME_APPLICATION" \
-o runtime \
--force \
--entitlements "$ENTITLEMENTS_CHILD_PATH" \
--timestamp \
"$APP_PATH"
codesign \
-s "$IDENTITY_NAME_APPLICATION" \
-o runtime \
--force \
--entitlements "$ENTITLEMENTS_PARENT_PATH" \
--timestamp \
"$APP_PATH"
echo "Create the DMG"
if [ ! -f "/usr/local/bin/create-dmg" ]; then
echo "Error: create-dmg is not installed"
exit 0
fi
/usr/local/bin/create-dmg "$APP_PATH" --identity "$IDENTITY_NAME_APPLICATION"
mv *.dmg dist
echo "Cleaning up"
rm -rf "$APP_PATH"
echo "All done, your DMG is in:"
ls dist/*.dmg
fi

View file

@ -1,17 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd $DIR
VERSION=`cat share/version.txt`
# clean up from last build
rm -r build dist >/dev/null 2>&1
# build binary package
python3 setup.py bdist_rpm --requires="python3-flask, python3-flask-httpauth, python3-stem, python3-qt5, python3-crypto, python3-pysocks, nautilus-python, tor, obfs4, python3-psutil, python3-socketio, python3-flask-socketio, python3-qrcode"
# install it
echo ""
echo "To install, run:"
echo "sudo dnf install dist/onionshare-$VERSION-1.noarch.rpm"

View file

@ -1,81 +0,0 @@
#!/bin/bash
# The script builds a source package
# See https://github.com/micahflee/onionshare/blob/develop/BUILD.md#source-package
# Usage
display_usage() {
echo "Usage: $0 [tag]"
}
if [ $# -lt 1 ]
then
display_usage
exit 1
fi
# Input validation
TAG=$1
if [ "${TAG:0:1}" != "v" ]
then
echo "Tag must start with 'v' character"
exit 1
fi
VERSION=${TAG:1}
# Make sure tag exists
git tag | grep "^$TAG\$"
if [ $? -ne 0 ]
then
echo "Tag does not exist"
exit 1
fi
# Clone source
mkdir -p build/source
mkdir -p dist
cd build/source
git clone https://github.com/micahflee/onionshare.git
cd onionshare
# Verify tag
git tag -v $TAG 2> ../verify.txt
if [ $? -ne 0 ]
then
echo "Tag does not verify"
exit 1
fi
cat ../verify.txt |grep "using RSA key 927F419D7EC82C2F149C1BD1403C2657CD994F73"
if [ $? -ne 0 ]
then
echo "Tag signed with wrong key"
exit 1
fi
cat ../verify.txt |grep "^gpg: Good signature from"
if [ $? -ne 0 ]
then
echo "Tag verification missing 'Good signature from'"
exit 1
fi
# Checkout code
git checkout $TAG
# Delete .git, compress, and PGP sign
cd ..
rm -rf onionshare/.git
tar -cf onionshare-$VERSION.tar.gz onionshare/
gpg -a --detach-sign onionshare-$VERSION.tar.gz
# Move source package to dist
cd ../..
mv build/source/onionshare-$VERSION.tar.gz dist
mv build/source/onionshare-$VERSION.tar.gz.asc dist
# Clean up
rm -rf build/source/onionshare
rm build/source/verify.txt
echo "Source package complete, files are in dist"

View file

@ -1,126 +0,0 @@
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014-2020 Micah Lee, et al. <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/>.
"""
"""
This script downloads a pre-built tor binary to bundle with OnionShare.
In order to avoid a Mac gnupg dependency, I manually verify the signature
and hard-code the sha256 hash.
"""
import inspect
import os
import sys
import hashlib
import zipfile
import io
import shutil
import subprocess
import requests
def main():
dmg_url = "https://archive.torproject.org/tor-package-archive/torbrowser/10.0/TorBrowser-10.0-osx64_en-US.dmg"
dmg_filename = "TorBrowser-10.0-osx64_en-US.dmg"
expected_dmg_sha256 = (
"4e1ca7068bc29d5e8ffba85ecc8fec36c52ae582faea67bcdf445cd57192fb08"
)
# Build paths
root_path = os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
working_path = os.path.join(root_path, "build", "tor")
dmg_tor_path = os.path.join(
"/Volumes", "Tor Browser", "Tor Browser.app", "Contents"
)
dmg_path = os.path.join(working_path, dmg_filename)
dist_path = os.path.join(root_path, "dist", "OnionShare.app", "Contents")
# Make sure the working folder exists
if not os.path.exists(working_path):
os.makedirs(working_path)
# Make sure the zip is downloaded
if not os.path.exists(dmg_path):
print("Downloading {}".format(dmg_url))
r = requests.get(dmg_url)
open(dmg_path, "wb").write(r.content)
dmg_sha256 = hashlib.sha256(r.content).hexdigest()
else:
dmg_data = open(dmg_path, "rb").read()
dmg_sha256 = hashlib.sha256(dmg_data).hexdigest()
# Compare the hash
if dmg_sha256 != expected_dmg_sha256:
print("ERROR! The sha256 doesn't match:")
print("expected: {}".format(expected_dmg_sha256))
print(" actual: {}".format(dmg_sha256))
sys.exit(-1)
# Mount the dmg, copy data to the working path
subprocess.call(["hdiutil", "attach", dmg_path])
# Make sure Resources/tor exists before copying files
if os.path.exists(os.path.join(dist_path, "Resources", "Tor")):
shutil.rmtree(os.path.join(dist_path, "Resources", "Tor"))
os.makedirs(os.path.join(dist_path, "Resources", "Tor"))
if os.path.exists(os.path.join(dist_path, "MacOS", "Tor")):
shutil.rmtree(os.path.join(dist_path, "MacOS", "Tor"))
os.makedirs(os.path.join(dist_path, "MacOS", "Tor"))
# Modify the tor script to adjust the path
tor_script = open(
os.path.join(dmg_tor_path, "Resources", "TorBrowser", "Tor", "tor"), "r"
).read()
tor_script = tor_script.replace("../../../MacOS/Tor", "../../MacOS/Tor")
open(os.path.join(dist_path, "Resources", "Tor", "tor"), "w").write(tor_script)
# Copy into dist
shutil.copyfile(
os.path.join(dmg_tor_path, "Resources", "TorBrowser", "Tor", "geoip"),
os.path.join(dist_path, "Resources", "Tor", "geoip"),
)
shutil.copyfile(
os.path.join(dmg_tor_path, "Resources", "TorBrowser", "Tor", "geoip6"),
os.path.join(dist_path, "Resources", "Tor", "geoip6"),
)
os.chmod(os.path.join(dist_path, "Resources", "Tor", "tor"), 0o755)
shutil.copyfile(
os.path.join(dmg_tor_path, "MacOS", "Tor", "tor.real"),
os.path.join(dist_path, "MacOS", "Tor", "tor.real"),
)
shutil.copyfile(
os.path.join(dmg_tor_path, "MacOS", "Tor", "libevent-2.1.7.dylib"),
os.path.join(dist_path, "MacOS", "Tor", "libevent-2.1.7.dylib"),
)
os.chmod(os.path.join(dist_path, "MacOS", "Tor", "tor.real"), 0o755)
# obfs4proxy binary
shutil.copyfile(
os.path.join(dmg_tor_path, "MacOS", "Tor", "PluggableTransports", "obfs4proxy"),
os.path.join(dist_path, "Resources", "Tor", "obfs4proxy"),
)
os.chmod(os.path.join(dist_path, "Resources", "Tor", "obfs4proxy"), 0o755)
# Eject dmg
subprocess.call(["diskutil", "eject", "/Volumes/Tor Browser"])
if __name__ == "__main__":
main()

View file

@ -1,100 +0,0 @@
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014-2020 Micah Lee, et al. <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/>.
"""
"""
This script downloads a pre-built tor binary to bundle with OnionShare.
In order to avoid a Windows gnupg dependency, I manually verify the signature
and hard-code the sha256 hash.
"""
import inspect
import os
import sys
import hashlib
import shutil
import subprocess
import requests
def main():
exe_url = "https://archive.torproject.org/tor-package-archive/torbrowser/10.0/torbrowser-install-10.0_en-US.exe"
exe_filename = "torbrowser-install-10.0_en-US.exe"
expected_exe_sha256 = (
"3d1a337da0e6eae32071e6de21963ba628a1a0939477bf823aa7df9051215410"
)
# Build paths
root_path = os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
working_path = os.path.join(root_path, "build", "tor")
exe_path = os.path.join(working_path, exe_filename)
dist_path = os.path.join(root_path, "src", "onionshare", "resources", "tor")
# Make sure the working folder exists
if not os.path.exists(working_path):
os.makedirs(working_path)
# Make sure Tor Browser is downloaded
if not os.path.exists(exe_path):
print("Downloading {}".format(exe_url))
r = requests.get(exe_url)
open(exe_path, "wb").write(r.content)
exe_sha256 = hashlib.sha256(r.content).hexdigest()
else:
exe_data = open(exe_path, "rb").read()
exe_sha256 = hashlib.sha256(exe_data).hexdigest()
# Compare the hash
if exe_sha256 != expected_exe_sha256:
print("ERROR! The sha256 doesn't match:")
print("expected: {}".format(expected_exe_sha256))
print(" actual: {}".format(exe_sha256))
sys.exit(-1)
# Extract the bits we need from the exe
subprocess.Popen([
"7z",
"e",
"-y",
exe_path,
"Browser\TorBrowser\Tor",
"-o%s" % os.path.join(working_path, "Tor"),
]).wait()
subprocess.Popen([
"7z",
"e",
"-y",
exe_path,
"Browser\TorBrowser\Data\Tor\geoip*",
"-o%s" % os.path.join(working_path, "Data"),
]).wait()
# Copy into the onionshare resources
if os.path.exists(dist_path):
shutil.rmtree(dist_path)
os.makedirs(dist_path)
shutil.copytree(os.path.join(working_path, "Tor"), os.path.join(dist_path, "Tor"))
shutil.copytree(
os.path.join(working_path, "Data"), os.path.join(dist_path, "Data", "Tor")
)
if __name__ == "__main__":
main()

View file

@ -1,111 +0,0 @@
!define APPNAME "OnionShare"
!define BINPATH "..\dist\onionshare"
!define ABOUTURL "https:\\onionshare.org\"
# change these with each release
!define INSTALLSIZE 132423
!define VERSIONMAJOR 2
!define VERSIONMINOR 3
!define VERSIONSTRING "2.3.dev1"
RequestExecutionLevel admin
Name "OnionShare"
InstallDir "$PROGRAMFILES\${APPNAME}"
Icon "onionshare.ico"
!include LogicLib.nsh
Page directory
Page instfiles
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
# in order to code sign uninstall.exe, we need to do some hacky stuff outlined
# here: http:\\nsis.sourceforge.net\Signing_an_Uninstaller
!ifdef INNER
!echo "Creating uninstall.exe"
OutFile "$%TEMP%\tempinstaller.exe"
SetCompress off
!else
!echo "Creating normal installer"
!system "makensis.exe /DINNER onionshare.nsi" = 0
!system "$%TEMP%\tempinstaller.exe" = 2
!system "signtool.exe sign /v /d $\"Uninstall OnionShare$\" /a /tr http://time.certum.pl/ $%TEMP%\uninstall.exe" = 0
# all done, now we can build the real installer
OutFile "..\dist\onionshare-setup.exe"
SetCompressor /FINAL /SOLID lzma
!endif
Function .onInit
!ifdef INNER
WriteUninstaller "$%TEMP%\uninstall.exe"
Quit # bail out early
!endif
setShellVarContext all
!insertmacro VerifyUserIsAdmin
FunctionEnd
Section "install"
SetOutPath "$INSTDIR"
File "onionshare.ico"
File /a /r "${BINPATH}\"
# uninstaller
!ifndef INNER
SetOutPath $INSTDIR
File $%TEMP%\uninstall.exe
!endif
# start menu
CreateShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\onionshare-gui.exe" "" "$INSTDIR\onionshare.ico"
# registry information for add\remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" \S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\onionshare.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" ${VERSIONSTRING}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR}
# there is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
# set the INSTALLSIZE constant (!defined at the top of this script) so Add\Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
SectionEnd
# uninstaller
Function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Uninstall ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
FunctionEnd
!ifdef INNER
Section "uninstall"
Delete "$SMPROGRAMS\${APPNAME}.lnk"
# remove files
RMDir /r $INSTDIR
# remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd
!endif

View file

@ -1,257 +0,0 @@
/* XPM */
static char * icon_xpm[] = {
"80 80 174 2",
" c None",
". c #4E0D4E",
"+ c #531453",
"@ c #581B58",
"# c #673067",
"$ c #906890",
"% c #B397B3",
"& c #CFBECF",
"* c #E0D5E0",
"= c #F0EBF0",
"- c #FCFCFC",
"; c #4F0E4F",
"> c #6E396E",
", c #8F668F",
"' c #C1AAC1",
") c #EFE9EF",
"! c #FFFFFF",
"~ c #865986",
"{ c #C5B0C5",
"] c #EAE2EA",
"^ c #764476",
"/ c #DFD4DF",
"( c #FAF9FA",
"_ c #5E235E",
": c #BDA5BD",
"< c #885C88",
"[ c #E8DFE8",
"} c #521352",
"| c #B89EB8",
"1 c #FCFBFC",
"2 c #5B1F5B",
"3 c #4D0C4D",
"4 c #571A57",
"5 c #5D225D",
"6 c #D8C9D8",
"7 c #612761",
"8 c #D4C4D4",
"9 c #D4C5D4",
"0 c #4E0C4E",
"a c #632A63",
"b c #DDD1DD",
"c c #693269",
"d c #DED3DE",
"e c #FDFCFD",
"f c #F6F3F6",
"g c #D7C9D7",
"h c #A482A4",
"i c #7E4E7E",
"j c #652D65",
"k c #521252",
"l c #490649",
"m c #4B094B",
"n c #662E66",
"o c #D9CCD9",
"p c #DCD0DC",
"q c #A584A5",
"r c #622862",
"s c #440044",
"t c #470447",
"u c #4A084A",
"v c #4C0A4C",
"w c #825482",
"x c #6F3A6F",
"y c #4D0B4D",
"z c #642B64",
"A c #DBCFDB",
"B c #F7F3F7",
"C c #9B779B",
"D c #835683",
"E c #E5DBE5",
"F c #E4DAE4",
"G c #E8E0E8",
"H c #713C71",
"I c #4C0B4C",
"J c #8C628C",
"K c #E2D9E2",
"L c #672F67",
"M c #6D386D",
"N c #E7DFE7",
"O c #622962",
"P c #926A92",
"Q c #FAF8FA",
"R c #E2D7E2",
"S c #6C376C",
"T c #4A074A",
"U c #6B346B",
"V c #CCBACC",
"W c #875C87",
"X c #F9F7F9",
"Y c #7B4C7B",
"Z c #DED4DE",
"` c #5B1E5B",
" . c #855885",
".. c #DDD2DD",
"+. c #895E89",
"@. c #DBCEDB",
"#. c #4B084B",
"$. c #7F507F",
"%. c #F7F4F7",
"&. c #5F245F",
"*. c #764576",
"=. c #551755",
"-. c #FEFEFE",
";. c #D7CAD7",
">. c #5C205C",
",. c #815381",
"'. c #F3EEF3",
"). c #774577",
"!. c #F4F0F4",
"~. c #D3C3D3",
"{. c #591C59",
"]. c #703C70",
"^. c #FEFDFE",
"/. c #D3C4D3",
"(. c #511051",
"_. c #501150",
":. c #B093B0",
"<. c #B59AB5",
"[. c #FDFDFD",
"}. c #B79CB7",
"|. c #B599B5",
"1. c #895F89",
"2. c #734073",
"3. c #987298",
"4. c #9A759A",
"5. c #8A608A",
"6. c #511251",
"7. c #602660",
"8. c #CEBCCE",
"9. c #F1ECF1",
"0. c #855985",
"a. c #5E225E",
"b. c #784778",
"c. c #DED1DE",
"d. c #F3EFF3",
"e. c #7F517F",
"f. c #F5F1F5",
"g. c #470347",
"h. c #5D215D",
"i. c #F3F0F3",
"j. c #865B86",
"k. c #450145",
"l. c #D6C7D6",
"m. c #F4F1F4",
"n. c #805280",
"o. c #E6DCE6",
"p. c #885D88",
"q. c #5C215C",
"r. c #E6DDE6",
"s. c #F8F6F8",
"t. c #936C93",
"u. c #460246",
"v. c #DACDDA",
"w. c #F6F4F6",
"x. c #8E658E",
"y. c #450045",
"z. c #5E245E",
"A. c #642C64",
"B. c #DED2DE",
"C. c #F7F5F7",
"D. c #EEE7EE",
"E. c #EDE6ED",
"F. c #916991",
"G. c #ECE5EC",
"H. c #FBF9FB",
"I. c #6A336A",
"J. c #662F66",
"K. c #FBFAFB",
"L. c #956F95",
"M. c #E9E1E9",
"N. c #DACCDA",
"O. c #541654",
"P. c #BAA1BA",
"Q. c #4E0E4E",
" . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . + @ # $ % & * = - - = * & % $ # @ + . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . ; > , ' ) ! ! ! ! ! ! ! ! ! ! ! ! ! ! ) ' , > ; . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . ~ { ] ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ] { ~ . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . ^ / ( ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ( / ^ . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . _ : ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! : _ . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . < [ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! [ < . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . } | 1 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 1 | } . . . . . . . . . . . . ",
" . . . . . . . . . . . . 2 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & 2 . . . . . . . . . . . . ",
" . . . . . . . . . . . . 2 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & 2 . . . . . . . . . . . . ",
" . . . . . . . . . 3 3 4 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & 2 . . . . . . . . . . . ",
" . . . . . . . . . . . . 5 6 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & } . . . . . . . . . . . ",
" . . . . . . . . . . . . . 7 8 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! | . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . _ 9 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 1 < . . . . . . . . . . . ",
" . . . . . . . 3 0 . . . . . . . a b ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! [ _ . . . . . . . . . . ",
" . . . . . . . . 0 . . . . . . . . . c d ! ! ! ! ! ! ! ! ! ! e f g h i j k k j i h g f e ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! : . . . . . . . . . . . ",
" . . . . . . . . . . . . . l m . . . . n o ! ! ! ! ! ! ! ! p q r s t u v . . v u t s r q p ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ . . . . . . . . . . ",
" . . . . . . . . . . . . . 3 w x y . . . . z A ! ! ! ! ! B C 7 t v . . . . . . . . . . v t 7 C B ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! / . . . . . . . . . . . ",
" . . . . . 3 0 . . . . . y D ! E 7 3 . . . . c F ! ! ! G H ; 3 . . . . . . . . . . . . . . 3 ; H G ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ( ~ . . . . . . . . . . ",
" . . . . . 0 . . . . 3 I J ! ! ! K L l . . . . M E ! N O u . . . . . . . . . . . . . . . . . . u O N ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! { ; . . . . . . . . . ",
" . . . . . . . . . . I P Q ! ! ! ! R S T . . . . U V O l . . . . . . . . . . . . . . . . . . . . l O G ! ! ! ! ! ! ! ! ! ! ! ! ! ! ] > . . . . . . . . . ",
" . . . . 0 . . . . . v W X ! ! ! ! ! ! / j 3 . . . . + u . . . . . . . . . . . . . . . . . . . . . . u H B ! ! ! ! ! ! ! ! ! ! ! ! ! ! , . . . . . . . . . . ",
" . . . 0 . . . . . v Y ! ! ! ! ! ! ! ! ! Z ` 0 . . . . . 3 . . . . . . . . . . . . . . . . . . . . . . ; C ! ! ! ! ! ! ! ! ! ! ! ! ! ! ' + . . . . . . . . . ",
" . . 0 . . . . 0 I .! ! ! ! ! ! ! ! ! ! ! ..7 u . . . . . 3 . . . . . . . . . . . . . . . . . . . . . 3 7 p ! ! ! ! ! ! ! ! ! ! ! ! ! ) @ . . . . . . . . . ",
" . . . . . . . v +.B ! ! ! ! ! ! ! ! ! ! ! ! @.L #.. . . . . 3 . . . . . . . . . . . . . . . . . . . . . t q e ! ! ! ! ! ! ! ! ! ! ! ! ! # . . . . . . . . . ",
". 0 . . . . . m $.%.! ! ! ! ! ! ! ! ! ! ! ! ! ! o &.. . . . . . 3 . . . . . . . . . . . . . . . . . . . . v r f ! ! ! ! ! ! ! ! ! ! ! ! ! $ . . . . . . . . . . ",
"3 . . . . . m *.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! o =.. . . . . . 3 . . . . . . . . . . . . . . . . . . . . s g ! ! ! ! ! ! ! ! ! ! ! ! ! % . . . . . . . . . . ",
". . . . . v i -.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ;.>.m . . . . 3 3 . . . . . . . . . . . . . . . . . . . t h ! ! ! ! ! ! ! ! ! ! ! ! ! & . . . . . . . . . . ",
". . . . v ,.'.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 9 r v . . . . . 3 . . . . . . . . . . . . . . . . . . u i ! ! ! ! ! ! ! ! ! ! ! ! ! * . . . . . . . . . . ",
". . . u ).!.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~.{.. . . . . . 3 . . . . . . . . . . . . . . . . . v j ! ! ! ! ! ! ! ! ! ! ! ! ! = . . . . . . . . . . ",
". . m ].^.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! /.(.. . . . . . 3 . . . . . . . . . . . . . . . . . k ! ! ! ! ! ! ! ! ! ! ! ! ! - . . . . . . . . . . ",
". y _.:.<.<.<.<.<.<.[.! ! ! ! ! ! ! ! ! ! ! ! ! }.<.<.<.|.<.1.l . . . . . 3 . . . . 3 . . . . . m 2.3.3.3.3.3.4.! ! ! ! ! ! ! ! ! ! ! ! ! [.3.3.3.3.3.3.5.6.3 . ",
". . . . . . . . . . = ! ! ! ! ! ! ! ! ! ! ! ! ! j v . . . . . . . . . . . . . . . . 3 . . . . . y 7.8.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 9.0.#.. . ",
". . . . . . . . . . * ! ! ! ! ! ! ! ! ! ! ! ! ! i u . . . . . . . . . . . . . . . . . 3 . . . . . 3 a.8.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 9.b.m . . . ",
". . . . . . . . . . & ! ! ! ! ! ! ! ! ! ! ! ! ! h t . . . . . . . . . . . . . . . . . . 3 . . . . . 3 2 c.! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! d.e.3 . . . . ",
". . . . . . . . . . % ! ! ! ! ! ! ! ! ! ! ! ! ! g s . . . . . . . . . . . . . . . . . . . 3 . . . . . m {./ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! f.5.g.. . . . . ",
". . . . . . . . . . $ ! ! ! ! ! ! ! ! ! ! ! ! ! f r v . . . . . . . . . . . . . . . . . . . 3 . . . . . m h.8 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! i.j.k.. . . . . 0 ",
" . . . . . . . . . # ! ! ! ! ! ! ! ! ! ! ! ! ! e q t . . . . . . . . . . . . . . . . . . . . 3 . . . . . y r l.! ! ! ! ! ! ! ! ! ! ! ! ! ! m.n.m . . . . . 3 ",
" . . . . . . . . . @ ) ! ! ! ! ! ! ! ! ! ! ! ! ! p 7 3 . . . . . . . . . . . . . . . . . . . . 3 . . . . . y &.o.! ! ! ! ! ! ! ! ! ! ! ! %.p.y . . . . . 3 . ",
" . . . . . . . . . + ' ! ! ! ! ! ! ! ! ! ! ! ! ! ! C ; . . . . . . . . . . . . . . . . . . . . . 3 . . . . . #.q.r.! ! ! ! ! ! ! ! ! ! s.t.u.. . . . . 3 . . ",
" . . . . . . . . . . , ! ! ! ! ! ! ! ! ! ! ! ! ! ! B H u . . . . . . . . . . . . . . . . . . . . . 3 3 . . . . #.7 v.! ! ! ! ! ! ! ! w.x.y.. . . . . 3 . . . ",
" . . . . . . . . . > ] ! ! ! ! ! ! ! ! ! ! ! ! ! ! G O l . . . . . . . . . . . . . . . . . . . . l z.A.. . . . y L B.! ! ! ! ! ! C.+.v . . . . . 3 . . . ",
" . . . . . . . . . ; { ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! N O u . . . . . . . . . . . . . . . . . . u O N D.h.. . . . y O E.! ! ! ! ( F.y . . . . . 3 . . . . ",
" . . . . . . . . . . ~ ( ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! G H ; 3 . . . . . . . . . . . . . . 3 ; H G ! ! D.a . . . . u 7.G.! ! H.C k.. . . . . 3 . . . . . ",
" . . . . . . . . . . . / ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! B C 7 t v . . . . . . . . . . v t 7 C B ! ! ! ! R I.. . . . #.J.R K.L.y.. . . . . 3 . . . . . . ",
" . . . . . . . . . . ^ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! p q r s t u v . . v u t s r q p ! ! ! ! ! ! ! * 7 . . . . y x n.y . . . . . 3 . . . . . . ",
" . . . . . . . . . . . : ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! e f g h i j k k j i h g f e ! ! ! ! ! ! ! ! ! M.@ . . . . . . . . . . . 3 . . . . . . . ",
" . . . . . . . . . . _ [ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! G _ . . . . . . . . . 3 . . . . . . . ",
" . . . . . . . . . . . < 1 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! @.A.. . . . . . . 3 . . . . . . . . ",
" . . . . . . . . . . . | ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! N.2 . . . . . 3 3 . . . . . . . ",
" . . . . . . . . . . . } & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! F O.. . . 3 . . . . . . . . . ",
" . . . . . . . . . . . 2 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! P.Q.. 3 . . . . . . . . . ",
" . . . . . . . . . . . . 2 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & 2 0 3 . . . . . . . . . . ",
" . . . . . . . . . . . . 2 & ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! & 2 . . . . . . . . . . . . ",
" . . . . . . . . . . . . } | 1 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 1 | } . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . < [ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! [ < . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . _ : ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! : _ . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . ^ / ( ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ( / ^ . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . ~ { ] ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ] { ~ . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . ; > , ' ) ! ! ! ! ! ! ! ! ! ! ! ! ! ! ) ' , > ; . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . + @ # $ % & * = - - = * & % $ # @ + . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . "};

View file

@ -1,18 +0,0 @@
#!/bin/bash
# This script pushes updates to my Ubuntu PPA: https://launchpad.net/~micahflee/+archive/ppa
# If you want to use it, you'll need your own ~/.dput.cf and ssh key.
# More info: https://help.launchpad.net/Packaging/PPA/Uploading
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
cd $DIR
VERSION=`cat share/version.txt`
rm -rf deb_dist >/dev/null 2>&1
python3 setup.py --command-packages=stdeb.command sdist_dsc
cd deb_dist/onionshare-$VERSION
dpkg-buildpackage -S
cd ..
dput ppa:micahflee/ppa onionshare_$VERSION-1_source.changes
cd ..

View file

@ -1,116 +0,0 @@
# -*- mode: python -*-
import os
import platform
from distutils.sysconfig import get_python_lib
p = platform.system()
version = open("share/version.txt").read().strip()
paths = ["."]
if p == "Windows":
paths.append(os.path.join(get_python_lib(), "PyQt5", "Qt", "bin"))
paths.append(
os.path.join(
os.path.abspath(os.sep),
"Program Files (x86)",
"Windows Kits",
"10",
"bin",
"x86",
)
)
paths.append(
os.path.join(
os.path.abspath(os.sep),
"Program Files (x86)",
"Windows Kits",
"10",
"bin",
"x64",
)
)
paths.append(
os.path.join(
os.path.abspath(os.sep),
"Program Files (x86)",
"Windows Kits",
"10",
"Redist",
"ucrt",
"DLLs",
"x86",
)
)
paths.append(
os.path.join(
os.path.abspath(os.sep),
"Program Files (x86)",
"Windows Kits",
"10",
"Redist",
"ucrt",
"DLLs",
"x64",
)
)
a = Analysis(
["scripts/onionshare-pyinstaller"],
pathex=paths,
binaries=None,
datas=[
("../share/version.txt", "share"),
("../share/wordlist.txt", "share"),
("../share/torrc_template", "share"),
("../share/torrc_template-obfs4", "share"),
("../share/torrc_template-meek_lite_azure", "share"),
("../share/images/*", "share/images"),
("../share/locale/*", "share/locale"),
("../share/static/*", "share/static"),
("../share/templates/*", "share/templates"),
("../share/static/css/*", "share/static/css"),
("../share/static/img/*", "share/static/img"),
("../share/static/js/*", "share/static/js"),
("../install/licenses/*", "licenses"),
],
hiddenimports=["engineio.async_drivers.threading"],
hookspath=[],
runtime_hooks=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
# Show console in dev releases, don't show console in production releases
console = "dev" in version
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name="onionshare-gui",
debug=False,
strip=False,
upx=True,
console=console,
)
coll = COLLECT(
exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name="onionshare"
)
if p == "Darwin":
app = BUNDLE(
coll,
name="OnionShare.app",
icon="onionshare.icns",
bundle_identifier="com.micahflee.onionshare",
info_plist={
"CFBundleShortVersionString": version,
"NSHighResolutionCapable": "True",
},
)

View file

@ -1,105 +0,0 @@
import os
import sys
import json
import locale
import subprocess
try:
import urllib.request
except:
import urllib
import gi
gi.require_version("Nautilus", "3.0")
from gi.repository import Nautilus
from gi.repository import GObject
# Put me in /usr/share/nautilus-python/extensions/
class OnionShareExtension(GObject.GObject, Nautilus.MenuProvider):
def __init__(self):
# Get the localized string for "Share via OnionShare" label
self.label = None
default_label = "Share via OnionShare"
try:
# Re-implement localization in python2
default_locale = "en"
locale_dir = os.path.join(sys.prefix, "share/onionshare/locale")
if os.path.exists(locale_dir):
# Load all translations
strings = {}
translations = {}
for filename in os.listdir(locale_dir):
abs_filename = os.path.join(locale_dir, filename)
lang, ext = os.path.splitext(filename)
if ext == ".json":
with open(abs_filename) as f:
translations[lang] = json.load(f)
strings = translations[default_locale]
lc, enc = locale.getdefaultlocale()
if lc:
lang = lc[:2]
if lang in translations:
# if a string doesn't exist, fallback to English
for key in translations[default_locale]:
if key in translations[lang]:
strings[key] = translations[lang][key]
self.label = strings["share_via_onionshare"]
except:
self.label = default_label
if not self.label:
self.label = default_label
"""
# This more elegant solution will only work if nautilus is using python3, and onionshare is installed system-wide.
# But nautilus is using python2, so this is commented out.
try:
import onionshare
onionshare.strings.load_strings(onionshare.common)
self.label = onionshare.strings._('share_via_onionshare')
except:
import sys
print('python version: {}').format(sys.version)
self.label = 'Share via OnionShare'
"""
def url2path(self, url):
file_uri = url.get_activation_uri()
arg_uri = file_uri[7:]
try:
path = urllib.request.url2pathname(arg_uri)
except:
path = urllib.url2pathname(arg_uri)
return path
def exec_onionshare(self, filenames):
# Would prefer this method but there is a conflict between GTK 2.0 vs GTK 3.0 components being loaded at once
# (nautilus:3090): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
# sys.argv = ["", "--filenames"] + filenames
# sys.exit(onionshare_gui.main())
path = os.path.join(os.sep, "usr", "bin", "onionshare-gui")
cmd = [path, "--filenames"] + filenames
subprocess.Popen(cmd)
def get_file_items(self, window, files):
menuitem = Nautilus.MenuItem(
name="OnionShare::Nautilus", label=self.label, tip="", icon=""
)
menu = Nautilus.Menu()
menu.append_item(menuitem)
menuitem.connect("activate", self.menu_activate_cb, files)
return (menuitem,)
def menu_activate_cb(self, menu, files):
file_list = []
for file in files:
file_list.append(self.url2path(file))
self.exec_onionshare(file_list)
# Workaround https://bugzilla.gnome.org/show_bug.cgi?id=784278
def get_background_items(self, window, file):
return None