v0.1.34: Fix URL resolution and JSON parsing errors
- 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:
@@ -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
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
try {
|
||||||
const error = await response.json();
|
const error = await response.json();
|
||||||
throw new Error(error.detail || `HTTP error! status: ${response.status}`);
|
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';
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user