navflow-browser-server
Version:
Standalone Playwright browser server for NavFlow - enables browser automation with API key authentication, workspace device management, session sync, LLM discovery tools, and requires Node.js v22+
119 lines • 3.38 kB
TypeScript
interface DeviceInfo {
macAddress: string;
apiKey: string;
deviceName: string;
port: number;
createdAt: string;
}
interface BrowserConfig {
browserType?: string;
headless?: boolean;
stealth?: boolean;
viewport?: {
width: number;
height: number;
};
timeout?: number;
}
export declare class DeviceRegistry {
private deviceInfo;
private configPath;
private proxyServerUrl;
private ws;
private browserConfig;
constructor();
/**
* Get the MAC address of the primary network interface
*/
private getMacAddress;
/**
* Generate a secure API key
*/
private generateApiKey;
/**
* Generate a default device name based on hostname and MAC
*/
private generateDeviceName;
/**
* Load existing device configuration from disk
*/
private loadDeviceConfig;
/**
* Save device configuration to disk
*/
private saveDeviceConfig;
/**
* Initialize or load device information
*/
initialize(port: number): Promise<DeviceInfo>;
/**
* Get current device information
*/
getDeviceInfo(): DeviceInfo | null;
/**
* Display device information to console in a user-friendly format
*/
displayDeviceInfo(): void;
/**
* Check if device is registered with proxy-server
*/
checkProxyRegistration(): Promise<boolean>;
/**
* Get the accessible IP address for this device
*/
private getAccessibleIpAddress;
/**
* Register device with proxy-server
* @param {string} workspaceId - Optional workspace ID to associate device with
* @param {string} userId - Optional user ID who is registering the device
*/
registerWithProxy(workspaceId?: string, userId?: string): Promise<boolean>;
/**
* Ensure device is registered with proxy-server
* Checks registration status and re-registers if needed
*/
ensureProxyRegistration(): Promise<void>;
/**
* Establish WebSocket connection to proxy-server for device communication
*/
connectToProxyServer(): Promise<void>;
/**
* Handle HTTP request forwarded from proxy-server
*/
private handleProxiedRequest;
/**
* Sync session data with proxy-server
* @param {string} sessionId - Browser session ID
* @param {Object} sessionData - Session data to sync
* @param {string} workspaceId - Workspace ID
* @param {string} userId - User ID
*/
syncSessionWithProxy(sessionId: string, sessionData: any, workspaceId: string, userId: string): Promise<boolean>;
/**
* Get synced sessions from proxy-server
* @param {string} userId - User ID to filter sessions
*/
getSyncedSessions(userId?: string): Promise<any[]>;
/**
* Close WebSocket connection
*/
closeWebSocket(): void;
/**
* Handle configuration update from proxy-server
*/
private handleConfigurationUpdate;
/**
* Get current browser configuration
*/
getBrowserConfig(): BrowserConfig | null;
/**
* Update browser configuration
*/
updateBrowserConfig(config: BrowserConfig): void;
/**
* Get authentication middleware for Express
*/
getAuthMiddleware(): (req: any, res: any, next: any) => any;
}
export {};
//# sourceMappingURL=DeviceRegistry.d.ts.map