use fp symbol instead, merge master changes before merging back to improve circles

master
Kevin Froman 2020-01-28 00:29:20 -06:00
commit 0059c91b06
12 changed files with 107 additions and 15 deletions

View File

@ -1,4 +1,4 @@
urllib3==1.25.7 urllib3==1.25.8
requests==2.22.0 requests==2.22.0
PyNaCl==1.3.0 PyNaCl==1.3.0
gevent==1.4.0 gevent==1.4.0
@ -8,7 +8,7 @@ stem==1.8.0
deadsimplekv==0.2.0 deadsimplekv==0.2.0
unpaddedbase32==0.2.0 unpaddedbase32==0.2.0
streamedrequests==1.0.0 streamedrequests==1.0.0
jinja2==2.10.3 jinja2==2.11.0
toomanyobjs==1.1.0 toomanyobjs==1.1.0
niceware==0.2.1 niceware==0.2.1
psutil==5.6.7 psutil==5.6.7

View File

@ -104,9 +104,9 @@ itsdangerous==1.1.0 \
--hash=sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19 \ --hash=sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19 \
--hash=sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749 \ --hash=sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749 \
# via flask # via flask
jinja2==2.10.3 \ jinja2==2.11.0 \
--hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \ --hash=sha256:6e7a3c2934694d59ad334c93dd1b6c96699cf24c53fdb8ec848ac6b23e685734 \
--hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de --hash=sha256:d6609ae5ec3d56212ca7d802eda654eaf2310000816ce815361041465b108be4
markupsafe==1.1.1 \ markupsafe==1.1.1 \
--hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ --hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \
--hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ --hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \
@ -195,9 +195,9 @@ toomanyobjs==1.1.0 \
unpaddedbase32==0.2.0 \ unpaddedbase32==0.2.0 \
--hash=sha256:4aacee75f8fd6c8cf129842ecba45ca59c11bfb13dae19d86f32b48fa3715403 \ --hash=sha256:4aacee75f8fd6c8cf129842ecba45ca59c11bfb13dae19d86f32b48fa3715403 \
--hash=sha256:b7b780c31d27d55e66abf6c221216a35690ee8892c2daacff7f2528e229bd9c3 --hash=sha256:b7b780c31d27d55e66abf6c221216a35690ee8892c2daacff7f2528e229bd9c3
urllib3==1.25.7 \ urllib3==1.25.8 \
--hash=sha256:a8a318824cc77d1fd4b2bec2ded92646630d7fe8619497b142c84a9e6f5a7293 \ --hash=sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc \
--hash=sha256:f3c5fd51747d450d4dcf6f923c81f78f811aab8205fda64b0aba34a4e48b0745 --hash=sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc
werkzeug==0.15.5 \ werkzeug==0.15.5 \
--hash=sha256:87ae4e5b5366da2347eb3116c0e6c681a0e939a33b2805e2c0cbd282664932c4 \ --hash=sha256:87ae4e5b5366da2347eb3116c0e6c681a0e939a33b2805e2c0cbd282664932c4 \
--hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6 \ --hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6 \

View File

@ -15,7 +15,6 @@ import onionrcrypto
from communicator import onlinepeers from communicator import onlinepeers
if TYPE_CHECKING: if TYPE_CHECKING:
from communicator import OnionrCommunicatorDaemon from communicator import OnionrCommunicatorDaemon
""" """
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -43,6 +43,7 @@ DATABASE_LOCK_TIMEOUT = 60
# Block creation anonymization requirements # Block creation anonymization requirements
MIN_BLOCK_UPLOAD_PEER_PERCENT = 0.1 MIN_BLOCK_UPLOAD_PEER_PERCENT = 0.1
MIN_SHARE_WAIT_DELAY_SECS = 5
WSGI_SERVER_REQUEST_TIMEOUT_SECS = 120 WSGI_SERVER_REQUEST_TIMEOUT_SECS = 120

View File

@ -6,6 +6,8 @@ import os
import subprocess import subprocess
from flask import Response, Blueprint, request, send_from_directory, abort from flask import Response, Blueprint, request, send_from_directory, abort
from gevent import spawn
from gevent import sleep
import unpaddedbase32 import unpaddedbase32
from httpapi import apiutils from httpapi import apiutils
@ -71,8 +73,8 @@ class PrivateEndpoints:
raise ValueError('block hash needs to be alpha numeric') raise ValueError('block hash needs to be alpha numeric')
name = reconstructhash.reconstruct_hash(name) name = reconstructhash.reconstruct_hash(name)
if name in client_api.publicAPI.hideBlocks: if name in client_api.publicAPI.hideBlocks:
client_api.publicAPI.hideBlocks.remove(name) spawn(_delay_wait_for_share_block_removal)
return Response("removed") return Response("will be removed")
else: else:
client_api.publicAPI.hideBlocks.append(name) client_api.publicAPI.hideBlocks.append(name)
return Response("added") return Response("added")

View File

@ -1,3 +1,5 @@
from . import insert from . import insert
from .insert import time_insert
insert = insert.insert_block insert = insert.insert_block
time_insert = time_insert

View File

@ -0,0 +1,4 @@
from . import main, timeinsert
insert_block = main.insert_block
time_insert = timeinsert.time_insert

View File

@ -24,7 +24,7 @@ from gevent import spawn
from onionrutils import bytesconverter, epoch from onionrutils import bytesconverter, epoch
import filepaths, onionrstorage import filepaths, onionrstorage
from . import storagecounter from .. import storagecounter
from onionrplugins import onionrevents as events from onionrplugins import onionrevents as events
from etc import powchoice, onionrvalues from etc import powchoice, onionrvalues
import config, onionrcrypto as crypto, onionrexceptions import config, onionrcrypto as crypto, onionrexceptions

View File

@ -0,0 +1,51 @@
"""Onionr - Private P2P Communication.
Wrapper to insert blocks with variable delay
"""
from . import main
"""
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 <https://www.gnu.org/licenses/>.
"""
def time_insert(*args, **kwargs):
"""Block insert wrapper to allow for insertions independent of mixmate.
Takes exact args as insert_block, with additional keyword:
delay=n; where n=seconds to tell initial nodes to delay share for.
defaults to 0 or previously set value in current block meta
"""
try:
kwargs['meta']
except KeyError:
kwargs['meta'] = {}
try:
delay = int(kwargs['meta']['dly'])
except KeyError:
delay = 0
try:
delay = kwargs['delay']
del kwargs['delay']
except KeyError:
delay = 0
# Ensure delay >=0
if delay < 0:
raise ValueError('delay cannot be less than 0')
kwargs['meta']['dly'] = delay
return main.insert_block(*args, **kwargs)

View File

@ -8,6 +8,7 @@
Friends Friends
</title> </title>
<link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'> <link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'>
<link rel="stylesheet" href="/shared/fontawesome-free-5.10.2/css/all.min.css">
<link rel='stylesheet' href='/shared/main/PNotifyBrightTheme.css'> <link rel='stylesheet' href='/shared/main/PNotifyBrightTheme.css'>
<link rel="stylesheet" href="/gettheme"> <link rel="stylesheet" href="/gettheme">
<link rel='stylesheet' href='/friends/style.css'> <link rel='stylesheet' href='/friends/style.css'>
@ -61,7 +62,9 @@
<div class="field"> <div class="field">
<div class="field has-addons"> <div class="field has-addons">
<p class="control"> <p class="control">
<a class="button is-static">Identity</a> <a class="button is-static">
<i class="fas fa-fingerprint"></i>
</a>
</p> </p>
<p class="control is-expanded"> <p class="control is-expanded">
<input id="myPub" class="input myPub" type="text" readonly> <input id="myPub" class="input myPub" type="text" readonly>

View File

@ -65,7 +65,9 @@
<div class="field"> <div class="field">
<div class="field has-addons"> <div class="field has-addons">
<p class="control"> <p class="control">
<a class="button is-static">Identity</a> <a class="button is-static">
<i class="fas fa-fingerprint"></i>
</a>
</p> </p>
<p class="control is-expanded"> <p class="control is-expanded">
<input id="myPub" class="input myPub" type="text" readonly> <input id="myPub" class="input myPub" type="text" readonly>

28
tests/test_timeinsert.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import unittest, sys
sys.path.append(".")
sys.path.append("src/")
from onionrblocks import time_insert
from onionrblocks import onionrblockapi
class TestTimeInsert(unittest.TestCase):
def test_time_insert_none(self):
bl = time_insert('test')
self.assertTrue(bl)
bl = onionrblockapi.Block(bl)
self.assertIs(bl.bmetadata['dly'], 0)
def test_time_insert_10(self):
bl = time_insert('test', delay=10)
self.assertTrue(bl)
bl = onionrblockapi.Block(bl)
self.assertIs(bl.bmetadata['dly'], 10)
def test_negative(self):
self.assertRaises(ValueError, time_insert, 'test', delay=-1)
self.assertRaises(ValueError, time_insert, 'test', delay=-10)
unittest.main()