From 37f1b5bbb03398834c5f53ee96ce03c726e383db Mon Sep 17 00:00:00 2001 From: helloplhm-qwq Date: Sun, 24 Dec 2023 15:56:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=9C=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=9A=84=E6=BA=90=E8=84=9A=E6=9C=AC=E7=9A=84?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.py | 9 ++++++++- common/lx_script.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/common/config.py b/common/config.py index 4880eb5..c41e34c 100644 --- a/common/config.py +++ b/common/config.py @@ -66,7 +66,14 @@ default = { "log_file": True, "_log_file-desc": "是否开启日志文件", "allow_download_script": True, - '_allow_download_script-desc': '是否允许直接从服务端下载脚本,开启后可以直接访问/script下载脚本', + '_allow_download_script-desc': '是否允许直接从服务端下载脚本,开启后可以直接访问 /script?key=你的请求key 下载脚本', + "download_config": { + "desc": "源脚本的相关配置", + "name": "修改为你的源脚本名称", + "intro": "修改为你的源脚本描述", + "author": "修改为你的源脚本作者", + "version": "修改为你的源版本" + } }, "security": { "rate_limit": { diff --git a/common/lx_script.py b/common/lx_script.py index 96f0318..41f416d 100644 --- a/common/lx_script.py +++ b/common/lx_script.py @@ -55,6 +55,16 @@ async def generate_script_response(request): newScriptLines.append(f'const API_URL = "{request.scheme}://{request.host}"') elif (line.startswith('const API_KEY')): newScriptLines.append(f'const API_KEY = "{config.read_config("security.key.value")}"') + elif (line.startswith("/*")): + newScriptLines.append(" /*") + elif (line.startswith("* @name")): + newScriptLines.append(" * @name " + config.read_config("common.download_config.name")) + elif (line.startswith("* @description")): + newScriptLines.append(" * @description " + config.read_config("common.download_config.intro")) + elif (line.startswith("* @author")): + newScriptLines.append((" * @author helloplhm-qwq & Folltoshe & " + config.read_config("common.download_config.author")) if config.read_config("common.download_config.author") else " * @author helloplhm-qwq & Folltoshe") + elif (line.startswith("* @version")): + newScriptLines.append(" * @name " + config.read_config("common.download_config.version")) else: newScriptLines.append(line)