Skip to content

Commit

Permalink
kg源数据更新 (#1231)
Browse files Browse the repository at this point in the history
* kg源评论接口更新,热门评论完整支持
---------

Co-authored-by: lyswhut <lyswhut@qq.com>
  • Loading branch information
helloplhm-qwq and lyswhut committed Mar 5, 2023
1 parent fe0487c commit ead7af9
Show file tree
Hide file tree
Showing 22 changed files with 295 additions and 82 deletions.
155 changes: 133 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^4.2.2",
"del": "^6.1.1",
"electron": "^22.3.1",
"electron": "^22.3.2",
"electron-builder": "^24.0.0-alpha.13",
"electron-debug": "^3.2.0",
"electron-devtools-installer": "^3.2.0",
"electron-to-chromium": "^1.4.314",
"electron-to-chromium": "^1.4.320",
"electron-updater": "^6.0.0-alpha.9",
"eslint": "^8.35.0",
"eslint-config-standard": "^17.0.0",
Expand All @@ -255,7 +255,7 @@
"postcss-pxtorem": "^6.0.0",
"pug": "^3.0.2",
"pug-plain-loader": "^1.1.0",
"rimraf": "^4.1.2",
"rimraf": "^4.3.0",
"spinnies": "github:lyswhut/spinnies#233305c58694aa3b053e3ab9af9049993f918b9d",
"svg-sprite-loader": "^6.0.11",
"svg-transform-loader": "^2.0.13",
Expand Down
13 changes: 13 additions & 0 deletions publish/changeLog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
### 不兼容性变更说明

- 同步功能,从这个版本起,数据同步功能至少需要移动端v1.0.0的版本才能连接

### 新增

- 重构数据同步功能,新增客户端模式
- 新增全屏时自动关闭歌词设置,默认开启,可以去设置-桌面歌词设置更改

### 优化

- 支持wy源flac hires歌曲类型的显示
- 快捷键调整音量时每次加减2%音量改为4%(#1220
- 音量、播放模式等设置弹出式按钮在鼠标移到按钮上时将自动弹出设置内容,保留点击切换显示/隐藏
- 支持kg源搜索列表flac hires歌曲类型的显示(@helloplhm-qwq

### 修复

- 修复同步连接的处理问题
- 修复记住播放进度的情况下,使用Scheme URL打开应用播放的歌曲进度没有被重置的问题
- 修复使用酷狗码无法打开某些类型的歌单的问题
- 修复tx源某些歌单因为歌曲信息缺失导致打开失败的问题

### 其他

- 更新 Electron 到v22.3.2
1 change: 1 addition & 0 deletions src/common/defaultSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const defaultSetting: LX.AppSetting = {
'desktopLyric.isAlwaysOnTopLoop': false,
'desktopLyric.isShowTaskbar': false,
'desktopLyric.audioVisualization': false,
'desktopLyric.fullscreenHide': true,
'desktopLyric.width': 450,
'desktopLyric.height': 300,
'desktopLyric.x': null,
Expand Down
5 changes: 5 additions & 0 deletions src/common/types/app_setting.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ declare global {
*/
'desktopLyric.audioVisualization': boolean

/**
* 是否在全屏时隐藏歌词
*/
'desktopLyric.fullscreenHide': boolean

/**
* 桌面歌词窗口宽度
*/
Expand Down
1 change: 1 addition & 0 deletions src/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
"setting__desktop_lyric_font": "Lyric font",
"setting__desktop_lyric_font_default": "Default",
"setting__desktop_lyric_font_weight": "Bold font",
"setting__desktop_lyric_fullscreen_hide": "Automatically close lyrics when full screen",
"setting__desktop_lyric_hover_hide": "Reduce the transparency of lyrics when the mouse moves into the lyrics area (this feature has platform compatibility issues)",
"setting__desktop_lyric_line_gap": "Lyric spacing ({num})",
"setting__desktop_lyric_line_gap_add": "Increase spacing",
Expand Down
1 change: 1 addition & 0 deletions src/lang/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"setting__desktop_lyric_font": "歌词字体",
"setting__desktop_lyric_font_default": "默认",
"setting__desktop_lyric_font_weight": "加粗字体",
"setting__desktop_lyric_fullscreen_hide": "全屏时自动关闭歌词",
"setting__desktop_lyric_hover_hide": "鼠标移入歌词区域时降低歌词透明度(此功能存在平台兼容性问题)",
"setting__desktop_lyric_line_gap": "歌词间距({num})",
"setting__desktop_lyric_line_gap_add": "加大间距",
Expand Down
1 change: 1 addition & 0 deletions src/lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
"setting__desktop_lyric_font": "歌詞字體",
"setting__desktop_lyric_font_default": "默認",
"setting__desktop_lyric_font_weight": "加粗字體",
"setting__desktop_lyric_fullscreen_hide": "全屏時自動關閉歌詞",
"setting__desktop_lyric_hover_hide": "鼠標移入歌詞區域時降低歌詞透明度(此功能存在平台兼容性問題)",
"setting__desktop_lyric_line_gap": "歌詞間距({num})",
"setting__desktop_lyric_line_gap_add": "加大間距",
Expand Down
4 changes: 4 additions & 0 deletions src/main/event/AppEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export class Event extends EventEmitter {
main_window_close() {
this.emit('main_window_close')
}

main_window_fullscreen(isFullscreen: boolean) {
this.emit('main_window_fullscreen', isFullscreen)
}
}


Expand Down
17 changes: 13 additions & 4 deletions src/main/modules/sync/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ const handleConnection = (socket: LX.Sync.Client.Socket) => {

const heartbeatTools = {
failedNum: 0,
maxTryNum: 3,
maxTryNum: 100000,
stepMs: 3000,
pingTimeout: null as NodeJS.Timeout | null,
delayRetryTimeout: null as NodeJS.Timeout | null,
handleOpen() {
console.log('open')
this.failedNum = 0
// this.failedNum = 0
this.heartbeat()
},
heartbeat() {
Expand All @@ -70,16 +71,23 @@ const heartbeatTools = {
throw new Error('connect error')
}

const waitTime = Math.min(2000 + Math.floor(this.failedNum / 2) * this.stepMs, 15000)

// sendSyncStatus({
// status: false,
// message: `Waiting ${waitTime / 1000}s reconnnect...`,
// })

this.delayRetryTimeout = setTimeout(() => {
this.delayRetryTimeout = null
if (!client) return
console.log(dateFormat(new Date()), 'reconnnect...')
sendSyncStatus({
status: false,
message: `Try reconnnect... (${this.failedNum}/${this.maxTryNum})`,
message: `Try reconnnect... (${this.failedNum})`,
})
connect(client.data.urlInfo, client.data.keyInfo)
}, 2000)
}, waitTime)
},
clearTimeout() {
if (this.delayRetryTimeout) {
Expand Down Expand Up @@ -177,6 +185,7 @@ export const connect = (urlInfo: LX.Sync.Client.UrlInfo, keyInfo: LX.Sync.Client
handleConnection(client as LX.Sync.Client.Socket)
log.info('register list sync service success')
client!.isReady = true
heartbeatTools.failedNum = 0
sendSyncStatus({
status: true,
message: '',
Expand Down

0 comments on commit ead7af9

Please sign in to comment.