From 7937747a0599a2c88a6a407fb8ca151dbb4436d9 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 19 Oct 2024 22:45:13 +0800 Subject: [PATCH] update --- plugins/fail2ban/index.py | 7 +++++-- plugins/fail2ban/info.json | 2 +- plugins/fail2ban/js/fail2ban.js | 5 +++++ plugins/gitea/index.py | 4 ++-- web/admin/config/__init__.py | 8 +++++++- web/admin/plugins/__init__.py | 8 +++++++- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/plugins/fail2ban/index.py b/plugins/fail2ban/index.py index bddb4bca9..efe3f900f 100755 --- a/plugins/fail2ban/index.py +++ b/plugins/fail2ban/index.py @@ -282,13 +282,14 @@ def _read_conf(path, l=None): return json.loads(conf) def getBlackList(): - _black_list = getServerDir + "/black_list.json" + _black_list = getServerDir() + "/black_list.json" conf = _read_conf(_black_list, l=1) if not conf: return '' if not conf: return [] - return "\n".join(conf) + content = "\n".join(conf) + return mw.returnJson(True, 'ok', content) if __name__ == "__main__": func = sys.argv[1] @@ -318,5 +319,7 @@ if __name__ == "__main__": print(configTpl()) elif func == 'read_config_tpl': print(readConfigTpl()) + elif func == 'get_black_list': + print(getBlackList()) else: print('error') diff --git a/plugins/fail2ban/info.json b/plugins/fail2ban/info.json index fd1b917ee..8ee623a88 100755 --- a/plugins/fail2ban/info.json +++ b/plugins/fail2ban/info.json @@ -11,7 +11,7 @@ "path": "server/fail2ban", "display": 1, "author": "fail2ban", - "date": "2025-07-28", + "date": "2024-07-28", "home": "https://www.fail2ban.org", "type": 0, "pid": "4" diff --git a/plugins/fail2ban/js/fail2ban.js b/plugins/fail2ban/js/fail2ban.js index 9b9c44b60..9e0cc4d52 100755 --- a/plugins/fail2ban/js/fail2ban.js +++ b/plugins/fail2ban/js/fail2ban.js @@ -81,4 +81,9 @@ function f2bBanIp(){ matchBrackets:true, }); editor.focus(); + + f2bPost('get_black_list', '', {}, function(data){ + console.log(data); + }) } + diff --git a/plugins/gitea/index.py b/plugins/gitea/index.py index 770cf7acd..cffc4908b 100755 --- a/plugins/gitea/index.py +++ b/plugins/gitea/index.py @@ -418,7 +418,7 @@ def getGogsConf(): result = [] for g in gets: - rep = g['name'] + '\s*=\s*(.*)' + rep = g['name'] + '\\s*=\\s*(.*)' tmp = re.search(rep, conf) if not tmp: continue @@ -447,7 +447,7 @@ def submitGogsConf(): conf = mw.readFile(filename) for g in gets: if g in args: - rep = g + '\s*=\s*(.*)' + rep = g + '\\s*=\\s*(.*)' val = g + ' = ' + args[g] conf = re.sub(rep, val, conf) mw.writeFile(filename, conf) diff --git a/web/admin/config/__init__.py b/web/admin/config/__init__.py index b2f884856..869d8fcc6 100644 --- a/web/admin/config/__init__.py +++ b/web/admin/config/__init__.py @@ -14,4 +14,10 @@ from flask import Blueprint, render_template blueprint = Blueprint('config', __name__, url_prefix='/config', template_folder='../../templates/default') @blueprint.route('/index', endpoint='index') def index(): - return render_template('config.html', data={}) \ No newline at end of file + return render_template('config.html', data={}) + + + +@blueprint.route('/get_panel_list', endpoint='get_panel_list', methods=['POST']) +def get_panel_list(): + return [] \ No newline at end of file diff --git a/web/admin/plugins/__init__.py b/web/admin/plugins/__init__.py index 5349cc527..7b39d1974 100644 --- a/web/admin/plugins/__init__.py +++ b/web/admin/plugins/__init__.py @@ -14,4 +14,10 @@ from flask import Blueprint, render_template blueprint = Blueprint('plugins', __name__, url_prefix='/plugins', template_folder='../../templates/default') @blueprint.route('/index', endpoint='index') def index(): - return render_template('plugins.html', data={}) \ No newline at end of file + return render_template('plugins.html', data={}) + + +# 插件列表 +@blueprint.route('/list', endpoint='list', methods=['GET']) +def list(): + return [] \ No newline at end of file