mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-26 02:31:40 +00:00
Reconcile the app-lock feature with main's refactored renderer architecture (publishers/hosts/AppShell) and main-process changes: - index.tsx/App.tsx: AppLockGate keeps ownership of useSettingsState and useAppLockState; new AppLockRuntimePublisher publishes the runtime via appRuntimeBridge; SettingsPublisher now binds the gate-owned settings. - AppSideEffects: defer deep links, tray port-forward toggles, global hotkeys and window close commands while locked; flush on unlock. - main.cjs: keep fresh-session re-lock before main's reusable-window fast path; before-quit guard delegates to handleBeforeQuit with main's async plugin-shutdown commitQuit and pending-update cancellation. - globalShortcutBridge: keep locked-state tray redaction on top of main's deferred tray panel show logic. - preload: adopt main's lastPayload replay for terminal popup config (superset of the gate-delay replay fix). - vite config: keep dev CSP plugin, adopt main's warn-only stale optimize-dep handling; electron-builder: keep Windows Hello helper extraResource with main's CLI-controlled arch targets. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { useLayoutEffect, type ReactNode } from 'react';
|
|
|
|
import {
|
|
AppSettingsRuntimeContext,
|
|
registerAppSettingsRuntime,
|
|
type AppSettingsRuntime,
|
|
} from '../../state/appRuntimeBridge';
|
|
|
|
export type SettingsPublisherProps = {
|
|
/**
|
|
* Pre-built settings runtime owned by an ancestor. `AppLockGate` (index.tsx)
|
|
* owns `useSettingsState` so the lock overlay can render before app children
|
|
* mount; the publisher only binds the runtime slot and context.
|
|
*/
|
|
settings: AppSettingsRuntime;
|
|
children?: ReactNode;
|
|
};
|
|
|
|
/**
|
|
* Publishes the gate-owned settings runtime the same way `VaultPublisher` /
|
|
* `SessionPublisher` hand over their runtimes: a context for render-time reads
|
|
* and the `appRuntimeBridge` slot for imperative callers.
|
|
*
|
|
* The store fan-out (`settingsChromeStore` / `appearanceChromeStore`) already
|
|
* happens inside `useSettingsState`, so this publisher only relocates the
|
|
* binding out of the component that also builds the shell's domain bags.
|
|
*/
|
|
export function SettingsPublisher({ settings, children }: SettingsPublisherProps) {
|
|
useLayoutEffect(() => {
|
|
registerAppSettingsRuntime(settings);
|
|
}, [settings]);
|
|
|
|
// Only a real unmount clears the slot; see VaultPublisher for why.
|
|
useLayoutEffect(() => () => {
|
|
registerAppSettingsRuntime(null);
|
|
}, []);
|
|
|
|
return (
|
|
<AppSettingsRuntimeContext.Provider value={settings}>
|
|
{children}
|
|
</AppSettingsRuntimeContext.Provider>
|
|
);
|
|
}
|