mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: updates
This commit is contained in:
parent
ffcc60b793
commit
dd5361b8c4
106 changed files with 11989 additions and 4143 deletions
|
|
@ -117,6 +117,7 @@ class Cache {
|
|||
case APIs.UserAccount:
|
||||
case APIs.Personalized:
|
||||
case APIs.RecommendResource:
|
||||
case APIs.UserArtists:
|
||||
case APIs.Likelist: {
|
||||
const data = db.find(Tables.AccountData, api)
|
||||
if (data?.json) return JSON.parse(data.json)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class Main {
|
|||
defaults: {
|
||||
window: {
|
||||
width: 1440,
|
||||
height: 960,
|
||||
height: 1024,
|
||||
},
|
||||
settings: initialState.settings,
|
||||
},
|
||||
|
|
@ -105,11 +105,14 @@ class Main {
|
|||
},
|
||||
width: this.store.get('window.width'),
|
||||
height: this.store.get('window.height'),
|
||||
minWidth: 1080,
|
||||
minHeight: 720,
|
||||
vibrancy: 'fullscreen-ui',
|
||||
titleBarStyle: 'hiddenInset',
|
||||
frame: !(isWindows || isLinux), // TODO: 适用于linux下独立的启用开关
|
||||
minWidth: 1240,
|
||||
minHeight: 848,
|
||||
// vibrancy: 'fullscreen-ui',
|
||||
titleBarStyle: 'customButtonsOnHover',
|
||||
trafficLightPosition: { x: 24, y: 24 },
|
||||
// frame: !(isWindows || isLinux), // TODO: 适用于linux下独立的启用开关
|
||||
frame: false,
|
||||
transparent: true,
|
||||
}
|
||||
if (this.store.get('window')) {
|
||||
options.x = this.store.get('window.x')
|
||||
|
|
@ -132,24 +135,21 @@ class Main {
|
|||
|
||||
disableCORS() {
|
||||
if (!this.win) return
|
||||
const upsertKeyValue = (
|
||||
object: Record<string, string | string[]>,
|
||||
keyToChange: string,
|
||||
value: string[]
|
||||
) => {
|
||||
if (!object) return
|
||||
for (const key of Object.keys(object)) {
|
||||
if (key.toLowerCase() === keyToChange.toLowerCase()) {
|
||||
object[key] = value
|
||||
}
|
||||
|
||||
const addCORSHeaders = (headers: Record<string, string | string[]>) => {
|
||||
if (
|
||||
headers['Access-Control-Allow-Origin']?.[0] !== '*' &&
|
||||
headers['access-control-allow-origin']?.[0] !== '*'
|
||||
) {
|
||||
headers['Access-Control-Allow-Origin'] = ['*']
|
||||
}
|
||||
object[keyToChange] = value
|
||||
return headers
|
||||
}
|
||||
|
||||
this.win.webContents.session.webRequest.onBeforeSendHeaders(
|
||||
(details, callback) => {
|
||||
const { requestHeaders, url } = details
|
||||
upsertKeyValue(requestHeaders, 'access-control-allow-origin', ['*'])
|
||||
addCORSHeaders(requestHeaders)
|
||||
|
||||
// 不加这几个 header 的话,使用 axios 加载 YouTube 音频会很慢
|
||||
if (url.includes('googlevideo.com')) {
|
||||
|
|
@ -164,14 +164,15 @@ class Main {
|
|||
|
||||
this.win.webContents.session.webRequest.onHeadersReceived(
|
||||
(details, callback) => {
|
||||
const { responseHeaders } = details
|
||||
if (responseHeaders) {
|
||||
upsertKeyValue(responseHeaders, 'access-control-allow-origin', ['*'])
|
||||
upsertKeyValue(responseHeaders, 'access-control-allow-headers', ['*'])
|
||||
const { responseHeaders, url } = details
|
||||
if (url.includes('sentry.io')) {
|
||||
callback({ responseHeaders })
|
||||
return
|
||||
}
|
||||
callback({
|
||||
responseHeaders,
|
||||
})
|
||||
if (responseHeaders) {
|
||||
addCORSHeaders(responseHeaders)
|
||||
}
|
||||
callback({ responseHeaders })
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@ function initWindowIpcMain(win: BrowserWindow | null) {
|
|||
on(IpcChannels.Close, () => {
|
||||
app.exit()
|
||||
})
|
||||
|
||||
on(IpcChannels.ResetWindowSize, () => {
|
||||
if (!win) return
|
||||
win?.setSize(1440, 1024, true)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -188,6 +188,9 @@ class Server {
|
|||
const source =
|
||||
retrievedSong.source === 'ytdl' ? 'youtube' : retrievedSong.source
|
||||
if (retrievedSong.url) {
|
||||
log.debug(
|
||||
`[server] UMN match: ${matchedAudio.song?.name} (https://youtube.com/v/${matchedAudio.song?.id})`
|
||||
)
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
"dependencies": {
|
||||
"@sentry/node": "^6.19.7",
|
||||
"@sentry/tracing": "^6.19.7",
|
||||
"@unblockneteasemusic/rust-napi": "^0.3.0-pre.1",
|
||||
"NeteaseCloudMusicApi": "^4.5.12",
|
||||
"@unblockneteasemusic/rust-napi": "^0.3.0",
|
||||
"NeteaseCloudMusicApi": "^4.6.0",
|
||||
"better-sqlite3": "7.5.1",
|
||||
"change-case": "^4.1.2",
|
||||
"compare-versions": "^4.1.3",
|
||||
|
|
@ -35,27 +35,26 @@
|
|||
"@types/cookie-parser": "^1.4.3",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express-fileupload": "^1.2.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||
"@typescript-eslint/parser": "^5.21.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
||||
"@typescript-eslint/parser": "^5.26.0",
|
||||
"@vitejs/plugin-react": "^1.3.1",
|
||||
"axios": "^0.27.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"dotenv": "^16.0.0",
|
||||
"electron": "^18.2.1",
|
||||
"electron": "^19.0.1",
|
||||
"electron-builder": "^23.0.3",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-rebuild": "^3.2.7",
|
||||
"electron-releases": "^3.1009.0",
|
||||
"esbuild": "^0.14.39",
|
||||
"electron-releases": "^3.1021.0",
|
||||
"esbuild": "^0.14.41",
|
||||
"eslint": "*",
|
||||
"express-fileupload": "^1.3.1",
|
||||
"express-fileupload": "^1.4.0",
|
||||
"minimist": "^1.2.6",
|
||||
"music-metadata": "^7.12.3",
|
||||
"open-cli": "^7.0.1",
|
||||
"ora": "^6.1.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"prettier": "*",
|
||||
"prettier-plugin-tailwindcss": "^0.1.10",
|
||||
"typescript": "*",
|
||||
"wait-on": "^6.0.1"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue