Fixes 'Unauthorized' errors when loading part images in web app.
Problem:
- InvenTree media files require authentication
- Direct image URLs return 401 Unauthorized
- Browser can't send API token with image requests
Solution:
- Added /api/proxy/image endpoint in Flask app
- Proxy fetches images with API token authentication
- Returns image with correct Content-Type header
- Frontend uses proxy URL instead of direct InvenTree URL
Usage:
- Images now load via: /api/proxy/image?url=/media/part_images/...
- Proxy adds Authorization header automatically
- Works for both image and thumbnail URLs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixes 404 errors when loading part images in the web interface.
Problem:
- InvenTree API returns relative image paths like /media/part_images/...
- Browser tries to load from Flask app instead of InvenTree server
- Results in 404 errors
Solution:
- Detect relative image URLs (starting with /)
- Prepend InvenTree host URL to make them absolute
- Apply to both image and thumbnail properties
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixes barcode parsing for ANSI MH10.8.2 format barcodes that don't use GS/RS separators.
Problem:
- Barcodes like [)>06PSAM9019-ND1PJL-100-25-T... were not being parsed
- Only separator-based and JSON formats were supported
- User's real-world barcodes were being added to queue as raw strings
Solution:
- Added ANSI MH10.8.2 format detection ([)>06 prefix)
- Extract part code between P and first field marker (1P, 30P)
- Extract quantity from Q<digits> pattern
- Updated both desktop and web app parsing logic
Tested with real barcode:
- Input: [)>06PSAM9019-ND1PJL-100-25-T30PSAM9019-NDK1...Q1811...
- Parsed: Part=SAM9019-ND, Qty=1811 ✅
Files Changed:
- src/stocktool/stock_tool_gui_v2.py - Enhanced parse_scan()
- src/stocktool/web/static/js/app.js - Enhanced parseBarcode()
- test_barcode_parsing.py - Test script for validation
- test_barcode_analyze.py - Barcode structure analysis tool
- QUICKSTART_WEB.md - Quick start guide for web app
Supported Formats Now:
1. JSON-like: {PM:PART-CODE,QTY:10}
2. Separator-based: GS/RS (\x1D, \x1E) separated fields
3. ANSI MH10.8.2: [)>06P<part>...Q<qty>... (NEW!)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements a modern web-based interface alongside the existing desktop app.
Features:
- Flask backend with REST API and WebSocket support
- Responsive web UI with TailwindCSS and Alpine.js
- Real-time updates via Socket.IO
- All desktop features available in browser
- Multi-user support
- Mobile-friendly responsive design
- Same async import queue functionality
Technology Stack:
- Backend: Flask + Flask-SocketIO + Flask-CORS
- Frontend: HTML5 + TailwindCSS + Alpine.js
- Real-time: WebSocket (Socket.IO)
- Icons: Font Awesome 6
New Files:
- src/stocktool/web/app.py - Flask application server
- src/stocktool/web/templates/index.html - Main web interface
- src/stocktool/web/static/js/app.js - Alpine.js application logic
- WEB_APP.md - Complete web app documentation
API Endpoints:
- GET /api/config - Application configuration
- GET /api/locations - List locations
- POST /api/part/search - Search for part
- POST /api/part/import - Queue part import
- POST /api/stock/add - Add stock
- POST /api/stock/update - Update stock
- POST /api/stock/check - Check stock level
- POST /api/part/locate - Locate part
- GET /api/pending - Get pending imports
WebSocket Events:
- import_complete - Part import finished
- import_retry - Import failed, retrying
- import_failed - Import failed completely
- barcode_parsed - Barcode successfully parsed
Benefits:
- Access from any device with a browser
- No desktop installation required
- Better mobile experience
- Multiple users can work simultaneously
- Easier deployment and updates
- Network-accessible within local network
Usage:
uv run stock-tool-web
# Open browser to http://localhost:5000🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements non-blocking part import to prevent UI freezing when scanning unknown parts.
Features:
- Background import worker thread processes unknown parts
- New "Pending Imports" UI section shows import progress
- User can continue scanning other parts while imports run
- Automatic retry on failure (up to 3 attempts)
- Parts automatically processed when import completes
Changes:
- Added PendingPart and ImportResult data structures
- Added PartImportWorker background thread class
- Replaced blocking find_or_import_part() with async find_part()
- Added pending parts queue UI with status display
- Added _on_import_complete() callback handler
- Added _update_pending_parts_ui() for real-time updates
- Added proper cleanup on window close
Benefits:
- No more 30+ second UI freezes during part imports
- Can scan multiple unknown parts in quick succession
- Visual feedback showing import status for each part
- Automatic error handling and retry logic
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Restructured project to use src/stocktool package layout
- Migrated to UV for dependency management
- Added pyproject.toml with all dependencies (sv-ttk, pillow, requests, pyyaml)
- Organized test files into tests/ directory
- Updated .gitignore for UV projects
- Comprehensive README with installation and usage instructions
- Removed old unused files (main.py, stock_tool_gui.py, duplicate copy)
- Added CLI entry point: stock-tool command
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
A comprehensive barcode scanning application for InvenTree inventory management.
Features:
- Multi-mode operation (Add/Update/Check/Locate stock)
- Smart duplicate prevention when adding stock
- Barcode scanning with automatic part code cleaning
- Real-time server connection monitoring
- Part information display with images
- Debug mode for troubleshooting
Fixes applied:
- Fixed encoding issues with non-ASCII characters in barcodes
- Fixed API response handling for list and dict formats
- Implemented duplicate prevention using PATCH to update existing stock
- Added comprehensive error handling and logging
Includes test suite for verification of all fixes.