* fix: 让从本地缓存获取的音乐可以拖动进度条

* fix: 登陆二维码使用SVG & 二维码支持强调色

* fix: 搜索页面在没有取得结果不再白屏

* fix: 避免私人FM出现相同的歌曲连着出现

* fix: 给部分api添加时间戳参数

因为发现无法获取个性化推荐歌单,添加时间戳后成功获取

* 改用`Date.now()`

* 将个性化推荐放在推荐歌单的前面
This commit is contained in:
memorydream 2022-04-30 02:08:25 +08:00 committed by GitHub
parent 07d7564b1e
commit 4d59401549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 14 deletions

View file

@ -17,6 +17,8 @@ enum Method {
Phone = 'phone',
}
const domParser = new DOMParser()
// Shared components and methods
const EmailInput = ({
email,
@ -367,23 +369,34 @@ const LoginWithQRCode = () => {
useEffect(() => {
const updateImage = async () => {
const image = await QRCode.toDataURL(qrCodeUrl, {
width: 1024,
const svg = await QRCode.toString(qrCodeUrl, {
margin: 0,
color: {
dark: '#335eea', // TODO: change brand color
light: '#ffffff00',
},
type: 'svg',
})
setQrCodeImage(image)
const path = domParser
.parseFromString(svg, 'text/xml')
.getElementsByTagName('path')[0]
setQrCodeImage(path?.getAttribute('d') ?? '')
}
updateImage()
}, [qrCodeUrl])
return (
<div className='flex flex-col items-center justify-center'>
<div className='rounded-3xl border p-6 dark:border-gray-700'>
<img src={qrCodeImage} alt='QR Code' className='no-drag' />
<div className='rounded-3xl border p-6 text-brand-500 dark:border-gray-700'>
<svg
xmlns='http://www.w3.org/2000/svg'
width='270'
height='270'
viewBox='0 0 37 37'
shapeRendering='crispEdges'
>
<path stroke='currentColor' d={qrCodeImage} />
</svg>
</div>
<div className='mt-4 text-sm text-gray-500 dark:text-gray-200'>
{qrCodeMessage}