progress in removing core
This commit is contained in:
parent
8163292ed9
commit
e69c8dbb60
@ -47,9 +47,6 @@ class Core:
|
||||
self.maxBlockSize = 10000000 # max block size in bytes
|
||||
|
||||
self.onionrInst = None
|
||||
self.queueDB = self.dataDir + 'queue.db'
|
||||
self.peerDB = self.dataDir + 'peers.db'
|
||||
self.blockDB = self.dataDir + 'blocks.db'
|
||||
self.blockDataLocation = self.dataDir + 'blocks/'
|
||||
self.blockDataDB = self.blockDataLocation + 'block-data.db'
|
||||
self.publicApiHostFile = self.dataDir + 'public-host.txt'
|
||||
|
11
onionr/filepaths/__init__.py
Normal file
11
onionr/filepaths/__init__.py
Normal file
@ -0,0 +1,11 @@
|
||||
from utils import identifyhome
|
||||
home = identifyhome.identify_home()
|
||||
if not home.endswith('/') home += '/'
|
||||
|
||||
usage_file = home + 'disk-usage.txt'
|
||||
block_data_location = home + 'blocks/'
|
||||
public_API_host_file = home + 'public-host.txt'
|
||||
private_API_host_file = home + 'private-host.txt'
|
||||
bootstrap_file_location = 'static-data/bootstrap-nodes.txt'
|
||||
data_nonce_file = home + 'block-nonces.dat'
|
||||
forward_keys_file = home + 'forward-keys.db'
|
3
onionr/onionrcommands/dopex.py
Normal file
3
onionr/onionrcommands/dopex.py
Normal file
@ -0,0 +1,3 @@
|
||||
from coredb import daemonqueue
|
||||
def do_PEX():
|
||||
daemonqueue.daemon_queue_add('pex')
|
0
onionr/onionrcrypto/signing.py
Normal file
0
onionr/onionrcrypto/signing.py
Normal file
@ -17,10 +17,11 @@
|
||||
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 get_client_API_server(core_inst):
|
||||
import filepaths
|
||||
def get_client_API_server():
|
||||
retData = ''
|
||||
try:
|
||||
with open(core_inst.privateApiHostFile, 'r') as host:
|
||||
with open(filepaths.private_API_host_file, 'r') as host:
|
||||
hostname = host.read()
|
||||
except FileNotFoundError:
|
||||
raise FileNotFoundError
|
||||
|
@ -19,14 +19,11 @@
|
||||
'''
|
||||
import urllib, requests, time
|
||||
import logger
|
||||
from onionrutils import getclientapiserver
|
||||
def local_command(core_inst, command, data='', silent = True, post=False, postData = {}, maxWait=20):
|
||||
'''
|
||||
Send a command to the local http API server, securely. Intended for local clients, DO NOT USE for remote peers.
|
||||
'''
|
||||
# TODO: URL encode parameters, just as an extra measure. May not be needed, but should be added regardless.
|
||||
hostname = ''
|
||||
waited = 0
|
||||
from . import getclientapiserver
|
||||
hostname = ''
|
||||
waited = 0
|
||||
maxWait = 3
|
||||
def get_hostname():
|
||||
while hostname == '':
|
||||
try:
|
||||
hostname = getclientapiserver.get_client_API_server(core_inst)
|
||||
@ -35,6 +32,16 @@ def local_command(core_inst, command, data='', silent = True, post=False, postDa
|
||||
waited += 1
|
||||
if waited == maxWait:
|
||||
return False
|
||||
return hostname
|
||||
hostname = get_hostname()
|
||||
|
||||
def local_command(core_inst, command, data='', silent = True, post=False, postData = {}, maxWait=20):
|
||||
'''
|
||||
Send a command to the local http API server, securely. Intended for local clients, DO NOT USE for remote peers.
|
||||
'''
|
||||
# TODO: URL encode parameters, just as an extra measure. May not be needed, but should be added regardless.
|
||||
if hostname == False:
|
||||
hostname = get_hostname()
|
||||
if data != '':
|
||||
data = '&data=' + urllib.parse.quote_plus(data)
|
||||
payload = 'http://%s/%s%s' % (hostname, command, data)
|
||||
|
Loading…
Reference in New Issue
Block a user