### Start and Stop Callback Server for OAuth in JavaScript Source: https://context7.com/router-for-me/easycli/llms.txt This JavaScript code demonstrates how to start and stop a local HTTP server using Tauri's invoke method to handle OAuth authentication callbacks from providers like Google. It specifies the provider, listening port, mode (local/remote), base URL for remote mode, and the local port for CLIProxyAPI. The server automatically redirects authenticated requests, and the code includes an example of a full authentication flow with a timeout for stopping the server. ```javascript // Start callback server for provider authentication // Gemini: port 8085, path /google/callback // Claude: port 54545, path /anthropic/callback // Codex: port 1455, path /codex/callback const result = await window.__TAURI__.core.invoke('start_callback_server', { provider: 'google', listen_port: 8085, mode: 'local', // or 'remote' base_url: null, // for remote mode local_port: 8317 // CLIProxyAPI port }); // Server automatically redirects: // Local mode: http://127.0.0.1:8317/google/callback?code=... // Remote mode: http://remote-server:8317/google/callback?code=... // Stop callback server when done await window.__TAURI__.core.invoke('stop_callback_server', { listen_port: 8085 }); // Full OAuth flow example for Gemini authentication async function authenticateGemini() { // Start local callback server await window.__TAURI__.core.invoke('start_callback_server', { provider: 'google', listen_port: 8085, mode: localStorage.getItem('type'), base_url: localStorage.getItem('base-url'), local_port: 8317 }); // Open OAuth URL in browser window.open('https://accounts.google.com/o/oauth2/auth?...', '_blank'); // Server handles callback and redirects to CLIProxyAPI // Stop server after authentication completes setTimeout(async () => { await window.__TAURI__.core.invoke('stop_callback_server', { listen_port: 8085 }); }, 60000); } ``` -------------------------------- ### Auto-start Configuration Source: https://context7.com/router-for-me/easycli/llms.txt APIs for managing whether the EasyCLI application automatically starts on system boot, with platform-specific implementations. ```APIDOC ## Auto-start Configuration ### Description These functions allow you to check, enable, and disable the automatic startup of the EasyCLI application when the system boots. The implementation is handled by Tauri core commands, with platform-specific logic. ### Methods - **checkAutoStartEnabled()**: Checks if auto-start is currently enabled. - Returns: An object containing an `enabled` boolean property. - **enableAutoStart()**: Enables auto-start for the application. - Platform-specific actions: - macOS: Creates `~/Library/LaunchAgents/com.easycli.app.plist`. - Linux: Creates `~/.config/autostart/easycli.desktop`. - Windows: Adds registry key `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`. - **disableAutoStart()**: Disables auto-start for the application. - Removes platform-specific entries created by `enableAutoStart()`. ### Request Example (Enable Auto-start) ```javascript // Using Tauri's invoke to call the core command await window.__TAURI__.core.invoke('enable_auto_start'); ``` ### Response Example (Check Status) ```json { "enabled": true } ``` ``` -------------------------------- ### Start Local CLIProxyAPI Process (Rust & JavaScript) Source: https://context7.com/router-for-me/easycli/llms.txt Starts the local CLIProxyAPI process in the background. It automatically generates a management password for accessing the API endpoints. The process runs detached with a keep-alive mechanism and triggers a system tray icon. Requires Tauri. ```rust #[tauri::command] fn start_cliproxyapi(app: tauri::AppHandle) -> Result ``` ```javascript // JavaScript usage const result = await window.__TAURI__.core.invoke('start_cliproxyapi'); // Response with auto-generated password for management endpoints { "success": true, "password": "abc123def456ghi789jkl012mno345pq" } // Store password for subsequent management API calls localStorage.setItem('local-management-key', result.password); // Process runs detached in background // Keep-alive mechanism starts automatically // System tray icon appears when process is running ``` -------------------------------- ### Tauri Command: start_cliproxyapi Source: https://context7.com/router-for-me/easycli/llms.txt Starts the local CLIProxyAPI process with an automatically generated management password. The process runs in the background, and a system tray icon appears when it's active. ```APIDOC ## Tauri Command: start_cliproxyapi ### Description Starts a local instance of the CLIProxyAPI process. This command automatically generates a secure password for accessing the management endpoints of the running CLIProxyAPI instance. The process operates detached in the background, and its running status is indicated by a system tray icon. ### Method TAURI INVOKE ### Endpoint N/A (Tauri Command) ### Parameters None ### Request Example ```javascript const result = await window.__TAURI__.core.invoke('start_cliproxyapi'); // Store the management password for subsequent API calls localStorage.setItem('local-management-key', result.password); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the CLIProxyAPI process was started successfully. - **password** (string) - The auto-generated password for accessing the CLIProxyAPI management endpoints. #### Response Example ```json { "success": true, "password": "abc123def456ghi789jkl012mno345pq" } ``` ### Notes - The process runs detached in the background. - A keep-alive mechanism is automatically initiated. - A system tray icon appears when the process is running. ``` -------------------------------- ### Tauri: Auto-start Application Configuration Source: https://context7.com/router-for-me/easycli/llms.txt Manage the application's auto-start behavior on system boot using Tauri's core invoke functionality. This snippet shows how to check if auto-start is enabled, enable it (which creates platform-specific configurations), and disable it, along with an example of integrating this with a UI element. ```javascript // Check if auto-start is enabled const status = await window.__TAURI__.core.invoke('check_auto_start_enabled'); console.log('Auto-start enabled:', status.enabled); // Enable auto-start // macOS: Creates ~/Library/LaunchAgents/com.easycli.app.plist // Linux: Creates ~/.config/autostart/easycli.desktop // Windows: Adds registry key HKCU\Software\Microsoft\Windows\CurrentVersion\Run const result = await window.__TAURI__.core.invoke('enable_auto_start'); // Disable auto-start (removes platform-specific entries) await window.__TAURI__.core.invoke('disable_auto_start'); // Example UI integration const autoStartSwitch = document.getElementById('auto-start-switch'); autoStartSwitch.addEventListener('change', async () => { try { if (autoStartSwitch.checked) { await window.__TAURI__.core.invoke('enable_auto_start'); } else { await window.__TAURI__.core.invoke('disable_auto_start'); } } catch (error) { console.error('Auto-start toggle failed:', error); autoStartSwitch.checked = !autoStartSwitch.checked; } }); ``` -------------------------------- ### Check CLIProxyAPI Version and Download (Rust & JavaScript) Source: https://context7.com/router-for-me/easycli/llms.txt Checks the locally installed CLIProxyAPI version against the latest GitHub release. It can optionally use a proxy for the GitHub API request. The response indicates if an update is needed and provides version details. Requires Tauri and Rust. ```rust #[tauri::command] async fn check_version_and_download( window: tauri::Window, proxy_url: Option, ) -> Result ``` ```javascript // JavaScript frontend usage const result = await window.__TAURI__.core.invoke('check_version_and_download', { proxyUrl: 'http://127.0.0.1:7890' // Optional proxy for GitHub API }); // Response structure { "success": true, "path": "/Users/john/cliproxyapi/1.2.3", "version": "1.2.3", "needsUpdate": false, "isLatest": true, "latestVersion": null } // If update needed { "success": true, "path": "/Users/john/cliproxyapi/1.2.0", "version": "1.2.0", "needsUpdate": true, "isLatest": false, "latestVersion": "1.2.3" } ``` -------------------------------- ### Tauri Command: check_version_and_download Source: https://context7.com/router-for-me/easycli/llms.txt Checks the locally installed CLIProxyAPI version against the latest GitHub release. It can optionally use a proxy for the GitHub API request. ```APIDOC ## Tauri Command: check_version_and_download ### Description Checks the locally installed CLIProxyAPI version against the latest GitHub release. This command can optionally utilize a proxy for accessing the GitHub API. ### Method TAURI INVOKE ### Endpoint N/A (Tauri Command) ### Parameters #### Query Parameters - **proxyUrl** (string) - Optional - A proxy URL (e.g., 'http://127.0.0.1:7890') to use for the GitHub API request. ### Request Example ```javascript const result = await window.__TAURI__.core.invoke('check_version_and_download', { proxyUrl: 'http://127.0.0.1:7890' }); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **path** (string) - The installation path of the CLIProxyAPI. - **version** (string) - The currently installed version of CLIProxyAPI. - **needsUpdate** (boolean) - True if an update is available, false otherwise. - **isLatest** (boolean) - True if the currently installed version is the latest, false otherwise. - **latestVersion** (string | null) - The latest available version on GitHub, or null if no update is needed or available. #### Response Example (Update Needed) ```json { "success": true, "path": "/Users/john/cliproxyapi/1.2.0", "version": "1.2.0", "needsUpdate": true, "isLatest": false, "latestVersion": "1.2.3" } ``` #### Response Example (No Update Needed) ```json { "success": true, "path": "/Users/john/cliproxyapi/1.2.3", "version": "1.2.3", "needsUpdate": false, "isLatest": true, "latestVersion": null } ``` ``` -------------------------------- ### Restart Local CLIProxyAPI Process (Rust & JavaScript) Source: https://context7.com/router-for-me/easycli/llms.txt Restarts the local CLIProxyAPI process, applying any new configuration changes. This command is typically called after configuration updates, such as port changes. The frontend can listen for a 'cliproxyapi-restarted' event to confirm the restart and get the new version. Requires Tauri. ```rust #[tauri::command] fn restart_cliproxyapi(app: tauri::AppHandle) -> Result<(), String> ``` ```javascript // JavaScript usage - automatically called after port changes async function handlePortChange() { try { await window.__TAURI__.core.invoke('restart_cliproxyapi'); console.log('CLIProxyAPI restarted with new configuration'); // Window receives 'cliproxyapi-restarted' event window.__TAURI__.event.listen('cliproxyapi-restarted', (event) => { console.log('Restarted version:', event.payload.version); }); } catch (error) { console.error('Restart failed:', error); } } ``` -------------------------------- ### Download Local Authentication Files (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Initiates a download for specified authentication files using the native operating system's file picker dialog. Users can choose a directory to save the files. The command returns a success status and counts for successful and failed downloads. ```rust #[tauri::command] fn download_local_auth_files(filenames: Vec) -> Result ``` ```javascript const result = await window.__TAURI__.core.invoke('download_local_auth_files', { filenames: ['account1.json', 'account2.json'] }); ``` -------------------------------- ### List Local Authentication Files (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Lists all JSON authentication files found in the directory specified by the 'auth-dir' configuration. It returns a JSON array of objects, each containing file details like name, size, modification time, and type. This is useful for displaying available authentication credentials. ```rust #[tauri::command] fn read_local_auth_files() -> Result ``` ```javascript const files = await window.__TAURI__.core.invoke('read_local_auth_files'); ``` -------------------------------- ### Upload Local Authentication Files (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Uploads JSON authentication files to the local 'auth-dir'. This command accepts a vector of file objects, each containing the file name and its content. It returns a summary of the upload operation, including the count of successful and failed uploads. ```rust #[tauri::command] fn upload_local_auth_files(files: Vec) -> Result ``` ```javascript // JavaScript usage with file input const fileInput = document.getElementById('auth-file-input'); const files = Array.from(fileInput.files); // Read file contents const uploadData = await Promise.all(files.map(async (file) => { const content = await file.text(); return { name: file.name, content }; })); const result = await window.__TAURI__.core.invoke('upload_local_auth_files', { files: uploadData }); ``` -------------------------------- ### Unified Configuration Management API with ConfigManager Source: https://context7.com/router-for-me/easycli/llms.txt The ConfigManager class offers a consistent API for managing application settings and API keys, abstracting whether the CLIProxyAPI is running locally or remotely. It handles configuration retrieval, updates, API key management, authentication file operations, and provider-specific token saving. ```javascript // Initialize (automatically detects mode from localStorage) const configManager = new ConfigManager(); // Mode is automatically determined from localStorage.getItem('type') // 'local' - manages local CLIProxyAPI instance via Tauri commands // 'remote' - connects to remote CLIProxyAPI via HTTP management API // Get complete configuration (works in both modes) const config = await configManager.getConfig(); // Update single setting await configManager.updateSetting('debug', true); await configManager.updateSetting('port', 8080); await configManager.updateSetting('remote-management.allow-remote', true); // Get API keys by type const geminiKeys = await configManager.getApiKeys('gemini'); const claudeKeys = await configManager.getApiKeys('claude'); const accessTokens = await configManager.getApiKeys('access-token'); // Update API keys await configManager.updateApiKeys('gemini', ['AIzaSyABC123', 'AIzaSyDEF456']); // Authentication file operations const authFiles = await configManager.getAuthFiles(); // Upload files (browser File objects) const uploadResult = await configManager.uploadAuthFiles([file1, file2]); // Delete files const deleteResult = await configManager.deleteAuthFiles(['old-file.json']); // Download files const downloadResult = await configManager.downloadAuthFiles(['account.json']); // Provider-specific auth methods await configManager.saveGeminiWebTokens( 'secure1psid_value', 'secure1psidts_value', 'user@example.com' ); await configManager.saveIFlowCookie('cookie_string'); await configManager.importVertexCredential(serviceAccountFile, 'us-central1'); // Keep-alive mechanism (Local mode only) await configManager.startKeepAlive(); await configManager.stopKeepAlive(); ``` -------------------------------- ### Read Configuration from config.yaml (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Reads the entire configuration from the config.yaml file in local mode. This command returns a JSON value representing the configuration. It's useful for loading all settings at once. No specific dependencies are mentioned beyond the Tauri framework. ```rust #[tauri::command] fn read_config_yaml() -> Result ``` ```javascript const config = await window.__TAURI__.core.invoke('read_config_yaml'); ``` -------------------------------- ### Download and Extract CLIProxyAPI (Rust & JavaScript) Source: https://context7.com/router-for-me/easycli/llms.txt Downloads and extracts the latest CLIProxyAPI release for the current platform. It supports using a proxy for the download and emits progress and status events to the frontend. The response includes the path and version of the downloaded release. Requires Tauri. ```rust #[tauri::command] async fn download_cliproxyapi( window: tauri::Window, proxy_url: Option, ) -> Result ``` ```javascript // JavaScript frontend usage with progress monitoring window.__TAURI__.event.listen('download-progress', (event) => { const { progress, downloaded, total } = event.payload; console.log(`Progress: ${progress}% (${downloaded}/${total} bytes)`); }); window.__TAURI__.event.listen('download-status', (event) => { const { status, version } = event.payload; // status: 'checking', 'starting', 'completed', 'failed' console.log(`Status: ${status}, Version: ${version}`); }); const result = await window.__TAURI__.core.invoke('download_cliproxyapi', { proxyUrl: 'socks5://127.0.0.1:1080' }); // Response { "success": true, "path": "/Users/john/cliproxyapi/1.2.3", "version": "1.2.3" } ``` -------------------------------- ### Tauri Command: download_cliproxyapi Source: https://context7.com/router-for-me/easycli/llms.txt Downloads and extracts the latest CLIProxyAPI release for the current platform. It supports progress monitoring via events and can use a proxy for the download. ```APIDOC ## Tauri Command: download_cliproxyapi ### Description Downloads and extracts the latest CLIProxyAPI release compatible with the current operating system and architecture. This command allows for progress monitoring through event listeners and can utilize a specified proxy URL for the download process. ### Method TAURI INVOKE ### Endpoint N/A (Tauri Command) ### Parameters #### Query Parameters - **proxyUrl** (string) - Optional - A proxy URL (e.g., 'socks5://127.0.0.1:1080') to use for the download. ### Event Listeners - **download-progress**: Listens for progress updates during the download. Payload includes `progress` (percentage), `downloaded` (bytes), and `total` (bytes). - **download-status**: Listens for status updates. Payload includes `status` ('checking', 'starting', 'completed', 'failed') and `version`. ### Request Example ```javascript // Listen for events before invoking the command window.__TAURI__.event.listen('download-progress', (event) => { const { progress, downloaded, total } = event.payload; console.log(`Progress: ${progress}% (${downloaded}/${total} bytes)`); }); window.__TAURI__.event.listen('download-status', (event) => { const { status, version } = event.payload; console.log(`Status: ${status}, Version: ${version}`); }); // Invoke the download command const result = await window.__TAURI__.core.invoke('download_cliproxyapi', { proxyUrl: 'socks5://127.0.0.1:1080' }); ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the download and extraction were successful. - **path** (string) - The installation path of the downloaded CLIProxyAPI. - **version** (string) - The version of the downloaded CLIProxyAPI. #### Response Example ```json { "success": true, "path": "/Users/john/cliproxyapi/1.2.3", "version": "1.2.3" } ``` ``` -------------------------------- ### Remote CLIProxyAPI Management via HTTP Source: https://context7.com/router-for-me/easycli/llms.txt This section details how to configure and interact with a remote CLIProxyAPI instance using its HTTP management API. It covers setting up the connection details in localStorage and making requests to specific endpoints for configuration, API keys, and file operations. ```javascript // Set up remote connection (in login.js) localStorage.setItem('type', 'remote'); localStorage.setItem('base-url', 'http://remote-server:8317'); localStorage.setItem('password', 'management-secret-key'); // ConfigManager automatically uses HTTP endpoints const configManager = new ConfigManager(); // GET /v0/management/config const config = await configManager.getConfig(); // PUT /v0/management/debug with {"value": true} await configManager.updateSetting('debug', true); // GET /v0/management/gemini-api-key const geminiKeys = await configManager.getApiKeys('gemini'); // PUT /v0/management/gemini-api-key with array body await configManager.updateApiKeys('gemini', ['key1', 'key2']); // POST /v0/management/auth-files with multipart/form-data const uploadResult = await configManager.uploadAuthFiles(fileList); // GET /v0/management/auth-files const files = await configManager.getAuthFiles(); // DELETE /v0/management/auth-files?name=file.json await configManager.deleteAuthFiles(['file.json']); // GET /v0/management/auth-files/download?name=file.json await configManager.downloadAuthFiles(['file.json']); // All requests include header: // Authorization: Bearer ``` -------------------------------- ### ConfigManager Class API Source: https://context7.com/router-for-me/easycli/llms.txt Provides a unified interface for managing configuration settings, API keys, and authentication files for both local and remote CLIProxyAPI instances. ```APIDOC ## ConfigManager Class API ### Description This class offers a consistent API for interacting with configuration settings and authentication data, abstracting away the underlying mode (local or remote). ### Methods - **getConfig()**: Retrieves the complete configuration object. - **updateSetting(key, value)**: Updates a specific configuration setting. - **getApiKeys(type)**: Retrieves API keys for a given provider type (e.g., 'gemini', 'claude', 'access-token'). - **updateApiKeys(type, keys)**: Updates API keys for a specified provider type. - **getAuthFiles()**: Retrieves a list of authentication files. - **uploadAuthFiles(files)**: Uploads one or more authentication files. - **deleteAuthFiles(filenames)**: Deletes specified authentication files. - **downloadAuthFiles(filenames)**: Downloads specified authentication files. - **saveGeminiWebTokens(psid, psidts, email)**: Saves Gemini web tokens. - **saveIFlowCookie(cookie)**: Saves an iFlow cookie. - **importVertexCredential(serviceAccountFile, location)**: Imports Vertex AI credentials. - **startKeepAlive()**: Starts the keep-alive mechanism (Local mode only). - **stopKeepAlive()**: Stops the keep-alive mechanism (Local mode only). ### Request Example (Update Setting) ```javascript const configManager = new ConfigManager(); await configManager.updateSetting('debug', true); ``` ### Response Example (Get Config) ```json { "debug": true, "port": 8080, "remote-management": { "allow-remote": true } } ``` ``` -------------------------------- ### Disable Window Maximization on Windows using Tauri Source: https://github.com/router-for-me/easycli/blob/main/login.html This asynchronous JavaScript function checks if the application is running on Windows and, if so, disables the window maximization feature using Tauri's API. It includes error handling to log warnings if the operation fails. ```javascript (async () => { try { const isWindows = navigator.userAgent.toLowerCase().includes('windows'); const getCurrentWindow = window.__TAURI__.window?.getCurrent; if (isWindows && typeof getCurrentWindow === 'function') { const currentWindow = getCurrentWindow(); if (currentWindow && typeof currentWindow.setMaximizable === 'function') { await currentWindow.setMaximizable(false); } } } catch (err) { console.warn('Disable maximize failed:', err); } })(); ``` -------------------------------- ### Update Configuration in config.yaml (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Updates a specific configuration value in config.yaml using a dot notation path. It can also be used to delete a configuration key. This command takes the endpoint (path), the new value, and an optional boolean to indicate deletion. It returns the updated configuration JSON. ```rust #[tauri::command] fn update_config_yaml( endpoint: String, value: serde_json::Value, is_delete: Option, ) -> Result ``` ```javascript // JavaScript usage - update nested values await window.__TAURI__.core.invoke('update_config_yaml', { endpoint: 'debug', value: true, is_delete: false }); // Update nested configuration await window.__TAURI__.core.invoke('update_config_yaml', { endpoint: 'remote-management.allow-remote', value: true, is_delete: false }); // Delete configuration key await window.__TAURI__.core.invoke('update_config_yaml', { endpoint: 'proxy-url', value: '', is_delete: true }); // Update array values await window.__TAURI__.core.invoke('update_config_yaml', { endpoint: 'gemini-api-key', value: ["AIzaSyABC123", "AIzaSyDEF456"], is_delete: false }); ``` -------------------------------- ### Tauri Command: restart_cliproxyapi Source: https://context7.com/router-for-me/easycli/llms.txt Restarts the local CLIProxyAPI process, applying any new configuration changes. This command is typically invoked after configuration updates, such as port changes. ```APIDOC ## Tauri Command: restart_cliproxyapi ### Description Restarts the currently running local CLIProxyAPI process. This is often necessary after configuration changes, such as updating network ports or other settings, to ensure the new configuration is applied effectively. The command also triggers a 'cliproxyapi-restarted' event upon successful restart. ### Method TAURI INVOKE ### Endpoint N/A (Tauri Command) ### Parameters None ### Request Example ```javascript async function handlePortChange() { try { await window.__TAURI__.core.invoke('restart_cliproxyapi'); console.log('CLIProxyAPI restarted with new configuration'); } catch (error) { console.error('Restart failed:', error); } } ``` ### Event Triggered on Success - **cliproxyapi-restarted**: This event is emitted after a successful restart. The payload contains the `version` of the restarted process. ### Response #### Success Response (200) - (No specific JSON response body, indicates success via event) #### Error Response - (Error details if the restart fails, typically returned as a string) ### Notes - This command is automatically called after port changes in the EasyCLI settings. - The `cliproxyapi-restarted` event can be used to update the UI or perform other actions based on the new state of the CLIProxyAPI process. ``` -------------------------------- ### Delete Local Authentication Files (Tauri Command) Source: https://context7.com/router-for-me/easycli/llms.txt Deletes specified authentication files from the local 'auth-dir'. It takes a vector of filenames as input and returns a JSON object indicating the success count and any errors encountered during deletion. ```rust #[tauri::command] fn delete_local_auth_files(filenames: Vec) -> Result ``` ```javascript const result = await window.__TAURI__.core.invoke('delete_local_auth_files', { filenames: ['old-account.json', 'expired-key.json'] }); ``` -------------------------------- ### Dev Convenience: Reload on Cmd/Ctrl+R Source: https://github.com/router-for-me/easycli/blob/main/settings.html This JavaScript snippet provides a developer convenience feature to reload the browser window when Cmd/Ctrl+R is pressed. It prevents the default browser behavior and triggers a page reload. This is useful during development for quick updates. ```javascript window.addEventListener('keydown', function (e) { if ((e.metaKey || e.ctrlKey) && (e.key === 'r' || e.key === 'R')) { e.preventDefault(); location.reload(); } }); ``` -------------------------------- ### Remote Mode: HTTP Management API Source: https://context7.com/router-for-me/easycli/llms.txt Exposes RESTful endpoints for managing remote CLIProxyAPI instances, including configuration, API keys, and authentication files. ```APIDOC ## Remote Mode: HTTP Management API ### Description This API allows you to connect to and manage remote CLIProxyAPI instances over HTTP. Requests are authenticated using a Bearer token. ### Base URL `http://:` (e.g., `http://remote-server:8317`) ### Authentication Requests must include the `Authorization: Bearer ` header. ### Endpoints - **GET /v0/management/config** - Description: Retrieves the complete configuration. - Method: GET - **PUT /v0/management/debug** - Description: Updates the debug setting. - Method: PUT - Request Body: - **value** (boolean) - Required - The new debug state. - **GET /v0/management/gemini-api-key** - Description: Retrieves Gemini API keys. - Method: GET - **PUT /v0/management/gemini-api-key** - Description: Updates Gemini API keys. - Method: PUT - Request Body: - **keys** (array[string]) - Required - The list of new API keys. - **POST /v0/management/auth-files** - Description: Uploads authentication files. - Method: POST - Parameters: `multipart/form-data` - **GET /v0/management/auth-files** - Description: Retrieves a list of authentication files. - Method: GET - **DELETE /v0/management/auth-files** - Description: Deletes specified authentication files. - Method: DELETE - Query Parameters: - **name** (string) - Required - The name of the file to delete. - **GET /v0/management/auth-files/download** - Description: Downloads specified authentication files. - Method: GET - Query Parameters: - **name** (string) - Required - The name of the file to download. ### Request Example (Update Debug Setting) ```javascript // Assuming configManager is initialized for remote mode await configManager.updateSetting('debug', true); ``` ### Response Example (Get Config) ```json { "debug": true, "port": 8080, "remote-management": { "allow-remote": true } } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.