### POST /services/ssl/start Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Starts the SSL service. ```APIDOC ## POST /services/ssl/start ### Description Starts the SSL service. ### Method POST ### Endpoint /services/ssl/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### API Configuration and General Usage Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Demonstrates the pre-configured Axios HTTP client setup and provides examples for fetching server status and creating new users. ```APIDOC ## API Configuration and General Usage ### Description Provides examples of how to use the pre-configured Axios instance for making API requests, including fetching server status and creating users. ### Method GET, POST ### Endpoint `/api/status`, `/api/users` (example routes) ### Request Example ```json // Example for creating a user { "username": "john_doe", "password": "SecurePassword123", "email": "john@example.com" } ``` ### Response Example ```json // Example for server status { "cpu_percent": 15.5, "online_euds": 10 } // Example for user creation { "message": "User created successfully" } ``` ``` -------------------------------- ### POST /services/tcp/start Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Starts the TCP service. ```APIDOC ## POST /services/tcp/start ### Description Starts the TCP service. ### Method POST ### Endpoint /services/tcp/start ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Plugin Management APIs Source: https://context7.com/brian7704/opentakserver-ui/llms.txt APIs for managing server plugins, including installation, uninstallation, and fetching lists of installed and available plugins. ```APIDOC ## GET /api/plugins ### Description Fetches a list of currently installed server plugins. ### Method GET ### Endpoint /api/plugins ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **data** (array) - An array of installed plugin objects. #### Response Example ```json [ { "id": "plugin1", "name": "Example Plugin", "version": "1.0.0" } ] ``` ## GET /api/plugins/repo ### Description Fetches a list of available plugins from the plugin repository. ### Method GET ### Endpoint /api/plugins/repo ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **data** (array) - An array of available plugin objects from the repository. #### Response Example ```json [ { "id": "plugin2", "name": "Another Plugin", "description": "A useful server extension.", "version": "0.5.0" } ] ``` ## POST /api/plugins ### Description Installs a new server plugin. ### Method POST ### Endpoint /api/plugins ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **plugin_id** (string) - Required - The unique identifier of the plugin to install. ### Request Example ```json { "plugin_id": "plugin2" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the plugin installation was successful. #### Response Example ```json { "success": true } ``` ## DELETE /api/plugins/{pluginId} ### Description Uninstalls a server plugin. ### Method DELETE ### Endpoint /api/plugins/{pluginId} ### Parameters #### Path Parameters - **pluginId** (string) - Required - The unique identifier of the plugin to uninstall. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **success** (boolean) - Indicates if the plugin uninstallation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Manage Server Plugins (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt APIs for managing server plugins, including installing and uninstalling extensions. It relies on 'axios_config' for HTTP requests and 'apiRoutes' for endpoint definitions. Functions allow fetching installed plugins, retrieving a list of available plugins from a repository, and performing install/uninstall operations. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get installed plugins const getPlugins = async () => { try { const response = await axios.get(apiRoutes.plugins); return response.data; } catch (error) { console.error('Failed to fetch plugins:', error); return []; } }; // Get available plugins from repository const getPluginRepo = async () => { try { const response = await axios.get(apiRoutes.pluginRepo); return response.data; } catch (error) { console.error('Failed to fetch plugin repository:', error); return []; } }; // Install plugin const installPlugin = async (pluginId: string) => { try { const response = await axios.post(apiRoutes.plugins, { plugin_id: pluginId }); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Uninstall plugin const uninstallPlugin = async (pluginId: string) => { try { const response = await axios.delete(`${apiRoutes.plugins}/${pluginId}`); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### GET /admin/settings Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Retrieves the current administrative settings. ```APIDOC ## GET /admin/settings ### Description Retrieves the current administrative settings. ### Method GET ### Endpoint /admin/settings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **settings** (object) - An object containing various administrative settings. #### Response Example ```json { "settings": { "max_users": 100, "log_level": "INFO" } } ``` ``` -------------------------------- ### Axios HTTP Client Configuration and Usage Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Demonstrates the pre-configured Axios instance for API communication, including credentials, XSRF token handling, and request examples for fetching server status and creating a user. Assumes 'axios_config' and 'apiRoutes' are available. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // The axios instance is pre-configured with: // - Credentials included (withCredentials: true) // - XSRF token handling (withXSRFToken: true) // - No redirects (maxRedirects: 0) // - JSON content type headers // Example: Fetch server statusaxios.get(apiRoutes.status) .then(response => { console.log('Server status:', response.data); console.log('CPU:', response.data.cpu_percent); console.log('Online EUDs:', response.data.online_euds); }) .catch(error => { console.error('Failed to fetch status:', error); }); // Example: Create a new useraxios.post(apiRoutes.create_user, { username: 'john_doe', password: 'SecurePassword123', email: 'john@example.com' }) .then(response => { console.log('User created:', response.data); }) .catch(error => { console.error('User creation failed:', error.response.data); }); ``` -------------------------------- ### GET /recordings Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Retrieves a list of video recordings. ```APIDOC ## GET /recordings ### Description Retrieves a list of video recordings. ### Method GET ### Endpoint /recordings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **recordings** (array) - An array of recording objects. - **id** (string) - The ID of the recording. - **timestamp** (string) - The timestamp of the recording. - **duration** (number) - The duration of the recording in seconds. #### Response Example ```json { "recordings": [ { "id": "rec-123", "timestamp": "2023-10-27T10:00:00Z", "duration": 3600 } ] } ``` ``` -------------------------------- ### User Authentication: Login and Two-Factor Setup Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions for user authentication, including standard username/password login, LDAP authentication, and setup/validation of two-factor authentication (2FA). It handles CSRF token retrieval and manages authentication state in local storage. Assumes 'axios_config' and 'apiRoutes' are available. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Standard login const loginUser = async (username: string, password: string) => { try { // First, get CSRF token const tokenResponse = await axios.get(apiRoutes.login); const csrfToken = tokenResponse.data.response.csrf_token; // Set CSRF token in headers axios.defaults.headers.common['X-XSRF-Token'] = csrfToken; // Perform login const response = await axios.post(apiRoutes.login, { username: username, password: password }); if (response.status === 200) { // Get user details const userResponse = await axios.get(apiRoutes.me); const user = userResponse.data; // Store authentication data localStorage.setItem('email', user.email); localStorage.setItem('token', user.token); localStorage.setItem('username', user.username); localStorage.setItem('administrator', user.roles.includes('administrator')); localStorage.setItem('isLoggedIn', 'true'); return { success: true, user }; } } catch (error) { console.error('Login failed:', error); return { success: false, error }; } }; // LDAP login const ldapLogin = async (username: string, password: string) => { try { const response = await axios.post(apiRoutes.ldapLogin, { username, password }); if (response.status === 200) { localStorage.setItem('isLoggedIn', 'true'); return { success: true }; } } catch (error) { return { success: false, error }; } }; // Setup 2FA const setup2FA = async () => { try { const response = await axios.post(apiRoutes.tfSetup); return { qrCode: response.data.qr_code, secret: response.data.secret }; } catch (error) { console.error('2FA setup failed:', error); throw error; } }; // Validate 2FA code const validate2FA = async (authCode: string) => { try { const response = await axios.post(apiRoutes.tfValidate, { auth_code: authCode }); if (response.status === 200) { return { valid: true }; } } catch (error) { return { valid: false, error }; } }; ``` -------------------------------- ### Generate Client Certificates with TypeScript Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Create authentication certificates for TAK clients. This module includes a function to generate a client certificate for a given user and duration, which is then downloaded as a zip file. It also provides functions to retrieve QR strings for ATAK and iTAK mobile setup. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Generate client certificate const generateCertificate = async (userData: { username: string; duration?: number; }) => { try { const response = await axios.post(apiRoutes.generate_certificate, { username: userData.username, duration: userData.duration || 365 // days }); if (response.status === 200) { // Download certificate const blob = new Blob([response.data], { type: 'application/zip' }); const url = window.URL.createObjectURL(blob); const link = document.createElement('a'); link.href = url; link.setAttribute('download', `${userData.username}_certificate.zip`); document.body.appendChild(link); link.click(); link.remove(); return { success: true }; } } catch (error) { return { success: false, error }; } }; // Get ATAK QR string for easy mobile setup const getATAKQRString = async (username: string) => { try { const response = await axios.get( `${apiRoutes.atakQrString}/${username}` ); return { success: true, qrString: response.data.qr_string }; } catch (error) { return { success: false, error }; } }; // Get iTAK QR string const getITAKQRString = async (username: string) => { try { const response = await axios.get( `${apiRoutes.itakQrString}/${username}` ); return { success: true, qrString: response.data.qr_string }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### GET /status Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Retrieves the current status of server components and resource usage. ```APIDOC ## GET /status ### Description Retrieves the current status of server components and resource usage. ### Method GET ### Endpoint /status ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **cotRouter** (boolean) - Status of the CoT router. - **tcp** (boolean) - Status of the TCP service. - **ssl** (boolean) - Status of the SSL service. - **onlineEUDs** (integer) - Number of online End User Devices. - **cpuPercent** (number) - Current CPU utilization percentage. - **diskUsage** (string) - Disk usage information (e.g., "70%"). - **memoryUsage** (string) - Memory usage information (e.g., "60%"). - **uptime** (string) - Server uptime. #### Response Example ```json { "cot_router": true, "tcp": true, "ssl": false, "online_euds": 5, "cpu_percent": 15.5, "disk_usage": "70%", "memory_usage": "60%", "uptime": "2 days 3 hours 15 minutes" } ``` ``` -------------------------------- ### TypeScript: Manage TAK.gov Integration Functions Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions to interact with the TAK.gov platform, including fetching status, linking accounts, getting tokens, and retrieving plugins. It uses an imported Axios instance and API routes configuration. Error handling is included for network requests. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get TAK.gov connection status const getTAKGovStatus = async () => { try { const response = await axios.get(apiRoutes.takgov); return response.data; } catch (error) { console.error('Failed to fetch TAK.gov status:', error); return null; } }; // Link TAK.gov account const linkTAKGovAccount = async (credentials: { username: string; password: string; }) => { try { const response = await axios.post(apiRoutes.takgovLink, credentials); return { success: response.status === 200, data: response.data }; } catch (error) { return { success: false, error }; } }; // Get TAK.gov token const getTAKGovToken = async () => { try { const response = await axios.get(apiRoutes.takgovToken); return { success: true, token: response.data.token }; } catch (error) { return { success: false, error }; } }; // Get TAK.gov plugins const getTAKGovPlugins = async () => { try { const response = await axios.get(apiRoutes.takgovPlugins); return response.data; } catch (error) { console.error('Failed to fetch TAK.gov plugins:', error); return []; } }; ``` -------------------------------- ### GET /video-streams Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Retrieves a list of all configured video streams. ```APIDOC ## GET /video-streams ### Description Retrieves a list of all configured video streams. ### Method GET ### Endpoint /video-streams ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **streams** (array) - An array of video stream objects. - **name** (string) - The name of the video stream. - **url** (string) - The URL of the video stream. - **type** (string, optional) - The type of the video stream. #### Response Example ```json { "streams": [ { "name": "Stream 1", "url": "http://example.com/stream1", "type": "RTSP" } ] } ``` ``` -------------------------------- ### User Authentication API Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Handles user authentication via standard username/password or LDAP, and facilitates the setup and validation of two-factor authentication. ```APIDOC ## User Authentication API ### Description Endpoints for user login using standard credentials or LDAP, and for configuring and verifying two-factor authentication. ### Method POST, GET ### Endpoint `/api/login`, `/api/ldapLogin`, `/api/tfSetup`, `/api/tfValidate`, `/api/me` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body ##### User Login - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. ##### LDAP Login - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. ##### Validate 2FA - **auth_code** (string) - Required - The two-factor authentication code. ### Request Example ```json // Standard Login Request Body { "username": "testuser", "password": "password123" } // LDAP Login Request Body { "username": "ldapuser", "password": "ldappassword" } // Validate 2FA Request Body { "auth_code": "123456" } ``` ### Response #### Success Response (200) ##### User Login - **response** (object) - Contains authentication details. - **csrf_token** (string) - The CSRF token for subsequent requests. - **user** (object) - User details. - **email** (string) - User's email. - **token** (string) - User's authentication token. - **username** (string) - User's username. - **roles** (array) - Array of user roles. ##### LDAP Login - **message** (string) - Success message. ##### Two-Factor Authentication Setup - **qrCode** (string) - The QR code for setting up 2FA. - **secret** (string) - The secret key for setting up 2FA. ##### Validate 2FA - **valid** (boolean) - Indicates if the 2FA code is valid. #### Response Example ```json // User Login Success Response { "response": { "csrf_token": "aBcDeFgHiJkLmNoPqRsT" }, "user": { "email": "testuser@example.com", "token": "user-auth-token-12345", "username": "testuser", "roles": ["user", "administrator"] } } // 2FA Setup Success Response { "qrCode": "otpauth://totp/OpenTAK:testuser?secret=JBSWY3DPEHPK3PXP&issuer=OpenTAK", "secret": "JBSWY3DPEHPK3PXP" } // Validate 2FA Success Response { "valid": true } ``` #### Error Response (400, 401, 500) - **error** (object) - Contains error details. - **message** (string) - Error message. - **status** (number) - HTTP status code. ``` -------------------------------- ### EUD Fetch and Monitor APIs for OpenTAKServer UI Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides API endpoints for retrieving a list of all End User Devices (EUDs) and their associated statistics. It uses 'axios' for making GET requests to 'apiRoutes.eud' and 'apiRoutes.eud_stats'. The functions return an array of EUD objects with details like UID, callsign, location, last seen time, and status, or an object containing aggregated statistics (total, online, offline, etc.). Error handling is included for failed requests. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get all EUDs const getAllEUDs = async () => { try { const response = await axios.get(apiRoutes.eud); // Returns array of EUD objects with properties: // - uid: unique identifier // - callsign: device callsign // - point: current location {lat, lon, alt} // - last_seen: timestamp // - status: online/offline return response.data; } catch (error) { console.error('Failed to fetch EUDs:', error); return []; } }; // Get EUD statistics const getEUDStats = async () => { try { const response = await axios.get(apiRoutes.eud_stats); return { total: response.data.total, online: response.data.online, offline: response.data.offline, lastHour: response.data.last_hour, lastDay: response.data.last_day }; } catch (error) { console.error('Failed to fetch EUD stats:', error); return null; } }; ``` -------------------------------- ### POST /admin/settings Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Updates the administrative settings. ```APIDOC ## POST /admin/settings ### Description Updates the administrative settings. ### Method POST ### Endpoint /admin/settings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **settings** (object) - Required - An object containing the administrative settings to update. ### Request Example ```json { "settings": { "log_level": "DEBUG" } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Certificate Management APIs Source: https://context7.com/brian7704/opentakserver-ui/llms.txt APIs for generating and managing client certificates for TAK clients. ```APIDOC ## Certificate Management APIs ### Generate Client Certificates #### Method POST #### Endpoint `/api/certificates/generate` #### Description Creates authentication certificates for TAK clients. #### Parameters ##### Request Body - **username** (string) - Required - The username for whom the certificate is generated. - **duration** (number) - Optional - The duration in days for which the certificate is valid (defaults to 365). #### Response ##### Success Response (200) - **success** (boolean) - Indicates if the certificate generation was successful. ### Get ATAK QR String #### Method GET #### Endpoint `/api/certificates/atak-qr/{username}` #### Description Retrieves the ATAK QR string for easy mobile setup for a given user. #### Parameters ##### Path Parameters - **username** (string) - Required - The username for whom to generate the QR string. #### Response ##### Success Response (200) - **success** (boolean) - Indicates if the QR string was successfully retrieved. - **qrString** (string) - The ATAK QR string. ### Get iTAK QR String #### Method GET #### Endpoint `/api/certificates/itak-qr/{username}` #### Description Retrieves the iTAK QR string for a given user. #### Parameters ##### Path Parameters - **username** (string) - Required - The username for whom to generate the QR string. #### Response ##### Success Response (200) - **success** (boolean) - Indicates if the QR string was successfully retrieved. - **qrString** (string) - The iTAK QR string. ``` -------------------------------- ### POST /video-streams Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Adds a new video stream to the system. ```APIDOC ## POST /video-streams ### Description Adds a new video stream to the system. ### Method POST ### Endpoint /video-streams ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (string) - Required - The name of the video stream. - **url** (string) - Required - The URL of the video stream. - **type** (string, optional) - The type of the video stream. ### Request Example ```json { "name": "New Stream", "url": "http://new.example.com/stream", "type": "HLS" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **data** (object) - Additional data, potentially containing the newly created stream information. #### Response Example ```json { "success": true, "data": { "id": "123e4567-e89b-12d3-a456-426614174000", "name": "New Stream", "url": "http://new.example.com/stream", "type": "HLS" } } ``` ``` -------------------------------- ### Alert Management APIs Source: https://context7.com/brian7704/opentakserver-ui/llms.txt APIs for managing and displaying system notifications. ```APIDOC ## Alert Management APIs ### Handle System Alerts #### Method GET #### Endpoint `/api/alerts` #### Description Retrieves all system alerts. #### Response ##### Success Response (200) - **alerts** (array) - A list of alert objects. ### Create Alert #### Method POST #### Endpoint `/api/alerts` #### Description Creates a new system alert. #### Parameters ##### Request Body - **title** (string) - Required - The title of the alert. - **message** (string) - Required - The content of the alert. - **severity** (string) - Required - The severity level of the alert ('info', 'warning', 'error', 'success'). - **recipients** (array of strings) - Optional - A list of users to send the alert to. #### Response ##### Success Response (200) - **success** (boolean) - Indicates if the alert was successfully created. - **data** (object) - The data of the created alert. ### Delete Alert #### Method DELETE #### Endpoint `/api/alerts/{alertId}` #### Description Deletes a specified system alert. #### Parameters ##### Path Parameters - **alertId** (string) - Required - The ID of the alert to delete. #### Response ##### Success Response (200) - **success** (boolean) - Indicates if the alert was successfully deleted. ``` -------------------------------- ### Connect and Handle Real-Time Events with WebSockets (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Establishes a WebSocket connection to receive live updates for points, markers, EUDs, casevac events, and alerts. It includes functions to connect, disconnect, and check the connection status. The snippet also demonstrates setting up event listeners for various real-time data feeds. ```typescript import { socket } from './socketio'; // Connect to Socket.io server const connectSocket = () => { socket.connect(); console.log('Socket connected:', socket.connected); }; // Listen for point updates (device location changes) socket.on('point', (data) => { console.log('Point update received:', data); // data contains: { uid, lat, lon, alt, timestamp, ... } // Update marker on map updateDeviceLocation(data.uid, data.lat, data.lon); }); // Listen for marker changes socket.on('marker', (data) => { console.log('Marker update:', data); // Handle marker creation/update/deletion }); // Listen for EUD updates socket.on('eud', (data) => { console.log('EUD update:', data); // data contains full EUD information updateEUDDisplay(data); }); // Listen for casevac events socket.on('casevac', (data) => { console.log('CASEVAC event:', data); // Handle casualty evacuation notifications showCasevacAlert(data); }); // Listen for alerts socket.on('alert', (data) => { console.log('Alert received:', data); displayAlert(data.message, data.severity); }); // Disconnect socket const disconnectSocket = () => { socket.disconnect(); }; // Check connection status const isConnected = () => socket.connected; // Example: Complete socket setup const setupRealtimeTracking = () => { socket.connect(); socket.on('connect', () => { console.log('Connected to server'); }); socket.on('disconnect', () => { console.log('Disconnected from server'); }); socket.on('point', (data) => { // Update device position in real-time updateMapMarker(data); }); socket.on('error', (error) => { console.error('Socket error:', error); }); }; ``` -------------------------------- ### Manage Video Streams and Recordings (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions to manage video streams and recordings. Includes fetching, adding, updating, and deleting video streams, as well as retrieving and deleting recordings. It relies on axios for HTTP requests and predefined apiRoutes. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get all video streams const getVideoStreams = async () => { try { const response = await axios.get(apiRoutes.video_streams); return response.data; } catch (error) { console.error('Failed to fetch video streams:', error); return []; } }; // Add video stream const addVideoStream = async (streamData: { name: string; url: string; type?: string; }) => { try { const response = await axios.post(apiRoutes.addVideoStream, streamData); return { success: response.status === 200, data: response.data }; } catch (error) { return { success: false, error }; } }; // Update video stream const updateVideoStream = async (streamId: string, streamData: any) => { try { const response = await axios.put( `${apiRoutes.updateVideoStream}/${streamId}`, streamData ); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Delete video stream const deleteVideoStream = async (streamId: string) => { try { const response = await axios.delete( `${apiRoutes.deleteVideoStream}/${streamId}` ); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Get video recordings const getVideoRecordings = async () => { try { const response = await axios.get(apiRoutes.getRecordings); return response.data; } catch (error) { console.error('Failed to fetch recordings:', error); return []; } }; // Delete recording const deleteRecording = async (recordingId: string) => { try { const response = await axios.delete( `${apiRoutes.deleteRecording}/${recordingId}` ); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### User Management APIs Source: https://context7.com/brian7704/opentakserver-ui/llms.txt APIs for creating, retrieving, updating, and deleting users, as well as managing their roles and status. ```APIDOC ## POST /api/users ### Description Creates a new user account. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **username** (string) - Required - The desired username for the new account. - **password** (string) - Required - The password for the new account. - **email** (string) - Optional - The email address for the new account. ### Request Example ```json { "username": "newUser", "password": "password123", "email": "newUser@example.com" } ``` ### Response #### Success Response (200) - **user** (object) - The newly created user object. - **success** (boolean) - True if the user was created successfully. #### Response Example ```json { "success": true, "user": { "id": "uuid-1234", "username": "newUser", "email": "newUser@example.com" } } ``` ## GET /api/users ### Description Retrieves a list of all users. ### Method GET ### Endpoint /api/users ### Response #### Success Response (200) - Returns an array of user objects. #### Response Example ```json [ { "id": "uuid-1234", "username": "user1", "email": "user1@example.com" }, { "id": "uuid-5678", "username": "user2", "email": "user2@example.com" } ] ``` ## POST /api/users/change-role ### Description Changes the role of a specified user. ### Method POST ### Endpoint /api/users/change-role ### Parameters #### Request Body - **username** (string) - Required - The username of the user whose role to change. - **role** (string) - Required - The new role to assign to the user. ### Request Example ```json { "username": "user1", "role": "admin" } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the role change was successful. #### Response Example ```json { "success": true } ``` ## POST /api/users/activate ### Description Activates a user account. ### Method POST ### Endpoint /api/users/activate ### Parameters #### Request Body - **username** (string) - Required - The username of the user to activate. ### Request Example ```json { "username": "user1" } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the user was activated successfully. #### Response Example ```json { "success": true } ``` ## POST /api/users/deactivate ### Description Deactivates a user account. ### Method POST ### Endpoint /api/users/deactivate ### Parameters #### Request Body - **username** (string) - Required - The username of the user to deactivate. ### Request Example ```json { "username": "user1" } ``` ### Response #### Success Response (200) - **success** (boolean) - True if the user was deactivated successfully. #### Response Example ```json { "success": true } ``` ## DELETE /api/users/{username} ### Description Deletes a user account. ### Method DELETE ### Endpoint /api/users/{username} ### Parameters #### Path Parameters - **username** (string) - Required - The username of the user to delete. ### Response #### Success Response (200) - **success** (boolean) - True if the user was deleted successfully. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Configure Meshtastic Radio Networks (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides APIs for integrating with Meshtastic mesh networking devices. It uses 'axios_config' and 'apiRoutes' for communication. Functions include fetching available Meshtastic channels, generating a Pre-Shared Key (PSK), and creating new Meshtastic channels. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get Meshtastic channels const getMeshtasticChannels = async () => { try { const response = await axios.get(apiRoutes.meshtasticChannels); return response.data; } catch (error) { console.error('Failed to fetch Meshtastic channels:', error); return []; } }; // Generate Meshtastic PSK (Pre-Shared Key) const generateMeshtasticPSK = async () => { try { const response = await axios.post(apiRoutes.generateMeshtasticPsk); return { success: true, psk: response.data.psk }; } catch (error) { return { success: false, error }; } }; // Create Meshtastic channel const createMeshtasticChannel = async (channelData: { name: string; psk: string; }) => { try { const response = await axios.post( apiRoutes.meshtasticChannels, channelData ); return { success: response.status === 200, data: response.data }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### Mission Management APIs (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions to interact with the mission management API. Includes endpoints for fetching, creating, inviting users to, and deleting missions. Requires an axios instance configured for API requests. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get all missions const getMissions = async () => { try { const response = await axios.get(apiRoutes.missions); return response.data; } catch (error) { console.error('Failed to fetch missions:', error); return []; } }; // Create new mission const createMission = async (missionData: { name: string; description?: string; groups?: string[]; }) => { try { const response = await axios.post(apiRoutes.missions, missionData); if (response.status === 200) { return { success: true, mission: response.data }; } } catch (error) { return { success: false, error: 'Mission creation failed' }; } }; // Invite users to mission const inviteToMission = async (missionId: string, usernames: string[]) => { try { const response = await axios.post(apiRoutes.mission_invite, { mission_id: missionId, usernames: usernames }); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Delete mission const deleteMission = async (missionId: string) => { try { const response = await axios.delete(`${apiRoutes.missions}/${missionId}`); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### Group Management APIs (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions for managing user groups within the system. Includes endpoints for fetching all groups, group members, user's groups, and creating new groups. Assumes an axios instance is configured. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get all groups const getAllGroups = async () => { try { const response = await axios.get(apiRoutes.allGroups); return response.data; } catch (error) { console.error('Failed to fetch groups:', error); return []; } }; // Get group members const getGroupMembers = async (groupId: string) => { try { const response = await axios.get(`${apiRoutes.groupMembers}/${groupId}`); return response.data; } catch (error) { console.error('Failed to fetch group members:', error); return []; } }; // Get user's groups const getUserGroups = async (username: string) => { try { const response = await axios.get(`${apiRoutes.userGroups}/${username}`); return response.data; } catch (error) { console.error('Failed to fetch user groups:', error); return []; } }; // Create group const createGroup = async (groupData: { name: string; description?: string; }) => { try { const response = await axios.post(apiRoutes.groups, groupData); return { success: response.status === 200, data: response.data }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### Handle System Alerts with TypeScript Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Manage and display system notifications. This module provides functions to fetch all system alerts, create new alerts with specified details (title, message, severity, recipients), and delete existing alerts by their ID. It utilizes axios for API requests and defined API routes. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get all alerts const getAlerts = async () => { try { const response = await axios.get(apiRoutes.alerts); return response.data; } catch (error) { console.error('Failed to fetch alerts:', error); return []; } }; // Create alert const createAlert = async (alertData: { title: string; message: string; severity: 'info' | 'warning' | 'error' | 'success'; recipients?: string[]; }) => { try { const response = await axios.post(apiRoutes.alerts, alertData); return { success: response.status === 200, data: response.data }; } catch (error) { return { success: false, error }; } }; // Delete alert const deleteAlert = async (alertId: string) => { try { const response = await axios.delete(`${apiRoutes.alerts}/${alertId}`); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; ``` -------------------------------- ### Control Server Components (TypeScript) Source: https://context7.com/brian7704/opentakserver-ui/llms.txt Provides functions to manage server components, including retrieving server status and toggling services like SSL and TCP. It also allows for fetching and updating administrative settings. Dependencies include axios and apiRoutes. ```typescript import axios from './axios_config'; import { apiRoutes } from './apiRoutes'; // Get server status const getServerStatus = async () => { try { const response = await axios.get(apiRoutes.status); return { cotRouter: response.data.cot_router, tcp: response.data.tcp, ssl: response.data.ssl, onlineEUDs: response.data.online_euds, cpuPercent: response.data.cpu_percent, diskUsage: response.data.disk_usage, memoryUsage: response.data.memory_usage, uptime: response.data.uptime }; } catch (error) { console.error('Failed to fetch server status:', error); return null; } }; // Start/Stop SSL service const toggleSSL = async (start: boolean) => { const endpoint = start ? apiRoutes.startSSL : apiRoutes.stopSSL; try { const response = await axios.post(endpoint); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Start/Stop TCP service const toggleTCP = async (start: boolean) => { const endpoint = start ? apiRoutes.startTCP : apiRoutes.stopTCP; try { const response = await axios.post(endpoint); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; // Get admin settings const getAdminSettings = async () => { try { const response = await axios.get(apiRoutes.adminSettings); return response.data; } catch (error) { console.error('Failed to fetch admin settings:', error); return null; } }; // Update admin settings const updateAdminSettings = async (settings: any) => { try { const response = await axios.post(apiRoutes.adminSettings, settings); return { success: response.status === 200 }; } catch (error) { return { success: false, error }; } }; ```