Skip to content

Commit

Permalink
fix: 修复下载script时错误信息乱码的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lerdb committed Jan 22, 2024
1 parent 9a9e64a commit e1d30cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/lx_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ async def get_script():

async def generate_script_response(request):
if (request.query.get('key') != config.read_config('security.key.value') and config.read_config('security.key.enable')):
return 'key验证失败'
return Response(body = json.dumps({'code': 6, 'msg': 'key验证失败', 'data': None}, indent=2, ensure_ascii=False), content_type='application/json', status = 400)
try:
with open('./lx-music-source-example.js', 'r', encoding='utf-8') as f:
script = f.read()
except:
return '本地无源脚本'
return Response(body = json.dumps({'code': 4, 'msg': '本地无源脚本', 'data': None}, indent=2, ensure_ascii=False), content_type='application/json', status = 500)
scriptLines = script.split('\n')
newScriptLines = []
for line in scriptLines:
Expand Down

0 comments on commit e1d30cf

Please sign in to comment.