mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-24 16:27:23 +08:00
fix(mpris): 修复 MPRIS 模块多项安全和性能问题
- 将 fix-sandbox.js 从 postinstall 移除,避免 npm install 时执行 sudo - 修复 play/pause/stop 事件语义错误,不再全部映射到 togglePlay - 缓存平台信息避免 sendSync 阻塞渲染进程 - 修复 cleanupAppShortcuts 中缺少 MPRIS 监听器清理导致的事件泄漏 - destroyMpris 中添加 IPC 监听器清理 - 清理冗余调试日志,安全加载 dbus-native 模块 - 添加 mpris-service 类型声明解决跨平台类型检查问题
This commit is contained in:
+17
-5
@@ -1,9 +1,21 @@
|
||||
/**
|
||||
* 修复 Linux 下 Electron sandbox 权限问题
|
||||
* chrome-sandbox 需要 root 拥有且权限为 4755
|
||||
*
|
||||
* 注意:此脚本需要 sudo 权限,仅在 CI 环境或手动执行时使用
|
||||
* 用法:sudo node fix-sandbox.js
|
||||
*/
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
if (process.platform === 'linux') {
|
||||
// You need to make sure that
|
||||
// /home/runner/work/VutronMusic/VutronMusic/node_modules/electron/dist/chrome-sandbox
|
||||
// is owned by root and has mode 4755.
|
||||
execSync('sudo chown root:root ./node_modules/electron/dist/chrome-sandbox');
|
||||
execSync('sudo chmod 4755 ./node_modules/electron/dist/chrome-sandbox');
|
||||
const sandboxPath = path.resolve('./node_modules/electron/dist/chrome-sandbox');
|
||||
if (fs.existsSync(sandboxPath)) {
|
||||
execSync(`sudo chown root:root ${sandboxPath}`);
|
||||
execSync(`sudo chmod 4755 ${sandboxPath}`);
|
||||
console.log('[fix-sandbox] chrome-sandbox permissions fixed');
|
||||
} else {
|
||||
console.log('[fix-sandbox] chrome-sandbox not found, skipping');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user