mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
增加global_static hook关键字,并优化menu的文件加载hook
"hook":[
{
"tag":"global_static",
"global_static": {
"css_path":"menu/own_style.css",
"js_path":"js/own_style.js"
}
}
],
This commit is contained in:
@@ -162,6 +162,7 @@ plugins/openlitespeed
|
|||||||
plugins/system_safe
|
plugins/system_safe
|
||||||
plugins/tamper_proof
|
plugins/tamper_proof
|
||||||
plugins/tamper_proof_*
|
plugins/tamper_proof_*
|
||||||
|
plugins/cryptocurrency_trade
|
||||||
plugins/op_load_balance
|
plugins/op_load_balance
|
||||||
plugins/gdrive
|
plugins/gdrive
|
||||||
plugins/mtproxy
|
plugins/mtproxy
|
||||||
|
|||||||
@@ -824,7 +824,9 @@ class config_api:
|
|||||||
data['username'] = mw.M('users').where(
|
data['username'] = mw.M('users').where(
|
||||||
"id=?", (1,)).getField('username')
|
"id=?", (1,)).getField('username')
|
||||||
|
|
||||||
# databases hook 获取
|
data['hook_tag'] = request.args.get('tag', '')
|
||||||
|
|
||||||
|
# databases hook
|
||||||
database_hook_file = 'data/hook_database.json'
|
database_hook_file = 'data/hook_database.json'
|
||||||
if os.path.exists(database_hook_file):
|
if os.path.exists(database_hook_file):
|
||||||
df = mw.readFile(database_hook_file)
|
df = mw.readFile(database_hook_file)
|
||||||
@@ -833,7 +835,7 @@ class config_api:
|
|||||||
else:
|
else:
|
||||||
data['hook_database'] = []
|
data['hook_database'] = []
|
||||||
|
|
||||||
# menu hook 获取
|
# menu hook
|
||||||
menu_hook_file = 'data/hook_menu.json'
|
menu_hook_file = 'data/hook_menu.json'
|
||||||
if os.path.exists(menu_hook_file):
|
if os.path.exists(menu_hook_file):
|
||||||
df = mw.readFile(menu_hook_file)
|
df = mw.readFile(menu_hook_file)
|
||||||
@@ -842,4 +844,13 @@ class config_api:
|
|||||||
else:
|
else:
|
||||||
data['hook_menu'] = []
|
data['hook_menu'] = []
|
||||||
|
|
||||||
|
# global_static hook
|
||||||
|
global_static_hook_file = 'data/hook_global_static.json'
|
||||||
|
if os.path.exists(global_static_hook_file):
|
||||||
|
df = mw.readFile(global_static_hook_file)
|
||||||
|
df = json.loads(df)
|
||||||
|
data['hook_global_static'] = df
|
||||||
|
else:
|
||||||
|
data['hook_global_static'] = []
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class plugins_api:
|
|||||||
|
|
||||||
def hookInstall(self, info):
|
def hookInstall(self, info):
|
||||||
valid_hook = ['backup', 'database']
|
valid_hook = ['backup', 'database']
|
||||||
valid_list_hook = ['menu']
|
valid_list_hook = ['menu', 'global_static']
|
||||||
if 'hook' in info:
|
if 'hook' in info:
|
||||||
hooks = info['hook']
|
hooks = info['hook']
|
||||||
for h in hooks:
|
for h in hooks:
|
||||||
@@ -271,6 +271,7 @@ class plugins_api:
|
|||||||
tag = h['tag']
|
tag = h['tag']
|
||||||
if tag in valid_list_hook:
|
if tag in valid_list_hook:
|
||||||
self.hookInstallFile(tag, h[tag])
|
self.hookInstallFile(tag, h[tag])
|
||||||
|
return True
|
||||||
elif hooks_type == str:
|
elif hooks_type == str:
|
||||||
for x in hooks:
|
for x in hooks:
|
||||||
if x in valid_hook:
|
if x in valid_hook:
|
||||||
@@ -280,7 +281,7 @@ class plugins_api:
|
|||||||
|
|
||||||
def hookUninstall(self, info):
|
def hookUninstall(self, info):
|
||||||
valid_hook = ['backup', 'database']
|
valid_hook = ['backup', 'database']
|
||||||
valid_list_hook = ['menu']
|
valid_list_hook = ['menu', 'global_static']
|
||||||
if 'hook' in info:
|
if 'hook' in info:
|
||||||
hooks = info['hook']
|
hooks = info['hook']
|
||||||
for h in hooks:
|
for h in hooks:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class App():
|
|||||||
|
|
||||||
self.__host_dir = self.getServerDir() + '/host'
|
self.__host_dir = self.getServerDir() + '/host'
|
||||||
if not os.path.exists(self.__host_dir):
|
if not os.path.exists(self.__host_dir):
|
||||||
os.makedirs(self.__host_dir)
|
mw.execShell('mkdir -p ' + self.__host_dir)
|
||||||
|
|
||||||
def getPluginName(self):
|
def getPluginName(self):
|
||||||
return 'webssh'
|
return 'webssh'
|
||||||
|
|||||||
@@ -2,35 +2,42 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<title>{{data['title']}}</title>
|
<title>{{data['title']}}</title>
|
||||||
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
|
||||||
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css?v={{config.version}}" rel="stylesheet">
|
||||||
<link href="/static/css/site.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/css/site.css?v={{config.version}}" rel="stylesheet">
|
||||||
<link href="/static/codemirror/lib/codemirror.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/codemirror/lib/codemirror.css?v={{config.version}}" rel="stylesheet">
|
||||||
<script src="/static/language/Simplified_Chinese/lan.js?v={{config.version}}"></script>
|
<script src="/static/language/Simplified_Chinese/lan.js?v={{config.version}}"></script>
|
||||||
<!--[if lte IE 9]>
|
<!--[if lte IE 9]>
|
||||||
<script src="/static/js/requestAnimationFrame.js"></script>
|
<script src="/static/js/requestAnimationFrame.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<!-- 统计一下用户量,让我的开发更有激情 -->
|
<!-- 统计一下用户量,让我的开发更有激情 -->
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FC74BB2RGD"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FC74BB2RGD"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', 'G-FC74BB2RGD');
|
gtag('config', 'G-FC74BB2RGD');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% for menu in data['hook_menu'] %}
|
{% for menu in data['hook_menu'] %}
|
||||||
{% if menu['js_path'] %}
|
{% if menu['css_path'] and data['hook_tag'] == menu['name'] %}
|
||||||
<!-- 加载插件css -->
|
<!-- 加载插件css -->
|
||||||
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- 全局静态HOOK -->
|
||||||
|
{% for menu in data['hook_global_static'] %}
|
||||||
|
{% if menu['css_path'] %}
|
||||||
|
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -85,9 +92,9 @@
|
|||||||
<div class="footer bgw">mdserver-web ©2018-∞ Linux面板 (<a class="btlink" target="_blank" href="//github.com/midoks/mdserver-web">源码</a>) <span style="margin-left:5px;">/</span>
|
<div class="footer bgw">mdserver-web ©2018-∞ Linux面板 (<a class="btlink" target="_blank" href="//github.com/midoks/mdserver-web">源码</a>) <span style="margin-left:5px;">/</span>
|
||||||
<a class="btlink" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki" target="_blank">WIKI</a><span style="margin-left:5px;">/</span>
|
<a class="btlink" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki" target="_blank">WIKI</a><span style="margin-left:5px;">/</span>
|
||||||
<a class='btlink panel_ad_list_mode' style="margin-left:5px;">AD</a>
|
<a class='btlink panel_ad_list_mode' style="margin-left:5px;">AD</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -158,8 +165,14 @@ if (thisPath.indexOf('?')>-1){
|
|||||||
<script src="/static/laydate/laydate.js?v={{config.version}}"></script>
|
<script src="/static/laydate/laydate.js?v={{config.version}}"></script>
|
||||||
|
|
||||||
{% for menu in data['hook_menu'] %}
|
{% for menu in data['hook_menu'] %}
|
||||||
|
{% if menu['js_path'] and data['hook_tag'] == menu['name'] %}
|
||||||
|
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- 全局静态HOOK -->
|
||||||
|
{% for menu in data['hook_global_static'] %}
|
||||||
{% if menu['js_path'] %}
|
{% if menu['js_path'] %}
|
||||||
<!-- 加载插件js -->
|
|
||||||
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user