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