支持单位授权与客户端限制
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
getUpdateState,
|
||||
openReleasesPage,
|
||||
} from "../services/autoUpdater";
|
||||
import { getDeviceId } from "../services/system/deviceId";
|
||||
import { getDeviceId, getPrimaryLocalIp } from "../services/system/deviceId";
|
||||
import { getTrayManager } from "../window/trayManager";
|
||||
import { getAutoLaunchManager } from "../window/autoLaunchManager";
|
||||
import { APP_DISPLAY_NAME } from "@shared/constants";
|
||||
@@ -284,6 +284,10 @@ export function registerAppHandlers(ctx: HandlerContext): void {
|
||||
return getDeviceId();
|
||||
});
|
||||
|
||||
ipcMain.handle("app:getPrimaryLocalIp", () => {
|
||||
return getPrimaryLocalIp();
|
||||
});
|
||||
|
||||
ipcMain.handle("app:checkUpdate", async () => {
|
||||
try {
|
||||
return await checkForUpdates();
|
||||
|
||||
@@ -314,7 +314,7 @@ describe("AcpEngine.prompt", () => {
|
||||
{ messageID: "rid-timeout-001" },
|
||||
);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(60_001);
|
||||
await vi.advanceTimersByTimeAsync(600_001);
|
||||
await expect(promptPromise).resolves.toBeDefined();
|
||||
|
||||
expect(onPromptEnd).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -28,6 +28,18 @@ export function getDeviceId(): string {
|
||||
return cachedDeviceId;
|
||||
}
|
||||
|
||||
export function getPrimaryLocalIp(): string | null {
|
||||
const interfaces = os.networkInterfaces();
|
||||
for (const entries of Object.values(interfaces)) {
|
||||
for (const entry of entries ?? []) {
|
||||
if (entry.family === "IPv4" && !entry.internal) {
|
||||
return entry.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function logSystemInfo(): void {
|
||||
// 固定字段尽量保持稳定输出,便于跨平台日志分析与检索。
|
||||
const baseInfo = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Main process system services
|
||||
export { getDeviceId } from './deviceId';
|
||||
export { getDeviceId, getPrimaryLocalIp } from './deviceId';
|
||||
export { getAppEnv, setMirrorConfig } from './dependencies';
|
||||
export {
|
||||
getAppDataDir,
|
||||
|
||||
Reference in New Issue
Block a user