How loxetra/miwebunlock works
Main Components
• Browser User Interface: Represented by the HTML (src/index.html) and styled via CSS (src/styles.css). This layer is what the user interacts with.
• JavaScript Logic: Located in src/script.js. This script handles the core functionality (unlocking devices) and communicates with the hardware using the WebUSB API.
• External Mi Device: The physical Mi device that is accessed/controlled via the browser’s WebUSB interface.
Components
• UI Layer: index.html + styles.css—this is where the layout and presentation reside.
• Application Logic: script.js—handles user actions, device communication, and unlocking commands.
Architectural Patterns & Design Principles
• Separation of Concerns: The design clearly separates presentation (HTML & CSS) from logic (JavaScript) which, in turn, handles the communication with external hardware.
• Direct Hardware Communication: Note the innovative use of the WebUSB API, bypassing a traditional backend service by enabling the browser to directly interact with a USB device.
Relevant Technologies & Frameworks
• HTML/CSS: Used for the structure and styling of the user interface.
• JavaScript & WebUSB API: Central to the unlocking functionality and direct device communication.
• (Other dependencies could be noted if they were present in package.json, but based on the file tree, the focus is on these client-side technologies.)
Being Very Detailed
• Every component, however small, is accounted for: even if the src folder contains only three primary files, each plays a part in the overall architecture.