mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
fix(panel): harden cross-environment 2.33.0+ launcher coverage with zero-subprocess fast path and on-demand UAC
- Add pure Node.js [MS-SHLLINK] raw-byte fast probe (`probeWindowsShortcutsFast`) so steady-state startups and 15-minute background rechecks run in <20ms with zero subprocesses, zero COM calls, and zero recursive folder traversal into Desktop subdirectories or unrelated Start Menu vendor folders - Restrict Windows shortcut scanning to top-level Desktop / OneDrive Desktop / Taskbar / Startup `.lnk` files and `Programs\Antigravity*`, pre-filtering raw bytes before lazily instantiating `WScript.Shell` COM - Patch exact O(1) user-space `HKCU\Software\Classes` launch keys (`antigravity` protocol, `Applications\Antigravity.exe`, `AntigravitySourceFile`) via `.NET` `Registry.CurrentUser` with `--remote-debugging-port=0` placed before `-- "%1"`, resolve `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe` explicitly, and tolerate inaccessible folders without aborting - Support All-Users read-only public shortcuts (`readOnlyPaths`) and elevated old host processes via user-consented `-Verb RunAs` on 1-click relaunch while preserving WMI `Win32_Process.Create` when already elevated and de-elevating via `Shell.Application` when the original host ran unelevated (preserving Explorer drag-and-drop) - Generalize Linux `.desktop` `Exec=` patching for `env` prefixes and `Antigravity-*.AppImage`, add pure `node:fs` `/proc` executable discovery, gate launcher checks behind leader lease acquisition, and differentiate macOS / read-only shortcut notices honestly in `BridgeStatusNotice`
This commit is contained in:
@@ -186,6 +186,7 @@ export const BridgeStatusNotice = defineComponent({
|
||||
|
||||
function syncActionButtons() {
|
||||
const canRelaunch = lastPayload.windowBridge?.canRelaunch !== false;
|
||||
const needsAuth = Boolean(lastPayload.windowBridge?.hasReadOnlyShortcuts);
|
||||
patchAttr(relaunchBtnEl, 'hidden', !canRelaunch);
|
||||
patchAttr(relaunchBtnEl, 'disabled', relaunchState === 'relaunching');
|
||||
patchText(
|
||||
@@ -194,7 +195,9 @@ export const BridgeStatusNotice = defineComponent({
|
||||
? t('settings.bridge.relaunchingBtn')
|
||||
: relaunchState === 'failed'
|
||||
? t('settings.bridge.relaunchFailed')
|
||||
: t('settings.bridge.relaunchBtn')
|
||||
: needsAuth
|
||||
? t('settings.bridge.relaunchAuthBtn')
|
||||
: t('settings.bridge.relaunchBtn')
|
||||
);
|
||||
|
||||
patchSvgIcon(copyBtnIconEl, copied ? 'check' : 'copy');
|
||||
@@ -227,38 +230,44 @@ export const BridgeStatusNotice = defineComponent({
|
||||
patchAttr(rootEl, 'hidden', !shouldShow);
|
||||
if (!shouldShow) return;
|
||||
|
||||
const plat = String(lastPayload.hostPlatform || '').trim().toLowerCase();
|
||||
const hasReadOnlyShortcuts = Boolean(wb?.hasReadOnlyShortcuts);
|
||||
const isMacDesktop = plat === 'darwin' && !wb?.argvConfigured;
|
||||
const isAutoConfigured = Boolean(
|
||||
wb?.launcherConfigured || wb?.argvUpdatedThisBoot || wb?.argvConfigured
|
||||
);
|
||||
const useRestartTheme = !hasReadOnlyShortcuts && (isAutoConfigured || isMacDesktop);
|
||||
|
||||
patchClasses(rootEl, {
|
||||
'is-restart': isAutoConfigured,
|
||||
'is-warn': !isAutoConfigured,
|
||||
'is-restart': useRestartTheme,
|
||||
'is-warn': !useRestartTheme,
|
||||
});
|
||||
patchSvgIcon(headIconEl, isAutoConfigured ? 'refresh' : 'warning');
|
||||
patchSvgIcon(headIconEl, useRestartTheme ? 'refresh' : 'warning');
|
||||
|
||||
let titleText = '';
|
||||
if (isAutoConfigured) {
|
||||
let bodyText = '';
|
||||
if (hasReadOnlyShortcuts) {
|
||||
titleText = contextMode
|
||||
? t('settings.bridge.ctxReadOnlyTitle')
|
||||
: t('settings.bridge.readOnlyTitle');
|
||||
bodyText = t('settings.bridge.readOnlyBody');
|
||||
} else if (isMacDesktop) {
|
||||
titleText = contextMode
|
||||
? t('settings.bridge.ctxMacTitle')
|
||||
: t('settings.bridge.macTitle');
|
||||
bodyText = t('settings.bridge.guideMac');
|
||||
} else if (isAutoConfigured) {
|
||||
titleText = contextMode
|
||||
? t('settings.bridge.ctxRestartTitle')
|
||||
: t('settings.bridge.restartTitle');
|
||||
} else if (contextMode) {
|
||||
titleText = t('settings.bridge.ctxTitle');
|
||||
} else if (state === 'cdp_unreachable') {
|
||||
titleText = t('settings.bridge.unreachableTitle');
|
||||
} else {
|
||||
titleText = t('settings.bridge.noPortTitle');
|
||||
}
|
||||
|
||||
const plat = String(lastPayload.hostPlatform || '').trim().toLowerCase();
|
||||
let bodyText = '';
|
||||
if (isAutoConfigured) {
|
||||
bodyText = t('settings.bridge.restartBody');
|
||||
} else if (plat === 'darwin') {
|
||||
bodyText = t('settings.bridge.guideMac');
|
||||
} else if (plat === 'linux') {
|
||||
bodyText = t('settings.bridge.guideLinux');
|
||||
} else {
|
||||
bodyText = t('settings.bridge.guideWin');
|
||||
titleText = contextMode
|
||||
? t('settings.bridge.ctxTitle')
|
||||
: state === 'cdp_unreachable'
|
||||
? t('settings.bridge.unreachableTitle')
|
||||
: t('settings.bridge.noPortTitle');
|
||||
bodyText = plat === 'linux' ? t('settings.bridge.guideLinux') : t('settings.bridge.guideWin');
|
||||
}
|
||||
|
||||
patchText(titleEl, titleText);
|
||||
|
||||
Reference in New Issue
Block a user