feat: 支持关闭某个平台的服务

This commit is contained in:
ikun0014 2024-10-28 18:07:25 +08:00
parent 88937e4917
commit 3533a72681
No known key found for this signature in database
GPG Key ID: CB646D33779F3C89
2 changed files with 13 additions and 0 deletions

View File

@ -84,6 +84,7 @@ security:
module: module:
kg: # 酷狗音乐相关配置 kg: # 酷狗音乐相关配置
enable: true # 是否开启本平台服务
client: # 客户端请求配置,不懂请保持默认,修改请统一为字符串格式 client: # 客户端请求配置,不懂请保持默认,修改请统一为字符串格式
appid: "1005" # 酷狗音乐的appid官方安卓为1005官方PC为1001 appid: "1005" # 酷狗音乐的appid官方安卓为1005官方PC为1001
signatureKey: OIlwieks28dk2k092lksi2UIkp # 客户端signature采用的key值需要与appid对应 signatureKey: OIlwieks28dk2k092lksi2UIkp # 客户端signature采用的key值需要与appid对应
@ -113,6 +114,7 @@ module:
login_url: http://login.user.kugou.com/v4/login_by_token login_url: http://login.user.kugou.com/v4/login_by_token
tx: # QQ音乐相关配置 tx: # QQ音乐相关配置
enable: true # 是否开启本平台服务
vkeyserver: # 请求官方api时使用的guiduin等信息不需要与cookie中信息一致 vkeyserver: # 请求官方api时使用的guiduin等信息不需要与cookie中信息一致
guid: "114514" guid: "114514"
uin: "10086" uin: "10086"
@ -128,6 +130,7 @@ module:
vkey_api_url: "xxx" vkey_api_url: "xxx"
wy: # 网易云音乐相关配置 wy: # 网易云音乐相关配置
enable: true # 是否开启本平台服务
user: user:
cookie: "" # 账号cookie数据可以通过浏览器获取需要vip账号来获取会员歌曲如果没有请留为空值 cookie: "" # 账号cookie数据可以通过浏览器获取需要vip账号来获取会员歌曲如果没有请留为空值
refresh_login: refresh_login:
@ -135,6 +138,7 @@ module:
interval: 86400 interval: 86400
mg: # 咪咕音乐相关配置 mg: # 咪咕音乐相关配置
enable: true # 是否开启本平台服务
user: # 研究不深后两项自行抓包获取网页端cookie user: # 研究不深后两项自行抓包获取网页端cookie
by: "" by: ""
session: "" session: ""
@ -144,6 +148,7 @@ module:
interval: 86400 interval: 86400
kw: # 酷我音乐相关配置proto支持值['bd-api', 'kuwodes'] kw: # 酷我音乐相关配置proto支持值['bd-api', 'kuwodes']
enable: true # 是否开启本平台服务
proto: bd-api proto: bd-api
user: user:
uid: "0" uid: "0"

View File

@ -150,6 +150,14 @@ async def handle(request):
try: try:
query = dict(request.query) query = dict(request.query)
if (method in dir(modules)): 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)) return handleResult(await getattr(modules, method)(source, songId, quality, query))
else: else:
return handleResult(await modules.other(method, source, songId, quality, query)) return handleResult(await modules.other(method, source, songId, quality, query))