Browse Source

Moved plugin web files to be in the plugin folder to reduce staticfiles blueprint coupling

tags/release-5.1.0
Kevin Froman 1 month ago
parent
commit
37e5dbab4b
23 changed files with 37 additions and 40 deletions
  1. +0
    -29
      src/httpapi/miscclientapi/staticfiles.py
  2. +13
    -0
      static-data/default-plugins/circles/flowapi.py
  3. +1
    -1
      static-data/default-plugins/circles/main.py
  4. +0
    -0
      static-data/default-plugins/circles/web/autorefresh.js
  5. +0
    -0
      static-data/default-plugins/circles/web/board.js
  6. +0
    -0
      static-data/default-plugins/circles/web/default-circle-picker.js
  7. +0
    -0
      static-data/default-plugins/circles/web/detect-plaintext-storage.js
  8. +0
    -0
      static-data/default-plugins/circles/web/index.html
  9. +0
    -0
      static-data/default-plugins/circles/web/popular.js
  10. +0
    -0
      static-data/default-plugins/circles/web/sethumanreadable.js
  11. +0
    -0
      static-data/default-plugins/circles/web/sort-posts.js
  12. +0
    -0
      static-data/default-plugins/circles/web/theme.css
  13. +13
    -0
      static-data/default-plugins/pms/mailapi.py
  14. +1
    -1
      static-data/default-plugins/pms/main.py
  15. +0
    -0
      static-data/default-plugins/pms/web/closesettings.js
  16. +0
    -0
      static-data/default-plugins/pms/web/index.html
  17. +0
    -0
      static-data/default-plugins/pms/web/loadsettings.js
  18. +0
    -0
      static-data/default-plugins/pms/web/mail.css
  19. +0
    -0
      static-data/default-plugins/pms/web/mail.js
  20. +0
    -0
      static-data/default-plugins/pms/web/sendmail.js
  21. +0
    -0
      static-data/default-plugins/pms/web/sethumanreadable.js
  22. +0
    -0
      static-data/default-plugins/pms/web/settings.js
  23. +9
    -9
      static-data/default_config.json

+ 0
- 29
src/httpapi/miscclientapi/staticfiles.py View File

@@ -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):


+ 13
- 0
static-data/default-plugins/circles/flowapi.py View File

@@ -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):


+ 1
- 1
static-data/default-plugins/circles/main.py View File

@@ -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'


static-data/www/board/autorefresh.js → static-data/default-plugins/circles/web/autorefresh.js View File


static-data/www/board/board.js → static-data/default-plugins/circles/web/board.js View File


static-data/www/board/default-circle-picker.js → static-data/default-plugins/circles/web/default-circle-picker.js View File


static-data/www/board/detect-plaintext-storage.js → static-data/default-plugins/circles/web/detect-plaintext-storage.js View File


static-data/www/board/index.html → static-data/default-plugins/circles/web/index.html View File


static-data/www/board/popular.js → static-data/default-plugins/circles/web/popular.js View File


static-data/www/board/sethumanreadable.js → static-data/default-plugins/circles/web/sethumanreadable.js View File


static-data/www/board/sort-posts.js → static-data/default-plugins/circles/web/sort-posts.js View File


static-data/www/board/theme.css → static-data/default-plugins/circles/web/theme.css View File


+ 13
- 0
static-data/default-plugins/pms/mailapi.py View File

@@ -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():


+ 1
- 1
static-data/default-plugins/pms/main.py View File

@@ -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):


static-data/www/mail/closesettings.js → static-data/default-plugins/pms/web/closesettings.js View File


static-data/www/mail/index.html → static-data/default-plugins/pms/web/index.html View File


static-data/www/mail/loadsettings.js → static-data/default-plugins/pms/web/loadsettings.js View File


static-data/www/mail/mail.css → static-data/default-plugins/pms/web/mail.css View File


static-data/www/mail/mail.js → static-data/default-plugins/pms/web/mail.js View File


static-data/www/mail/sendmail.js → static-data/default-plugins/pms/web/sendmail.js View File


static-data/www/mail/sethumanreadable.js → static-data/default-plugins/pms/web/sethumanreadable.js View File


static-data/www/mail/settings.js → static-data/default-plugins/pms/web/settings.js View File


+ 9
- 9
static-data/default_config.json View File

@@ -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…
Cancel
Save