-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(getOnlineUrl): 修复网页端登录后获取url的CORS问题 #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -162,8 +162,9 @@ class Player { | |||||||||||||||||||||||||
| } else return null; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| // 返回歌曲地址 | ||||||||||||||||||||||||||
| // 客户端直接返回,网页端转 https | ||||||||||||||||||||||||||
| const url = isElectron ? songData.url : songData.url.replace(/^http:/, "https:"); | ||||||||||||||||||||||||||
| // 客户端直接返回,网页端转 https, 并转换url以便解决音乐链接cors问题 | ||||||||||||||||||||||||||
| const url = isElectron ? songData.url : songData.url.replace(/^http:/, "https:").replace(/m804\.music\.126\.net/g, 'm801.music.126.net').replace(/m704\.music\.126\.net/g, 'm701.music.126.net'); | ||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直接通过字符串替换来解决CORS问题虽然能快速生效,但不够灵活和稳定。建议使用更通用的代理方式或配置CORS策略,以提高代码的健壮性和可维护性。
Suggested change
|
||||||||||||||||||||||||||
| console.log(`🎧 ${id} music url:`, url); | ||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在生产环境中,应避免打印敏感信息(如完整的音乐URL)到控制台,以防止潜在的安全风险。
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在生产环境中,应避免打印敏感信息(如完整的音乐URL)到控制台,以防止潜在的安全风险。
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 此处添加的
Suggested change
|
||||||||||||||||||||||||||
| return url; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接通过字符串替换来解决CORS问题虽然能快速生效,但不够灵活和稳定。建议使用更通用的代理方式或配置CORS策略,以提高代码的健壮性和可维护性。