mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 02:52:07 +08:00
fix(service): show how to reclaim an app data root the service refuses
When the service refuses the app data root because another uid owns it (code 1012), show a sticky notice with the chown command for this account. Repairing the service cannot fix this. Refs #8026
This commit is contained in:
@@ -25,6 +25,8 @@ const SERVICE_PERMISSION_NOTICE =
|
||||
'settings.feedback.notifications.clashService.permissionFallback'
|
||||
const SERVICE_PERMISSION_GUIDE =
|
||||
'https://clash-verge-rev.github.io/faq/windows.html#service-core-permissions'
|
||||
const SERVICE_OWNER_NOTICE =
|
||||
'settings.feedback.notifications.clashService.appDataNotOwned'
|
||||
|
||||
type NoticePosition = NonNullable<IVergeConfig['notice_position']>
|
||||
type NoticeItem = ReturnType<typeof getSnapshotNotices>[number]
|
||||
@@ -95,6 +97,26 @@ const resolveNoticeMessage = (
|
||||
)
|
||||
}
|
||||
|
||||
if (i18n.key === SERVICE_OWNER_NOTICE) {
|
||||
return (
|
||||
<>
|
||||
{t(SERVICE_OWNER_NOTICE)}
|
||||
<Box
|
||||
component="code"
|
||||
sx={{
|
||||
display: 'block',
|
||||
mt: 1,
|
||||
userSelect: 'text',
|
||||
whiteSpace: 'pre-wrap',
|
||||
wordBreak: 'break-all',
|
||||
}}
|
||||
>
|
||||
{String(i18n.params?.command ?? '')}
|
||||
</Box>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const source = (i18n.params ?? {}) as Record<string, unknown>
|
||||
// Bound both parameters and their final interpolation.
|
||||
const params =
|
||||
@@ -171,6 +193,9 @@ const resolveNoticeCopyText = (
|
||||
if (notice.i18n?.key === SERVICE_PERMISSION_NOTICE) {
|
||||
return extractNoticeCopyText(notice.i18n.params?.reason)
|
||||
}
|
||||
if (notice.i18n?.key === SERVICE_OWNER_NOTICE) {
|
||||
return extractNoticeCopyText(notice.i18n.params?.command)
|
||||
}
|
||||
if (
|
||||
notice.i18n?.key === 'shared.feedback.notices.prefixedRaw' ||
|
||||
notice.i18n?.key === 'shared.feedback.notices.raw'
|
||||
|
||||
Reference in New Issue
Block a user