### CANcloud Installation Commands Source: https://github.com/css-electronics/cancloud/blob/master/README.md Provides the necessary npm commands for installing dependencies and starting CANcloud in development mode. ```bash npm install ``` ```bash npm start ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/css-electronics/cancloud/blob/master/font-awesome/README.md Install Ruby and Node.js dependencies required for development. Run these commands from the root of the repository. ```bash $ bundle install $ npm install ``` -------------------------------- ### React Router Setup and Navigation Source: https://context7.com/css-electronics/cancloud/llms.txt Defines the application's routes using React Router and demonstrates programmatic navigation. Ensure the 'react-router-dom' and 'history' modules are installed and imported. ```jsx import React from "react"; import { Switch, Route } from "react-router-dom"; // Route table (order matters — most specific first): // /login → Login page // /status-dashboard → Fleet status dashboard // /configuration/:device? → JSON schema config editor // /configuration → server-level (no device) // /configuration/A1B2C3D4 → device-level OTA editor // /:bucket?/* → S3 object browser // / → Home bucket (root) // /A1B2C3D4/ → device bucket // /A1B2C3D4/00000001/ → session folder // Programmatic navigation examples (uses history from src/browser/js/history.js): import history from "./history"; history.push("/login"); history.replace("/A1B2C3D4/00000001/"); history.push("/configuration/A1B2C3D4"); history.push("/status-dashboard"); ``` -------------------------------- ### CANcloud Versioning Example Source: https://github.com/css-electronics/cancloud/blob/master/README.md Shows the format for CANcloud versioning, which follows a MAJOR.MINOR.PATCH structure with two-digit numbers for each component. ```text version 04.01.01 ``` -------------------------------- ### Example S3 Login Details Source: https://github.com/css-electronics/cancloud/blob/master/README.md Illustrates the typical login credentials required for connecting to an S3 server like AWS S3. Note that MinIO servers may require a port number. ```text endpoint: https://s3.amazonaws.com accessKey: LBIDJHBOIZQ3XBJ23UUQ secretKey: Jxasdeue3324e3/wqe9wewdcxsa219421Hsj bucket: aws-cancloud-bucket ``` -------------------------------- ### Presigned Get URL Source: https://context7.com/css-electronics/cancloud/llms.txt Generates a time-limited presigned GET URL for accessing an object in S3. ```APIDOC ## PresignedGet ### Description Generates a time-limited presigned GET URL for an object. ### Method `web.PresignedGet(params)` ### Parameters #### Request Body - **bucket** (string) - Required - The name of the bucket. - **object** (string) - Required - The name of the object. - **expiry** (integer) - Required - The expiry time in seconds. ### Response #### Success Response (200) - **url** (string) - The presigned URL for the object. ### Response Example ```json { "url": "https://my-canedge-bucket.s3.amazonaws.com/A1B2C3D4/device.json?AWSAccessKeyId=...&Expires=...&Signature=..." } ``` ``` -------------------------------- ### Login Component Setup and Configuration Source: https://context7.com/css-electronics/cancloud/llms.txt The `Login` React component handles user credentials for cloud storage. It supports manual input and pre-filling from a CANedge configuration JSON file. Validation rules are enforced before submission. ```jsx import React from "react"; import { Provider } from "react-redux"; import { MemoryRouter } from "react-router-dom"; import store from "./store"; import { Login } from "./browser/Login"; // Minimal standalone render (normally mounted via React Router at /login) // The component calls web.Login() on form submit and redirects to / on success. // Manual credential form fields: // endPoint → e.g. "https://s3.us-east-1.amazonaws.com" // accessKey → IAM access key // secretKey → IAM secret key // region → e.g. "us-east-1" // bucketName → pre-created S3 bucket name // "Load from config" button: accepts a CANedge config-XX.YY.json file. // The file reader parses cfg.connect.s3.server and pre-fills the form: const exampleConfigJson = { connect: { s3: { server: { keyformat: 0, // 0 = plaintext, 1 = encrypted (not loaded) endpoint: "s3.us-east-1.amazonaws.com", port: 443, accesskey: "AKIAIOSFODNN7EXAMPLE", secretkey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket: "my-canedge-bucket", region: "us-east-1" } } } }; // Validation rules enforced before calling web.Login(): // - All fields required // - http:// endpoint auto-upgraded to https:// when page is served over HTTPS // - Raw "https://s3.amazonaws.com" endpoint rejected → must include region // - http:// MinIO behind Chrome/Edge → blocked (TLS required) ``` -------------------------------- ### List Objects Recursively Source: https://context7.com/css-electronics/cancloud/llms.txt Recursively lists all objects under a given bucket and prefix, useful for getting a total count. ```javascript // Recursively list all objects under a prefix web.ListObjectsRecursive({ bucketName: "A1B2C3D4", prefix: "", marker: "" }) .then(res => console.log(`Total files: ${res.objects.length}`)); ``` -------------------------------- ### Generate Presigned GET URL Source: https://context7.com/css-electronics/cancloud/llms.txt Generates a time-limited presigned URL for GET requests to an S3 object. Expiry is specified in seconds. ```javascript // Get a time-limited presigned GET URL (expiry in seconds) web.PresignedGet({ bucket: "A1B2C3D4", object: "device.json", expiry: 5 * 24 * 60 * 60 // 5 days }) .then(res => console.log("Shareable URL:", res.url)); ``` -------------------------------- ### List Objects Recursive Source: https://context7.com/css-electronics/cancloud/llms.txt Recursively lists all objects under a given bucket and prefix, useful for getting a total count of files. ```APIDOC ## ListObjectsRecursive ### Description Recursively lists all objects under a prefix. ### Method `web.ListObjectsRecursive(params)` ### Parameters #### Request Body - **bucketName** (string) - Required - The name of the bucket. - **prefix** (string) - Required - The prefix to start recursion from. - **marker** (string) - Optional - A marker for pagination. ### Response #### Success Response (200) - **objects** (array) - An array of all objects found recursively. - **name** (string) - The name of the object. - **size** (integer) - The size of the object in bytes. - **lastModified** (string) - The last modified timestamp of the object. ### Response Example ```json { "objects": [ { "name": "file1.txt", "size": 100, "lastModified": "..." }, { "name": "subdir/file2.txt", "size": 200, "lastModified": "..." } ] } ``` ``` -------------------------------- ### Get Object Stat Source: https://context7.com/css-electronics/cancloud/llms.txt Retrieves metadata for an object, including its size, last modified date, and any custom metadata. ```APIDOC ## getObjectStat ### Description Heads an object, returning its size, lastModified, and custom metadata. ### Method `web.getObjectStat(params)` ### Parameters #### Request Body - **bucketName** (string) - Required - The name of the bucket. - **objectName** (string) - Required - The name of the object. ### Response #### Success Response (200) - **metaInfo** (object) - An object containing metadata about the object. - **size** (integer) - The size of the object in bytes. - **lastModified** (string) - The last modified timestamp. - **metaData** (object) - Custom metadata associated with the object. ### Response Example ```json { "metaInfo": { "size": 1024, "lastModified": "2023-10-27T10:00:00Z", "metaData": { "timestamp": "20230114T134632" } } } ``` ``` -------------------------------- ### Get Widget Query Result Source: https://context7.com/css-electronics/cancloud/llms.txt Executes an S3 Select SQL query on a CSV object to retrieve specific data. ```APIDOC ## getWidgetQueryResult ### Description Runs an S3 Select SQL expression on a CSV object. ### Method `web.getWidgetQueryResult(params)` ### Parameters #### Request Body - **dataFileName** (string) - Required - The S3 object path (e.g., bucket/file.csv). - **sqlExpression** (string) - Required - The SQL query to execute. ### Response #### Success Response (200) - **records** (array) - An array of records returned by the SQL query. ### Response Example ```json { "records": [ { "speed": 105, "timestamp": "..." }, { "speed": 120, "timestamp": "..." } ] } ``` ``` -------------------------------- ### Get Partial Object Source: https://context7.com/css-electronics/cancloud/llms.txt Reads a specific byte range from an object, useful for efficiently accessing parts of large files like log headers. ```APIDOC ## GetPartialObject ### Description Reads a specific byte range from an object. ### Method `web.GetPartialObject(params)` ### Parameters #### Request Body - **bucketName** (string) - Required - The name of the bucket. - **objectName** (string) - Required - The name of the object. - **offset** (integer) - Required - The starting byte offset. - **byteLength** (integer) - Required - The number of bytes to read. ### Response #### Success Response (200) - **objContent** (array) - An array containing the requested bytes as a `Uint8ClampedArray`. ### Response Example ```json { "objContent": [ // Uint8ClampedArray content here ] } ``` ``` -------------------------------- ### Get Object Metadata Source: https://context7.com/css-electronics/cancloud/llms.txt Retrieves object metadata, including size, last modified date, and custom metadata, without downloading the object content. ```javascript // Head an object — returns size, lastModified, and custom metadata web.getObjectStat({ bucketName: "A1B2C3D4", objectName: "device.json" }) .then(res => { const { size, lastModified, metaData } = res.metaInfo; // metaData may include { timestamp: "20230114T134632" } console.log(size, lastModified, metaData); }); ``` -------------------------------- ### Get Partial Object Content Source: https://context7.com/css-electronics/cancloud/llms.txt Reads a specific byte range from an S3 object, useful for processing large files like log data without full download. ```javascript // Read the first 15 000 bytes of an MF4 log file (used for timestamp extraction) web.GetPartialObject({ bucketName: "A1B2C3D4", objectName: "00000001/00000001.MF4", offset: 0, byteLength: 15000 }) .then(res => { // res.objContent[0] is a Uint8ClampedArray console.log("Header bytes received:", res.objContent[0].length); }); ``` -------------------------------- ### Serve Font Awesome Locally Source: https://github.com/css-electronics/cancloud/blob/master/font-awesome/README.md Serve the project on a local development server. This command also watches for file changes and rebuilds automatically. ```bash $ bundle exec jekyll -w serve ``` -------------------------------- ### Build Font Awesome Project Source: https://github.com/css-electronics/cancloud/blob/master/font-awesome/README.md Build the project and its documentation. This command compiles assets and generates static files. ```bash $ bundle exec jekyll build ``` -------------------------------- ### Fetch and Update Configuration Files with S3 Actions Source: https://context7.com/css-electronics/cancloud/llms.txt Use these actions to manage device configuration files stored in S3. Fetch schema, UI-schema, and config files, then upload modified configurations. Ensure the Redux location is correctly set to /configuration/. ```javascript import { fetchFilesS3, fetchFileContentS3, updateConfigFileS3, } from "./editorNew/actions"; // Scan a device prefix for schema, config, and UI-schema files // Expects the Redux location to be at /configuration/ store.dispatch(fetchFilesS3("A1B2C3D4")); // Internally filters objects matching: // schema-05.09.json → rule schema // config-05.09.json → current configuration // uischema-05.09.json → UI layout hints // Load content for a specific file type into the editor store.dispatch(fetchFileContentS3("config-05.09.json", "config")); store.dispatch(fetchFileContentS3("schema-05.09.json", "schema")); store.dispatch(fetchFileContentS3("uischema-05.09.json", "uischema")); // Pass "None" to reset/clear the editor for that type: store.dispatch(fetchFileContentS3("None", "config")); // Submit a modified configuration back to S3 (OTA update) const updatedConfig = JSON.stringify({ connect: { s3: { server: { endpoint: "https://s3.us-east-1.amazonaws.com" } } } }); store.dispatch(updateConfigFileS3(updatedConfig, "config-05.09.json")); // Uploads to: A1B2C3D4/config-05.09.json // Dispatches an "info" alert on success ``` -------------------------------- ### Path Parsing and Joining Utilities Source: https://context7.com/css-electronics/cancloud/llms.txt Use `pathSlice` to parse bucket and prefix from a URL path, and `pathJoin` to reconstruct a path from bucket and prefix. Ensure correct input formats for expected output. ```javascript import { pathSlice, pathJoin, } from "./utils"; // Parse bucket and prefix from a browser URL path pathSlice("/A1B2C3D4/00000001/"); // → { bucket: "A1B2C3D4", prefix: "00000001/" } pathSlice("/Home/"); // → { bucket: "Home", prefix: "" } // Reconstruct a path from bucket + prefix pathJoin("A1B2C3D4", "00000001/"); // → "/A1B2C3D4/00000001/" ``` -------------------------------- ### Dispatching Bucket and Device Actions in Redux Source: https://context7.com/css-electronics/cancloud/llms.txt Manage the device sidebar list and bootstrap sessions using these actions. They handle bucket creation, deletion, and metadata enrichment. Ensure the Redux store is configured with thunk middleware. ```javascript import { fetchBuckets, selectBucket, makeBucket, deleteBucket, addBucketMetaData, fetchPolicies, } from "./buckets/actions"; // Bootstrap: lists all devices, selects the correct one from the URL, loads device.json files store.dispatch(fetchBuckets()); // Select a device and navigate to an optional sub-prefix store.dispatch(selectBucket("A1B2C3D4")); // device root store.dispatch(selectBucket("A1B2C3D4", "00000001/")); // specific session // Select the "Home" virtual bucket (flat view of the root bucket) store.dispatch(selectBucket("Home")); // Create a new bucket (MinIO only; for AWS use the AWS console first) store.dispatch(makeBucket("new-device-folder")) .catch(err => console.error(err.message)); // Delete an existing bucket store.dispatch(deleteBucket("old-device-folder")); // Enrich the sidebar device labels with meta names from device.json // (called automatically after device files are loaded) store.dispatch(addBucketMetaData()); // Fetch and display bucket policies (MinIO) store.dispatch(fetchPolicies("A1B2C3D4")); ``` -------------------------------- ### CANcloud Production Build Command Source: https://github.com/css-electronics/cancloud/blob/master/README.md Command to build CANcloud for production deployment. ```bash npm run build ``` -------------------------------- ### List Objects Source: https://context7.com/css-electronics/cancloud/llms.txt Lists objects within a specified bucket and prefix, supporting pagination with a marker. ```APIDOC ## ListObjects ### Description Lists objects with a prefix and pagination marker. ### Method `web.ListObjects(params)` ### Parameters #### Request Body - **bucketName** (string) - Required - The name of the bucket to list objects from. - **prefix** (string) - Required - The prefix to filter objects by. - **marker** (string) - Optional - A marker for pagination. ### Response #### Success Response (200) - **objects** (array) - An array of object details. - **name** (string) - The name of the object. - **size** (integer) - The size of the object in bytes. - **lastModified** (string) - The last modified timestamp of the object. ### Response Example ```json { "objects": [ { "name": "00000001/log.MF4", "size": 102400, "lastModified": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### List Buckets Source: https://context7.com/css-electronics/cancloud/llms.txt Lists all virtual 'buckets', which correspond to device prefix folders (e.g., A1B2C3D4/) within the configured S3 storage. ```APIDOC ## ListBuckets ### Description Lists all virtual "buckets" (device prefix folders, e.g. A1B2C3D4/). ### Method `web.ListBuckets()` ### Response #### Success Response (200) - **buckets** (array) - An array of bucket objects, each with a `name` property. - **name** (string) - The name of the bucket (device ID). ### Response Example ```json { "buckets": [ {"name": "A1B2C3D4"}, {"name": "DEADBEEF"}, {"name": "server"} ] } ``` ``` -------------------------------- ### Dispatching Browser and Device File Actions in Redux Source: https://context7.com/css-electronics/cancloud/llms.txt Control sidebar state and manage the `device.json` file using these actions. They handle fetching device metadata, images, and UI element visibility. Ensure the Redux store is configured with thunk middleware. ```javascript import { fetchDeviceFile, fetchDeviceFileContent, fetchDeviceFileIfNew, fetchDeviceImage, toggleSidebar, closeSidebar, } from "./browser/actions"; // Load device.json for the given device ID (bucket name) // Internally calls ListObjects to find the file, then PresignedGet + fetch store.dispatch(fetchDeviceFile("A1B2C3D4")); // Load device.json content by exact file name (called by fetchDeviceFile) store.dispatch(fetchDeviceFileContent("device.json", "A1B2C3D4")); // device.json shape: // { // "id": "A1B2C3D4", // "cfg_name": "config-05.09.json", // "log_meta": "Test Vehicle", // "hw_ver": "02.00", // "sw_ver": "01.05" // } // Skip reload if the same device is already loaded store.dispatch(fetchDeviceFileIfNew("A1B2C3D4")); // Load a device image via presigned URL and store its URL in state store.dispatch(fetchDeviceImage("A1B2C3D4/device-image.jpg")); // Toggle / close the left-hand device sidebar store.dispatch(toggleSidebar()); store.dispatch(closeSidebar()); ``` -------------------------------- ### List S3 Buckets Source: https://context7.com/css-electronics/cancloud/llms.txt Lists all virtual "buckets", which represent device prefix folders (e.g., A1B2C3D4/). ```javascript // List all virtual "buckets" (device prefix folders, e.g. A1B2C3D4/) web.ListBuckets() .then(res => { const devices = res.buckets.map(b => b.name); // ["A1B2C3D4", "DEADBEEF", "server"] console.log("Devices:", devices); }); ``` -------------------------------- ### List S3 Objects Source: https://context7.com/css-electronics/cancloud/llms.txt Lists objects within a specified bucket and prefix, supporting pagination with a marker. ```javascript // List objects with a prefix and pagination marker web.ListObjects({ bucketName: "A1B2C3D4", prefix: "00000001/", marker: "" }) .then(res => { res.objects.forEach(o => console.log(o.name, o.size, o.lastModified) ); }); ``` -------------------------------- ### String and Timestamp Utilities Source: https://context7.com/css-electronics/cancloud/llms.txt Utilize `removeFirstOccurence` for string manipulation and `get_first_timestamp` to extract the initial Unix timestamp from MF4 header byte arrays. `get_first_timestamp` returns -1 on failure. ```javascript import { removeFirstOccurence, get_first_timestamp, } from "./utils"; // String helper: remove first occurrence of a substring removeFirstOccurence("A1B2C3D4/00000001/file.MF4", "A1B2C3D4/"); // → "00000001/file.MF4" // Extract first CAN timestamp (Unix seconds) from a raw MF4 header byte array // Returns -1 if the header is too short or does not match the CE tool signature const headerBytes = new Uint8ClampedArray(15000); // from GetPartialObject const ts = get_first_timestamp(headerBytes); // ts → Unix timestamp in seconds, or -1 on failure if (ts > 0) { const date = new Date(ts * 1000); console.log("Recording started:", date.toISOString()); } ``` -------------------------------- ### Login Source: https://context7.com/css-electronics/cancloud/llms.txt Stores a JWT in localStorage on successful authentication with S3. Requires access key, secret key, endpoint, region, and bucket name. ```APIDOC ## Login ### Description Stores a JWT in localStorage on success. ### Method `web.Login(credentials)` ### Parameters #### Request Body - **accessKey** (string) - Required - S3 access key. - **secretKey** (string) - Required - S3 secret key. - **endPoint** (string) - Required - S3 endpoint URL. - **region** (string) - Required - S3 region. - **bucketName** (string) - Required - Name of the S3 bucket. ### Request Example ```javascript web.Login({ accessKey: "AKIAIOSFODNN7EXAMPLE", secretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", endPoint: "https://s3.us-east-1.amazonaws.com", region: "us-east-1", bucketName: "my-canedge-bucket" }) .then(res => console.log("Token stored:", res.token)) .catch(err => console.error("Login failed:", err.message)); ``` ### Response #### Success Response (200) - **token** (string) - JWT token for subsequent requests. ``` -------------------------------- ### Login to S3 Source: https://context7.com/css-electronics/cancloud/llms.txt Stores a JWT in localStorage on successful login. Requires S3 endpoint, credentials, bucket name, and region. ```javascript import web from "./web"; // Login — stores a JWT in localStorage on success web.Login({ accessKey: "AKIAIOSFODNN7EXAMPLE", secretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", endPoint: "https://s3.us-east-1.amazonaws.com", region: "us-east-1", bucketName: "my-canedge-bucket" }) .then(res => console.log("Token stored:", res.token)) .catch(err => console.error("Login failed:", err.message)); ``` -------------------------------- ### CANcloud Key Features Source: https://github.com/css-electronics/cancloud/blob/master/README.md Lists the core functionalities of CANcloud, including S3 server login, object management, device navigation, file operations, configuration editing, and customization. ```text 1. Securely login to any S3 server by providing your endpoint, credentials and bucket name 2. List all objects within an S3 bucket in a folder structure hierarchy 3. Easily navigate between connected CANedge2/CANedge3 devices via the sidebar 4. Download, share & delete objects - or upload files (e.g. firmware.bin for firmware over-the-air) 5. Configure CANedge devices via an online editor - and submit for easy over-the-air updates 6. Encrypt configuration passwords using the built-in encryption tool 7. Add device meta data (incl. pictures and searchable meta name) 8. Easily customize the portal with your own logo and CSS styling (see `src/browser/index.html`) ``` -------------------------------- ### File Type Validation Utilities Source: https://context7.com/css-electronics/cancloud/llms.txt Use these functions to validate file names against specific types like log files, schemas, configurations, and CANedge files. Note the supported extensions for each type. ```javascript import { isValidDevice, isValidLogfile, isValidSchema, isValidConfig, isValidUISchema, isValidCanedgefile, } from "./utils"; // Validate device IDs (8 hex characters) isValidDevice("A1B2C3D4"); // true isValidDevice("server"); // false // File type guards isValidLogfile("session.MF4"); // true (MF4/MFE/MFC/MFM) isValidLogfile("config-05.09.json"); // false isValidSchema("schema-05.09.json"); // true isValidConfig("config-05.09.json"); // true isValidUISchema("uischema-05.09.json");// true isValidCanedgefile("data.csv"); // true (mf4/txt/csv/json) ``` -------------------------------- ### Load Device and Log Files for Status Dashboard Source: https://context7.com/css-electronics/cancloud/llms.txt Actions to populate the fleet-wide telematics dashboard. Load all device files and log files, or filter for specific devices and file types. Used for monitoring device heartbeats, configuration CRC32 verification, and log upload activity. ```javascript import { listAllObjects, listLogFiles, fetchDeviceFileContentAll, fetchConfigFileContentAll, setPeriodStartBack, } from "./dashboardStatus/actions"; // Main entry point: loads device files and log files for all detected devices store.dispatch(listAllObjects()); // Load only log-file data for a specific subset of devices store.dispatch(listLogFiles(["A1B2C3D4", "DEADBEEF"])); // Fetch device.json content for an array of device objects const deviceObjects = [ { deviceId: "A1B2C3D4" }, { deviceId: "DEADBEEF" } ]; store.dispatch(fetchDeviceFileContentAll(deviceObjects)); // For each device, fetches device.json via PresignedGet and stores: // { id, cfg_name, log_meta, hw_ver, sw_ver } // Fetch config files and compute CRC32 for each device // (used to show ✓/✗ match against the device.json cfg_name) const configObjects = [ { deviceId: "A1B2C3D4", name: "A1B2C3D4/config-05.09.json" }, { deviceId: "DEADBEEF", name: "DEADBEEF/config-05.09.json" } ]; store.dispatch(fetchConfigFileContentAll(configObjects)); // Stores CRC32 hex strings, e.g. { deviceId: "A1B2C3D4", crc32: "3F2A1B0C" } // Set the look-back period for log-file aggregation (hours) store.dispatch(setPeriodStartBack(24)); // last 24 hours store.dispatch(setPeriodStartBack(168)); // last 7 days ``` -------------------------------- ### Dispatching Object Actions in Redux Source: https://context7.com/css-electronics/cancloud/llms.txt Use these actions to manage objects within the UI. They interact with the web layer and update the Redux store. Ensure the Redux store is configured with thunk middleware. ```javascript import { createStore, applyMiddleware } from "redux"; import thunk from "redux-thunk"; import rootReducer from "./reducers"; import { fetchObjects, selectPrefix, downloadObject, shareObject, deleteObject, deleteCheckedObjects, downloadCheckedObjects, sortObjects, fetchObjectStat, fetchSessionMetaList, fetchSessionObjectsMetaList, } from "./objects/actions"; const store = createStore(rootReducer, applyMiddleware(thunk)); // Load objects for the currently selected bucket / prefix store.dispatch(fetchObjects()); // Navigate into a sub-prefix (folder) store.dispatch(selectPrefix("00000001/")); // Download a single object (triggers a browser file-save via Axios + presigned URL) store.dispatch(downloadObject("00000001.MF4")); // Generate a presigned share link (5 days, 0 hours, 0 minutes) store.dispatch(shareObject("00000001.MF4", 5, 0, 0)); // → dispatches showShareObject with the time-limited URL // Delete a single object or folder store.dispatch(deleteObject("00000001.MF4")); // file store.dispatch(deleteObject("00000002/")); // folder (recursive) // Bulk-delete all checked objects store.dispatch(deleteCheckedObjects()); // Bulk-download all checked objects as a ZIP archive named after the bucket store.dispatch(downloadCheckedObjects()); // Sort the visible object list (toggles asc/desc on repeat calls) store.dispatch(sortObjects("name")); // by name store.dispatch(sortObjects("size")); // by size store.dispatch(sortObjects("last-modified")); // by S3 last-modified date // Fetch S3 HEAD metadata for a single object (populates object info panel) store.dispatch(fetchObjectStat("00000001.MF4")); // Fetch session-level metadata for a list of session folders // Each entry must have the shape { name: "00000001/" } store.dispatch(fetchSessionMetaList("A1B2C3D4", [ { name: "00000001/" }, { name: "00000002/" } ])); // Fetch per-file metadata (MF4 timestamp + S3 meta) inside one session folder store.dispatch(fetchSessionObjectsMetaList( "A1B2C3D4", "00000001/", [{ name: "00000001.MF4" }, { name: "00000002.MF4" }] )); ``` -------------------------------- ### Put Object Source: https://context7.com/css-electronics/cancloud/llms.txt Uploads an object to S3 using its string content. Useful for configuration files or small data uploads. ```APIDOC ## PutObject ### Description Uploads an object to S3 by string content. ### Method `web.PutObject(params)` ### Parameters #### Request Body - **objectName** (string) - Required - The full name of the object, including path. - **file** (string) - Required - The content of the file as a string. ### Response #### Success Response (200) - Indicates successful upload. No specific data returned. ``` -------------------------------- ### Check Login State Source: https://context7.com/css-electronics/cancloud/llms.txt Synchronously checks if a valid session is active by reading from localStorage. ```javascript // Check login state (synchronous, reads localStorage) if (web.LoggedIn()) { console.log("Session is active"); } ``` -------------------------------- ### Object Sorting Utilities Source: https://context7.com/css-electronics/cancloud/llms.txt Sort arrays of objects by name, size, or date using the provided utility functions. Specify `ascending` boolean to control sort order. ```javascript import { sortObjectsByName, sortObjectsBySize, sortObjectsByDate, } from "./utils"; // Sort object arrays (folders always precede files) const objects = [ { name: "00000002.MF4", size: 2048, lastModified: "2023-06-01T10:00:00Z" }, { name: "00000001/", size: 0, lastModified: "2023-05-30T08:00:00Z" }, { name: "00000001.MF4", size: 1024, lastModified: "2023-05-30T09:00:00Z" } ]; sortObjectsByName(objects, false); // ascending: folders first, then files A→Z sortObjectsBySize(objects, true); // descending by file size sortObjectsByDate(objects, true); // descending by lastModified ``` -------------------------------- ### Check Login State Source: https://context7.com/css-electronics/cancloud/llms.txt Synchronously checks if a user is currently logged in by reading the localStorage for session tokens. ```APIDOC ## LoggedIn ### Description Checks login state synchronously by reading localStorage. ### Method `web.LoggedIn()` ### Response #### Success Response (200) - **boolean** - Returns `true` if logged in, `false` otherwise. ``` -------------------------------- ### Logout Source: https://context7.com/css-electronics/cancloud/llms.txt Removes the authentication token and region from localStorage, effectively logging the user out. ```APIDOC ## Logout ### Description Removes token and region from localStorage. ### Method `web.Logout()` ``` -------------------------------- ### Upload Object from String Source: https://context7.com/css-electronics/cancloud/llms.txt Uploads a file, such as text or JSON, to S3 using its string content. The object name specifies the full path. ```javascript // Upload a text/JSON file by string content web.PutObject({ objectName: "A1B2C3D4/config-05.09.json", file: JSON.stringify({ connect: { s3: { server: { endpoint: "..." } } } }) }) .then(() => console.log("Config uploaded")); ``` -------------------------------- ### Query S3 Object with SQL Source: https://context7.com/css-electronics/cancloud/llms.txt Executes an S3 Select SQL expression on a CSV object to retrieve specific data, filtering or transforming it. ```javascript // Run an S3 Select SQL expression on a CSV object web.getWidgetQueryResult({ dataFileName: "A1B2C3D4/data.csv", sqlExpression: "SELECT * FROM s3object WHERE speed > 100" }) .then(res => console.log("Records:", res.records)); ``` -------------------------------- ### SD Card Validity Test Source: https://context7.com/css-electronics/cancloud/llms.txt Perform a validity test on SD card serial numbers using `sdValidityTest`. Ensure the input string conforms to the expected format for accurate results. ```javascript import { sdValidityTest, } from "./utils"; // Test SD card validity from a device.json string field sdValidityTest("12345678534133324780abc"); // true sdValidityTest("12345678000000000000abc"); // false ``` -------------------------------- ### Logout from S3 Source: https://context7.com/css-electronics/cancloud/llms.txt Removes the authentication token and region from localStorage to end the current session. ```javascript // Logout — removes token and region from localStorage web.Logout(); ``` -------------------------------- ### Remove Object Source: https://context7.com/css-electronics/cancloud/llms.txt Deletes one or more objects from an S3 bucket. ```APIDOC ## RemoveObject ### Description Deletes one or more objects from an S3 bucket. ### Method `web.RemoveObject(params)` ### Parameters #### Request Body - **bucketName** (string) - Required - The name of the bucket. - **objects** (array) - Required - An array of object names to delete. ### Response #### Success Response (200) - Indicates successful deletion. No specific data returned. ``` -------------------------------- ### Delete S3 Objects Source: https://context7.com/css-electronics/cancloud/llms.txt Deletes one or more specified objects from an S3 bucket. Requires the bucket name and a list of object names. ```javascript // Delete one or more objects web.RemoveObject({ bucketName: "A1B2C3D4", objects: ["00000001/00000001.MF4"] }) .then(() => console.log("File deleted")); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.