v0.1.34: Fix URL resolution and JSON parsing errors
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

- Fixed scan URL to use relative 'scan' instead of '/scan' for Home Assistant ingress
- Improved error handling for non-JSON and malformed API responses
- Added better debugging for JSON parsing errors
- Updated version to 0.1.34 in all files

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
paul2212
2026-03-18 18:09:43 +01:00
parent 620e433547
commit c9de6af83b
4 changed files with 29 additions and 7 deletions

View File

@@ -5,6 +5,17 @@ All notable changes to this project are documented in this file.
The format is based on Keep a Changelog and this project uses Semantic Versioning. The format is based on Keep a Changelog and this project uses Semantic Versioning.
## [0.1.34] - 2026-03-18
### Fixed
- **Web UI**: Fixed URL resolution issue - scan now uses relative URL 'scan' instead of '/scan' to work correctly with Home Assistant ingress.
- **Web UI**: Improved error handling for non-JSON responses and malformed API responses.
- **Web UI**: Added better debugging for JSON parsing errors.
### Changed
- **Web UI**: Updated scan fetch call to match other API calls in the codebase.
- **Web UI**: Enhanced error messages to include raw response text when JSON parsing fails.
## [0.1.33] - 2026-03-18 ## [0.1.33] - 2026-03-18
### Fixed ### Fixed

View File

@@ -1,5 +1,5 @@
name: "Fichero Printer" name: "Fichero Printer"
version: "0.1.33" version: "0.1.34"
slug: "fichero_printer" slug: "fichero_printer"
description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth" description: "REST API for the Fichero D11s (AiYin) thermal label printer over Bluetooth"
url: "https://git.leuschner.dev/Tobias/Fichero" url: "https://git.leuschner.dev/Tobias/Fichero"

View File

@@ -77,7 +77,7 @@ async def lifespan(app: FastAPI): # noqa: ARG001
app = FastAPI( app = FastAPI(
title="Fichero Printer API", title="Fichero Printer API",
description="REST API for the Fichero D11s (AiYin) thermal label printer.", description="REST API for the Fichero D11s (AiYin) thermal label printer.",
version = "0.1.33", version = "0.1.34",
lifespan=lifespan, lifespan=lifespan,
docs_url=None, docs_url=None,
redoc_url=None, redoc_url=None,
@@ -153,14 +153,25 @@ def _ui_html() -> str:
console.log('Starting scan request...'); console.log('Starting scan request...');
try { try {
const response = await fetch('/scan'); const response = await fetch('scan');
if (!response.ok) { if (!response.ok) {
const error = await response.json(); try {
throw new Error(error.detail || `HTTP error! status: ${response.status}`); const error = await response.json();
throw new Error(error.detail || `HTTP error! status: ${response.status}`);
} catch (e) {
const text = await response.text();
throw new Error(`HTTP error! status: ${response.status}, response: ${text}`);
}
} }
const devices = await response.json(); let devices;
try {
devices = await response.json();
} catch (e) {
const text = await response.text();
throw new Error(`Invalid JSON response: ${text}`);
}
if (devices.length === 0) { if (devices.length === 0) {
resultsEl.textContent = '📡 No BLE devices found.\n\nTroubleshooting tips:\n- Make sure your printer is powered on\n- Ensure Bluetooth is enabled on this device\n- Bring the printer closer (within 5 meters)\n- Try restarting the printer'; resultsEl.textContent = '📡 No BLE devices found.\n\nTroubleshooting tips:\n- Make sure your printer is powered on\n- Ensure Bluetooth is enabled on this device\n- Bring the printer closer (within 5 meters)\n- Try restarting the printer';

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "fichero-printer" name = "fichero-printer"
version = "0.1.33" version = "0.1.34"
description = "Web GUI, Python CLI, and protocol documentation for the Fichero D11s thermal label printer." description = "Web GUI, Python CLI, and protocol documentation for the Fichero D11s thermal label printer."
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"