From a20367b86e741abd05caf0500c099666367ae18e Mon Sep 17 00:00:00 2001 From: helloplhm-qwq Date: Sat, 13 Jan 2024 13:55:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=84=9A=E6=9C=AC=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.py | 7 +++++-- common/lx_script.py | 8 ++++++-- modules/kw/encrypt.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/common/config.py b/common/config.py index 582fda5..19203e3 100644 --- a/common/config.py +++ b/common/config.py @@ -52,7 +52,8 @@ default = { "ports": [ 9763 ], "_ports-desc": "服务器启动时所使用的端口", "ssl_info": { - "desc": "服务器https配置", + "desc": "服务器https配置,is_https是这个服务器是否是https服务器,如果你使用了反向代理来转发这个服务器,如果它使用了https,也请将它设置为true", + "is_https": False, "enable": False, "ssl_ports": [ 443 ], "path": { @@ -85,9 +86,11 @@ default = { "intro": "修改为你的源脚本描述", "author": "修改为你的源脚本作者", "version": "修改为你的源版本", + "filename": "lx-music-source.js", + "_filename-desc": "客户端保存脚本时的文件名(可能因浏览器不同出现不一样的情况)", "dev": True, "quality": { - "kw": ["128k", "320k", "flac"], + "kw": ["128k"], "kg": ["128k"], "tx": ["128k"], "wy": ["128k"], diff --git a/common/lx_script.py b/common/lx_script.py index aed1362..2ea02e4 100644 --- a/common/lx_script.py +++ b/common/lx_script.py @@ -79,6 +79,7 @@ async def generate_script_response(request): scriptLines = script.split('\n') newScriptLines = [] for line in scriptLines: + oline = line line = line.strip() if (line.startswith('const API_URL')): newScriptLines.append(f'const API_URL = "{request.scheme}://{request.host}"') @@ -95,14 +96,17 @@ async def generate_script_response(request): elif (line.startswith("const DEV_ENABLE ")): newScriptLines.append("const DEV_ENABLE = " + str(config.read_config("common.download_config.dev")).lower()) else: - newScriptLines.append(line) + newScriptLines.append(oline) r = '\n'.join(newScriptLines) r = re.sub(r'const MUSIC_QUALITY = {[^}]+}', f'const MUSIC_QUALITY = JSON.parse(\'{json.dumps(config.read_config("common.download_config.quality"))}\')', r) return Response(text = r, content_type = 'text/javascript', headers = { - 'Content-Disposition': 'attachment; filename=lx-music-source.js' + 'Content-Disposition': f'attachment; filename={ + config.read_config("common.download_config.filename") + if config.read_config("common.download_config.filename").endswith(".js") + else (config.read_config("common.download_config.filename" + ".js"))}' }) if (config.read_config('common.allow_download_script')): diff --git a/modules/kw/encrypt.py b/modules/kw/encrypt.py index f3303a0..e44751f 100644 --- a/modules/kw/encrypt.py +++ b/modules/kw/encrypt.py @@ -1,7 +1,7 @@ # ---------------------------------------- # - mode: python - # - author: helloplhm-qwq - -# - name: kwdes.py - +# - name: encrypt.py - # - project: lx-music-api-server - # - license: MIT - # ----------------------------------------