diff --git a/aur/mihomo-party-bin/PKGBUILD b/aur/mihomo-party-bin/PKGBUILD index 34db537..4b34053 100644 --- a/aur/mihomo-party-bin/PKGBUILD +++ b/aur/mihomo-party-bin/PKGBUILD @@ -21,8 +21,8 @@ sha256sums_aarch64=('8cd7398b8fc1cd70d41e386af9995cbddc1043d9018391c29f056f14357 package() { bsdtar -xf data.tar.xz -C "${pkgdir}/" chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha install -Dm755 "${srcdir}/${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop" diff --git a/aur/mihomo-party-electron-bin/PKGBUILD b/aur/mihomo-party-electron-bin/PKGBUILD index 5a57476..4350ae4 100644 --- a/aur/mihomo-party-electron-bin/PKGBUILD +++ b/aur/mihomo-party-electron-bin/PKGBUILD @@ -27,8 +27,8 @@ package() { asar extract $srcdir/opt/mihomo-party/resources/app.asar ${pkgdir}/opt/mihomo-party cp -r $srcdir/opt/mihomo-party/resources/sidecar ${pkgdir}/opt/mihomo-party/resources/ cp -r $srcdir/opt/mihomo-party/resources/files ${pkgdir}/opt/mihomo-party/resources/ - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha install -Dm755 "${srcdir}/${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop" install -Dm644 "${pkgdir}/opt/mihomo-party/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png" diff --git a/aur/mihomo-party-electron/PKGBUILD b/aur/mihomo-party-electron/PKGBUILD index 443cabb..408f326 100644 --- a/aur/mihomo-party-electron/PKGBUILD +++ b/aur/mihomo-party-electron/PKGBUILD @@ -36,8 +36,8 @@ package() { asar extract $srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/app.asar ${pkgdir}/opt/mihomo-party cp -r $srcdir/${_pkgname}-${pkgver}/extra/sidecar ${pkgdir}/opt/mihomo-party/resources/ cp -r $srcdir/${_pkgname}-${pkgver}/extra/files ${pkgdir}/opt/mihomo-party/resources/ - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop" install -Dm644 "${pkgdir}/opt/mihomo-party/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png" diff --git a/aur/mihomo-party-git/PKGBUILD b/aur/mihomo-party-git/PKGBUILD index 8d611ce..30fc523 100644 --- a/aur/mihomo-party-git/PKGBUILD +++ b/aur/mihomo-party-git/PKGBUILD @@ -38,8 +38,8 @@ package() { bsdtar -xf mihomo-party-linux-$(jq '.version' $srcdir/${_pkgname}/package.json | tr -d 'v"')*.deb bsdtar -xf data.tar.xz -C "${pkgdir}/" chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha install -Dm755 "${srcdir}/../${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop" diff --git a/aur/mihomo-party/PKGBUILD b/aur/mihomo-party/PKGBUILD index e2a4c31..fb36105 100644 --- a/aur/mihomo-party/PKGBUILD +++ b/aur/mihomo-party/PKGBUILD @@ -33,8 +33,8 @@ package() { bsdtar -xf mihomo-party-linux-${pkgver}*.deb bsdtar -xf data.tar.xz -C "${pkgdir}/" chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo - chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +sx ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha install -Dm755 "${srcdir}/../${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${pkgname}.desktop" diff --git a/build/linux/deb/postinst b/build/linux/postinst similarity index 88% rename from build/linux/deb/postinst rename to build/linux/postinst index bb1b53d..f825f12 100644 --- a/build/linux/deb/postinst +++ b/build/linux/postinst @@ -11,6 +11,8 @@ else fi chmod 4755 '/opt/mihomo-party/chrome-sandbox' || true +chmod +sx /opt/mihomo-party/resources/sidecar/mihomo +chmod +sx /opt/mihomo-party/resources/sidecar/mihomo-alpha if hash update-mime-database 2>/dev/null; then update-mime-database /usr/share/mime || true diff --git a/changelog.md b/changelog.md index f11d886..bf33103 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,3 @@ ### New Features -- Sub-Store 请求默认经过内核代理 -- 允许控制是否允许局域网连接 Sub-Store -- 全局模式时自动置顶 GLOBAL 代理组 - -### Bug Fixes - -- 修复下拉菜单组件样式异常 -- 修复便携版更新时文件占用的问题 +- Linux 不再存储 root 密码 diff --git a/electron-builder.yml b/electron-builder.yml index c01a6d4..5a48433 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -58,6 +58,8 @@ linux: category: Utility artifactName: ${name}-linux-${version}-${arch}.${ext} deb: - afterInstall: 'build/linux/deb/postinst' + afterInstall: 'build/linux/postinst' +rpm: + afterInstall: 'build/linux/postinst' npmRebuild: true publish: [] diff --git a/src/main/core/manager.ts b/src/main/core/manager.ts index 4970a81..114ec24 100644 --- a/src/main/core/manager.ts +++ b/src/main/core/manager.ts @@ -69,7 +69,7 @@ export async function startCore(detached = false): Promise[]> { try { process.kill(pid, 'SIGINT') } catch { - if (process.platform !== 'win32' && encryptedPassword && isEncryptionAvailable()) { + if (process.platform === 'darwin' && encryptedPassword && isEncryptionAvailable()) { const execPromise = promisify(exec) const password = safeStorage.decryptString(Buffer.from(encryptedPassword)) try { @@ -243,16 +243,12 @@ async function checkProfile(): Promise { } export async function autoGrantCorePermition(corePath: string): Promise { - if (process.platform === 'win32') return + if (process.platform !== 'darwin') return const { encryptedPassword } = await getAppConfig() const execPromise = promisify(exec) if (encryptedPassword && isEncryptionAvailable()) { try { const password = safeStorage.decryptString(Buffer.from(encryptedPassword)) - if (process.platform === 'linux') { - await execPromise(`echo "${password}" | sudo -S chown root:root "${corePath}"`) - await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`) - } if (process.platform === 'darwin') { await execPromise(`echo "${password}" | sudo -S chown root:admin "${corePath}"`) await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`) diff --git a/src/main/utils/init.ts b/src/main/utils/init.ts index 632d16e..661b4ff 100644 --- a/src/main/utils/init.ts +++ b/src/main/utils/init.ts @@ -154,7 +154,8 @@ async function migration(): Promise { envType = [process.platform === 'win32' ? 'powershell' : 'bash'], useSubStore = true, showFloatingWindow = false, - disableTray = false + disableTray = false, + encryptedPassword } = await getAppConfig() const { 'external-controller-pipe': externalControllerPipe, @@ -214,6 +215,10 @@ async function migration(): Promise { if (!showFloatingWindow && disableTray) { await patchAppConfig({ disableTray: false }) } + // remove password + if (process.platform === 'linux' && encryptedPassword) { + await patchAppConfig({ encryptedPassword: undefined }) + } } function initDeeplink(): void { diff --git a/src/renderer/src/components/sider/tun-switcher.tsx b/src/renderer/src/components/sider/tun-switcher.tsx index dbb8143..a2b3f07 100644 --- a/src/renderer/src/components/sider/tun-switcher.tsx +++ b/src/renderer/src/components/sider/tun-switcher.tsx @@ -32,7 +32,7 @@ const TunSwitcher: React.FC = () => { }) const transform = tf ? { x: tf.x, y: tf.y, scaleX: 1, scaleY: 1 } : null const onChange = async (enable: boolean): Promise => { - if (enable && platform !== 'win32') { + if (enable && platform === 'darwin') { const encryptionAvailable = await isEncryptionAvailable() if (!appConfig?.encryptedPassword && encryptionAvailable) { setOpenPasswordModal(true) diff --git a/src/renderer/src/pages/mihomo.tsx b/src/renderer/src/pages/mihomo.tsx index 55b5004..76763d3 100644 --- a/src/renderer/src/pages/mihomo.tsx +++ b/src/renderer/src/pages/mihomo.tsx @@ -89,6 +89,11 @@ const Mihomo: React.FC = () => { setTimeout(() => { PubSub.publish('mihomo-core-changed') }, 2000) + if (platform === 'linux') { + new Notification('内核权限丢失', { + body: '内核升级成功,若要使用虚拟网卡(Tun),请到虚拟网卡页面重新手动授权内核' + }) + } } catch (e) { if (typeof e === 'string' && e.includes('already using latest version')) { new Notification('已经是最新版本')