moved static data one directory up
|
@ -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'
|
||||||
|
|
|
@ -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():
|
||||||
|
|
|
@ -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("")
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
||||||
|
|
0
onionr/static-data/www/profiles/profiles.js → static-data/default-plugins/chat/settings.py
Executable file → Normal 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
|
||||||
|
|
|
@ -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(' ')
|
||||||
}
|
}
|
|
@ -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'
|
||||||
})
|
})
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 675 KiB After Width: | Height: | Size: 675 KiB |
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 820 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |