try to remove password storage logic

This commit is contained in:
pompurin404 2024-10-16 10:58:16 +08:00
parent 636a59ec91
commit 2705bba00f
No known key found for this signature in database
12 changed files with 30 additions and 27 deletions

View File

@ -21,8 +21,8 @@ sha256sums_aarch64=('8cd7398b8fc1cd70d41e386af9995cbddc1043d9018391c29f056f14357
package() { package() {
bsdtar -xf data.tar.xz -C "${pkgdir}/" bsdtar -xf data.tar.xz -C "${pkgdir}/"
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo chmod +sx ${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-alpha
install -Dm755 "${srcdir}/${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" 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" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop"

View File

@ -27,8 +27,8 @@ package() {
asar extract $srcdir/opt/mihomo-party/resources/app.asar ${pkgdir}/opt/mihomo-party 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/sidecar ${pkgdir}/opt/mihomo-party/resources/
cp -r $srcdir/opt/mihomo-party/resources/files ${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 +sx ${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-alpha
install -Dm755 "${srcdir}/${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" install -Dm755 "${srcdir}/${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop" 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" install -Dm644 "${pkgdir}/opt/mihomo-party/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png"

View File

@ -36,8 +36,8 @@ package() {
asar extract $srcdir/${_pkgname}-${pkgver}/dist/linux-unpacked/resources/app.asar ${pkgdir}/opt/mihomo-party 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/sidecar ${pkgdir}/opt/mihomo-party/resources/
cp -r $srcdir/${_pkgname}-${pkgver}/extra/files ${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 +sx ${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-alpha
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm644 "${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop" 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" install -Dm644 "${pkgdir}/opt/mihomo-party/resources/icon.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/${_pkgname}.png"

View File

@ -38,8 +38,8 @@ package() {
bsdtar -xf mihomo-party-linux-$(jq '.version' $srcdir/${_pkgname}/package.json | tr -d 'v"')*.deb bsdtar -xf mihomo-party-linux-$(jq '.version' $srcdir/${_pkgname}/package.json | tr -d 'v"')*.deb
bsdtar -xf data.tar.xz -C "${pkgdir}/" bsdtar -xf data.tar.xz -C "${pkgdir}/"
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo chmod +sx ${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-alpha
install -Dm755 "${srcdir}/../${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" 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" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop"

View File

@ -33,8 +33,8 @@ package() {
bsdtar -xf mihomo-party-linux-${pkgver}*.deb bsdtar -xf mihomo-party-linux-${pkgver}*.deb
bsdtar -xf data.tar.xz -C "${pkgdir}/" bsdtar -xf data.tar.xz -C "${pkgdir}/"
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo chmod +sx ${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-alpha
install -Dm755 "${srcdir}/../${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" 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" sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${pkgname}.desktop"

View File

@ -11,6 +11,8 @@ else
fi fi
chmod 4755 '/opt/mihomo-party/chrome-sandbox' || true 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 if hash update-mime-database 2>/dev/null; then
update-mime-database /usr/share/mime || true update-mime-database /usr/share/mime || true

View File

@ -1,10 +1,3 @@
### New Features ### New Features
- Sub-Store 请求默认经过内核代理 - Linux 不再存储 root 密码
- 允许控制是否允许局域网连接 Sub-Store
- 全局模式时自动置顶 GLOBAL 代理组
### Bug Fixes
- 修复下拉菜单组件样式异常
- 修复便携版更新时文件占用的问题

View File

@ -58,6 +58,8 @@ linux:
category: Utility category: Utility
artifactName: ${name}-linux-${version}-${arch}.${ext} artifactName: ${name}-linux-${version}-${arch}.${ext}
deb: deb:
afterInstall: 'build/linux/deb/postinst' afterInstall: 'build/linux/postinst'
rpm:
afterInstall: 'build/linux/postinst'
npmRebuild: true npmRebuild: true
publish: [] publish: []

View File

@ -69,7 +69,7 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
try { try {
process.kill(pid, 'SIGINT') process.kill(pid, 'SIGINT')
} catch { } catch {
if (process.platform !== 'win32' && encryptedPassword && isEncryptionAvailable()) { if (process.platform === 'darwin' && encryptedPassword && isEncryptionAvailable()) {
const execPromise = promisify(exec) const execPromise = promisify(exec)
const password = safeStorage.decryptString(Buffer.from(encryptedPassword)) const password = safeStorage.decryptString(Buffer.from(encryptedPassword))
try { try {
@ -243,16 +243,12 @@ async function checkProfile(): Promise<void> {
} }
export async function autoGrantCorePermition(corePath: string): Promise<void> { export async function autoGrantCorePermition(corePath: string): Promise<void> {
if (process.platform === 'win32') return if (process.platform !== 'darwin') return
const { encryptedPassword } = await getAppConfig() const { encryptedPassword } = await getAppConfig()
const execPromise = promisify(exec) const execPromise = promisify(exec)
if (encryptedPassword && isEncryptionAvailable()) { if (encryptedPassword && isEncryptionAvailable()) {
try { try {
const password = safeStorage.decryptString(Buffer.from(encryptedPassword)) 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') { if (process.platform === 'darwin') {
await execPromise(`echo "${password}" | sudo -S chown root:admin "${corePath}"`) await execPromise(`echo "${password}" | sudo -S chown root:admin "${corePath}"`)
await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`) await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`)

View File

@ -154,7 +154,8 @@ async function migration(): Promise<void> {
envType = [process.platform === 'win32' ? 'powershell' : 'bash'], envType = [process.platform === 'win32' ? 'powershell' : 'bash'],
useSubStore = true, useSubStore = true,
showFloatingWindow = false, showFloatingWindow = false,
disableTray = false disableTray = false,
encryptedPassword
} = await getAppConfig() } = await getAppConfig()
const { const {
'external-controller-pipe': externalControllerPipe, 'external-controller-pipe': externalControllerPipe,
@ -214,6 +215,10 @@ async function migration(): Promise<void> {
if (!showFloatingWindow && disableTray) { if (!showFloatingWindow && disableTray) {
await patchAppConfig({ disableTray: false }) await patchAppConfig({ disableTray: false })
} }
// remove password
if (process.platform === 'linux' && encryptedPassword) {
await patchAppConfig({ encryptedPassword: undefined })
}
} }
function initDeeplink(): void { function initDeeplink(): void {

View File

@ -32,7 +32,7 @@ const TunSwitcher: React.FC = () => {
}) })
const transform = tf ? { x: tf.x, y: tf.y, scaleX: 1, scaleY: 1 } : null const transform = tf ? { x: tf.x, y: tf.y, scaleX: 1, scaleY: 1 } : null
const onChange = async (enable: boolean): Promise<void> => { const onChange = async (enable: boolean): Promise<void> => {
if (enable && platform !== 'win32') { if (enable && platform === 'darwin') {
const encryptionAvailable = await isEncryptionAvailable() const encryptionAvailable = await isEncryptionAvailable()
if (!appConfig?.encryptedPassword && encryptionAvailable) { if (!appConfig?.encryptedPassword && encryptionAvailable) {
setOpenPasswordModal(true) setOpenPasswordModal(true)

View File

@ -89,6 +89,11 @@ const Mihomo: React.FC = () => {
setTimeout(() => { setTimeout(() => {
PubSub.publish('mihomo-core-changed') PubSub.publish('mihomo-core-changed')
}, 2000) }, 2000)
if (platform === 'linux') {
new Notification('内核权限丢失', {
body: '内核升级成功若要使用虚拟网卡Tun请到虚拟网卡页面重新手动授权内核'
})
}
} catch (e) { } catch (e) {
if (typeof e === 'string' && e.includes('already using latest version')) { if (typeof e === 'string' && e.includes('already using latest version')) {
new Notification('已经是最新版本') new Notification('已经是最新版本')