mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix: bugs
This commit is contained in:
parent
0b701d23da
commit
ee248be2c5
18 changed files with 3712 additions and 3901 deletions
|
|
@ -12,6 +12,7 @@ import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
|
|||
import express from "express";
|
||||
import expressProxy from "express-http-proxy";
|
||||
import Store from "electron-store";
|
||||
import path from "path";
|
||||
|
||||
class Background {
|
||||
constructor() {
|
||||
|
|
@ -88,20 +89,18 @@ class Background {
|
|||
createWindow() {
|
||||
console.log("creating app window");
|
||||
|
||||
// Only for Windows, a special title bar for it
|
||||
const withoutFrame = process.platform == "win32";
|
||||
|
||||
this.window = new BrowserWindow({
|
||||
width: this.store.get("window.width") | 1440,
|
||||
height: this.store.get("window.height") | 840,
|
||||
minWidth: 1080,
|
||||
minHeight: 720,
|
||||
titleBarStyle: "hiddenInset",
|
||||
frame: !withoutFrame,
|
||||
frame: process.platform !== "win32",
|
||||
webPreferences: {
|
||||
webSecurity: false,
|
||||
nodeIntegration: true,
|
||||
enableRemoteModule: true,
|
||||
contextIsolation: false,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<div class="right-part">
|
||||
<div class="info">
|
||||
<div class="title">{{ track.name }}</div>
|
||||
<div class="artist"><ArtistsInLine :artists="track.artists" /></div>
|
||||
<div class="artist"><ArtistsInLine :artists="artists" /></div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="buttons">
|
||||
|
|
@ -47,6 +47,9 @@ export default {
|
|||
isPlaying() {
|
||||
return this.player.playing && this.player.isPersonalFM;
|
||||
},
|
||||
artists() {
|
||||
return this.track.artists || this.track.ar || [];
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
play() {
|
||||
|
|
|
|||
|
|
@ -73,15 +73,16 @@
|
|||
<script>
|
||||
import ButtonIcon from "@/components/ButtonIcon.vue";
|
||||
import { mapState } from "vuex";
|
||||
const platformIsWin32 = window.require
|
||||
? window.require("os").platform() == "win32"
|
||||
? true
|
||||
: false
|
||||
: false;
|
||||
|
||||
const win = platformIsWin32
|
||||
? window.require("electron").remote.getCurrentWindow()
|
||||
: null;
|
||||
// import icons for win32 title bar
|
||||
// icons by https://github.com/microsoft/vscode-codicons
|
||||
import "vscode-codicons/dist/codicon.css";
|
||||
|
||||
let win = undefined;
|
||||
if (process.env.IS_ELECTRON === true) {
|
||||
const electron = require("electron");
|
||||
win = electron.remote.BrowserWindow.getFocusedWindow();
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "Navbar",
|
||||
|
|
@ -173,7 +174,7 @@ nav {
|
|||
display: none;
|
||||
}
|
||||
|
||||
[data-electron-platform-win32="yes"] {
|
||||
[data-electron-os="win32"] {
|
||||
nav {
|
||||
padding-top: 20px;
|
||||
-webkit-app-region: no-drag;
|
||||
|
|
|
|||
|
|
@ -61,12 +61,4 @@ export function initIpcMain(win, store) {
|
|||
ipcMain.on("settings", (event, options) => {
|
||||
store.set("settings", options);
|
||||
});
|
||||
|
||||
ipcMain.on("max-restore", () => {
|
||||
if (win.isMaximized()) {
|
||||
win.restore();
|
||||
} else {
|
||||
win.maximize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ export function ipcRenderer(vueInstance) {
|
|||
// 添加专有的类名
|
||||
document.body.setAttribute("data-electron", "yes");
|
||||
document.body.setAttribute(
|
||||
"data-electron-platform-win32",
|
||||
window.require("os").platform() == "win32" ? "yes" : "no"
|
||||
"data-electron-os",
|
||||
window.require("os").platform()
|
||||
);
|
||||
// ipc message channel
|
||||
const electron = window.require("electron");
|
||||
|
|
|
|||
|
|
@ -21,14 +21,18 @@ export function createTray(win) {
|
|||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: "播放/暂停",
|
||||
icon: "src/assets/icons/play.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/play.png")
|
||||
),
|
||||
click: () => {
|
||||
win.webContents.send("play");
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "上一首",
|
||||
icon: "src/assets/icons/left.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/left.png")
|
||||
),
|
||||
accelerator: "CmdOrCtrl+Left",
|
||||
click: () => {
|
||||
win.webContents.send("previous");
|
||||
|
|
@ -36,7 +40,9 @@ export function createTray(win) {
|
|||
},
|
||||
{
|
||||
label: "下一首",
|
||||
icon: "src/assets/icons/right.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/right.png")
|
||||
),
|
||||
accelerator: "CmdOrCtrl+Right",
|
||||
click: () => {
|
||||
win.webContents.send("next");
|
||||
|
|
@ -44,7 +50,9 @@ export function createTray(win) {
|
|||
},
|
||||
{
|
||||
label: "循环播放",
|
||||
icon: "src/assets/icons/repeat.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/repeat.png")
|
||||
),
|
||||
accelerator: "Alt+R",
|
||||
click: () => {
|
||||
win.webContents.send("repeat");
|
||||
|
|
@ -52,7 +60,9 @@ export function createTray(win) {
|
|||
},
|
||||
{
|
||||
label: "加入喜欢",
|
||||
icon: "src/assets/icons/like.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/like.png")
|
||||
),
|
||||
accelerator: "CmdOrCtrl+L",
|
||||
click: () => {
|
||||
win.webContents.send("like");
|
||||
|
|
@ -60,7 +70,9 @@ export function createTray(win) {
|
|||
},
|
||||
{
|
||||
label: "退出",
|
||||
icon: "src/assets/icons/exit.png",
|
||||
icon: nativeImage.createFromPath(
|
||||
path.join(__static, "img/icons/exit.png")
|
||||
),
|
||||
accelerator: "CmdOrCtrl+W",
|
||||
click: () => {
|
||||
app.exit();
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ import * as Sentry from "@sentry/browser";
|
|||
import { Vue as VueIntegration } from "@sentry/integrations";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
|
||||
// import icons for win32 title bar
|
||||
// icons by https://github.com/microsoft/vscode-codicons
|
||||
import "vscode-codicons/dist/codicon.css";
|
||||
|
||||
Vue.use(VueAnalytics, {
|
||||
id: "UA-180189423-1",
|
||||
router,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue