Skip to content

lshaf/bruce-web-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bruce Web UI Interface

This project provides a web-based user interface for the Bruce firmware (tested with version 1.10.1). It is designed to serve static web content and simulate backend API responses as provided by the Bruce firmware.

For a detailed overview of the project file structure and backend API endpoints, see STRUCTURE_AND_ENDPOINTS.md.

Project Structure (Summary)

  • server.js: Node.js server to serve static files and backend API endpoints.
  • interface/: Main web UI files (HTML, CSS, JS).
  • sample/: Example web UI files and assets.
  • backend/: Simulated API endpoints and sample responses, matching Bruce firmware v1.10.1.

How server.js Works

  • Serves static files from the interface folder by default (or another folder if specified as a command-line argument).
  • Prevents serving directly from the backend folder for security.
  • Handles requests for files and API endpoints, searching in the following order:
    1. Main UI folder (default: interface/)
    2. backend/ (for API endpoint simulation)
    3. Project root
  • Returns appropriate MIME types for common file extensions.
  • Logs each request to the console.
  • Listens on port 8080 by default.
  • If you make a request to a path starting with /bruce/, the server will forward (proxy) the request to a real Bruce device on your network (see below).

Backend API Simulation

The backend/ folder contains files that simulate the responses of Bruce firmware endpoints, such as:

  • systeminfo: Returns firmware version and storage info
  • listfiles: Lists files and folders as reported by the firmware
  • file, edit, cm, etc.: Simulate file operations and command execution endpoints

These samples are based on Bruce firmware v1.10.1 and are useful for UI development and testing without requiring the actual hardware.

Proxying Requests to a Real Bruce Device

If you send a request to a path starting with /bruce/, the server will emulate a real Bruce device by forwarding your request to the actual device on your network (by default, to http://bruce.local).

IMPORTANT!

  • You MUST edit the file server.js and set the correct username and password for your Bruce device. Look for these lines near the top of the file:
    const bruceUsername = "admin"; // CHANGE THIS to your Bruce device username
    const brucePassword = "bruce"; // CHANGE THIS to your Bruce device password
  • If you do not set the correct username and password, you will NOT be able to connect to your real Bruce device. The web UI will NOT work with the real device until you do this!
  • Make sure your computer and the Bruce device are connected to the same WiFi network, or connect to the Bruce device's AP (Access Point) mode.
  • This allows you to interact with a real Bruce device from the web UI, using the same API as the firmware.

Usage

  1. Install Node.js (if not already installed).
  2. Edit server.js and set your Bruce device username and password as described above.
  3. Run the server:
    node server.js
    Optionally, specify a different folder to serve:
    node server.js sample
  4. Open your browser and go to http://127.0.0.1:8080/

Notes

  • This project is for development and testing purposes.
  • The backend responses are static samples and do not perform real hardware actions unless you use the /bruce/ path to proxy to a real device.
  • For more information about Bruce firmware, see the official documentation.
  • This README generated by AI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors