From 7a358b7a879c1a627befc656eef5a7e61873c03c Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sat, 8 Aug 2020 03:48:28 -0300 Subject: [PATCH 01/36] :sparkles: Improve remote control --- src/providers/companionServer.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/providers/companionServer.js b/src/providers/companionServer.js index c425acef2..21c61414d 100644 --- a/src/providers/companionServer.js +++ b/src/providers/companionServer.js @@ -5,6 +5,7 @@ const networkInterfaces = os.networkInterfaces() const qrcode = require('qrcode-generator') const infoPlayerProvider = require('../providers/infoPlayerProvider') const settingsProvider = require('../providers/settingsProvider') +const { deprecate } = require('util') const ip = '0.0.0.0' const port = 9863 @@ -212,10 +213,12 @@ var serverFunction = function (req, res) { ) { try { let headerAuth = req.headers.authorization - let auth = headerAuth.split(' ')[1] + let authToken = headerAuth + .split(' ')[1] + .toUpperCase() if ( - auth == + authToken == settingsProvider.get( 'settings-companion-server-token' ) @@ -375,14 +378,7 @@ function execCmd(cmd, value) { value = value || true switch (cmd) { - case 'track-play': - ipcMain.emit('media-command', { - command: 'media-play-pause', - value: true, - }) - break - - case 'track-pause': + case 'track-play-pause': ipcMain.emit('media-command', { command: 'media-play-pause', value: true, @@ -469,14 +465,14 @@ function execCmd(cmd, value) { case 'player-repeat': ipcMain.emit('media-command', { command: 'media-repeat', - value: value, + value: true, }) break case 'player-shuffle': ipcMain.emit('media-command', { command: 'media-shuffle', - value: value, + value: true, }) break From 6d897d668c12cca15b219a476f52f87ef874a214 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sat, 8 Aug 2020 11:24:50 -0300 Subject: [PATCH 02/36] :bug: Lyrics #298 --- src/pages/lyrics/lyrics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/lyrics/lyrics.js b/src/pages/lyrics/lyrics.js index 5aecd7d98..68068c0e0 100644 --- a/src/pages/lyrics/lyrics.js +++ b/src/pages/lyrics/lyrics.js @@ -37,7 +37,7 @@ setInterval(async () => { async function setData(data) { var scrollHeight = document.getElementById('content').scrollHeight - target = (scrollHeight * data.track.statePercent) / 1.4 + target = (scrollHeight * data.player.statePercent) / 1.4 if (toggled) { document.getElementById('content').scrollTo(0, target) } From 083cb2cf0d109d20eebd6b0508a26e3c7a546fbe Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sat, 8 Aug 2020 15:56:43 -0300 Subject: [PATCH 03/36] :sparkles: Improve updateActivity data --- main.js | 95 +++++++++++++++-------------- src/providers/discordRpcProvider.js | 11 +--- 2 files changed, 51 insertions(+), 55 deletions(-) diff --git a/main.js b/main.js index a941dd54c..3582bdeb3 100644 --- a/main.js +++ b/main.js @@ -47,9 +47,10 @@ let mainWindow, customCSSPageKey, lastTrackId, lastTrackProgress, + lastIsPaused, + lastSeekbarCurrentPosition, doublePressPlayPause, updateTrackInfoTimeout, - activityIsPaused, activityLikeStatus, windowsMediaProvider @@ -366,6 +367,7 @@ function createWindow() { var trackInfo = infoPlayerProvider.getTrackInfo() var progress = playerInfo.statePercent + var seekbarCurrentPosition = playerInfo.seekbarCurrentPosition var trackId = trackInfo.id var title = trackInfo.title var author = trackInfo.author @@ -375,32 +377,9 @@ function createWindow() { var nowPlaying = `${title} - ${author}` if (title && author) { - discordRPC.setActivity(getAll()) rainmeterNowPlaying.setActivity(getAll()) mprisProvider.setActivity(getAll()) - if ( - playerInfo.isPaused != activityIsPaused || - playerInfo.likeStatus != activityLikeStatus - ) { - mediaControl.createThumbar( - mainWindow, - infoPlayerProvider.getAllInfo() - ) - - activityIsPaused = playerInfo.isPaused - activityLikeStatus = playerInfo.likeStatus - - if ( - isWindows() && - os.release().startsWith('10.') && - settingsProvider.get('settings-windows10-media-service') && - windowsMediaProvider != undefined - ) { - windowsMediaProvider.setPlaybackStatus(playerInfo.isPaused) - } - } - mediaControl.setProgress( mainWindow, settingsProvider.get('settings-enable-taskbar-progressbar') @@ -436,22 +415,15 @@ function createWindow() { } } - // Experimental - /*if (isWindows() && view.webContents.getURL().indexOf('v=') != -1) { - mainWindow.setThumbnailClip({ - x: 230, - y: 150, - width: 676, - height: 676, - }) - } else { - mainWindow.setThumbnailClip({ - x: 0, - y: 0, - width: mainWindow.getSize()[0], - height: mainWindow.getSize()[1], - }) - }*/ + /** + * Update only when change seekbar + */ + if ( + lastSeekbarCurrentPosition - seekbarCurrentPosition > 2 || + lastSeekbarCurrentPosition - seekbarCurrentPosition < -2 + ) { + discordRPC.setActivity(getAll()) + } /** * Update only when change track @@ -493,18 +465,49 @@ function createWindow() { ) } + writeLog({ type: 'info', data: `Listen: ${title} - ${author}` }) + discordRPC.setActivity(getAll()) + } + + /** + * Update only when change state play/pause + */ + if (lastIsPaused != playerInfo.isPaused) { + lastIsPaused = playerInfo.isPaused + + discordRPC.setActivity(getAll()) + if (!isMac() && !settingsProvider.get('settings-shiny-tray')) { - if (playerInfo.isPaused) { - tray.updateTrayIcon(iconPause) - } else { - tray.updateTrayIcon(iconPlay) - } + tray.updateTrayIcon( + playerInfo.isPaused ? iconPause : iconPlay + ) } - writeLog({ type: 'info', data: `Listen: ${title} - ${author}` }) + mediaControl.createThumbar( + mainWindow, + infoPlayerProvider.getAllInfo() + ) + + if ( + isWindows() && + os.release().startsWith('10.') && + settingsProvider.get('settings-windows10-media-service') && + windowsMediaProvider != undefined + ) { + windowsMediaProvider.setPlaybackStatus(playerInfo.isPaused) + } + } + + if (activityLikeStatus != playerInfo.likeStatus) { + mediaControl.createThumbar( + mainWindow, + infoPlayerProvider.getAllInfo() + ) + activityLikeStatus = playerInfo.likeStatus } lastTrackProgress = progress + lastSeekbarCurrentPosition = seekbarCurrentPosition } } diff --git a/src/providers/discordRpcProvider.js b/src/providers/discordRpcProvider.js index 813eaa6c8..336ae5160 100644 --- a/src/providers/discordRpcProvider.js +++ b/src/providers/discordRpcProvider.js @@ -3,7 +3,7 @@ const RPC = require('discord-rpc') const settingsProvider = require('./settingsProvider') var client -var _isStarted, _lastTrackId, _lastState +var _isStarted function isStarted() { return _isStarted @@ -40,11 +40,7 @@ function stop() { } function setActivity(info) { - if ( - isStarted() && - info.track.title && - (_lastTrackId != info.track.id || _lastState != info.player.isPaused) - ) { + if (isStarted() && info.track.title) { var now = Date.now() var activity = {} var discordSettings = settingsProvider.get('discord-presence-settings') @@ -82,9 +78,6 @@ function setActivity(info) { console.log(err) }) } - - _lastTrackId = info.track.id - _lastState = info.player.isPaused } } From faf5d4c3bf2d0d6c1a458af1e47807e5fd297dac Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sat, 8 Aug 2020 18:36:45 -0300 Subject: [PATCH 04/36] :bug: Fix #296 --- main.js | 4 ++++ package.json | 6 +++--- src/providers/companionServer.js | 27 ++++++++++++++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index 3582bdeb3..cc466d8eb 100644 --- a/main.js +++ b/main.js @@ -1612,6 +1612,8 @@ if (!gotTheLock) { }) app.on('before-quit', function (e) { + mainWindow = null + view = null if (isMac()) { app.exit() } @@ -1619,6 +1621,8 @@ if (!gotTheLock) { }) app.on('quit', function () { + mainWindow = null + view = null tray.quit() }) } diff --git a/package.json b/package.json index fbd36e436..18f9460ee 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "start": "electron .", "rebuild": "electron-rebuild -f", "postinstall": "npx electron-builder install-app-deps", - "deploy:win": "npx electron-builder --win --config electron-builder-deploy64.yml", - "deploy:mac": "npx electron-builder --mac --config electron-builder-deploy64.yml", - "deploy:lin": "npx electron-builder --linux --config electron-builder-deploy64.yml", + "build:win": "npx electron-builder --win --config electron-builder-deploy64.yml", + "build:mac": "npx electron-builder --mac --config electron-builder-deploy64.yml", + "build:lin": "npx electron-builder --linux --config electron-builder-deploy64.yml", "publish:win": "npx electron-builder --win -p always --config electron-builder64.yml", "publish:mac": "npx electron-builder --mac -p always --config electron-builder64.yml", "publish:lin": "npx electron-builder --linux -p always --config electron-builder64.yml" diff --git a/src/providers/companionServer.js b/src/providers/companionServer.js index 21c61414d..cab10b633 100644 --- a/src/providers/companionServer.js +++ b/src/providers/companionServer.js @@ -5,13 +5,12 @@ const networkInterfaces = os.networkInterfaces() const qrcode = require('qrcode-generator') const infoPlayerProvider = require('../providers/infoPlayerProvider') const settingsProvider = require('../providers/settingsProvider') -const { deprecate } = require('util') const ip = '0.0.0.0' const port = 9863 const hostname = os.hostname() -const pattIgnoreInterface = /(virtual|wsl|vEthernet|Default Switch|VMware|Adapter)\w*/gim +const pattIgnoreInterface = /(Loopback|virtual|wsl|vEthernet|Default Switch|VMware|Adapter|Hamachi)\w*/gim let totalConnections = 0 let timerTotalConections @@ -34,7 +33,20 @@ function infoServer() { } function fetchNetworkInterfaces() { - Object.keys(networkInterfaces).forEach((v, k) => { + serverInterfaces = Object.entries(networkInterfaces) + .filter(([interfaces]) => !pattIgnoreInterface.test(interfaces)) + .map(([name, value]) => { + value = value.filter((data) => { + return data.family == 'IPv4' && data.internal == false + }) + return { + name: name, + ip: value[0].address, + isProtected: infoServer().isProtected, + } + }) + + /*Object.keys(networkInterfaces).forEach((v, k) => { if (!pattIgnoreInterface.test(v)) { networkInterfaces[v].forEach((vv, kk) => { if (vv.family == 'IPv4' && vv.internal == false) { @@ -47,15 +59,17 @@ function fetchNetworkInterfaces() { } }) } - }) + })*/ } var serverFunction = function (req, res) { if (req.url === '/') { - var collection = '' + let collection = '' + let isProtected = infoServer().isProtected serverInterfaces.forEach((value) => { - let qr = qrcode(6, 'H') + let qr = qrcode(0, 'H') + value['hostname'] = hostname qr.addData(JSON.stringify(value)) qr.make() @@ -88,7 +102,6 @@ var serverFunction = function (req, res) { res.setHeader('Access-Control-Allow-Origin', '*') res.writeHead(200) - let isProtected = infoServer().isProtected res.write(` YTMDesktop Remote Control From 7ab3dd1ce8c7c86feb27871a4f8d4adf28544201 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sat, 8 Aug 2020 19:56:12 -0300 Subject: [PATCH 05/36] :bug: remote control webpage, strange visual with multiples interfaces #300 --- src/providers/companionServer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/providers/companionServer.js b/src/providers/companionServer.js index cab10b633..91738cc09 100644 --- a/src/providers/companionServer.js +++ b/src/providers/companionServer.js @@ -41,7 +41,7 @@ function fetchNetworkInterfaces() { }) return { name: name, - ip: value[0].address, + ip: value.length ? value[0].address : '', isProtected: infoServer().isProtected, } }) @@ -74,7 +74,7 @@ var serverFunction = function (req, res) { qr.make() collection += ` -
+
@@ -115,6 +115,7 @@ var serverFunction = function (req, res) { padding: 0; text-align: center; background: linear-gradient(to right top, #000 20%, #1d1d1d 80%); + background-attachment: fixed; font-family: sans-serif; } h5 { @@ -123,7 +124,6 @@ var serverFunction = function (req, res) { .center { width: 68%; - /*height: 400px;*/ position: absolute; left: 50%; top: 48%; @@ -156,7 +156,7 @@ var serverFunction = function (req, res) {
-
+
${collection} From 7d656c2beb8fea9e7bb2516d107dfc03efc09d30 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sun, 9 Aug 2020 01:01:34 -0300 Subject: [PATCH 06/36] :sparkles: Thumbs up behavior #259 (hotkeys) --- main.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index cc466d8eb..2fb28871f 100644 --- a/main.js +++ b/main.js @@ -659,19 +659,17 @@ function createWindow() { } ) - globalShortcut.register( - settingsAccelerator['media-track-like'], - function () { + globalShortcut.register(settingsAccelerator['media-track-like'], () => { + if (infoPlayerProvider.getPlayerInfo().likeStatus != 'LIKE') { mediaControl.upVote(view) } - ) + }) - globalShortcut.register( - settingsAccelerator['media-track-dislike'], - function () { + globalShortcut.register(settingsAccelerator['media-track-dislike'], () => { + if (infoPlayerProvider.getPlayerInfo().likeStatus != 'DISLIKE') { mediaControl.downVote(view) } - ) + }) globalShortcut.register( settingsAccelerator['media-volume-up'], From 3b0ac53748fd2980bad1181dd2a4f74eee901f02 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Sun, 9 Aug 2020 05:21:00 -0300 Subject: [PATCH 07/36] :sparkles: disable shortcuts setting #301 #3 --- main.js | 161 ++++++++++++++++--------------- src/assets/css/styles.css | 2 +- src/pages/settings/settings.css | 5 + src/pages/settings/settings.html | 9 +- src/pages/settings/settings.js | 14 +++ 5 files changed, 112 insertions(+), 79 deletions(-) diff --git a/main.js b/main.js index 2fb28871f..ed68f68cb 100644 --- a/main.js +++ b/main.js @@ -623,118 +623,121 @@ function createWindow() { } }) - globalShortcut.register('MediaStop', function () { - mediaControl.stopTrack(view) - }) - - globalShortcut.register('MediaPreviousTrack', function () { - mediaControl.previousTrack(view) - }) - - globalShortcut.register('MediaNextTrack', function () { - mediaControl.nextTrack(view) - }) - - // Custom accelerators - let settingsAccelerator = settingsProvider.get('settings-accelerators') - - globalShortcut.register( - settingsAccelerator['media-play-pause'], - function () { - mediaControl.playPauseTrack(view) - } - ) - - globalShortcut.register( - settingsAccelerator['media-track-next'], - function () { - mediaControl.nextTrack(view) - } - ) - - globalShortcut.register( - settingsAccelerator['media-track-previous'], - function () { - mediaControl.previousTrack(view) - } - ) - - globalShortcut.register(settingsAccelerator['media-track-like'], () => { - if (infoPlayerProvider.getPlayerInfo().likeStatus != 'LIKE') { - mediaControl.upVote(view) - } - }) - - globalShortcut.register(settingsAccelerator['media-track-dislike'], () => { - if (infoPlayerProvider.getPlayerInfo().likeStatus != 'DISLIKE') { - mediaControl.downVote(view) - } - }) - - globalShortcut.register( - settingsAccelerator['media-volume-up'], - function () { - mediaControl.volumeUp(view) - } - ) - - globalShortcut.register( - settingsAccelerator['media-volume-down'], - function () { - mediaControl.volumeDown(view) + ipcMain.on('change-accelerator', (dataMain, dataRenderer) => { + if (dataMain.type != undefined) { + args = dataMain + } else { + args = dataRenderer } - ) - ipcMain.on('change-accelerator', (event, args) => { try { globalShortcut.unregister(args.oldValue) } catch (_) {} switch (args.type) { case 'media-play-pause': - globalShortcut.register(args.newValue, () => { + registerGlobalShortcut(args.newValue, () => { mediaControl.playPauseTrack(view) }) break case 'media-track-next': - globalShortcut.register(args.newValue, () => { + registerGlobalShortcut(args.newValue, () => { mediaControl.nextTrack(view) }) break case 'media-track-previous': - globalShortcut.register(args.newValue, () => { + registerGlobalShortcut(args.newValue, () => { mediaControl.previousTrack(view) }) break case 'media-track-like': - globalShortcut.register(args.newValue, () => { - mediaControl.upVote(view) + registerGlobalShortcut(args.newValue, () => { + if ( + infoPlayerProvider.getPlayerInfo().likeStatus != 'LIKE' + ) { + mediaControl.upVote(view) + } }) break case 'media-track-dislike': - globalShortcut.register(args.newValue, () => { - mediaControl.downVote(view) + registerGlobalShortcut(args.newValue, () => { + if ( + infoPlayerProvider.getPlayerInfo().likeStatus != + 'DISLIKE' + ) { + mediaControl.downVote(view) + } }) break case 'media-volume-up': - globalShortcut.register(args.newValue, () => { + registerGlobalShortcut(args.newValue, () => { mediaControl.volumeUp(view) }) break case 'media-volume-down': - globalShortcut.register(args.newValue, () => { + registerGlobalShortcut(args.newValue, () => { mediaControl.volumeDown(view) }) break } }) + // Custom accelerators + let settingsAccelerator = settingsProvider.get('settings-accelerators') + + ipcMain.emit('change-accelerator', { + type: 'media-play-pause', + newValue: settingsAccelerator['media-play-pause'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-track-next', + newValue: settingsAccelerator['media-track-next'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-track-previous', + newValue: settingsAccelerator['media-track-previous'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-track-like', + newValue: settingsAccelerator['media-track-like'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-track-dislike', + newValue: settingsAccelerator['media-track-dislike'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-volume-up', + newValue: settingsAccelerator['media-volume-up'], + }) + + ipcMain.emit('change-accelerator', { + type: 'media-volume-down', + newValue: settingsAccelerator['media-volume-down'], + }) + + globalShortcut.register('MediaStop', function () { + mediaControl.stopTrack(view) + }) + + globalShortcut.register('MediaPreviousTrack', function () { + mediaControl.previousTrack(view) + }) + + globalShortcut.register('MediaNextTrack', function () { + mediaControl.nextTrack(view) + }) + ipcMain.handle('invoke-all-info', async (event, args) => { return infoPlayerProvider.getAllInfo() }) @@ -1729,13 +1732,11 @@ function loadCustomPageScript() { } } -ipcMain.on('log', (dataMain, dataRenderer) => { - if (dataMain.type !== undefined) { - writeLog(dataMain) - } else { - writeLog(dataRenderer) +function registerGlobalShortcut(value, fn) { + if (value != 'disabled') { + globalShortcut.register(`${value}`, fn) } -}) +} function writeLog(log) { switch (log.type) { @@ -1749,6 +1750,14 @@ function writeLog(log) { } } +ipcMain.on('log', (dataMain, dataRenderer) => { + if (dataMain.type !== undefined) { + writeLog(dataMain) + } else { + writeLog(dataRenderer) + } +}) + if (settingsProvider.get('settings-companion-server')) { companionServer.start() } diff --git a/src/assets/css/styles.css b/src/assets/css/styles.css index 8b7cc4747..4d7413262 100644 --- a/src/assets/css/styles.css +++ b/src/assets/css/styles.css @@ -114,5 +114,5 @@ html, body { } .text-initial { - text-transform: initial; + text-transform: capitalize; } \ No newline at end of file diff --git a/src/pages/settings/settings.css b/src/pages/settings/settings.css index a7b2eb6d8..3e440d460 100644 --- a/src/pages/settings/settings.css +++ b/src/pages/settings/settings.css @@ -238,4 +238,9 @@ input[type=range]+.thumb { .settings-item-child::before { color: #666; content: '└ '; +} + +.text-disabled { + text-decoration: line-through; + text-transform: capitalize; } \ No newline at end of file diff --git a/src/pages/settings/settings.html b/src/pages/settings/settings.html index dcc80dcb6..af8204322 100644 --- a/src/pages/settings/settings.html +++ b/src/pages/settings/settings.html @@ -738,14 +738,19 @@ >
diff --git a/src/pages/settings/settings.js b/src/pages/settings/settings.js index ea847b8f2..f9f4fe34b 100644 --- a/src/pages/settings/settings.js +++ b/src/pages/settings/settings.js @@ -531,6 +531,20 @@ document.querySelector('#saveAccelerator').addEventListener('click', () => { loadCustomKeys() }) +document.querySelector('#disableAccelerator').addEventListener('click', () => { + ipc.send('change-accelerator', { + type: typeAcceleratorSelected, + oldValue: settingsAccelerators[typeAcceleratorSelected], + newValue: 'disabled', + }) + + settingsAccelerators[typeAcceleratorSelected] = 'disabled' + + settingsProvider.set('settings-accelerators', settingsAccelerators) + + loadCustomKeys() +}) + document.querySelector('#release-notes').addEventListener('click', () => { ipc.send('window', { command: 'show-changelog' }) }) From 987d0c887268f37f2c7b8f7e1546082852479e34 Mon Sep 17 00:00:00 2001 From: "Felipe Guaycuru de C. B. Franco" Date: Mon, 10 Aug 2020 14:17:37 -0300 Subject: [PATCH 08/36] :bug: Fix clone instructions to use new repo URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90a9daeae..aa825711d 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ To clone and run this repository you'll need [Git](https://git-scm.com) and [Nod ```bash # Clone this repository -git clone https://github.com/adlerluiz/ytmdesktop +git clone https://github.com/ytmdesktop/ytmdesktop # Go into the repository cd ytmdesktop # Install dependencies From 1e9bdf255aef1c543d1af89dcfcf1b9421f7b4fe Mon Sep 17 00:00:00 2001 From: Mingjun Yin Date: Mon, 10 Aug 2020 18:38:37 -0700 Subject: [PATCH 09/36] :globe_with_meridians: Refine Simplified Chinese translation. --- src/locales/zh.json | 46 +++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/locales/zh.json b/src/locales/zh.json index c7f45dff3..6677306f6 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -1,51 +1,51 @@ { "DOUBLE_CLICK_TO_RESET_POSITION": "双击重置位置", "LABEL_EXIT": "退出", - "LABEL_GUEST": "LABEL_GUEST", + "LABEL_GUEST": "匿名模式", "LABEL_LOADING": "载入中...", "LABEL_LYRICS": "歌词", "LABEL_LYRICS_NOT_FOUND": "找不到歌词", - "LABEL_MINIPLAYER": "LABEL_MINIPLAYER", + "LABEL_MINIPLAYER": "Mini播放器", "LABEL_PLAY_MUSIC": "播放音乐", "LABEL_SETTINGS": "设置", "LABEL_SETTINGS_RELAUNCH": "应用并重启", "LABEL_SETTINGS_SHOW_HIDE_WINDOW": "隐藏/显示主窗口", "LABEL_SETTINGS_TAB_ABOUT": "关于", - "LABEL_SETTINGS_TAB_APPEARANCE_TASKBAR_PROGRESSBAR": "LABEL_SETTINGS_TAB_APPEARANCE_TASKBAR_PROGRESSBAR", + "LABEL_SETTINGS_TAB_APPEARANCE_TASKBAR_PROGRESSBAR": "任务栏图标显示播放进度", "LABEL_SETTINGS_TAB_APPEARENCE": "显示", "LABEL_SETTINGS_TAB_GENERAL": "偏好设置", "LABEL_SETTINGS_TAB_GENERAL_COMPANION_SERVER": "远端控制", "LABEL_SETTINGS_TAB_GENERAL_COMPANION_SERVER_INFO": "点击此处扫码连接", - "LABEL_SETTINGS_TAB_GENERAL_COMPANION_SERVER_PROTECT": "LABEL_SETTINGS_TAB_GENERAL_COMPANION_SERVER_PROTECT", + "LABEL_SETTINGS_TAB_GENERAL_COMPANION_SERVER_PROTECT": "远端控制启用密码保护", "LABEL_SETTINGS_TAB_GENERAL_CONTINUE_WHERE_LEFT_OF": "退出时保存当前播放队列", - "LABEL_SETTINGS_TAB_GENERAL_CUSTOM_THEME": "LABEL_SETTINGS_TAB_GENERAL_CUSTOM_THEME", - "LABEL_SETTINGS_TAB_GENERAL_DISCORD_RICH_PRESENCE": "Discord Rich Presence", + "LABEL_SETTINGS_TAB_GENERAL_CUSTOM_THEME": "自定义主题", + "LABEL_SETTINGS_TAB_GENERAL_DISCORD_RICH_PRESENCE": "Discord集成", "LABEL_SETTINGS_TAB_GENERAL_KEEP_BACKGROUND": "关闭窗口时保持后台播放", "LABEL_SETTINGS_TAB_GENERAL_PAGE_ZOOM": "页面缩放", - "LABEL_SETTINGS_TAB_GENERAL_SELECT_AUDIO_OUTPUT": "LABEL_SETTINGS_TAB_GENERAL_SELECT_AUDIO_OUTPUT", + "LABEL_SETTINGS_TAB_GENERAL_SELECT_AUDIO_OUTPUT": "选择输出音频设备", "LABEL_SETTINGS_TAB_GENERAL_SELECT_LANGUAGE": "语言", - "LABEL_SETTINGS_TAB_GENERAL_SELECT_LYRICS_PROVIDER": "LABEL_SETTINGS_TAB_GENERAL_SELECT_LYRICS_PROVIDER", + "LABEL_SETTINGS_TAB_GENERAL_SELECT_LYRICS_PROVIDER": "选择歌词来源", "LABEL_SETTINGS_TAB_GENERAL_SELECT_TITLEBAR_TYPE": "标题栏风格", "LABEL_SETTINGS_TAB_GENERAL_SELECT_TITLEBAR_TYPE_NICE": "集成", "LABEL_SETTINGS_TAB_GENERAL_SELECT_TITLEBAR_TYPE_NONE": "禁用", "LABEL_SETTINGS_TAB_GENERAL_SELECT_TITLEBAR_TYPE_SYSTEM": "跟随系统", "LABEL_SETTINGS_TAB_GENERAL_SHINY_TRAY": "启用托盘区控制(仅Mac OS)", "LABEL_SETTINGS_TAB_GENERAL_SHOW_NOTIFICATIONS": "显示通知", - "LABEL_SETTINGS_TAB_GENERAL_START_MINIMIZED": "LABEL_SETTINGS_TAB_GENERAL_START_MINIMIZED", + "LABEL_SETTINGS_TAB_GENERAL_START_MINIMIZED": "开启最小化", "LABEL_SETTINGS_TAB_GENERAL_START_ON_BOOT": "开机启动 (实验功能, Mac/Win)", "LABEL_SETTINGS_TAB_INTEGRATION": "集成", - "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER": "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER", - "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER_AUTHORIZE": "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER_AUTHORIZE", + "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER": "LAST FM集成", + "LABEL_SETTINGS_TAB_LAST_FM_SCROBBLER_AUTHORIZE": "绑定LAST FM账号", "LABEL_SETTINGS_TAB_MACOS": "Mac OS X", "LABEL_SETTINGS_TAB_MINIPLAYER": "Mini播放器", - "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_ON_TOP": "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_ON_TOP", - "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_SHOW_CONTROLS": "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_SHOW_CONTROLS", - "LABEL_SETTINGS_TAB_MINIPLAYER_PAINT_CONTROLS": "LABEL_SETTINGS_TAB_MINIPLAYER_PAINT_CONTROLS", - "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE": "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE", - "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_LARGE": "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_LARGE", - "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_NORMAL": "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_NORMAL", - "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_SMALL": "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_SMALL", - "LABEL_SETTINGS_TAB_RAINMETER_WEB_NOW_PLAYING": "LABEL_SETTINGS_TAB_RAINMETER_WEB_NOW_PLAYING", + "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_ON_TOP": "Mini播放器窗口置顶", + "LABEL_SETTINGS_TAB_MINIPLAYER_ALWAYS_SHOW_CONTROLS": "Mini播放器控制显示锁定", + "LABEL_SETTINGS_TAB_MINIPLAYER_PAINT_CONTROLS": "Mini播放器绘制设置", + "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE": "Mini播放器大小", + "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_LARGE": "大", + "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_NORMAL": "中", + "LABEL_SETTINGS_TAB_MINIPLAYER_SELECT_SIZE_SMALL": "小", + "LABEL_SETTINGS_TAB_RAINMETER_WEB_NOW_PLAYING": "Rainmeter (WebNowPlaying)集成", "LABEL_SETTINGS_TAB_READ_CLIPBOARD": "阅读剪贴板的YouTube链接", "LABEL_SETTINGS_TAB_SHORTCUTS": "快捷键", "LABEL_SETTINGS_TAB_SHORTCUTS_GLOBAL": "全局", @@ -61,5 +61,11 @@ "MEDIA_CONTROL_SEARCH": "搜索", "MEDIA_CONTROL_SHUFFLE": "随机", "MEDIA_CONTROL_THUMBS_DOWN": "踩", - "MEDIA_CONTROL_THUMBS_UP": "赞" + "MEDIA_CONTROL_THUMBS_UP": "赞", + "LABEL_SETTINGS_TAB_GENERAL_DISABLE_HARDWARE_ACCELERATION": "禁用硬件加速", + "LABEL_SETTINGS_TAB_MINIPLAYER_RESIZABLE": "允许调整Mini播放器大小", + "LABEL_SETTINGS_TAB_MINIPLAYER_SHOW_TASK": "在任务栏显示Mini播放器", + "MEDIA_CONTROL_VOLUME_UP": "增大音量", + "MEDIA_CONTROL_VOLUME_DOWN": "减小音量", + "LABEL_CHANGELOG": "更新日志" } From 54832f81994cbcaefb4207e36d076d6bd62c2479 Mon Sep 17 00:00:00 2001 From: Adler Luiz Date: Tue, 11 Aug 2020 01:37:36 -0300 Subject: [PATCH 10/36] :sparkles: Improve code --- main.js | 2 +- src/pages/settings/settings.html | 2 +- src/providers/companionServer.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index ed68f68cb..f9812282f 100644 --- a/main.js +++ b/main.js @@ -340,7 +340,7 @@ function createWindow() { if (global.on_the_road) { updateActivity() } - }, 500) + }, 100) } }) diff --git a/src/pages/settings/settings.html b/src/pages/settings/settings.html index af8204322..75f49ee2d 100644 --- a/src/pages/settings/settings.html +++ b/src/pages/settings/settings.html @@ -740,7 +740,7 @@