From 3533a7268120c5e5672d1222c316d2cc5571d27f Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Mon, 28 Oct 2024 18:07:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=9F=90=E4=B8=AA=E5=B9=B3=E5=8F=B0=E7=9A=84=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/default_config.py | 5 +++++ main.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/common/default_config.py b/common/default_config.py index e04a3c7..0107dda 100644 --- a/common/default_config.py +++ b/common/default_config.py @@ -84,6 +84,7 @@ security: module: kg: # 酷狗音乐相关配置 + enable: true # 是否开启本平台服务 client: # 客户端请求配置,不懂请保持默认,修改请统一为字符串格式 appid: "1005" # 酷狗音乐的appid,官方安卓为1005,官方PC为1001 signatureKey: OIlwieks28dk2k092lksi2UIkp # 客户端signature采用的key值,需要与appid对应 @@ -113,6 +114,7 @@ module: login_url: http://login.user.kugou.com/v4/login_by_token tx: # QQ音乐相关配置 + enable: true # 是否开启本平台服务 vkeyserver: # 请求官方api时使用的guid,uin等信息,不需要与cookie中信息一致 guid: "114514" uin: "10086" @@ -128,6 +130,7 @@ module: vkey_api_url: "xxx" wy: # 网易云音乐相关配置 + enable: true # 是否开启本平台服务 user: cookie: "" # 账号cookie数据,可以通过浏览器获取,需要vip账号来获取会员歌曲,如果没有请留为空值 refresh_login: @@ -135,6 +138,7 @@ module: interval: 86400 mg: # 咪咕音乐相关配置 + enable: true # 是否开启本平台服务 user: # 研究不深,后两项自行抓包获取,网页端cookie by: "" session: "" @@ -144,6 +148,7 @@ module: interval: 86400 kw: # 酷我音乐相关配置,proto支持值:['bd-api', 'kuwodes'] + enable: true # 是否开启本平台服务 proto: bd-api user: uid: "0" diff --git a/main.py b/main.py index 0dd3f5f..0a10007 100644 --- a/main.py +++ b/main.py @@ -150,6 +150,14 @@ async def handle(request): try: query = dict(request.query) if (method in dir(modules)): + source_enable = config.read_config(f'module.{source}.enable') + if not source_enable: + return handleResult({ + 'code': 4, + 'msg': '此平台已停止服务', + 'data': None, + "Your IP": request.remote_addr + }, 404) return handleResult(await getattr(modules, method)(source, songId, quality, query)) else: return handleResult(await modules.other(method, source, songId, quality, query))