Add ESP32 firmware flasher

Browser-based ESP32/ESP8266 flasher (esptool-js + Web Serial); nothing is
uploaded to WROLPi, the flash is written straight to the device over USB.

Firmware sources (themed, tabbed): a saved set, the WROLPi media directory,
or a local file. Local files can be dropped anywhere on the page, which jumps
to the "Add from computer" dropzone. The media picker searches .bin files by
path and can detect the connected chip to filter firmware to matching images.

- Indexed file_group.suffix + path filter for fast .bin search (alembic
  migration backfills via split_path_stem_and_suffix)
- modules/flasher: chip detection from ESP image headers, /search endpoint,
  and flasher.yaml saved configurations (/configs CRUD)
- Flash progress modal with ETA, connect timeout, boot-mode hint, auto-
  scrolling logs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-01 18:24:21 -06:00 • committed by lrnselfreliance
parent fcb64fed13
commit c95afc7f62
25 changed files with 2063 additions and 14 deletions

View file

@ -1212,8 +1212,14 @@ export async function deleteDownload(downloadId) {
}
}
export async function filesSearch(offset, limit, searchStr, mimetypes, model, tagNames, headline, months, fromYear, toYear, anyTag, order) {
export async function filesSearch(offset, limit, searchStr, mimetypes, model, tagNames, headline, months, fromYear, toYear, anyTag, order, suffix, path) {
const body = {search_str: searchStr, offset: parseInt(offset), limit: parseInt(limit), any_tag: anyTag};
if (suffix) {
body['suffix'] = suffix;
}
if (path) {
body['path'] = path;
}
if (mimetypes) {
body['mimetypes'] = mimetypes;
}
@ -1257,6 +1263,51 @@ export async function filesSearch(offset, limit, searchStr, mimetypes, model, ta
}
}
export async function flasherSearch(chip, path) {
// Search .bin firmware, filtered to ESP images for the given chip (from connecting to the device).
const body = {};
if (chip) body['chip'] = chip;
if (path) body['path'] = path;
const response = await apiPost(`${API_URI}/flasher/search`, body);
if (response.ok) {
const data = await response.json();
return [data['file_groups'], data['totals']['file_groups']];
}
const message = await getErrorMessage(response, 'Cannot search firmware. See server logs.');
toast({type: 'error', title: 'Unable to search firmware', description: message, time: 5000});
return [null, null];
}
export async function getFlasherConfigs() {
// Return the user's saved firmware flashing configurations.
const response = await apiGet(`${API_URI}/flasher/configs`);
if (response.ok) {
const data = await response.json();
return data['configurations'] || [];
}
return [];
}
export async function saveFlasherConfig(name, files, eraseAll) {
const response = await apiPost(`${API_URI}/flasher/configs`, {name, files, erase_all: eraseAll});
if (!response.ok) {
const message = await getErrorMessage(response, 'Cannot save configuration. See server logs.');
toast({type: 'error', title: 'Unable to save configuration', description: message, time: 5000});
return false;
}
return true;
}
export async function deleteFlasherConfig(name) {
const response = await apiDelete(`${API_URI}/flasher/configs/${encodeURIComponent(name)}`);
if (!response.ok) {
const message = await getErrorMessage(response, 'Cannot delete configuration. See server logs.');
toast({type: 'error', title: 'Unable to delete configuration', description: message, time: 5000});
return false;
}
return true;
}
export async function refreshFiles(paths) {
let response;
if (Array.isArray(paths) && paths.length > 0) {