mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
parent
b72476952a
commit
fe5ddcf0c2
|
@ -2,6 +2,10 @@
|
|||
|
||||
- 1.2.x YAML覆写语法有所变动,请更新后参考文档进行修改
|
||||
|
||||
### Features
|
||||
|
||||
- 支持托盘菜单切换订阅
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- 修复覆写更新后全局启用状态丢失的问题
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import {
|
||||
changeCurrentProfile,
|
||||
getAppConfig,
|
||||
getControledMihomoConfig,
|
||||
getProfileConfig,
|
||||
patchAppConfig,
|
||||
patchControledMihomoConfig
|
||||
} from '../config'
|
||||
|
@ -75,6 +77,7 @@ const buildContextMenu = async (): Promise<Menu> => {
|
|||
// 避免出错时无法创建托盘菜单
|
||||
}
|
||||
}
|
||||
const { current, items = [] } = await getProfileConfig()
|
||||
|
||||
const contextMenu = [
|
||||
{
|
||||
|
@ -163,6 +166,24 @@ const buildContextMenu = async (): Promise<Menu> => {
|
|||
},
|
||||
...groupsMenu,
|
||||
{ type: 'separator' },
|
||||
{
|
||||
type: 'submenu',
|
||||
label: '订阅配置',
|
||||
submenu: items.map((item) => {
|
||||
return {
|
||||
type: 'radio',
|
||||
label: item.name,
|
||||
checked: item.id === current,
|
||||
click: async (): Promise<void> => {
|
||||
if (item.id === current) return
|
||||
await changeCurrentProfile(item.id)
|
||||
mainWindow?.webContents.send('profileConfigUpdated')
|
||||
ipcMain.emit('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
type: 'submenu',
|
||||
label: '打开目录',
|
||||
|
|
|
@ -33,6 +33,7 @@ export const ProfileConfigProvider: React.FC<{ children: ReactNode }> = ({ child
|
|||
alert(e)
|
||||
} finally {
|
||||
mutateProfileConfig()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,7 @@ export const ProfileConfigProvider: React.FC<{ children: ReactNode }> = ({ child
|
|||
alert(e)
|
||||
} finally {
|
||||
mutateProfileConfig()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,7 @@ export const ProfileConfigProvider: React.FC<{ children: ReactNode }> = ({ child
|
|||
alert(e)
|
||||
} finally {
|
||||
mutateProfileConfig()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +66,7 @@ export const ProfileConfigProvider: React.FC<{ children: ReactNode }> = ({ child
|
|||
alert(e)
|
||||
} finally {
|
||||
mutateProfileConfig()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,6 +77,7 @@ export const ProfileConfigProvider: React.FC<{ children: ReactNode }> = ({ child
|
|||
alert(e)
|
||||
} finally {
|
||||
mutateProfileConfig()
|
||||
window.electron.ipcRenderer.send('updateTrayMenu')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user