Moved plugin web files to be in the plugin folder to reduce staticfiles blueprint coupling
This commit is contained in:
		
							parent
							
								
									14f2d03ebf
								
							
						
					
					
						commit
						37e5dbab4b
					
				
					 23 changed files with 37 additions and 40 deletions
				
			
		| 
						 | 
				
			
			@ -43,31 +43,6 @@ def onboard_files(path):
 | 
			
		|||
    return send_from_directory(f'{root}onboarding/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/chat/', endpoint='chatIndex')
 | 
			
		||||
def chat_index():
 | 
			
		||||
    return send_from_directory(root + 'chat/', "index.html")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/chat/<path:path>', endpoint='chat')
 | 
			
		||||
def load_chat(path):
 | 
			
		||||
    return send_from_directory(root + 'chat/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/board/', endpoint='board')
 | 
			
		||||
def loadBoard():
 | 
			
		||||
    return send_from_directory(root + 'board/', "index.html")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/mail/<path:path>', endpoint='mail')
 | 
			
		||||
def loadMail(path):
 | 
			
		||||
    return send_from_directory(root + 'mail/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/mail/', endpoint='mailindex')
 | 
			
		||||
def loadMailIndex():
 | 
			
		||||
    return send_from_directory(root + 'mail/', 'index.html')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/friends/<path:path>', endpoint='friends')
 | 
			
		||||
def loadContacts(path):
 | 
			
		||||
    return send_from_directory(root + 'friends/', path)
 | 
			
		||||
| 
						 | 
				
			
			@ -88,10 +63,6 @@ def loadContacts():
 | 
			
		|||
    return send_from_directory(root + 'profiles/', 'index.html')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/board/<path:path>', endpoint='boardContent')
 | 
			
		||||
def boardContent(path):
 | 
			
		||||
    return send_from_directory(root + 'board/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@static_files_bp.route('/shared/<path:path>', endpoint='sharedContent')
 | 
			
		||||
def sharedContent(path):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@ import os
 | 
			
		|||
import ujson as json
 | 
			
		||||
 | 
			
		||||
from flask import Response, Blueprint
 | 
			
		||||
from flask import send_from_directory
 | 
			
		||||
from deadsimplekv import DeadSimpleKV
 | 
			
		||||
 | 
			
		||||
from utils import identifyhome
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +29,9 @@ from utils import identifyhome
 | 
			
		|||
 | 
			
		||||
flask_blueprint = Blueprint('circles', __name__)
 | 
			
		||||
 | 
			
		||||
root = os.path.dirname(os.path.realpath(__file__))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
with open(
 | 
			
		||||
    os.path.dirname(
 | 
			
		||||
        os.path.realpath(__file__)) + '/info.json', 'r') as info_file:
 | 
			
		||||
| 
						 | 
				
			
			@ -41,6 +45,15 @@ read_only_cache = DeadSimpleKV(
 | 
			
		|||
    flush_on_exit=False,
 | 
			
		||||
    refresh_seconds=30)
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/board/<path:path>', endpoint='circlesstatic')
 | 
			
		||||
def load_mail(path):
 | 
			
		||||
    return send_from_directory(root + '/web/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/board/', endpoint='circlesindex')
 | 
			
		||||
def load_mail_index():
 | 
			
		||||
    return send_from_directory(root + '/web/', 'index.html')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/circles/getpostsbyboard/<board>')
 | 
			
		||||
def get_post_by_board(board):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ import flowapi  # noqa
 | 
			
		|||
"""
 | 
			
		||||
 | 
			
		||||
flask_blueprint = flowapi.flask_blueprint
 | 
			
		||||
security_whitelist = ['staticfiles.boardContent', 'staticfiles.board']
 | 
			
		||||
security_whitelist = ['circles.circlesstatic', 'circles.circlesindex']
 | 
			
		||||
 | 
			
		||||
plugin_name = 'circles'
 | 
			
		||||
PLUGIN_VERSION = '0.1.0'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ import os
 | 
			
		|||
 | 
			
		||||
import ujson as json
 | 
			
		||||
from flask import Response, request, redirect, Blueprint, abort
 | 
			
		||||
from flask import send_from_directory
 | 
			
		||||
import deadsimplekv as simplekv
 | 
			
		||||
 | 
			
		||||
from onionrusers import contactmanager
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +33,18 @@ import sentboxdb
 | 
			
		|||
"""
 | 
			
		||||
flask_blueprint = Blueprint('mail', __name__)
 | 
			
		||||
kv = simplekv.DeadSimpleKV(identifyhome.identify_home() + '/mailcache.dat')
 | 
			
		||||
root = os.path.dirname(os.path.realpath(__file__))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/mail/<path:path>', endpoint='mailstatic')
 | 
			
		||||
def load_mail(path):
 | 
			
		||||
    return send_from_directory(root + '/web/', path)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/mail/', endpoint='mailindex')
 | 
			
		||||
def load_mail_index():
 | 
			
		||||
    return send_from_directory(root + '/web/', 'index.html')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@flask_blueprint.route('/mail/ping')
 | 
			
		||||
def mail_ping():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ import sentboxdb, mailapi, loadinbox # import after path insert
 | 
			
		|||
from onblacklist import on_blacklist_add
 | 
			
		||||
 | 
			
		||||
flask_blueprint = mailapi.flask_blueprint
 | 
			
		||||
security_whitelist = ['staticfiles.mail', 'staticfiles.mailindex']
 | 
			
		||||
security_whitelist = ['mail.mailstatic', 'mail.mailindex']
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_deleted(keyStore, b_hash):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,16 +8,16 @@
 | 
			
		|||
    "general": {
 | 
			
		||||
        "allow_public_api_dns_rebinding": false,
 | 
			
		||||
        "announce_node": true,
 | 
			
		||||
        "dev_mode": false,
 | 
			
		||||
        "dev_mode": true,
 | 
			
		||||
        "display_header": true,
 | 
			
		||||
        "ephemeral_tunnels": false,
 | 
			
		||||
        "hide_created_blocks": true,
 | 
			
		||||
        "insert_deniable_blocks": true,
 | 
			
		||||
        "insert_deniable_blocks": false,
 | 
			
		||||
        "max_block_age": 2678400,
 | 
			
		||||
        "minimum_block_pow": 5,
 | 
			
		||||
        "minimum_send_pow": 5,
 | 
			
		||||
        "minimum_block_pow": 1,
 | 
			
		||||
        "minimum_send_pow": 1,
 | 
			
		||||
        "public_key": "",
 | 
			
		||||
        "random_bind_ip": true,
 | 
			
		||||
        "random_bind_ip": false,
 | 
			
		||||
        "security_level": 0,
 | 
			
		||||
        "show_notifications": true,
 | 
			
		||||
        "store_plaintext_blocks": true,
 | 
			
		||||
| 
						 | 
				
			
			@ -31,12 +31,12 @@
 | 
			
		|||
        },
 | 
			
		||||
        "file": {
 | 
			
		||||
            "output": true,
 | 
			
		||||
            "remove_on_exit": true
 | 
			
		||||
            "remove_on_exit": false
 | 
			
		||||
        },
 | 
			
		||||
        "verbosity": "default"
 | 
			
		||||
    },
 | 
			
		||||
    "onboarding": {
 | 
			
		||||
        "done": false
 | 
			
		||||
        "done": true
 | 
			
		||||
    },
 | 
			
		||||
    "peers": {
 | 
			
		||||
        "max_connect": 1000,
 | 
			
		||||
| 
						 | 
				
			
			@ -69,10 +69,10 @@
 | 
			
		|||
    "transports": {
 | 
			
		||||
        "lan": true,
 | 
			
		||||
        "sneakernet": true,
 | 
			
		||||
        "tor": true
 | 
			
		||||
        "tor": false
 | 
			
		||||
    },
 | 
			
		||||
    "ui": {
 | 
			
		||||
        "animated_background": true,
 | 
			
		||||
        "animated_background": false,
 | 
			
		||||
        "theme": "dark"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue