mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-26 17:31:21 -05:00
commit
185006d662
@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import sys, os, inspect, hashlib, base64, hmac, platform, zipfile, tempfile, math, time
|
import sys, os, inspect, hashlib, base64, platform, zipfile, tempfile, math, time
|
||||||
from random import SystemRandom
|
from random import SystemRandom
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys, subprocess, time, argparse, inspect, shutil, socket, threading
|
import os, sys, time, argparse, shutil, socket, threading
|
||||||
|
|
||||||
from . import strings, helpers, web, hs
|
from . import strings, helpers, web, hs
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import json, locale, sys, os
|
import json, locale, os
|
||||||
|
|
||||||
from . import helpers
|
from . import helpers
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
import queue, mimetypes, platform, os, sys
|
import queue, mimetypes, platform, os, sys
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from flask import Flask, Response, request, render_template_string, abort
|
from flask import Flask, Response, request, render_template_string, abort
|
||||||
from functools import wraps
|
|
||||||
|
|
||||||
from . import strings, helpers
|
from . import strings, helpers
|
||||||
|
|
||||||
@ -231,7 +230,7 @@ def download(slug_candidate):
|
|||||||
# The user has canceled the download, so stop serving the file
|
# The user has canceled the download, so stop serving the file
|
||||||
if client_cancel:
|
if client_cancel:
|
||||||
add_request(REQUEST_CANCELED, path, {'id': download_id})
|
add_request(REQUEST_CANCELED, path, {'id': download_id})
|
||||||
break;
|
break
|
||||||
|
|
||||||
chunk = fp.read(chunk_size)
|
chunk = fp.read(chunk_size)
|
||||||
if chunk == b'':
|
if chunk == b'':
|
||||||
|
@ -17,9 +17,7 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
from onionshare import helpers
|
from onionshare import helpers
|
||||||
from nose import with_setup
|
|
||||||
|
|
||||||
import test_helpers
|
|
||||||
|
|
||||||
def test_get_platform_returns_platform_system():
|
def test_get_platform_returns_platform_system():
|
||||||
"""get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined"""
|
"""get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined"""
|
||||||
|
@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
import locale
|
import locale
|
||||||
from onionshare import strings
|
from onionshare import strings
|
||||||
from nose import with_setup
|
|
||||||
|
|
||||||
|
|
||||||
def test_starts_with_empty_strings():
|
def test_starts_with_empty_strings():
|
||||||
|
@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
import socket
|
import socket
|
||||||
from onionshare import OnionShare
|
from onionshare import OnionShare
|
||||||
from nose import with_setup
|
|
||||||
|
|
||||||
|
|
||||||
def test_choose_port_returns_a_port_number():
|
def test_choose_port_returns_a_port_number():
|
||||||
|
@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class MockSubprocess():
|
class MockSubprocess():
|
||||||
@ -31,9 +32,7 @@ class MockSubprocess():
|
|||||||
|
|
||||||
|
|
||||||
def write_tempfile(text):
|
def write_tempfile(text):
|
||||||
tempdir = tempfile.mkdtemp()
|
path = os.path.join(tempfile.mkdtemp(), "/test-file.txt")
|
||||||
path = tempdir + "/test-file.txt"
|
|
||||||
with open(path, "w") as f:
|
with open(path, "w") as f:
|
||||||
f.write(text)
|
f.write(text)
|
||||||
f.close()
|
|
||||||
return path
|
return path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user