kokorobox-native 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/index.d.ts +35 -3
- package/index.js +6 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -43,8 +43,10 @@ The full TypeScript declarations are shipped in
|
|
|
43
43
|
| Rules | `fileToStr` |
|
|
44
44
|
| Platform | `getLaunchAtLogin`, `setLaunchAtLogin`, `getNetworkContext` |
|
|
45
45
|
| macOS service | `getMacosManagedServiceStatus`, `registerMacosManagedService`, `unregisterMacosManagedService`, `reloadMacosManagedService`, `openMacosLoginItemsSettings` |
|
|
46
|
+
| macOS application routing | `invokeMacosApplicationRouting` |
|
|
46
47
|
| Core permissions | `getCorePrivilegeStatus`, `setCorePrivileges` |
|
|
47
|
-
|
|
|
48
|
+
| Privileged operations | `runServiceLifecycleElevated`, `cleanupLegacyMacosService`, `stopMacosManagedService`, `repairManagedFilePermissions` |
|
|
49
|
+
| Windows | `getCurrentUserSid`, `isRunningAsAdmin`, `relaunchCurrentApplicationWithPrivilege`, `setupFirewallRules` |
|
|
48
50
|
|
|
49
51
|
`inspectApplication` validates the input for the current platform and resolves
|
|
50
52
|
it to a routing identifier: an executable path on Windows and Linux, or a code
|
|
@@ -77,6 +79,11 @@ LaunchDaemon plist and use `SMAppService` directly. They return an explicit
|
|
|
77
79
|
`requires-approval` state when an administrator must approve the daemon in
|
|
78
80
|
System Settings.
|
|
79
81
|
|
|
82
|
+
`invokeMacosApplicationRouting(request)` runs the bounded, versioned macOS
|
|
83
|
+
application-routing control-plane protocol off the Node.js main thread. It
|
|
84
|
+
controls the bundled System Extension and Network Extension; packet forwarding
|
|
85
|
+
continues to run in the separate extension process.
|
|
86
|
+
|
|
80
87
|
Core-file privilege APIs are supported on macOS and Linux. They accept only
|
|
81
88
|
canonical, existing executables named `mihomo` or `mihomo-alpha`; callers cannot
|
|
82
89
|
use them as a general privileged-command interface. See the repository's
|
|
@@ -95,10 +102,15 @@ Windows account, elevation, Firewall, and application-scan APIs report an
|
|
|
95
102
|
`UNSUPPORTED_PLATFORM:` error on other operating systems instead of behaving as
|
|
96
103
|
no-ops.
|
|
97
104
|
|
|
98
|
-
`
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
`runServiceLifecycleElevated(options)` accepts only the KokoroBox Service
|
|
106
|
+
`init`, `install`, `uninstall`, `start`, `stop`, and `restart` actions. macOS
|
|
107
|
+
legacy-service cleanup, managed-service stopping, and managed-file permission
|
|
108
|
+
repair are separate purpose-specific APIs.
|
|
109
|
+
|
|
110
|
+
`relaunchCurrentApplicationWithPrivilege(args, elevated)` starts a new copy of
|
|
111
|
+
the current Windows application without accepting an executable path. An
|
|
112
|
+
elevated relaunch presents the standard UAC prompt; the unelevated path uses
|
|
113
|
+
the interactive desktop shell token. It does not configure persistent
|
|
102
114
|
elevation.
|
|
103
115
|
|
|
104
116
|
## Contributing
|
package/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface NativeCapabilities {
|
|
|
14
14
|
networkContext: boolean;
|
|
15
15
|
networkMonitor: boolean;
|
|
16
16
|
macosServiceManagement: boolean;
|
|
17
|
+
macosApplicationRouting: boolean;
|
|
17
18
|
coreFilePrivileges: boolean;
|
|
18
19
|
serviceIdentity: boolean;
|
|
19
20
|
}
|
|
@@ -195,6 +196,40 @@ export function registerMacosManagedService(plistName: string): MacOSManagedServ
|
|
|
195
196
|
export function unregisterMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
196
197
|
export function reloadMacosManagedService(plistName: string): MacOSManagedServiceStatus;
|
|
197
198
|
export function openMacosLoginItemsSettings(): void;
|
|
199
|
+
/** Invoke the versioned macOS Network/System Extension control-plane protocol. */
|
|
200
|
+
export function invokeMacosApplicationRouting(request: string): Promise<string>;
|
|
201
|
+
export type ServiceLifecycleAction =
|
|
202
|
+
| "init"
|
|
203
|
+
| "install"
|
|
204
|
+
| "uninstall"
|
|
205
|
+
| "start"
|
|
206
|
+
| "stop"
|
|
207
|
+
| "restart";
|
|
208
|
+
export interface ServiceLifecycleOptions {
|
|
209
|
+
executablePath: string;
|
|
210
|
+
action: ServiceLifecycleAction;
|
|
211
|
+
publicKey?: string;
|
|
212
|
+
authorizedSid?: string;
|
|
213
|
+
authorizedUid?: number;
|
|
214
|
+
}
|
|
215
|
+
/** Run only a validated KokoroBox Service lifecycle action with elevation. */
|
|
216
|
+
export function runServiceLifecycleElevated(options: ServiceLifecycleOptions): Promise<void>;
|
|
217
|
+
/** Remove only the fixed pre-SMAppService KokoroBox LaunchDaemon files. */
|
|
218
|
+
export function cleanupLegacyMacosService(): Promise<void>;
|
|
219
|
+
/** Stop the fixed KokoroBox SMAppService daemon label. */
|
|
220
|
+
export function stopMacosManagedService(): Promise<void>;
|
|
221
|
+
/** Repair one file below a validated managed root for the requested Unix owner. */
|
|
222
|
+
export function repairManagedFilePermissions(
|
|
223
|
+
target: string,
|
|
224
|
+
managedRoot: string,
|
|
225
|
+
uid: number,
|
|
226
|
+
gid: number,
|
|
227
|
+
): Promise<void>;
|
|
228
|
+
/** Relaunch the current Windows application at the requested privilege level. */
|
|
229
|
+
export function relaunchCurrentApplicationWithPrivilege(
|
|
230
|
+
args: string[],
|
|
231
|
+
elevated: boolean,
|
|
232
|
+
): void;
|
|
198
233
|
/** Inspect only validated `mihomo` and `mihomo-alpha` executable paths. */
|
|
199
234
|
export function getCorePrivilegeStatus(paths: string[]): CorePrivilegeStatus[];
|
|
200
235
|
/** Grant or revoke the constrained Unix core-file privilege. */
|
|
@@ -210,7 +245,4 @@ export function scanWindowsApplications(
|
|
|
210
245
|
): Promise<ApplicationScanResult>;
|
|
211
246
|
export function getCurrentUserSid(): string;
|
|
212
247
|
export function isRunningAsAdmin(): boolean;
|
|
213
|
-
export function runElevated(command: string, args?: string[]): number;
|
|
214
|
-
export function launchElevated(command: string, args?: string[]): void;
|
|
215
|
-
export function launchUnelevated(command: string, args?: string[]): void;
|
|
216
248
|
export function setupFirewallRules(rules: FirewallRule[]): void;
|
package/index.js
CHANGED
|
@@ -110,15 +110,18 @@ export const registerMacosManagedService = nativeBinding.registerMacosManagedSer
|
|
|
110
110
|
export const unregisterMacosManagedService = nativeBinding.unregisterMacosManagedService;
|
|
111
111
|
export const reloadMacosManagedService = nativeBinding.reloadMacosManagedService;
|
|
112
112
|
export const openMacosLoginItemsSettings = nativeBinding.openMacosLoginItemsSettings;
|
|
113
|
+
export const invokeMacosApplicationRouting = nativeBinding.invokeMacosApplicationRouting;
|
|
114
|
+
export const runServiceLifecycleElevated = nativeBinding.runServiceLifecycleElevated;
|
|
115
|
+
export const cleanupLegacyMacosService = nativeBinding.cleanupLegacyMacosService;
|
|
116
|
+
export const stopMacosManagedService = nativeBinding.stopMacosManagedService;
|
|
117
|
+
export const repairManagedFilePermissions = nativeBinding.repairManagedFilePermissions;
|
|
118
|
+
export const relaunchCurrentApplicationWithPrivilege = nativeBinding.relaunchCurrentApplicationWithPrivilege;
|
|
113
119
|
export const getCorePrivilegeStatus = nativeBinding.getCorePrivilegeStatus;
|
|
114
120
|
export const setCorePrivileges = nativeBinding.setCorePrivileges;
|
|
115
121
|
export const inspectApplication = nativeBinding.inspectApplication;
|
|
116
122
|
export const scanWindowsApplications = nativeBinding.scanWindowsApplications;
|
|
117
123
|
export const getCurrentUserSid = nativeBinding.getCurrentUserSid;
|
|
118
124
|
export const isRunningAsAdmin = nativeBinding.isRunningAsAdmin;
|
|
119
|
-
export const runElevated = nativeBinding.runElevated;
|
|
120
|
-
export const launchElevated = nativeBinding.launchElevated;
|
|
121
|
-
export const launchUnelevated = nativeBinding.launchUnelevated;
|
|
122
125
|
export const setupFirewallRules = nativeBinding.setupFirewallRules;
|
|
123
126
|
export const ServiceIdentity = nativeBinding.ServiceIdentity;
|
|
124
127
|
export const openServiceIdentity = nativeBinding.openServiceIdentity;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokorobox-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "KokoroBox native bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"kokorobox-native-win32-x64-msvc": "0.
|
|
52
|
-
"kokorobox-native-win32-arm64-msvc": "0.
|
|
53
|
-
"kokorobox-native-darwin-x64": "0.
|
|
54
|
-
"kokorobox-native-darwin-arm64": "0.
|
|
55
|
-
"kokorobox-native-linux-x64-gnu": "0.
|
|
56
|
-
"kokorobox-native-linux-arm64-gnu": "0.
|
|
51
|
+
"kokorobox-native-win32-x64-msvc": "0.11.0",
|
|
52
|
+
"kokorobox-native-win32-arm64-msvc": "0.11.0",
|
|
53
|
+
"kokorobox-native-darwin-x64": "0.11.0",
|
|
54
|
+
"kokorobox-native-darwin-arm64": "0.11.0",
|
|
55
|
+
"kokorobox-native-linux-x64-gnu": "0.11.0",
|
|
56
|
+
"kokorobox-native-linux-arm64-gnu": "0.11.0"
|
|
57
57
|
}
|
|
58
58
|
}
|