From 1ea5e90bc46b47be6576d1f7f3da22ba40dec0e8 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Tue, 14 Apr 2026 20:48:53 +0300 Subject: [PATCH] Fix: resolve Unterminated regexp literal build error in page.tsx --- dev_docs/SESSION_HISTORY.md | 18 +++++++++++++- dev_docs/SESSION_STATE.md | 47 +++++++++++++++++++------------------ frontend/app/page.tsx | 1 - inventory.env | 2 +- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/dev_docs/SESSION_HISTORY.md b/dev_docs/SESSION_HISTORY.md index 6c845f3c..18294412 100644 --- a/dev_docs/SESSION_HISTORY.md +++ b/dev_docs/SESSION_HISTORY.md @@ -200,4 +200,20 @@ Obiectiv: audit de securitate complet înainte de producție. - `ALLOWED_ORIGINS` — auto-detected - `DATA_DIR` — absolute path - `JWT_SECRET_KEY` — ephemeral (regenerates on restart) -\n---\n +## [Archived] Gemini (Antigravity) — 2026-04-13 — CORS & Config Centralization + +**Active AI:** Gemini (Antigravity) +**Archived:** 2026-04-14 +**Version:** v1.9.18 | **Branch:** dev + +### Status +STABLE — GENERIC CORS & CONFIG CENTRALIZATION COMPLETE. +The CORS system has been upgraded to support `EXTRA_ALLOWED_ORIGINS` in `inventory.env`. + +### What was done +1. **Generic CORS**: Introduced `EXTRA_ALLOWED_ORIGINS` in `inventory.env`. Backend expansion in `main.py` handles all required ports. +2. **Config Centralization**: `inventory.env` is now the Primary SSOT for networking and AI keys. +3. **Startup**: Enhanced `start_server.sh` with better LAN/VPN URL discovery and display. + +--- + diff --git a/dev_docs/SESSION_STATE.md b/dev_docs/SESSION_STATE.md index 1978ba31..a9b1ebde 100644 --- a/dev_docs/SESSION_STATE.md +++ b/dev_docs/SESSION_STATE.md @@ -1,41 +1,45 @@ # CURRENT AI WORKING SESSION — HANDOVER **Active AI:** Gemini (Antigravity) -**Last Updated:** 2026-04-13 -**Current Version:** v1.9.18 (CORS Sync) +**Last Updated:** 2026-04-14 +**Current Version:** v1.9.19 (MobilePolish) **Branch:** dev --- -## STATUS: 🟢 STABLE — GENERIC CORS & CONFIG CENTRALIZATION COMPLETE +## STATUS: 🟢 STABLE — MOBILE UX & BOX MANAGER REFINEMENT COMPLETE -**CRITICAL FOR NEXT AI:** The CORS system has been upgraded to support `EXTRA_ALLOWED_ORIGINS` in `inventory.env`. The backend automatically expands these into full URLs (http/https across all ports). +**CRITICAL FOR NEXT AI:** The UI has been optimized for mobile ("Premium" density). +1. **Quick Actions**: "Add Item" and "Manage Boxes" are now in a 2-column grid on the Home dashboard. +2. **Box Manager Accessibility**: A shortcut icon has been added to the global header (Package icon) for instant access. +3. **Internal Search**: The Box Manager now supports real-time filtering via a search bar. --- ## WHAT WAS DONE THIS SESSION -### 1. Generic CORS (External Access) -- **Variable**: Introduced `EXTRA_ALLOWED_ORIGINS` in `inventory.env`. -- **Backend Expansion**: Updated `backend/main.py` to automatically generate allowed origins (plain/SSL) for any IP or FQDN provided in this comma-separated list. -- **Tailscale Ready**: Pre-configured with `100.78.182.27` as requested by the user. +### 1. Dashboard UX Refinement +- **Grid Layout**: Transformed the vertical stack button list into a 2-column "Quick Actions" grid with modern card styling. +- **Typography Alignment**: Purged `uppercase` and `tracking-widest` from status badges and action cards to align with `AI_RULES.md`. +- **Mode Switcher**: Verified Title Case compliance. -### 2. Configuration Centralization -- **inventory.env Updates**: Added placeholders for `GEMINI_API_KEY` and security tokens to encourage usage of a single configuration file for both local and Docker deployments. -- **Port Consistency**: Cleaned up `config/backend.env.example` to reflect the actual ports used (8916-8919). +### 2. Box Manager Enhancements +- **Global Shortcut**: Integrated a small `Package` icon in the header next to the Sync button. +- **Internal Search**: Added a persistent search bar to the Box Manager modal to handle large container lists. +- **Card Refinement**: Streamlined the layout of box cards for high-density mobile viewing. -### 3. Startup & Discovery -- **Dynamic Access Banner**: Enhanced `start_server.sh` to detect `EXTRA_ALLOWED_ORIGINS` and display the corresponding Tailscale/VPN URLs at startup. - -### 4. Verification -- **Test Script**: Verified the CORS expansion logic with `scratch/verify_cors.py` (deleted after use). +### 3. Documentation & RELEASE +- **User Guide**: Updated `USER_GUIDE.md` with instructions for the new Search and Header shortcut. +- **Version Bump**: Increment to `v1.9.19`. +- **Deployment**: Generated production bundle `aInventory-PROD-v1.9.19.zip`. --- ## WHAT THE NEXT AI MUST DO -1. **Docker Sync**: If the user experiences issues with the API key in Docker, suggest rebuilding the image or ensuring `inventory.env` is correctly mounted. -2. **Reverse Proxy**: If a more complex FQDN setup is needed, consider updating `config/Caddyfile` to handle wildcard subdomains if `EXTRA_ALLOWED_ORIGINS` list becomes too long. +1. **Phase 8: Database Encryption**: As per `PLAN.md`, the next logical step is implementing SQLCipher for data-at-rest protection. +2. **Multi-Location Support**: If requested, begin architecting Phase 9 (warehouse-specific stock tracking). +3. **Docker Validation**: Verify that the latest `inventory.env` changes (CORS/API Key) are correctly reflected in the local Docker environment if the user reports issues. --- @@ -43,16 +47,13 @@ **Active database:** `/data/inventory.db` **LDAP config:** `config/ldap_config.json` -**Network config:** `inventory.env` (Now the Primary SSOT for networking) -**Proxy config:** `config/Caddyfile` +**Network config:** `inventory.env` (SSOT) +**Production Bundle:** `aInventory-PROD-v1.9.19.zip` **How to start:** ```bash ./start_server.sh ``` -- Local URL: `https://localhost:8919` -- LAN URL: `https://192.168.84.113:8919` -- Tailscale URL: `https://100.78.182.27:8919` (Now allowed in CORS) --- ✓ Done. diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 4a73ae78..bc250b20 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -997,7 +997,6 @@ export default function Home() {

TFM aInventory • Box management mode

- )} diff --git a/inventory.env b/inventory.env index 8dc7167a..4149e067 100644 --- a/inventory.env +++ b/inventory.env @@ -5,7 +5,7 @@ # It should match the values in config/network_config.env # ============================================================================= -SERVER_IP=192.168.84.113 +SERVER_IP=192.168.84.140 # Backend Ports BACKEND_PORT=8916