pull/10/head
Steve Nyemba 6 months ago
parent d5ecc89479
commit b468e1ad0a

@ -5,6 +5,7 @@ import os
import importlib import importlib
import importlib.util import importlib.util
import copy import copy
import mistune
from mistune import markdown from mistune import markdown
import re import re
@ -122,7 +123,8 @@ def html(_uri,_config) :
_api = os.sep.join([f'{_context}/api/disk/read?uri=',_layout['root']]) _api = os.sep.join([f'{_context}/api/disk/read?uri=',_layout['root']])
if f"{_layout['root']}{os.sep}" in _html : if f"{_layout['root']}{os.sep}" in _html :
_html = _html.replace(f"{_layout['root']}",_api) _html = _html.replace(f"{_layout['root']}",_api)
_html = markdown(_html).replace("&quot;",'"').replace("&lt;","<").replace("&gt;",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html _html = mistune.html(_html).replace("&quot;",'"').replace("&lt;","<").replace("&gt;",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html
return _html return _html
def plugins (**_args): def plugins (**_args):

@ -118,7 +118,7 @@ def _index (_path,root):
</p> </p>
""" """
_indexfile = os.sep.join([_path,'index.html']) _indexfile = os.sep.join([_path,'index.html'])
if os.path.exists(_indexfile): if not os.path.exists(_indexfile) and os.path.exists(_path):
# #
# In case a project needs to be upgraded ... # In case a project needs to be upgraded ...
f = open(_indexfile,'w') f = open(_indexfile,'w')
@ -149,6 +149,7 @@ def make (**_args) :
f.close() f.close()
_ilogo(os.sep.join([_folder,_root])) _ilogo(os.sep.join([_folder,_root]))
print ([_folder,_root])
_index(os.sep.join([_folder,_root]),_root) _index(os.sep.join([_folder,_root]),_root)
_itheme(_folder,_root) _itheme(_folder,_root)

@ -177,23 +177,41 @@ def _version ():
_handler = _route.get() _handler = _route.get()
global _config global _config
return _handler.system()['version'] return _handler.system()['version']
@_app.route('/reload',methods=['POST']) @_app.route("/reload/<key>")
def reload(): def _reload(key) :
global _route global _route
_handler = _route.get_main() _handler = _route.get_main()
_system = _handler.system() _system = _handler.system()
_key = request.headers['key'] if 'key' in request.headers else None
if not 'source' in _system : if not 'source' in _system :
_systemKey = None _systemKey = None
elif 'key' in _system['source'] and _system['source']['key']: elif 'key' in _system['source'] and _system['source']['key']:
_systemKey = _system['source']['key'] _systemKey = _system['source']['key']
print ([_key,_systemKey,_systemKey == _key]) print ([key,_systemKey,_systemKey == key])
if _key and _systemKey and _systemKey == _key : if key and _systemKey and _systemKey == key :
_handler.reload() _handler.reload()
return "",200 return "",200
pass pass
return "",403 return "",403
@_app.route('/reload',methods=['POST'])
def reload():
# global _route
# _handler = _route.get_main()
# _system = _handler.system()
_key = request.headers['key'] if 'key' in request.headers else None
return _reload(_key)
# if not 'source' in _system :
# _systemKey = None
# elif 'key' in _system['source'] and _system['source']['key']:
# _systemKey = _system['source']['key']
# print ([_key,_systemKey,_systemKey == _key])
# if _key and _systemKey and _systemKey == _key :
# _handler.reload()
# return "",200
# pass
# return "",403
@_app.route('/page',methods=['POST']) @_app.route('/page',methods=['POST'])
def cms_page(): def cms_page():
""" """

@ -69,7 +69,7 @@ Vanderbilt University Medical Center
</script> </script>
<body> <body>
<div class="main"> <div class="main {{system.theme}}">
<div id="header" class="header" onclick="window.location.href='{{system.context}}/'" style="cursor:pointer"> <div id="header" class="header" onclick="window.location.href='{{system.context}}/'" style="cursor:pointer">
{%include "header.html" %} {%include "header.html" %}
</div> </div>

Loading…
Cancel
Save