修复重定向问题

This commit is contained in:
shaonianzhentan 2023-12-19 19:42:42 +08:00
parent fce38ab51d
commit 68c5c61447
2 changed files with 36 additions and 28 deletions

View File

@ -1,4 +1,6 @@
import os, json, requests
import os
import json
import requests
from urllib.parse import parse_qsl, quote
from homeassistant.components.http import HomeAssistantView
from aiohttp import web
@ -7,6 +9,7 @@ from .manifest import manifest
DOMAIN = manifest.domain
class HttpView(HomeAssistantView):
url = "/cloud_music/url"
@ -69,7 +72,12 @@ class HttpView(HomeAssistantView):
self.play_key = play_key
self.play_url = play_url
# 重定向到可播放链接
return web.HTTPFound(play_url)
response = web.HTTPFound(play_url, headers={
'Content-Length': 0,
'Cache-Control': 'no-cache, no-store, keep-alive=timeout=4'
})
response.remove_header('Content-Type')
return response
# VIP音乐资源
def getVipMusic(self, id):

View File

@ -1,7 +1,7 @@
{
"domain": "ha_cloud_music",
"name": "\u4E91\u97F3\u4E50",
"version": "2023.11.19",
"version": "2023.12.19",
"config_flow": true,
"documentation": "https://github.com/shaonianzhentan/ha_cloud_music",
"requirements": [