moved static data one directory up

This commit is contained in:
Kevin Froman 2019-09-23 17:56:05 -05:00
parent e4df34ef29
commit 09f6735961
124 changed files with 27 additions and 54 deletions

View File

@ -50,7 +50,7 @@ def client_api_insert_block():
try: try:
if bData['encrypt']: if bData['encrypt']:
to = bData['to'].strip() to = bData['to'].strip()
if " " in to: if "-" in to:
to = mnemonickeys.get_base32(to) to = mnemonickeys.get_base32(to)
encrypt = True encrypt = True
encryptType = 'asym' encryptType = 'asym'

View File

@ -28,7 +28,7 @@ mimetypes.add_type('text/css', '.css')
static_files_bp = Blueprint('staticfiles', __name__) static_files_bp = Blueprint('staticfiles', __name__)
root = os.getcwd() + '/static-data/www/' # should be set to onionr install directory from onionr startup root = os.path.dirname(os.path.realpath(__file__)) + '/../../../static-data/www/' # should be set to onionr install directory from onionr startup
@static_files_bp.route('/chat/', endpoint='chatIndex') @static_files_bp.route('/chat/', endpoint='chatIndex')
def chat_index(): def chat_index():

View File

@ -31,7 +31,7 @@ class PublicEndpoints:
def banner(): def banner():
# Display a bit of information to people who visit a node address in their browser # Display a bit of information to people who visit a node address in their browser
try: try:
with open('static-data/index.html', 'r') as html: with open('../static-data/index.html', 'r') as html:
resp = Response(html.read(), mimetype='text/html') resp = Response(html.read(), mimetype='text/html')
except FileNotFoundError: except FileNotFoundError:
resp = Response("") resp = Response("")

View File

@ -1,3 +1,3 @@
from . import client # Client connection warden. Monitors & validates connection security. from . import client # Client connection warden. Monitors & validates connection security.
from . import server # Server connection warden. Monitors and validates server security from . import server # Server connection warden. Monitors and validates server security
from . import watchdog # Watchdog. Oversees running services for statistic collection and TTL control #from . import watchdog # Watchdog. Oversees running services for statistic collection and TTL control

View File

@ -21,13 +21,14 @@ import os, shutil
import onionrplugins as plugins import onionrplugins as plugins
import logger import logger
import filepaths
def setup_default_plugins(): def setup_default_plugins():
# Copy default plugins into plugins folder # Copy default plugins into plugins folder
if not os.path.exists(plugins.get_plugins_folder()): if not os.path.exists(plugins.get_plugins_folder()):
if os.path.exists('static-data/default-plugins/'): if os.path.exists('../static-data/default-plugins/'):
names = [f for f in os.listdir("static-data/default-plugins/")] names = [f for f in os.listdir("../static-data/default-plugins/")]
shutil.copytree('static-data/default-plugins/', plugins.get_plugins_folder()) shutil.copytree('../static-data/default-plugins/', plugins.get_plugins_folder())
# Enable plugins # Enable plugins
for name in names: for name in names:

View File

@ -1,44 +0,0 @@
'''
$name plugin template file.
Generated on $date by $user.
'''
# Imports some useful libraries
import logger, config
from onionrblockapi import Block
plugin_name = '$name'
def on_init(api, data = None):
'''
This event is called after Onionr is initialized, but before the command
inputted is executed. Could be called when daemon is starting or when
just the client is running.
'''
# Doing this makes it so that the other functions can access the api object
# by simply referencing the variable `pluginapi`.
global pluginapi
pluginapi = api
return
def on_start(api, data = None):
'''
This event can be called for multiple reasons:
1) The daemon is starting
2) The user called `onionr --start-plugins` or `onionr --reload-plugins`
3) For whatever reason, the plugins are reloading
'''
return
def on_stop(api, data = None):
'''
This event can be called for multiple reasons:
1) The daemon is stopping
2) The user called `onionr --stop-plugins` or `onionr --reload-plugins`
3) For whatever reason, the plugins are reloading
'''
return

View File

@ -21,7 +21,7 @@
from typing import Union from typing import Union
import os import os
def get_static_dir()->str: def get_static_dir()->str:
return os.path.dirname(os.path.realpath(__file__)) + '/../static-data/' return os.path.dirname(os.path.realpath(__file__)) + '/../../static-data/'
def read_static(file:str, ret_bin:bool=False)->Union[str, bytes]: def read_static(file:str, ret_bin:bool=False)->Union[str, bytes]:
static_file = get_static_dir() + file static_file = get_static_dir() + file

16
static-data/default_plugin.py Executable file
View File

@ -0,0 +1,16 @@
'''
$name plugin template file.
Generated on $date by $user.
'''
plugin_name = '$name'
def on_init(api, data = None):
'''
This event is called after Onionr is initialized, but before the command
inputted is executed. Could be called when daemon is starting or when
just the client is running.
'''
pluginapi = api

View File

@ -35,5 +35,5 @@ function setHumanReadableIDOnPost(el, key){
}) })
return return
} }
el.innerText = humanReadableKeys[key].split(' ').slice(0, 3).join(' ') el.innerText = humanReadableKeys[key].split('-').slice(0, 3).join(' ')
} }

View File

@ -58,7 +58,7 @@ sendForm.onsubmit = function(){
return false return false
} }
} }
if (! to.value.includes(" ") && to.value.length !== 56 && to.value.length !== 52){ if (! to.value.includes("-") && to.value.length !== 56 && to.value.length !== 52){
PNotify.error({ PNotify.error({
text: 'User ID is not valid' text: 'User ID is not valid'
}) })

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Some files were not shown because too many files have changed in this diff Show More