Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qier222/YesPlayMusic into…
Browse files Browse the repository at this point in the history
… qier222-master
  • Loading branch information
Shi committed May 2, 2022
2 parents b7645e2 + 107bf53 commit 080322c
Show file tree
Hide file tree
Showing 32 changed files with 1,571 additions and 1,019 deletions.
41 changes: 38 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Release

env:
YARN_INSTALL_NOPT: yarn add --ignore-platform --ignore-optional

on:
push:
branches:
Expand Down Expand Up @@ -39,9 +42,41 @@ jobs:
- name: Install Snapcraft (on Ubuntu)
uses: samuelmeuli/action-snapcraft@v1
if: startsWith(matrix.os, 'ubuntu')
# with:
# Disable since the Snapcraft token is currently not working
# snapcraft_token: ${{ secrets.snapcraft_token }}
with:
snapcraft_token: ${{ secrets.snapcraft_token }}

- id: get_unm_version
name: Get the installed UNM version
run: |
yarn --ignore-optional
unm_version=$(node -e "console.log(require('./node_modules/@unblockneteasemusic/rust-napi/package.json').version)")
echo "::set-output name=unmver::${unm_version}"
shell: bash

- name: Install UNM dependencies for Windows
if: runner.os == 'Windows'
run: |
${{ env.YARN_INSTALL_NOPT }} \
@unblockneteasemusic/rust-napi-win32-x64-msvc@${{steps.get_unm_version.outputs.unmver}}
shell: bash

- name: Install UNM dependencies for macOS
if: runner.os == 'macOS'
run: |
${{ env.YARN_INSTALL_NOPT }} \
@unblockneteasemusic/rust-napi-darwin-x64@${{steps.get_unm_version.outputs.unmver}} \
@unblockneteasemusic/rust-napi-darwin-arm64@${{steps.get_unm_version.outputs.unmver}} \
dmg-license
shell: bash

- name: Install UNM dependencies for Linux
if: runner.os == 'Linux'
run: |
${{ env.YARN_INSTALL_NOPT }} \
@unblockneteasemusic/rust-napi-linux-x64-gnu@${{steps.get_unm_version.outputs.unmver}} \
@unblockneteasemusic/rust-napi-linux-arm64-gnu@${{steps.get_unm_version.outputs.unmver}} \
@unblockneteasemusic/rust-napi-linux-arm-gnueabihf@${{steps.get_unm_version.outputs.unmver}}
shell: bash

- name: Build/release Electron app
uses: samuelmeuli/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
},
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"jsx": "preserve"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yesplaymusic",
"version": "0.4.4",
"version": "0.4.5",
"private": true,
"description": "A third party music player for Netease Music",
"author": "qier222<[email protected]>",
Expand All @@ -23,27 +23,27 @@
},
"main": "background.js",
"dependencies": {
"@unblockneteasemusic/server": "v0.27.0-rc.6",
"@unblockneteasemusic/rust-napi": "^0.3.0-pre.1",
"NeteaseCloudMusicApi": "^4.5.2",
"axios": "^0.21.0",
"axios": "^0.26.1",
"change-case": "^4.1.2",
"cli-color": "^2.0.0",
"color": "^3.1.3",
"color": "^4.2.3",
"core-js": "^3.6.5",
"crypto-js": "^4.0.0",
"dayjs": "^1.8.36",
"dexie": "^3.0.3",
"discord-rich-presence": "^0.0.8",
"electron": "^13.6.7",
"electron-builder": "^23.0.0",
"electron-context-menu": "^2.3.0",
"electron-context-menu": "^3.1.2",
"electron-debug": "^3.1.0",
"electron-devtools-installer": "^3.2",
"electron-icon-builder": "^1.0.2",
"electron-is-dev": "^1.2.0",
"electron-icon-builder": "^2.0.1",
"electron-is-dev": "^2.0.0",
"electron-log": "^4.3.0",
"electron-store": "^6.0.1",
"electron-updater": "^4.3.5",
"electron-store": "^8.0.1",
"electron-updater": "^5.0.1",
"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"express-http-proxy": "^1.6.2",
Expand All @@ -62,12 +62,12 @@
"prettier": "2.5.1",
"qrcode": "^1.4.4",
"register-service-worker": "^1.7.1",
"svg-sprite-loader": "^5.0.0",
"svg-sprite-loader": "^6.0.11",
"tunnel": "^0.0.6",
"vscode-codicons": "^0.0.17",
"vue": "^2.6.11",
"vue-analytics": "^5.22.1",
"vue-clipboard2": "^0.3.1",
"vue-gtag": "1",
"vue-i18n": "^8.22.0",
"vue-router": "^3.4.3",
"vue-slider-component": "^3.2.5",
Expand Down
7 changes: 7 additions & 0 deletions restyled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
commit_template: 'style: with ${restyler.name}'
restylers:
- prettier
- prettier-json
- prettier-markdown
- prettier-yaml
- whitespace
12 changes: 7 additions & 5 deletions src/api/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ import {
* @param {string} id - 音乐的 id,例如 id=405998841,33894312
*/
export function getMP3(id) {
let br =
store.state.settings?.musicQuality !== undefined
? store.state.settings.musicQuality
: 320000;
const getBr = () => {
// 当返回的 quality >= 400000时,就会优先返回 hi-res
const quality = store.state.settings?.musicQuality ?? '320000';
return quality === 'flac' ? '350000' : quality;
};

return request({
url: '/song/url',
method: 'get',
params: {
id,
br,
br: getBr(),
},
});
}
Expand Down
48 changes: 46 additions & 2 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
dialog,
globalShortcut,
nativeTheme,
screen,
} from 'electron';
import {
isWindows,
Expand Down Expand Up @@ -203,8 +204,42 @@ class Background {
};

if (this.store.get('window.x') && this.store.get('window.y')) {
options.x = this.store.get('window.x');
options.y = this.store.get('window.y');
let x = this.store.get('window.x');
let y = this.store.get('window.y');

let displays = screen.getAllDisplays();
let isResetWindiw = false;
if (displays.length === 1) {
let { bounds } = displays[0];
if (
x < bounds.x ||
x > bounds.x + bounds.width - 50 ||
y < bounds.y ||
y > bounds.y + bounds.height - 50
) {
isResetWindiw = true;
}
} else {
isResetWindiw = true;
for (let i = 0; i < displays.length; i++) {
let { bounds } = displays[i];
if (
x > bounds.x &&
x < bounds.x + bounds.width &&
y > bounds.y &&
y < bounds.y - bounds.height
) {
// 检测到APP窗口当前处于一个可用的屏幕里,break
isResetWindiw = false;
break;
}
}
}

if (!isResetWindiw) {
options.x = x;
options.y = y;
}
}

this.window = new BrowserWindow(options);
Expand Down Expand Up @@ -352,6 +387,7 @@ class Background {
this.window.once('ready-to-show', () => {
log('window ready-to-show event');
this.window.show();
this.store.set('window', this.window.getBounds());
});

this.window.on('close', e => {
Expand Down Expand Up @@ -387,6 +423,14 @@ class Background {
this.store.set('window', this.window.getBounds());
});

this.window.on('maximize', () => {
this.window.webContents.send('isMaximized', true);
});

this.window.on('unmaximize', () => {
this.window.webContents.send('isMaximized', false);
});

this.window.webContents.on('new-window', function (e, url) {
e.preventDefault();
log('open url');
Expand Down
20 changes: 15 additions & 5 deletions src/components/ArtistsInLine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
<span class="artist-in-line">
{{ computedPrefix }}
<span v-for="(ar, index) in filteredArtists" :key="index">
<router-link v-if="ar.id !== 0" :to="`/artist/${ar.id}`">
{{ ar.name }}
</router-link>
<router-link v-if="ar.id !== 0" :to="`/artist/${ar.id}`">{{
ar.name
}}</router-link>
<span v-else>{{ ar.name }}</span>
<span v-if="index !== filteredArtists.length - 1">, </span>
<span v-if="index !== filteredArtists.length - 1" class="separator"
>,</span
>
</span>
</span>
</template>
Expand Down Expand Up @@ -40,4 +42,12 @@ export default {
};
</script>

<style lang="scss" scoped></style>
<style lang="scss" scoped>
.separator {
/* make separator distinct enough in long list */
margin-left: 1px;
margin-right: 4px;
position: relative;
top: 0.5px;
}
</style>
16 changes: 12 additions & 4 deletions src/components/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ export default {
box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.08);
border: 1px solid rgba(0, 0, 0, 0.06);
backdrop-filter: blur(12px);
border-radius: 8px;
border-radius: 12px;
box-sizing: border-box;
padding: 6px;
z-index: 1000;
-webkit-app-region: no-drag;
transition: background 125ms ease-out, opacity 125ms ease-out,
transform 125ms ease-out;
&:focus {
outline: none;
Expand All @@ -94,8 +96,9 @@ export default {
[data-theme='dark'] {
.menu {
background: rgba(36, 36, 36, 0.78);
backdrop-filter: blur(16px) contrast(120%);
backdrop-filter: blur(16px) contrast(120%) brightness(60%);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 0 6px rgba(255, 255, 255, 0.08);
}
.menu .item:hover {
color: var(--color-text);
Expand All @@ -112,14 +115,19 @@ export default {
font-weight: 600;
font-size: 14px;
padding: 10px 14px;
border-radius: 7px;
border-radius: 8px;
cursor: default;
color: var(--color-text);
display: flex;
align-items: center;
&:hover {
color: var(--color-primary);
background: var(--color-primary-bg-for-transparent);
transition: opacity 125ms ease-out, transform 125ms ease-out;
}
&:active {
opacity: 0.75;
transform: scale(0.95);
}
.svg-icon {
Expand Down Expand Up @@ -149,7 +157,7 @@ hr {
border-radius: 4px;
}
.info {
margin-left: 8px;
margin-left: 10px;
}
.title {
font-size: 16px;
Expand Down
2 changes: 2 additions & 0 deletions src/components/ExplicitSymbol.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default {
this.svgStyle = {
height: this.size + 'px',
width: this.size + 'px',
position: 'relative',
left: '-1px',
};
},
};
Expand Down
10 changes: 4 additions & 6 deletions src/components/LinuxTitlebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<div
class="button max-restore codicon"
:class="{
'codicon-chrome-restore': !isShowMaximized,
'codicon-chrome-maximize': isShowMaximized,
'codicon-chrome-restore': isMaximized,
'codicon-chrome-maximize': !isMaximized,
}"
@click="windowMaxRestore"
></div>
Expand All @@ -40,7 +40,7 @@ export default {
name: 'LinuxTitlebar',
data() {
return {
isShowMaximized: true,
isMaximized: false,
};
},
computed: {
Expand All @@ -49,9 +49,7 @@ export default {
created() {
if (process.env.IS_ELECTRON === true) {
ipcRenderer.on('isMaximized', (_, value) => {
// 当窗口最大化时,value为false
// 当窗口还原时,value为true
this.isShowMaximized = value;
this.isMaximized = value;
});
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ export default {
type: Boolean,
default: false,
},
minWidth: {
type: String,
default: 'calc(min(23rem, 100vw))',
},
},
computed: {
modalStyles() {
return {
width: this.width,
minWidth: this.minWidth,
};
},
},
Expand Down
1 change: 1 addition & 0 deletions src/components/ModalNewPlaylist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default {
label {
font-size: 12px;
}
user-select: none;
}
}
}
Expand Down
Loading

0 comments on commit 080322c

Please sign in to comment.