Skip to content

Commit 672d62d

Browse files
committed
🐞 fix: 修复自动获取窗口无法关闭
1 parent 7881b12 commit 672d62d

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

electron/main/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ class MainProcess {
4646
"disable-features",
4747
"HardwareMediaKeyHandling,MediaSessionService",
4848
);
49+
// GPU 稳定性配置:禁用 GPU 进程崩溃次数限制,允许 GPU 进程自动恢复
50+
app.commandLine.appendSwitch("disable-gpu-process-crash-limit");
4951
}
52+
// 防止后台时渲染进程被休眠
53+
app.commandLine.appendSwitch("disable-renderer-backgrounding");
54+
app.commandLine.appendSwitch("disable-backgrounding-occluded-windows");
5055
// 程序单例锁
5156
initSingleLock();
5257
// 监听应用事件

electron/main/windows/login-window.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class LoginWindow {
6969
width: 1280,
7070
height: 800,
7171
center: true,
72+
frame: true,
7273
autoHideMenuBar: true,
7374
webPreferences: {
7475
preload: join(__dirname, "../preload/index.mjs"),

src/assets/data/exclude.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export const keywords = [
215215
"总企划",
216216
"作词",
217217
"作曲",
218+
"乐团",
218219
"Acknowledgement",
219220
"Additional Vocal by",
220221
"Arranged By",

src/utils/auth.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ import { likeSong } from "@/api/song";
1515
import { formatCoverList, formatArtistsList, formatSongsList } from "@/utils/format";
1616
import { useDataStore, useMusicStore } from "@/stores";
1717
import { logout, refreshLogin } from "@/api/login";
18-
import { debounce, isFunction } from "lodash-es";
18+
import { debounce, isFunction, type DebouncedFunc } from "lodash-es";
1919
import { isBeforeSixAM } from "./time";
2020
import { dailyRecommend } from "@/api/rec";
2121
import { isElectron } from "./env";
2222
import { likePlaylist, playlistTracks } from "@/api/playlist";
2323
import { likeArtist } from "@/api/artist";
2424
import { likeAlbum } from "@/api/album";
2525
import { radioSub } from "@/api/radio";
26+
import router from "@/router";
2627

2728
/**
2829
* 用户是否登录
@@ -34,10 +35,8 @@ export const isLogin = (): 0 | 1 | 2 => {
3435
if (dataStore.loginType === "uid") return 2;
3536
return getCookie("MUSIC_U") ? 1 : 0;
3637
};
37-
3838
// 退出登录
39-
export const toLogout = async () => {
40-
const router = useRouter();
39+
export const toLogout = async (): Promise<void> => {
4140
const dataStore = useDataStore();
4241
await logout();
4342
// 去除 cookie
@@ -192,8 +191,8 @@ export const updateUserLikeMvs = async () => {
192191
};
193192

194193
// 喜欢歌曲
195-
export const toLikeSong = debounce(
196-
async (song: SongType, like: boolean) => {
194+
export const toLikeSong: DebouncedFunc<(song: SongType, like: boolean) => Promise<void>> = debounce(
195+
async (song: SongType, like: boolean): Promise<void> => {
197196
try {
198197
if (!isLogin()) {
199198
window.$message.warning("请登录后使用");
@@ -239,9 +238,9 @@ const toLikeSomething = (
239238
thingName: string,
240239
request: () => (id: number, t: 1 | 2) => Promise<{ code: number }>,
241240
update: () => Promise<void>,
242-
) =>
241+
): DebouncedFunc<(id: number, like: boolean) => Promise<void>> =>
243242
debounce(
244-
async (id: number, like: boolean) => {
243+
async (id: number, like: boolean): Promise<void> => {
245244
// 错误情况
246245
if (!id) return;
247246
if (!isLogin()) {

0 commit comments

Comments
 (0)