Compare commits
99 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 78c3306d9e | |||
| 0f567c4ba0 | |||
| 169e32bff3 | |||
| d28055a512 | |||
| 68f7756e2c | |||
| b82b4d9d94 | |||
| 91b4ecd670 | |||
| 380fa8ee99 | |||
| 89b8686f4f | |||
| b6aa07a1fd | |||
| 47c26ffdc8 | |||
| 12357db933 | |||
| 6def94948b | |||
| abbc2772ff | |||
| 473d3f59a4 | |||
| e7ae5c90c7 | |||
| 195c3d3bfa | |||
| 85ba22c7c8 | |||
| 698eb721f2 | |||
| 45dc79e5b7 | |||
| 8508993441 | |||
| a3147d704e | |||
| 834d8efab4 | |||
| 8894a5a2c7 | |||
| 5f4c29bd5a | |||
| 460875430b | |||
| 8a596cb7d8 | |||
| 99b8953ccf | |||
| c87d7d2cde | |||
| 424fc7bbe3 | |||
| 61a2372caa | |||
| ad9be3b705 | |||
| bd8dc0501a | |||
| c9a6f8ec42 | |||
| 0afdf60d38 | |||
| 6ab1da4bd5 | |||
| 1566e32a85 | |||
| fe7a047656 | |||
| 9c285b426f | |||
| c58705f35c | |||
| 8d874944b5 | |||
| b6f85b8e29 | |||
| 68693e7168 | |||
| 84c3bb6e4c | |||
| d8aec91599 | |||
| 11d3209482 | |||
| e19c2564f6 | |||
| 6c0ae6627b | |||
| 8928c75a9d | |||
| b09b485e80 | |||
| 9e9528054e | |||
| 12cbcb1a29 | |||
| 9b9a196f73 | |||
| 9ce3fbcb9e | |||
| 3065b80370 | |||
| 93acc58191 | |||
| d9f775562f | |||
| 85d957be2b | |||
| 7774fc4cc8 | |||
| a0b0ed0cd7 | |||
| 1e831f05db | |||
| 855300cca1 | |||
| 141fca27cf | |||
| 0ee540210a | |||
| 71c5b16d48 | |||
| 5ed1fc9ac0 | |||
| 42149012a1 | |||
| c050ec9fa3 | |||
| 3cd439e068 | |||
| 3430e56dfc | |||
| e75b004ebc | |||
| f3b62ed3a1 | |||
| ba5a52c5dc | |||
| 8366e0691d | |||
| 68906b2f28 | |||
| 5f7d3e71ae | |||
| 6b982b6730 | |||
| ef0c10ca6b | |||
| f121b8804c | |||
| bab6993e5b | |||
| 80303f7900 | |||
| 46ba537bec | |||
| e21b76ad7f | |||
| 5f69967c7a | |||
| 24954cb893 | |||
| 189b640309 | |||
| da4bd635db | |||
| ab6aca2f01 | |||
| 850c5047b8 | |||
| 3e44f5bb24 | |||
| 02964ecf23 | |||
| 49e5319f4c | |||
| 3ebe551b9e | |||
| 0e1eccfe33 | |||
| 4624811707 | |||
| 3607ebf1d7 | |||
| 8bb6c01b7d | |||
| b1a882f92d | |||
| 1b7b271b43 |
@@ -1,25 +1,102 @@
|
|||||||
# EverShelf - Configuration
|
# EverShelf — Configuration
|
||||||
# Copy this file to .env and fill in your values
|
# Copy this file to .env and fill in your values:
|
||||||
# cp .env.example .env
|
# cp .env.example .env
|
||||||
|
#
|
||||||
|
# All settings here can also be changed from the in-app Settings screen and
|
||||||
|
# will be written back to this file automatically.
|
||||||
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
# Google Gemini AI API Key (required for AI features)
|
# ── AI ────────────────────────────────────────────────────────────────────────
|
||||||
# Get one at: https://aistudio.google.com/app/apikey
|
# Google Gemini API key (required for AI features: expiry reading, recipe gen, …)
|
||||||
|
# Get one free at: https://aistudio.google.com/app/apikey
|
||||||
GEMINI_API_KEY=
|
GEMINI_API_KEY=
|
||||||
|
|
||||||
# Bring! Shopping List credentials (optional)
|
# ── Shopping list (Bring!) ────────────────────────────────────────────────────
|
||||||
# Sign up at: https://www.getbring.com/
|
# Credentials for the Bring! app (optional — app works without it)
|
||||||
BRING_EMAIL=
|
BRING_EMAIL=
|
||||||
BRING_PASSWORD=
|
BRING_PASSWORD=
|
||||||
|
|
||||||
# TTS (Text-to-Speech) for cooking mode voice guidance (optional)
|
# ── Text-to-Speech (TTS) ─────────────────────────────────────────────────────
|
||||||
# Works with Home Assistant, or any HTTP endpoint that accepts text
|
# Works with Home Assistant, a local TTS server, or any HTTP endpoint.
|
||||||
TTS_URL=
|
# TTS_ENABLED: master switch (true/false)
|
||||||
TTS_TOKEN=
|
|
||||||
TTS_METHOD=POST
|
|
||||||
TTS_AUTH_TYPE=bearer
|
|
||||||
TTS_CONTENT_TYPE=application/json
|
|
||||||
TTS_PAYLOAD_KEY=message
|
|
||||||
TTS_ENABLED=false
|
TTS_ENABLED=false
|
||||||
|
# TTS_URL: endpoint that receives the text payload
|
||||||
|
TTS_URL=
|
||||||
|
# TTS_TOKEN: Authorization token sent as Bearer header (or empty)
|
||||||
|
TTS_TOKEN=
|
||||||
|
# TTS_METHOD: HTTP method (POST or GET)
|
||||||
|
TTS_METHOD=POST
|
||||||
|
# TTS_AUTH_TYPE: how the token is sent (bearer | basic | none)
|
||||||
|
TTS_AUTH_TYPE=bearer
|
||||||
|
# TTS_CONTENT_TYPE: request Content-Type header
|
||||||
|
TTS_CONTENT_TYPE=application/json
|
||||||
|
# TTS_PAYLOAD_KEY: JSON key that carries the text (e.g. "message", "text")
|
||||||
|
TTS_PAYLOAD_KEY=message
|
||||||
|
# TTS_ENGINE: preferred browser TTS engine ('browser', 'server', 'custom') — optional
|
||||||
|
TTS_ENGINE=
|
||||||
|
# TTS_RATE / TTS_PITCH: speech rate and pitch multipliers (1 = normal)
|
||||||
|
TTS_RATE=1
|
||||||
|
TTS_PITCH=1
|
||||||
|
# TTS_AUTH_HEADER_NAME / VALUE: custom HTTP header for authentication (optional)
|
||||||
|
TTS_AUTH_HEADER_NAME=
|
||||||
|
TTS_AUTH_HEADER_VALUE=
|
||||||
|
# TTS_EXTRA_FIELDS: additional JSON fields as key=value pairs, comma-separated (optional)
|
||||||
|
TTS_EXTRA_FIELDS=
|
||||||
|
|
||||||
# GitHub Error Reporting: token is hardcoded in api/index.php (same for all clients).
|
# ── User preferences ─────────────────────────────────────────────────────────
|
||||||
# No .env entry needed — update GH_ISSUE_TOKEN constant in api/index.php to rotate.
|
# These mirror the toggle switches in the Settings screen.
|
||||||
|
DEFAULT_PERSONS=1
|
||||||
|
PREF_VELOCE=false
|
||||||
|
PREF_POCAFAME=false
|
||||||
|
PREF_SCADENZE=true
|
||||||
|
PREF_HEALTHY=false
|
||||||
|
PREF_OPENED=true
|
||||||
|
PREF_ZEROWASTE=false
|
||||||
|
# Dietary restrictions shown to the AI (e.g. "vegetariano,senza glutine")
|
||||||
|
DIETARY=
|
||||||
|
|
||||||
|
# ── Appliances ────────────────────────────────────────────────────────────────
|
||||||
|
# Comma-separated list of appliances available in your kitchen.
|
||||||
|
# Used by the AI when generating recipes.
|
||||||
|
APPLIANCES=Forno,Microonde,Friggitrice ad aria,Pentola a pressione
|
||||||
|
|
||||||
|
# ── Camera ───────────────────────────────────────────────────────────────────
|
||||||
|
# Default camera for barcode scanning ('environment' = rear, 'user' = front)
|
||||||
|
CAMERA_FACING=environment
|
||||||
|
|
||||||
|
# ── Smart Kitchen Scale ───────────────────────────────────────────────────────
|
||||||
|
# SCALE_ENABLED: enables the scale integration
|
||||||
|
SCALE_ENABLED=false
|
||||||
|
# SCALE_GATEWAY_URL: address of the EverShelf Scale Gateway (Android app)
|
||||||
|
SCALE_GATEWAY_URL=
|
||||||
|
|
||||||
|
# ── Meal Plan ────────────────────────────────────────────────────────────────
|
||||||
|
# MEAL_PLAN_ENABLED: show the weekly meal planner tab in Settings
|
||||||
|
MEAL_PLAN_ENABLED=false
|
||||||
|
|
||||||
|
# ── Screensaver (kiosk / tablet mode) ────────────────────────────────────────
|
||||||
|
SCREENSAVER_ENABLED=false
|
||||||
|
# SCREENSAVER_TIMEOUT: inactivity seconds before screensaver activates (default 5 min)
|
||||||
|
SCREENSAVER_TIMEOUT=300
|
||||||
|
|
||||||
|
# ── Price estimates ───────────────────────────────────────────────────────────
|
||||||
|
# PRICE_ENABLED: show AI-estimated price column on the shopping list
|
||||||
|
PRICE_ENABLED=false
|
||||||
|
# PRICE_COUNTRY: country used for price context (e.g. "Italia", "Germany")
|
||||||
|
PRICE_COUNTRY=Italia
|
||||||
|
# PRICE_CURRENCY: ISO 4217 currency code (e.g. EUR, USD, GBP)
|
||||||
|
PRICE_CURRENCY=EUR
|
||||||
|
# PRICE_UPDATE_MONTHS: how many months to cache a price before re-fetching (default 3)
|
||||||
|
PRICE_UPDATE_MONTHS=3
|
||||||
|
|
||||||
|
# ── Security ─────────────────────────────────────────────────────────────────
|
||||||
|
# SETTINGS_TOKEN: if set, the Settings screen requires this token to save changes.
|
||||||
|
# Leave empty to allow anyone with access to the server to change settings.
|
||||||
|
SETTINGS_TOKEN=
|
||||||
|
|
||||||
|
# ── Developer / demo ─────────────────────────────────────────────────────────
|
||||||
|
# DEMO_MODE: when true, all write operations are blocked (for public demos)
|
||||||
|
DEMO_MODE=false
|
||||||
|
|
||||||
|
# NOTE: GitHub error reporting uses a token hardcoded in api/index.php.
|
||||||
|
# To rotate it, update the GH_ISSUE_TOKEN constant there.
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ko_fi: evershelfproject
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: Report a bug or unexpected behavior in EverShelf
|
||||||
|
title: "[BUG] "
|
||||||
|
labels: ["bug"]
|
||||||
|
assignees: ["dadaloop82"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to report a bug! Please fill in the details below.
|
||||||
|
Before submitting, check the [FAQ](https://github.com/dadaloop82/EverShelf/wiki/FAQ) and [existing issues](https://github.com/dadaloop82/EverShelf/issues?q=is%3Aissue+label%3Abug).
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: EverShelf Version
|
||||||
|
description: Found in Settings → About, or in the footer of the web app.
|
||||||
|
placeholder: "e.g. 1.7.13"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: component
|
||||||
|
attributes:
|
||||||
|
label: Component
|
||||||
|
description: Which part of EverShelf is affected?
|
||||||
|
options:
|
||||||
|
- Web app (browser / PWA)
|
||||||
|
- Android Kiosk app
|
||||||
|
- API / PHP backend
|
||||||
|
- Docker setup
|
||||||
|
- Bring! integration
|
||||||
|
- AI features (Gemini)
|
||||||
|
- Smart Scale
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Bug Description
|
||||||
|
description: A clear and concise description of the bug.
|
||||||
|
placeholder: "What went wrong?"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: steps
|
||||||
|
attributes:
|
||||||
|
label: Steps to Reproduce
|
||||||
|
description: How can we reproduce this?
|
||||||
|
placeholder: |
|
||||||
|
1. Go to '...'
|
||||||
|
2. Tap '...'
|
||||||
|
3. See error
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected Behavior
|
||||||
|
description: What should have happened?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: actual
|
||||||
|
attributes:
|
||||||
|
label: Actual Behavior
|
||||||
|
description: What actually happened? Include error messages, screenshots, or console output.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: browser
|
||||||
|
attributes:
|
||||||
|
label: Browser / OS
|
||||||
|
placeholder: "e.g. Chrome 124 on Android 13, Safari on iOS 17, Firefox on Ubuntu 22.04"
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
id: php
|
||||||
|
attributes:
|
||||||
|
label: PHP Version (if relevant)
|
||||||
|
placeholder: "e.g. 8.2.12 — run: php -v"
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: install
|
||||||
|
attributes:
|
||||||
|
label: Installation Method
|
||||||
|
options:
|
||||||
|
- Docker (docker compose)
|
||||||
|
- Manual (Apache/Nginx)
|
||||||
|
- Other
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Relevant Logs
|
||||||
|
description: PHP error log, browser console output, or `data/error_reports.log` snippet.
|
||||||
|
render: text
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: checklist
|
||||||
|
attributes:
|
||||||
|
label: Checklist
|
||||||
|
options:
|
||||||
|
- label: I searched existing issues and this is not a duplicate
|
||||||
|
required: true
|
||||||
|
- label: I checked the FAQ
|
||||||
|
required: true
|
||||||
|
- label: I am on the latest version (or this bug exists on the latest version)
|
||||||
|
required: false
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: 📖 Wiki & FAQ
|
||||||
|
url: https://github.com/dadaloop82/EverShelf/wiki/FAQ
|
||||||
|
about: Check the FAQ — your question may already be answered there.
|
||||||
|
- name: 💬 Discussions — Q&A
|
||||||
|
url: https://github.com/dadaloop82/EverShelf/discussions
|
||||||
|
about: General questions, show-and-tell, ideas — use Discussions, not Issues.
|
||||||
|
- name: 🔒 Security Vulnerability
|
||||||
|
url: mailto:evershelfproject@gmail.com
|
||||||
|
about: Please report security vulnerabilities privately via email, not as a public issue.
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
name: Feature Request
|
||||||
|
description: Suggest a new feature or improvement
|
||||||
|
title: "[FEATURE] "
|
||||||
|
labels: ["enhancement"]
|
||||||
|
assignees: ["dadaloop82"]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for the idea! Check the [Roadmap](https://github.com/dadaloop82/EverShelf/blob/main/README.md#-roadmap) and [Discussions](https://github.com/dadaloop82/EverShelf/discussions) first — it may already be planned or discussed.
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: category
|
||||||
|
attributes:
|
||||||
|
label: Category
|
||||||
|
options:
|
||||||
|
- Inventory management
|
||||||
|
- Shopping list
|
||||||
|
- AI / Gemini features
|
||||||
|
- Cooking mode
|
||||||
|
- Dashboard / stats
|
||||||
|
- Kiosk app
|
||||||
|
- Smart Scale
|
||||||
|
- Integrations (Bring!, HA, etc.)
|
||||||
|
- Performance / developer experience
|
||||||
|
- Translations / i18n
|
||||||
|
- Other
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: problem
|
||||||
|
attributes:
|
||||||
|
label: Problem / Motivation
|
||||||
|
description: What pain point does this address? Why do you need this?
|
||||||
|
placeholder: "I'm always frustrated when..."
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: solution
|
||||||
|
attributes:
|
||||||
|
label: Proposed Solution
|
||||||
|
description: Describe what you'd like to see added or changed.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: alternatives
|
||||||
|
attributes:
|
||||||
|
label: Alternatives Considered
|
||||||
|
description: Any workarounds you've tried, or other solutions you considered?
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: context
|
||||||
|
attributes:
|
||||||
|
label: Additional Context
|
||||||
|
description: Screenshots, mockups, links to similar features in other apps, etc.
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
id: checklist
|
||||||
|
attributes:
|
||||||
|
label: Checklist
|
||||||
|
options:
|
||||||
|
- label: I checked the Roadmap and this is not already planned
|
||||||
|
required: true
|
||||||
|
- label: I searched existing issues and discussions — this is not a duplicate
|
||||||
|
required: true
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- What does this PR do? Link the related issue: "Closes #123" or "Relates to #123" -->
|
||||||
|
|
||||||
|
Closes #
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Type of Change
|
||||||
|
|
||||||
|
- [ ] Bug fix (non-breaking change that fixes an issue)
|
||||||
|
- [ ] New feature (non-breaking change that adds functionality)
|
||||||
|
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||||
|
- [ ] Refactor / cleanup (no functional change)
|
||||||
|
- [ ] Documentation update
|
||||||
|
- [ ] Translation update
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
<!-- How was this tested? -->
|
||||||
|
|
||||||
|
- [ ] Tested locally (PHP built-in server or Docker)
|
||||||
|
- [ ] Tested on mobile browser
|
||||||
|
- [ ] Tested with Docker Compose: `docker compose up --build`
|
||||||
|
- [ ] PHP syntax: `php -l api/index.php && php -l api/database.php`
|
||||||
|
- [ ] JS syntax: `node --check assets/js/app.js`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Translation
|
||||||
|
|
||||||
|
- [ ] New user-visible strings added → translation keys added to **all three** files: `translations/it.json`, `en.json`, `de.json`
|
||||||
|
- [ ] No user-visible strings changed
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## CHANGELOG
|
||||||
|
|
||||||
|
- [ ] Entry added to `CHANGELOG.md` under `## [Unreleased]` or the correct version
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Screenshots / Video
|
||||||
|
|
||||||
|
<!-- If this is a UI change, add before/after screenshots. Delete this section if not applicable. -->
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "monthly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "ci"
|
||||||
|
labels:
|
||||||
|
- "dependencies"
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
name: Build & Release Scale Gateway APK
|
name: Build & Release Scale Gateway APK (DEPRECATED)
|
||||||
|
# ⚠️ This workflow is disabled. The Scale Gateway is deprecated since Kiosk v1.6.0.
|
||||||
|
# BLE scale support is now built into the EverShelf Kiosk app.
|
||||||
|
# Kept for reference — re-enable manually via workflow_dispatch if needed for legacy setups.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
paths:
|
|
||||||
- 'evershelf-scale-gateway/**'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
confirm:
|
||||||
|
description: "Type 'yes' to confirm you want to build the deprecated gateway APK"
|
||||||
|
required: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -19,7 +20,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ jobs:
|
|||||||
name: PHP Syntax Check
|
name: PHP Syntax Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
name: JavaScript Lint
|
name: JavaScript Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Check JS syntax
|
- name: Check JS syntax
|
||||||
run: |
|
run: |
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
name: Docker Build Test
|
name: Docker Build Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: docker build -t evershelf-test .
|
run: docker build -t evershelf-test .
|
||||||
@@ -53,7 +53,7 @@ jobs:
|
|||||||
name: Validate Translation Files
|
name: Validate Translation Files
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Validate JSON syntax
|
- name: Validate JSON syntax
|
||||||
run: |
|
run: |
|
||||||
@@ -99,7 +99,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout (full history)
|
- name: Checkout (full history)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -119,3 +119,63 @@ jobs:
|
|||||||
|
|
||||||
Triggered by: $LAST"
|
Triggered by: $LAST"
|
||||||
git push origin main
|
git push origin main
|
||||||
|
|
||||||
|
# ── Auto-create GitHub Release on main ───────────────────────────────────
|
||||||
|
# Runs after auto-merge succeeds. Reads version from index.html,
|
||||||
|
# creates a release tag vX.Y.Z if it doesn't exist yet.
|
||||||
|
# This powers the in-app update badge for self-hosted users.
|
||||||
|
create-release:
|
||||||
|
name: Create GitHub Release
|
||||||
|
needs: [auto-merge-to-main]
|
||||||
|
if: github.ref == 'refs/heads/develop'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout main
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract version from index.html
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VER=$(grep -oP 'header-version">v\K[\d.]+' index.html | head -1)
|
||||||
|
echo "version=v${VER}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Detected version: v${VER}"
|
||||||
|
|
||||||
|
- name: Check if tag already exists
|
||||||
|
id: tag_check
|
||||||
|
run: |
|
||||||
|
if git ls-remote --tags origin "refs/tags/${{ steps.version.outputs.version }}" | grep -q .; then
|
||||||
|
echo "exists=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "exists=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Read CHANGELOG entry for this version
|
||||||
|
id: changelog
|
||||||
|
if: steps.tag_check.outputs.exists == 'false'
|
||||||
|
run: |
|
||||||
|
VER="${{ steps.version.outputs.version }}"
|
||||||
|
# Extract the section for this version from CHANGELOG.md
|
||||||
|
BODY=$(awk "/^## \[?${VER#v}\]?|^## ${VER}/,/^## [0-9]/" CHANGELOG.md | head -50 | tail -n +1 | grep -v "^## [0-9]" || true)
|
||||||
|
if [ -z "$BODY" ]; then
|
||||||
|
BODY="See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details."
|
||||||
|
fi
|
||||||
|
# Multiline output
|
||||||
|
echo "body<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$BODY" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
if: steps.tag_check.outputs.exists == 'false'
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.version.outputs.version }}
|
||||||
|
name: "EverShelf ${{ steps.version.outputs.version }}"
|
||||||
|
body: ${{ steps.changelog.outputs.body }}
|
||||||
|
target_commitish: main
|
||||||
|
make_latest: true
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
name: Security Scan (Trivy)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, develop]
|
||||||
|
paths:
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'docker-compose.yml'
|
||||||
|
- 'api/**'
|
||||||
|
- '.github/workflows/security.yml'
|
||||||
|
schedule:
|
||||||
|
# Run weekly on Monday at 07:00 UTC
|
||||||
|
- cron: '0 7 * * 1'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trivy-docker:
|
||||||
|
name: Trivy — Docker image scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t evershelf:scan .
|
||||||
|
|
||||||
|
- name: Run Trivy vulnerability scanner
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
with:
|
||||||
|
image-ref: 'evershelf:scan'
|
||||||
|
format: 'sarif'
|
||||||
|
output: 'trivy-results.sarif'
|
||||||
|
severity: 'CRITICAL,HIGH'
|
||||||
|
ignore-unfixed: true
|
||||||
|
exit-code: '0' # don't fail the build, just report
|
||||||
|
|
||||||
|
- name: Upload Trivy SARIF to GitHub Security tab
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
|
with:
|
||||||
|
sarif_file: 'trivy-results.sarif'
|
||||||
|
category: 'trivy-docker'
|
||||||
|
|
||||||
|
trivy-fs:
|
||||||
|
name: Trivy — Filesystem scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Run Trivy filesystem scanner
|
||||||
|
uses: aquasecurity/trivy-action@v0.36.0
|
||||||
|
with:
|
||||||
|
scan-type: 'fs'
|
||||||
|
scan-ref: '.'
|
||||||
|
format: 'sarif'
|
||||||
|
output: 'trivy-fs-results.sarif'
|
||||||
|
severity: 'CRITICAL,HIGH'
|
||||||
|
ignore-unfixed: true
|
||||||
|
exit-code: '0'
|
||||||
|
|
||||||
|
- name: Upload Trivy FS SARIF
|
||||||
|
uses: github/codeql-action/upload-sarif@v4
|
||||||
|
with:
|
||||||
|
sarif_file: 'trivy-fs-results.sarif'
|
||||||
|
category: 'trivy-fs'
|
||||||
@@ -49,3 +49,5 @@ evershelf-kiosk/local.properties
|
|||||||
data/error_reports.log
|
data/error_reports.log
|
||||||
data/latest_release_cache.json
|
data/latest_release_cache.json
|
||||||
data/food_facts_cache.json
|
data/food_facts_cache.json
|
||||||
|
data/category_ai_cache.json
|
||||||
|
assets/img/logo/*_backup.*
|
||||||
|
|||||||
@@ -5,105 +5,126 @@ All notable changes to EverShelf will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased] — Ideas & Roadmap
|
||||||
|
|
||||||
|
> Ideas collected during development. No priority or date implied.
|
||||||
|
|
||||||
|
- **Recipe scraps tips** — During cooking steps, detect "waste" generated (peels, cores, bones, eggshells, coffee grounds, citrus zest, etc.) and surface AI-powered tips on how to reuse them (compost, natural cleaner, broth, candied peel, etc.). Could be shown as an optional collapsible hint card below the step that generates the scrap.
|
||||||
|
|
||||||
|
## [1.7.15] - 2026-05-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Full i18n audit** — Comprehensive sweep of all user-visible strings in `app.js` and `index.html`. 25+ new translation keys added across `it.json`, `en.json`, `de.json`, covering: vacuum toast, TTS voice controls, timer step labels, product note labels, error messages, expiry form, barcode hint, category select placeholder, cooking step fallback, `form.select_placeholder`, `btn.yes_short`/`no_short`, `add.vacuum_question`, `add.vacuum_saved`, `move.vacuum_seal_rest`, `cooking.step_fallback`, `error.prefix`/`unknown`, `product.select_variant`, and more.
|
||||||
|
- **Splash screen redesign** — Logo displayed prominently, spinner below, app version shown at the bottom; version label injected dynamically at boot time so it never gets out of sync. Minimum 3-second display duration enforced: `_splashStart` is recorded before `DOMContentLoaded`; the fade-out is delayed by the remaining time if the app loads faster than 3 s.
|
||||||
|
- **Demo GIF in README** — `assets/img/demo.gif` (processed at 2× speed, ~36 s) added to the `## 📸 Screenshots` section.
|
||||||
|
- **`pz`/`conf` unit labels translated** — "pz" now shows as "pcs" in English and "Stk" in German; "conf" shows as "pkg" / "Pkg". All `unitLabels` objects in JS now use `t('units.pz')` / `t('units.conf')`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Camera button (📷) opened kiosk SettingsActivity on Android** — The native `btnSettings` ImageButton in the kiosk layout was positioned `top|end` with `alpha=0.12` (nearly invisible), sitting directly on top of the HTML scan button in the webapp header. Every tap on the 📷 button was intercepted by the native View and opened `SettingsActivity`. Fixed: moved `btnSettings` to `bottom|end` (above the bottom nav bar, `marginBottom=80dp`) and increased `alpha` to `0.28` so it is clearly separate from the header. Kiosk versionCode bumped to 16.
|
||||||
|
- **Camera button (📷) opened settings on Android Chrome/Brave** — `pointerleave` fired before `pointerup` when finger drifted slightly, cancelling the long-press timer and leaving the browser to dispatch a synthetic `click` that bubbled to an unintended handler. Fixed: added `setPointerCapture` (prevents `pointerleave` during touch) and `preventDefault` (blocks synthetic click); replaced `pointerleave` with `pointercancel` handler. Added `touch-action: manipulation` to `.header-scan-btn` CSS.
|
||||||
|
- **Logo white background on splash screen** — Re-processed both `logo.png` and `logo_icon.png` with fuzz 35% alpha extraction, removing the white background that was visible against the dark splash background (`#0f172a`).
|
||||||
|
- **Recipe button label** — Shortened to "Ricetta" / "Recipe" / "Rezept" for compact display in the inventory quick-action modal.
|
||||||
|
- **Quantity decimal precision** — `qtyNum` in recipe/cooking ingredient buttons and `conf` fallback display in inventory cards now limited to 1 decimal place (was showing 7+ decimal places from raw AI output, e.g. `0.25353223 conf`).
|
||||||
|
- **"Errore" / "Error" fallback strings** — All remaining Italian hardcoded `'Errore'` fallbacks in `showToast()` calls replaced with `t('error.generic')`. Italian fallback strings removed from buttons that already used `t()`.
|
||||||
|
- **README Italian phrases** — "La quantità è giusta (2 pz)", "🤖 Spiega", "Latte / Affettato / Panna da cucina", "Buon appetito!", "L'ho buttato" replaced with English equivalents in the README.
|
||||||
|
- **Appliance chips translated** — `renderAppliances()` now shows translated names (e.g. "Air fryer" in EN, "Heißluftfritteuse" in DE) for all known canonical Italian appliance names via `_applianceDisplayName()` lookup. `addApplianceQuick` toast no longer hardcoded Italian. Remove-button title translated.
|
||||||
|
- **Gemini API key not preserved on settings save** — `saveSettings()` was overwriting `s.gemini_key = ""` when the Gemini input field was empty (it is intentionally not pre-populated for security). Key is now preserved if the input is blank. `_geminiAvailable` is re-fetched from the server after every settings save so the recipe buttons reflect the real state immediately.
|
||||||
|
|
||||||
|
## [1.7.14] - 2026-05-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **In-app bug report form** — "Segnala un problema" now opens a modal form instead of redirecting to GitHub. Users can select type (Bug / Feature / Question), write title and description, optionally add reproduction steps. A GitHub issue is created directly with labels and app metadata attached.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Kiosk settings button** — "Apri configurazione kiosk" in webapp settings was showing a toast asking to tap a gear icon that no longer exists. Now calls `openNativeSettings()` bridge directly (opens Android SettingsActivity). Fallback for old APKs shows a proper "update the kiosk app" hint.
|
||||||
|
- **False update badge** — `manifest.json` version was `1.7.12` while the app header showed `v1.7.13`, causing the server to report an older deployed version and triggering a spurious update notification.
|
||||||
|
- **Kiosk settings gear disappeared** — Race condition where Kotlin's `onPageFinished` injects `#_kiosk_overlay` before JS runs; JS found the element already present and returned early without ever restoring the native gear button. Fixed: JS no longer hides the native gear on load; `closeModal()` restores it with `setNativeSettingsVisible(true)`.
|
||||||
|
- **`openNativeSettings()` fragile typeof check** — Android `@JavascriptInterface` methods are not always detected as `'function'` by typeof; replaced with try/catch.
|
||||||
|
|
||||||
|
## [1.7.13] - 2026-05-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **Fresh-install crash: `no such column: undone`** — The `transactions` table was created in `initializeDB()` without the `undone` column, but the composite index `idx_transactions_pid_type_undone` immediately referenced it, crashing every new installation at first DB access. Added `undone INTEGER DEFAULT 0` to the transactions schema in `initializeDB()`.
|
||||||
|
- **Race condition: `duplicate column name: package_unit`** — Concurrent API requests on a new installation could all pass the `PRAGMA table_info` guard simultaneously and each try to `ALTER TABLE products ADD COLUMN package_unit`, with all but the first failing with a PDOException. Wrapped all `ALTER TABLE … ADD COLUMN` calls in try/catch to silently ignore duplicate-column errors.
|
||||||
|
|
||||||
## [1.7.12] - 2026-05-13
|
## [1.7.12] - 2026-05-13
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **Banner "Usa prima" con data calcolata confusa** — `_renderUseExpiryHint` mostrava una data di scadenza *calcolata* (shelf life dopo apertura) anziché la data reale. Ora, se il prodotto ha `opened_at`, il banner mostra "Quella [nel frigo], aperta da X giorni — usala prima!" usando la nuova chiave `use.expiry_warning_opened`.
|
- **"Use first" banner showed a calculated expiry date** — `_renderUseExpiryHint` was displaying a *calculated* shelf-life date (from opening date) instead of the actual one. When `opened_at` is set, the banner now shows "That one [in the fridge], opened X days ago — use it first!" using the new `use.expiry_warning_opened` translation key.
|
||||||
- **"Usa TUTTO / Finito" nelle ricette cancellava la riga** — `submitRecipeUse(true)` inviava `use_all: true` all'API che eseguiva un `DELETE` diretto sulla riga di inventario senza conferma. La funzione ora calcola la quantità esatta dagli item disponibili (`_recipeUseContext.items`) e invia un normale `inventory_use` con quantità esplicita.
|
- **"Use All / Done" in recipes deleted the inventory row** — `submitRecipeUse(true)` was sending `use_all: true` to the API, which executed a direct `DELETE` on the inventory row without any confirmation. The function now calculates the exact quantity from the available items (`_recipeUseContext.items`) and sends a regular `inventory_use` with an explicit quantity.
|
||||||
- **Ricette: `qty_number` in grammi per prodotti `pz`** — Il prompt AI e la post-elaborazione PHP ora istruiscono Gemini a esprimere `qty_number` come pezzi interi per ingredienti con unità `pz` (Pan bauletto, fette biscottate, ecc.). La lista ingredienti nel prompt include `[usa PEZZI interi]` per ogni prodotto `pz`. Il fallback PHP per `pz` senza `default_quantity` non divide più per 100 (trattando grammi come pezzi), ma usa il `qty_number` restituito dall'AI se sembra un conteggio plausibile, altrimenti 1.
|
- **Recipes: `qty_number` returned in grams for piece-counted (`pz`) items** — The AI prompt and PHP post-processing now instruct Gemini to express `qty_number` as whole pieces for ingredients with unit `pz` (sliced bread, crackers, etc.). The ingredient list in the prompt includes `[use whole PIECES]` for each `pz` product. The PHP fallback for `pz` items without `default_quantity` no longer divides by 100, but uses the AI-returned `qty_number` if it is a plausible count, otherwise defaults to 1.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **Traduzione `use.expiry_warning_opened`** — Nuova chiave in `it.json`, `en.json`, `de.json` con placeholder `{loc}` (posizione) e `{when}` (giorni dall'apertura).
|
- **Translation key `use.expiry_warning_opened`** — New key in `it.json`, `en.json`, `de.json` with `{loc}` (location) and `{when}` (days since opening) placeholders.
|
||||||
|
|
||||||
## [1.7.11] - 2026-05-12
|
## [1.7.11] - 2026-05-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **Scan page redesign** — La pagina di scansione è stata completamente ridisegnata per tablet e mobile:
|
- **Scan page redesign** — The scanner page has been completely redesigned for tablet and mobile:
|
||||||
- **2× zoom fisso** — zoom hardware se disponibile, altrimenti CSS `scale(2)` automatico.
|
- **2× fixed zoom** — hardware zoom if available, otherwise automatic CSS `scale(2)`.
|
||||||
- **Torcia** — bottone nel viewport con feedback toast e stato visivo.
|
- **Torch** — in-viewport button with toast feedback and visual state indicator.
|
||||||
- **Flip fotocamera** — switch front/back con persistenza in settings.
|
- **Camera flip** — front/back switch with persistence in settings.
|
||||||
- **3 tab input** — Barcode / Nome / AI per un accesso rapido a ciascuna modalità.
|
- **3 input tabs** — Barcode / Name / AI for quick access to each scanning mode.
|
||||||
- **Prodotti recenti** — chip degli ultimi 6 prodotti scansionati (localStorage), con icona categoria.
|
- **Recent products** — chips for the last 6 scanned products (localStorage), with category icon.
|
||||||
- **Live code overlay** — codice barcode rilevato parzialmente mostrato in sovrimpressione nel viewport.
|
- **Live code overlay** — partially detected barcode shown as overlay in the viewport during partial scan.
|
||||||
- **Confirm overlay** — checkmark + nome prodotto per 900ms al riconoscimento avvenuto.
|
- **Confirm overlay** — checkmark + product name displayed for 900 ms on successful recognition.
|
||||||
- **Angoli guida** — frame visivo per inquadrare il barcode.
|
- **Guide corners** — visual alignment frame for barcode centering.
|
||||||
- **AI Number OCR** — dopo 4s senza scansione, compare il bottone "Leggi numeri con AI": Gemini analizza l'immagine e legge le cifre del barcode anche se non viene letto otticamente.
|
- **AI Number OCR** — after 4 s without a scan, a "Read numbers with AI" button appears; Gemini analyses the video frame and returns barcode digits even when the optical scanner fails.
|
||||||
- **PHP `gemini_number_ocr`** — Nuovo endpoint POST; accetta un'immagine JPEG base64, chiede a Gemini di individuare il codice EAN-13 / EAN-8 stampato sul prodotto, e restituisce le cifre o `not_found`.
|
- **PHP `gemini_number_ocr` endpoint** — New POST endpoint; accepts a base64 JPEG image, asks Gemini to locate the EAN-13 / EAN-8 code printed on the product, and returns the digits or `not_found`.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **Falsi positivi anomalia consumo "Mozzarella 3 pezzi"** — Rimossa la direzione `untracked` (consumo maggiore degli acquisti registrati) che generava banner su ogni prodotto con acquisti non tracciati. Ora vengono segnalate solo le anomalie `phantom` e `missing`.
|
- **False consumption anomaly positives (e.g. "Mozzarella 3 pcs")** — Removed the `untracked` direction (consumption higher than recorded purchases), which was generating banners for every product with untracked purchase history. Only `phantom` and `missing` anomalies are now reported.
|
||||||
- **Predizione "~0g/settimana"** — Il modello richiedeva ora min 5 transazioni (era 3) e un arco temporale di almeno 7 giorni; se il consumo predetto è < 15% della baseline viene saltato, eliminando i falsi positivi su prodotti con poche transazioni ravvicinate.
|
- **"~0 g/week" consumption prediction** — The model now requires a minimum of 5 transactions (was 3) and a time span of at least 7 days; predictions where consumption is < 15% of the baseline are skipped, eliminating false positives for products with few closely-spaced transactions.
|
||||||
- **Menu a tendina suggerimenti sul campo Nome (scan)** — Rimosso `list="common-products"` dal campo di input, il datalist non viene più aperto su tablet.
|
- **Suggestion dropdown on the Name field (scan page)** — Removed `list="common-products"` from the input field; the datalist is no longer triggered on tablets.
|
||||||
|
|
||||||
## [1.7.10] - 2026-05-11
|
## [1.7.10] - 2026-05-11
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **Banner "Imposta scadenza" non faceva nulla** — `editBannerNoExpiry()` chiamava `openEditInventoryModal()` che non esiste. Corretto in `editInventoryItem()` (la funzione corretta usata da tutti gli altri handler banner). Aggiunto anche il fetch preventivo di `inventory_list` perché `currentInventory` è vuoto sulla dashboard.
|
- **"Set expiry" banner did nothing** — `editBannerNoExpiry()` was calling `openEditInventoryModal()` which does not exist. Fixed to call `editInventoryItem()` (the correct function used by all other banner handlers). Added a prefetch of `inventory_list` because `currentInventory` is empty on the dashboard.
|
||||||
- **"Prodotto non trovato" aprendo modal da banner** — `currentInventory` è sempre vuoto sulla dashboard; il fetch dell'inventario ora avviene prima di aprire la modal (stesso pattern di `editReviewItem` e `weighBannerItem`).
|
- **"Product not found" when opening modal from a banner** — `currentInventory` is always empty on the dashboard; the inventory fetch now happens before opening the modal (same pattern as `editReviewItem` and `weighBannerItem`).
|
||||||
- **Banner scaduto su latte UHT aperto** — Il testo mostrava "Scaduto!" invece di "Aperto da troppo tempo". Ora i prodotti con `opened_at` mostrano "Aperto da N giorni in [posizione]" sia nel titolo che nel dettaglio del banner.
|
- **Expired banner on opened UHT milk** — The banner was showing "Expired!" instead of "Opened too long". Items with `opened_at` now display "Opened X days ago in [location]" in both the title and the banner detail.
|
||||||
- **Shelf life latte generico 4 → 7 giorni** — Il latte senza qualificatori (es. "Latte") veniva trattato come fresco (4 giorni). Il latte fresco è già gestito esplicitamente (`latte fresco/intero/parzial/scremato` → 3gg); il generico ora vale 7 giorni (default UHT). Fix applicato sia in PHP (`database.php`) che in JS (`app.js`).
|
- **Generic milk shelf life 4 → 7 days** — Milk without qualifiers (e.g. "Milk") was treated as fresh (4 days). Fresh milk is still handled explicitly (`latte fresco/intero/parzial/scremato` → 3 days); the generic case now defaults to 7 days (UHT default). Fix applied in both PHP (`database.php`) and JS (`app.js`).
|
||||||
- **`opened_at` stale sulle confezioni intere dopo split** — Quando un uso splitta la riga in "confezioni intere + frazione aperta", la riga delle intere non azzerava `opened_at`. Ora tutti e 3 i percorsi di split eseguono `opened_at = NULL` sulla riga sigillata.
|
- **Stale `opened_at` on sealed packages after split** — When a use operation splits a row into "whole sealed packages + opened fraction", the sealed-packages row was not clearing `opened_at`. All 3 split code paths now execute `opened_at = NULL` on the sealed row.
|
||||||
- **`inventory_update` non registrava transazioni** — La modal di modifica quantità aggiornava l'inventario senza creare transazioni. La differenza viene ora registrata automaticamente come `'in'` o `'out'` con nota `[Correzione manuale]`, evitando falsi positivi nel rilevatore di anomalie.
|
- **`inventory_update` was not recording transactions** — The quantity-edit modal updated inventory without creating transaction records. The quantity difference is now automatically recorded as `in` or `out` with a `[Manual correction]` note, preventing false positives in the anomaly detector.
|
||||||
- **False anomalie di consumo dopo la spesa** — La baseline della prediction usava solo la quantità del rifornimento (`restockQty`), ignorando le scorte preesistenti → `actual > expected` sistematicamente. Nuova baseline: `qty_attuale + consumato_da_ultimo_rifornimento`, che riflette correttamente la realtà indipendentemente dalle scorte pregresse.
|
- **False consumption anomalies after restocking** — The prediction baseline was using only the restock quantity (`restockQty`), ignoring pre-existing stock, causing `actual > expected` systematically. New baseline: `current_qty + consumed_since_last_restock`, which correctly reflects the real situation regardless of prior stock levels.
|
||||||
- **Banner "consumo anomalo" su quasi tutti i prodotti** — Due fix:
|
- **Anomaly banner firing on almost all products** — Two fixes:
|
||||||
1. `expected = 0` non genera più anomalia "more" (il modello pensa che dovresti aver finito, ma hai ricomprato).
|
1. `expected = 0` no longer generates a "more" anomaly (the model assumed you should have run out, but you restocked).
|
||||||
2. Soglia "more than expected" alzata al 400% (era 30%); "less than expected" rimane al 30%.
|
2. "More than expected" threshold raised to 400% (was 30%); "less than expected" threshold remains at 30%.
|
||||||
- **Sezione scaduti mostra prodotti già buttati** — La query `expired` mancava di `AND i.quantity > 0`; i prodotti buttati (qty=0) con scadenza passata continuavano ad apparire. Corretta la query + pulizia righe orfane nel DB.
|
- **Expired section showing already-discarded products** — The `expired` query was missing `AND i.quantity > 0`; discarded products (qty=0) with a past expiry kept appearing. Query fixed and orphan rows cleaned from the DB.
|
||||||
- **Hardcoded `scade il` in banner** — Stringa italiana hardcodata nel dettaglio del banner scaduti rimossa.
|
- **Hardcoded Italian string `scade il` in banner** — Replaced with the correct i18n key.
|
||||||
- **Docker: `SQLSTATE[HY000][14] unable to open database file`** — Aggiunta `_ensureDataDir()` in `database.php` che crea la directory se mancante e tenta `chmod(0775)` se non scrivibile.
|
- **Docker: `SQLSTATE[HY000][14] unable to open database file`** — `_ensureDataDir()` in `database.php` now creates the `data/` directory if missing and attempts `chmod(0775)` if not writable, resolving the error on freshly mounted Docker volumes.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **i18n completa** — Aggiunti ~25 chiavi di traduzione mancanti per UI kiosk, gemini, banner, scanner, shopping, appliances in tutti e 3 i file (`it.json`, `en.json`, `de.json`). Totale: 934 chiavi per lingua.
|
- **Complete i18n** — Added ~25 missing translation keys for kiosk UI, Gemini responses, banners, scanner, shopping, and appliances across all 3 language files (`it.json`, `en.json`, `de.json`). Total: 934 keys per language.
|
||||||
|
|
||||||
|
|
||||||
### Added
|
|
||||||
- **Category badge on inventory items** — Every product in the inventory now displays a macro-category badge (icon + label) next to the location badge. Badges showing `altro` are asynchronously refined via the new `guess_category` AI endpoint (Gemini + `data/category_ai_cache.json` cache) so the correct category appears automatically after the page loads.
|
|
||||||
- **Category search** — The inventory search bar now matches items by category. Typing "biscotti" returns every cookie/biscuit regardless of brand or exact name; the match uses both the direct category key and the translated label.
|
|
||||||
- **Brand map in `guessCategoryFromName`** — A fast-path brand table (Oreo, Ringo, Uno, Barilla, De Cecco, Galbani, Mutti, Lavazza, etc.) provides instant category resolution before any regex evaluation.
|
|
||||||
- **PHP `guess_category` endpoint** — New server-side action that calls Gemini to classify a product name into a local category key, with file-based caching (`data/category_ai_cache.json`). Returns `altro` immediately when no Gemini API key is configured.
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- **Duplicate banner alerts** — `loadBannerAlerts()` was occasionally enqueuing the same item multiple times when called concurrently. Fixed with a `_bannerLoading` re-entrancy guard and a `_queuedItemIds` Set that prevents any item from being pushed more than once per refresh cycle.
|
|
||||||
- **`mapToLocalCategory` with `en:dairies` / `en:dairies-and-eggs`** — The dairy regex was not matching OpenFoodFacts tags that use the `dairi` stem; extended to cover the full range of dairy tags.
|
|
||||||
- **`mapToLocalCategory` always returning `altro`** — When the input category was already `altro`, the function exited the direct-match loop before attempting any fallback, losing all name-based guesses. The loop now skips the `altro` key for the early-return and falls back to `guessCategoryFromName(productName)` at the end.
|
|
||||||
- **"Tonno all'olio" → condimenti** — `tonno\b` was matched after `olio\b` (condimenti) due to regex ordering. Moved the conserve block before the condimenti block so tuna products resolve correctly.
|
|
||||||
|
|
||||||
### Security
|
|
||||||
- **AI function guards** — All Gemini-powered functions now check `_geminiAvailable` (JS) or the presence of `GEMINI_API_KEY` (PHP) before executing. Affected functions: `_refineCategoryBadgesAsync`, `fetchAllPrices`, `getShoppingPrice`. The PHP endpoint returns `{"success":false,"error":"no_api_key"}` instead of silently returning empty results, making the missing-key state explicit and diagnosable.
|
|
||||||
|
|
||||||
## [1.7.8] - 2026-05-10
|
## [1.7.8] - 2026-05-10
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- **Trasferisci a Ricette dalla chat** — Quando la chat con Gemini Chef genera una ricetta, compare il bottone "📥 Trasferisci a Ricette". Premendolo, Gemini converte il testo in JSON strutturato completo (titolo, pasti, ingredienti, passi), il backend arricchisce ogni ingrediente con product_id e location via fuzzy-match (identico a generateRecipe), la ricetta viene salvata in archivio e si apre direttamente nella sezione Ricette con tutti i pulsanti "Usa" e la modalità cottura completa.
|
- **Transfer to Recipes from chat** — When the Gemini Chef chat generates a recipe, a "📥 Transfer to Recipes" button appears. Pressing it triggers Gemini to convert the chat text into a complete structured JSON (title, meal, ingredients, steps); the backend enriches each ingredient with `product_id` and `location` via fuzzy-match (identical to `generateRecipe`); the recipe is saved and opens directly in the Recipes section with all "Use" buttons and full cooking mode.
|
||||||
- **Bottone "Apri la ricetta"** — Dopo un trasferimento riuscito, il bottone "📥 Trasferisci a Ricette" si trasforma direttamente in "📖 Apri la ricetta" (stesso elemento DOM), evitando problemi di sovrapposizione.
|
- **"Open recipe" button** — After a successful transfer, the "📥 Transfer to Recipes" button transforms into "📖 Open recipe" (same DOM element), preventing overlap.
|
||||||
- **Crea una ricetta per ingrediente** — Nel pannello azione di ogni alimento in inventario compare il bottone "👨🍳 Crea una ricetta con questo" (teal, larghezza piena). Premendolo, Gemini genera una ricetta italiana usando quell'alimento come protagonista (stesso pipeline di chatToRecipe: arricchimento fuzzy-match inventario, meal=null, 8192 token max).
|
- **Create a recipe from an ingredient** — In the action panel of every inventory item, a "👨🍳 Create a recipe with this" button appears (teal, full width). Pressing it, Gemini generates a recipe using that ingredient as the star (same pipeline as `chatToRecipe`: inventory fuzzy-match enrichment, `meal=null`, 8192 token max).
|
||||||
- **meal non auto-categorizzato** — Le ricette generate da chat o da ingrediente non vengono più auto-categorizzate (meal rimane null); il tag pasto nell'UI viene mostrato solo se valorizzato.
|
- **Meal not auto-categorized** — Recipes generated from chat or from an ingredient are no longer auto-categorized (`meal` remains null); the meal tag in the UI is only shown when explicitly set.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **Smart shopping: falso positivo "quasi finito"** — Se un prodotto in grammi/ml era quasi esaurito (es. Burro 30g = 12%) ma lo stesso prodotto era disponibile anche come confezione (Burro 1 conf = 99%), il sistema segnalava ugualmente "sta finendo". Ora verifica se la famiglia `shopping_name` ha scorte da altri prodotti: se sì, l'alert viene soppresso. (Esempio: 30g di Burro + 1 conf di Burro → nessun alert.)
|
- **Smart shopping: false "running low" alert** — If a product in grams/ml was nearly exhausted (e.g. Butter 30 g = 12%) but the same product was also available as a sealed package (Butter 1 pack = 99%), the system still flagged "running low". Now checks whether the `shopping_name` family has stock from other products; if so, the alert is suppressed.
|
||||||
- **Traduzioni JSON corrotte** — La sezione `action` era duplicata nei file `de.json`, `en.json` e `it.json`, causando errori di parsing che bloccavano la CI/CD. Rimossa la sezione spuria.
|
- **Corrupted translation JSON** — The `action` section was duplicated in `de.json`, `en.json`, and `it.json`, causing JSON parse errors that blocked CI/CD. The spurious duplicate section has been removed.
|
||||||
|
|
||||||
## [1.7.7] - 2026-05-10
|
## [1.7.7] - 2026-05-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **Smart shopping family suppression** — La logica `recentlyExhausted` (prodotti terminati < 14gg) bypassava erroneamente anche la suppression per `shopping_name` family, causando falsi positivi: prodotti come Yaourt Vanille apparivano come urgenti anche con 2kg di Yogurt in stock, Salame Paesano con 1kg di Affettato in stock, Gran bauletto rustico con più pani in stock. Ora `recentlyExhausted` bypassa solo il check token-based (match lasco), mentre la family suppression per `shopping_name` si applica sempre.
|
- **Smart shopping family suppression** — The `recentlyExhausted` logic (products finished < 14 days ago) was incorrectly bypassing the `shopping_name` family suppression, causing false positives: products like Vanilla Yogurt appeared urgent even with 2 kg of Yogurt in stock. `recentlyExhausted` now only bypasses the token-based loose match; family suppression by `shopping_name` always applies.
|
||||||
- **Shelf life pre-warming nel cron** — Il cron ora chiama `prewarmShelfLifeCache()` ogni 5 minuti, precaricando via Gemini AI la shelf life degli item aperti in inventario (max 5 item per ciclo) prima che l'utente li visualizzi. Questo elimina il delay percepibile al primo click su "Aperto il...".
|
- **Shelf-life pre-warming in cron** — The cron now calls `prewarmShelfLifeCache()` every 5 minutes, pre-loading via Gemini AI the shelf life of opened inventory items (max 5 items per cycle) before the user views them. This eliminates the noticeable delay on first click of "Opened on…".
|
||||||
|
|
||||||
## [1.7.6] - 2026-05-10
|
## [1.7.6] - 2026-05-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- **`shopping_name` troncato (Piadina)** — Il prodotto "Piadine medie" aveva `shopping_name='Pi'` (troncato), non veniva aggruppato correttamente nella famiglia. Corretto in `Piadina`.
|
- **`shopping_name` truncated (Piadina)** — The product "Piadine medie" had `shopping_name='Pi'` (truncated), preventing it from grouping correctly in its family. Fixed to `Piadina`.
|
||||||
- **Family merges DB** — Grana Padano ora sotto `Formaggio` (era `Grana` singleton), Prosciutto cotto ora sotto `Affettato`, Panna acida ora sotto `Panna`.
|
- **Family merges in DB** — Grana Padano now under `Formaggio` (was a `Grana` singleton), Prosciutto cotto now under `Affettato`, Panna acida now under `Panna`.
|
||||||
- **`daily_rate` su periodo effettivo** — Il tasso di consumo giornaliero usava `first_in → now` come finestra, diluendo il rate con periodi in cui il prodotto era già esaurito (es. aglio esaurito a 34gg veniva calcolato su 60+). Ora usa `first_in → last_activity` (ultimo acquisto o ultimo uso), più preciso per le previsioni di riordino.
|
- **`daily_rate` over the actual active period** — The daily consumption rate was using `first_in → now` as the window, diluting the rate with periods when the product was already exhausted (e.g. garlic exhausted at day 34 was calculated over 60+ days). Now uses `first_in → last_activity` (last purchase or last use), giving more accurate reorder predictions.
|
||||||
- **Anomaly dismiss key stabile** — La chiave di dismiss usava `product_id + round(expected)` che cambiava ad ogni nuova transazione, causando la ricomparsa delle anomalie già chiuse. Ora usa `product_id + direction` (phantom/missing/untracked) — stabile finché la direzione non cambia.
|
- **Stable anomaly dismiss key** — The dismiss key was using `product_id + round(expected)`, which changed with every new transaction, causing already-dismissed anomalies to reappear. Now uses `product_id + direction` (phantom/missing/untracked) — stable as long as the direction does not change.
|
||||||
- **Smart shopping: prodotti esauriti < 14 giorni** — Prodotti terminati negli ultimi 14 giorni non vengono più soppressi dal check token-coverage o shopping_name-family: se li hai appena finiti, è probabile tu voglia ricomprarli indipendentemente dalla presenza di equivalenti in stock.
|
- **Smart shopping: products exhausted < 14 days ago** — Products finished within the last 14 days are no longer suppressed by the token-coverage check or the shopping_name family check: if you just ran out, you probably want to restock regardless of equivalent stock on hand.
|
||||||
- **Chat pruning** — `chatSave()` ora esegue `DELETE` dei messaggi oltre i 200 più recenti dopo ogni salvataggio, evitando crescita illimitata della tabella `chat_messages`.
|
- **Chat pruning** — `chatSave()` now deletes messages beyond the 200 most recent after each save, preventing unbounded growth of the `chat_messages` table.
|
||||||
- **`getStats()` query consolidate** — Le 5 query separate (COUNT products, SUM inventory, COUNT locations, COUNT recent_in, COUNT recent_out) sono ora una sola query con subselect, riducendo i round-trip SQLite da 5 a 1.
|
|
||||||
- **Bring! cleanup rate-limiting** — Aggiunto `usleep(300ms)` tra le rimozioni multiple per evitare di sovraccaricare l'API Bring! in burst.
|
|
||||||
- **Indici compositi su `transactions`** — Aggiunti `idx_transactions_type_date(type, created_at)` (per `getStats`) e `idx_transactions_pid_type_undone(product_id, type, undone)` (per `smartShopping`), con migration automatica per DB esistenti.
|
|
||||||
|
|
||||||
### Security
|
|
||||||
- **CSRF protection** — Le action di scrittura (inventory_add, bring_add, product_save, ecc.) richiedono ora `X-EverShelf-Request: 1` oppure `Content-Type: application/json`. Il frontend `api()` invia sempre il header su POST. Questo previene attacchi CSRF cross-site tramite form HTML.
|
|
||||||
|
|
||||||
## [1.7.5] - 2026-05-10
|
## [1.7.5] - 2026-05-10
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer at **evershelfproject@gmail.com**. All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM php:8.2-apache
|
FROM php:8.2-apache-bookworm
|
||||||
|
|
||||||
# Install required PHP extensions + Tesseract OCR for offline expiry date reading
|
# Install required PHP extensions + Tesseract OCR for offline expiry date reading
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
libonig-dev \
|
libonig-dev \
|
||||||
|
|||||||
@@ -25,54 +25,17 @@
|
|||||||
[](https://www.sqlite.org/)
|
[](https://www.sqlite.org/)
|
||||||
[](Dockerfile)
|
[](Dockerfile)
|
||||||
[](translations/)
|
[](translations/)
|
||||||
[](CHANGELOG.md)
|
[](CHANGELOG.md)
|
||||||
|
[](https://github.com/dadaloop82/EverShelf/stargazers)
|
||||||
|
[](https://github.com/dadaloop82/EverShelf/commits/main)
|
||||||
|
[](https://github.com/dadaloop82/EverShelf/graphs/contributors)
|
||||||
|
[](https://github.com/dadaloop82/EverShelf/discussions)
|
||||||
|
[](https://github.com/dadaloop82/EverShelf/actions/workflows/ci.yml)
|
||||||
|
|
||||||
|
[](https://ko-fi.com/J3J01ZNETZ)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🌍 Recent Updates (v1.7.12)
|
|
||||||
|
|
||||||
- **Banner aperto con indicazione posizione** — Nella sezione "Usa prima" il testo ora mostra "Quella nel frigo, aperta da X giorni" invece di una data di scadenza calcolata che poteva risultare confusa.
|
|
||||||
- **Ricette: quantità in pezzi per prodotti pz** — Il prompt AI e la post-elaborazione PHP ora istruiscono Gemini a esprimere `qty_number` come pezzi interi (non grammi) per i prodotti con unità `pz` (es. Pan bauletto, fette biscottate). Il fallback PHP non divide più per 100 quando `default_quantity = 0`.
|
|
||||||
- **Fix: "Usa TUTTO" nelle ricette non elimina più la riga** — Il pulsante "Usa TUTTO / Finito" nella modal di utilizzo ricette inviava `use_all: true` che causava un `DELETE` immediato senza conferma. Ora calcola la quantità esatta dagli item disponibili e fa un normale `inventory_use`.
|
|
||||||
|
|
||||||
- **Scan page redesign** — La pagina di scansione è stata completamente ridisegnata: **2× zoom fisso** (hardware o CSS), **torcia** con feedback visivo, **flip fotocamera** (front/back), **3 tab input** (Barcode / Nome / AI), **prodotti recenti** (ultimi 6 in localStorage), **live code overlay** durante la scansione parziale, **confirm overlay** al successo, **angoli guida** nel viewport.
|
|
||||||
- **AI Number OCR** — Dopo 4 secondi senza scansione compare il bottone "Leggi numeri con AI": Gemini analizza il frame video e restituisce le cifre del barcode anche quando lo scanner ottico non riesce a leggerlo.
|
|
||||||
- **Fix falsi positivi anomalie** — Rimossa la direzione `untracked` dal rilevatore di anomalie; le predizioni di consumo richiedono ora min 5 transazioni e 7 giorni di storico.
|
|
||||||
- **Fix menu suggerimenti scan** — Rimosso il datalist dal campo Nome nella pagina scansione (non più aperto su tablet).
|
|
||||||
- **Fix falsi positivi anomalie consumo** — `getConsumptionPredictions` richiedeva solo 3 transazioni, potendo generare rate esplose su dati ravvicinati. Ora: min 5 txn, min 7gg span, skip se consumo predetto < 15% baseline.
|
|
||||||
|
|
||||||
- **Banner "Imposta scadenza" ora funziona** — Il pulsante sul banner "nessuna scadenza" apriva una funzione inesistente. Corretto, ora apre correttamente la modal di modifica.
|
|
||||||
- **Banner aperto vs scaduto** — I prodotti con `opened_at` mostrano "Aperto da N giorni in [posizione]" invece di "Scaduto!", con la posizione (frigo/dispensa/freezer) esplicitamente indicata.
|
|
||||||
- **Shelf life latte UHT** — Il latte generico è ora trattato come UHT (7 giorni dopo apertura) invece che fresco (4 giorni).
|
|
||||||
- **Niente più false anomalie di consumo** — Il rilevatore ora ignora i casi in cui `expected = 0` (prodotto probabilmente ricomprato) e alza la soglia "more than expected" al 400%. Le notifiche rimangono solo per consumi significativamente inferiori al previsto.
|
|
||||||
- **Scaduti nascondono prodotti già buttati** — La sezione scaduti ora filtra correttamente i prodotti con `quantity = 0`.
|
|
||||||
- **Docker: fix permessi DB al primo avvio** — `_ensureDataDir()` crea la directory `data/` se mancante e tenta `chmod(0775)` se non scrivibile, risolvendo `SQLSTATE[HY000][14]` su volumi Docker freschi.
|
|
||||||
- **AI price estimation for shopping list** — Each Bring! shopping item now shows an estimated retail price badge (unit price + total). Prices are fetched via Gemini AI, cached server-side for 3 months, and stored client-side in `sessionStorage` to survive navigation. The dashboard shopping stat card shows a live green `ca. €X.XX` badge that updates in real-time as prices are calculated — even in background when you're on another tab.
|
|
||||||
- **Kiosk v1.7.0: OTA update system** — "Cerca aggiornamenti" button in Settings triggers a forced GitHub release check; new `installUpdate()` JS bridge calls Android `DownloadManager` directly (lockTask mode blocks external browser links); graceful degradation for older APKs with manual instructions. Automatic OTA check every 6 hours with native update banner.
|
|
||||||
- **Kiosk: consistent APK signing** — Project keystore (`evershelf.jks`) committed to the repo; every build — local or CI — now produces an APK with the same signature, eliminating "APK incompatible / signature conflict" errors on OTA update.
|
|
||||||
- **GitHub Actions: auto-publish kiosk APK** — On every push to `main` that touches `evershelf-kiosk/`, Actions builds the APK and publishes a versioned semver release (`kiosk-X.Y.Z`) plus updates the `kiosk-latest` alias. No more manual release uploads.
|
|
||||||
- **Fix: false "update available" on launch** — `checkForUpdates` now requires a strictly-greater semver tag to flag an update. Non-semver tags (e.g. `kiosk-latest`) no longer trigger a false positive immediately after a fresh install.
|
|
||||||
- **Kiosk: live scale diagnostic panel** — When connected, Settings shows device name, battery %, real-time weight, protocol and reconnection status without leaving the settings page.
|
|
||||||
- **Kiosk: scale dot visible on header** — Connected-state dot changed from green-on-green to white fill + green glow, clearly visible on any background.
|
|
||||||
- **Kiosk: reconfigure BLE scale** — New "Riconfigura bilancia BLE" button in Settings; shows amber notice with download link if the installed APK predates the `reconfigureScale()` bridge method.
|
|
||||||
- **Nutrition analysis dashboard** — Category distribution pie chart (3D conic-gradient), health/variety/freshness score bars, alternates with the anti-waste section hourly.
|
|
||||||
- **Screensaver nutrition panel** — Animated 3D pie + donut ring scores rotate with fact cards every 5 minutes in the screensaver overlay.
|
|
||||||
- **Automatic error reporting** — Unhandled JS errors, Android crashes and PHP exceptions are silently posted to `api/?action=report_error`; the server deduplicates by fingerprint and creates or comments on a GitHub Issue automatically. Crash details are persisted to `SharedPreferences` so even errors that prevent network I/O are sent on the next launch.
|
|
||||||
- **Demo mode (JS)** — Full frontend demo with mock pantry data, Gemini enabled, Bring! writes silently no-op'd; accessible via `?demo=1` or `.env` `DEMO_MODE=true`.
|
|
||||||
- **Graceful Bring! no-key state** — When Bring! credentials are not configured, the shopping tab shows a friendly message with a direct link to Settings instead of a raw error.
|
|
||||||
- **Use-quantity guard** — Consuming more than the stocked quantity at a given location is now blocked client-side with a shake animation on the quantity field.
|
|
||||||
- **Kiosk v1.6.0: BLE scale gateway integrated** — The standalone Scale Gateway app is no longer needed. BLE scanning, GATT connection and the WebSocket server (`:8765`) now run as a built-in `GatewayService` foreground service inside the kiosk app. Setup step 4 shows a live BLE device scan — users select their scale directly, no external APK install required. The external gateway app is deprecated.
|
|
||||||
- **Kiosk setup wizard overhaul** — Auto-discovery rewritten with `ExecutorCompletionService` + `NetworkInterface` (no deprecated `WifiManager`), 60 parallel TCP pre-checks, real-time UI feedback, ports 80/443/8080/8443, correct LAN subnet detection (VPN/cellular interfaces filtered, `wlan`/`eth` prioritised).
|
|
||||||
- **Kiosk permissions flow** — Grant button transforms into a green "✅ Permessi concessi — Continua →" button after permissions are granted instead of just showing a card.
|
|
||||||
- **3 new AI features (Gemini)** — Storage/shelf-life hint shown inline in the add form; AI-enriched shopping suggestions with a short practical tip per item; plain-language anomaly explanation via a "🤖 Spiega" button on anomaly banners.
|
|
||||||
- **Security hardening** — `get_settings` no longer exposes API keys in plain text (boolean flags only); `save_settings` protected by optional `SETTINGS_TOKEN` (validated with `hash_equals`); native `DEMO_MODE` in `.env` blocks all write operations at the PHP router level before any other guard.
|
|
||||||
- **Real-time webapp update detection** — An inline header pill appears when a newer release is on GitHub (checked on load + every 30 min); no intrusive full-page banners.
|
|
||||||
- **Gemini availability flag** — All AI entry points check `_geminiAvailable` before firing; the header button shows a visual no-AI state (greyed + amber dot) when no key is configured.
|
|
||||||
- **Dashboard skeleton loading** — Stat cards show an animated shimmer while data loads instead of a jarring `0` flash for 3–5 seconds.
|
|
||||||
- **APK self-update with conflict recovery** — Both Kiosk and Scale Gateway use the `PackageInstaller` session API for OTA installs; a signature conflict now shows a dialog to uninstall the old version instead of a cryptic failure.
|
|
||||||
- **Smarter low-quantity alerts** — The "suspiciously low quantity" banner is no longer raised for a partially-used entry when the same product has stock in another location.
|
|
||||||
- **Non-alarmist expired banner** — Adapts icon, colour, and title to the actual safety level: green ✅ for long-life products still safe, amber 👀 for items to check, red 🚫 only for genuinely dangerous items.
|
|
||||||
|
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
### 📦 Inventory Management
|
### 📦 Inventory Management
|
||||||
@@ -82,7 +45,7 @@
|
|||||||
- **Expiry tracking** — Automatic shelf-life estimation based on product type and storage
|
- **Expiry tracking** — Automatic shelf-life estimation based on product type and storage
|
||||||
- **Opened product tracking** — Reduced shelf-life calculation when packages are opened; opened-product expiry is now also checked when building banner alerts (not just the dashboard section)
|
- **Opened product tracking** — Reduced shelf-life calculation when packages are opened; opened-product expiry is now also checked when building banner alerts (not just the dashboard section)
|
||||||
- **Vacuum-sealed support** — Extended expiry dates for vacuum-sealed items
|
- **Vacuum-sealed support** — Extended expiry dates for vacuum-sealed items
|
||||||
- **Anomaly detection** — Banner alerts for suspicious quantities and consumption predictions with inline correction; dismiss button now shows the current inventory quantity so the action is unambiguous ("La quantità è giusta (2 pz)")
|
- **Anomaly detection** — Banner alerts for suspicious quantities and consumption predictions with inline correction; dismiss button now shows the current inventory quantity so the action is unambiguous ("Quantity is correct (2 pcs)")
|
||||||
|
|
||||||
### 🤖 AI-Powered (Google Gemini)
|
### 🤖 AI-Powered (Google Gemini)
|
||||||
- **Expiry date reading** — Photograph a label and extract the expiry date automatically
|
- **Expiry date reading** — Photograph a label and extract the expiry date automatically
|
||||||
@@ -92,13 +55,13 @@
|
|||||||
- **Recipe generation** — Get personalized recipes based on what's in your pantry; streams live via Server-Sent Events so results appear as they are generated
|
- **Recipe generation** — Get personalized recipes based on what's in your pantry; streams live via Server-Sent Events so results appear as they are generated
|
||||||
- **Smart chat assistant** — Ask questions about your inventory, get cooking tips
|
- **Smart chat assistant** — Ask questions about your inventory, get cooking tips
|
||||||
- **Shopping suggestions with tips** — AI-powered purchase recommendations, each enriched with a short practical buying/storing tip
|
- **Shopping suggestions with tips** — AI-powered purchase recommendations, each enriched with a short practical buying/storing tip
|
||||||
- **Anomaly explanation** — "🤖 Spiega" button on anomaly banners explains in plain language why a discrepancy likely occurred and what to do
|
- **Anomaly explanation** — "Explain" button on anomaly banners explains in plain language why a discrepancy likely occurred and what to do
|
||||||
- **Model fallback** — All AI endpoints try `gemini-2.5-flash` first and fall back to `gemini-2.0-flash` automatically
|
- **Model fallback** — All AI endpoints try `gemini-2.5-flash` first and fall back to `gemini-2.0-flash` automatically
|
||||||
- **Graceful no-key state** — When no Gemini key is configured, AI entry points show a friendly message; the header button is visually greyed with an amber dot
|
- **Graceful no-key state** — When no Gemini key is configured, AI entry points show a friendly message; the header button is visually greyed with an amber dot
|
||||||
|
|
||||||
### 🛒 Shopping List
|
### 🛒 Shopping List
|
||||||
- **Bring! integration** — Sync with the [Bring!](https://www.getbring.com/) shopping list app
|
- **Bring! integration** — Sync with the [Bring!](https://www.getbring.com/) shopping list app
|
||||||
- **Generic shopping names** — Products are grouped by type ("Latte", "Affettato", "Panna da cucina") rather than brand, keeping the Bring! list clean and consolidated
|
- **Generic shopping names** — Products are grouped by type (e.g. "Milk", "Cold cuts", "Cooking cream") rather than brand, keeping the Bring! list clean and consolidated
|
||||||
- **Smart predictions** — Know what you'll need before you run out
|
- **Smart predictions** — Know what you'll need before you run out
|
||||||
- **Auto-add on depletion** — When a product reaches zero the app adds it to Bring! automatically, no confirmation needed
|
- **Auto-add on depletion** — When a product reaches zero the app adds it to Bring! automatically, no confirmation needed
|
||||||
- **Auto-remove on scan** — Products are removed from the shopping list when scanned in - **Auto-migration** — Items already on the Bring! list are silently renamed to their generic name in the background (throttled, runs on list load)
|
- **Auto-remove on scan** — Products are removed from the shopping list when scanned in - **Auto-migration** — Items already on the Bring! list are silently renamed to their generic name in the background (throttled, runs on list load)
|
||||||
@@ -109,7 +72,7 @@
|
|||||||
- **Text-to-Speech** — Voice readout of recipe steps; supports browser Web Speech API, native Android TTS (kiosk), or a custom REST endpoint (Home Assistant, etc.); retries voice loading for up to 10 seconds with a fallback refresh button; TTS activates automatically without requiring the global TTS setting to be enabled
|
- **Text-to-Speech** — Voice readout of recipe steps; supports browser Web Speech API, native Android TTS (kiosk), or a custom REST endpoint (Home Assistant, etc.); retries voice loading for up to 10 seconds with a fallback refresh button; TTS activates automatically without requiring the global TTS setting to be enabled
|
||||||
- **Auto-read on navigate** — Each step is read aloud automatically when you tap Next or Previous; the first step is read when entering cooking mode
|
- **Auto-read on navigate** — Each step is read aloud automatically when you tap Next or Previous; the first step is read when entering cooking mode
|
||||||
- **Timer voice alerts** — 10-second countdown warning spoken aloud before each timer expires; expiry announced vocally when time is up
|
- **Timer voice alerts** — 10-second countdown warning spoken aloud before each timer expires; expiry announced vocally when time is up
|
||||||
- **Recipe completion** — "Buon appetito!" spoken when the last step is confirmed
|
- **Recipe completion** — "Bon appétit!" announced via TTS when the last step is confirmed
|
||||||
- **Built-in timer** — Automatic timer suggestions based on recipe instructions
|
- **Built-in timer** — Automatic timer suggestions based on recipe instructions
|
||||||
- **Ingredient tracking** — Mark ingredients as used during cooking; leftover quantities prompt a "move to another location" flow
|
- **Ingredient tracking** — Mark ingredients as used during cooking; leftover quantities prompt a "move to another location" flow
|
||||||
|
|
||||||
@@ -119,7 +82,7 @@
|
|||||||
- **Expiry alerts** — Visual warnings for expired and soon-to-expire items
|
- **Expiry alerts** — Visual warnings for expired and soon-to-expire items
|
||||||
- **Opened products panel** — Tracks partially-used items; expiry is recalculated from the opening date using AI (Gemini) + per-category rule fallback; whole sealed packages always keep their original manufacturer expiry; conf items with mixed whole + fractional units are shown as two separate entries
|
- **Opened products panel** — Tracks partially-used items; expiry is recalculated from the opening date using AI (Gemini) + per-category rule fallback; whole sealed packages always keep their original manufacturer expiry; conf items with mixed whole + fractional units are shown as two separate entries
|
||||||
- **Freezer shelf-life** — Granular per-product estimates (USDA/EFSA): fish 120 d, poultry 270 d, whole red-meat cuts 365 d, mince 120 d, vegetables/fruit 270 d, generic 180 d; AI + cache still take priority over rules
|
- **Freezer shelf-life** — Granular per-product estimates (USDA/EFSA): fish 120 d, poultry 270 d, whole red-meat cuts 365 d, mince 120 d, vegetables/fruit 270 d, generic 180 d; AI + cache still take priority over rules
|
||||||
- **Safety ratings** — Smart assessment of expired product safety (by category and location); expired unsafe items shown with a red danger banner and "L'ho buttato" as the primary action
|
- **Safety ratings** — Smart assessment of expired product safety (by category and location); expired unsafe items shown with a red danger banner and a discard action as the primary action
|
||||||
- **Expired product banner** — Products that have passed their effective shelf-life (including opened-product reduced expiry) appear in the top notification banner; icon, colour and title adapt to the actual safety level (✅ green for safe, 👀 amber to check, 🚫 red for danger); high-risk items get a prominent discard action
|
- **Expired product banner** — Products that have passed their effective shelf-life (including opened-product reduced expiry) appear in the top notification banner; icon, colour and title adapt to the actual safety level (✅ green for safe, 👀 amber to check, 🚫 red for danger); high-risk items get a prominent discard action
|
||||||
- **Quick recipe bar** — One-tap recipe suggestion using expiring products
|
- **Quick recipe bar** — One-tap recipe suggestion using expiring products
|
||||||
- **Anomaly banner** — Scrollable banner with suspicious quantities and consumption prediction mismatches, with one-tap correction or inline edit
|
- **Anomaly banner** — Scrollable banner with suspicious quantities and consumption prediction mismatches, with one-tap correction or inline edit
|
||||||
@@ -141,7 +104,7 @@
|
|||||||
- **Stability + auto-confirm** — 10s stable wait + 5s countdown before confirming
|
- **Stability + auto-confirm** — 10s stable wait + 5s countdown before confirming
|
||||||
- **Real-time status** — Scale connection indicator always visible in the header
|
- **Real-time status** — Scale connection indicator always visible in the header
|
||||||
- **Multi-protocol** — Supports Bluetooth SIG Weight Scale, Body Composition, Xiaomi Mi Scale 2 and 100+ models
|
- **Multi-protocol** — Supports Bluetooth SIG Weight Scale, Body Composition, Xiaomi Mi Scale 2 and 100+ models
|
||||||
- **Built into kiosk (v1.6.0+)** — BLE gateway runs as an integrated foreground service inside the [EverShelf Kiosk](evershelf-kiosk/) app; no separate APK needed. The standalone gateway app in [`evershelf-scale-gateway/`](evershelf-scale-gateway/) is deprecated but kept for non-kiosk use cases.
|
- **Built into kiosk (v1.6.0+)** — BLE gateway runs as an integrated foreground service inside the [EverShelf Kiosk](evershelf-kiosk/) app; no separate APK needed.
|
||||||
|
|
||||||
### 📺 Android Kiosk Mode (Add-on)
|
### 📺 Android Kiosk Mode (Add-on)
|
||||||
- **Dedicated tablet app** — Full-screen WebView wrapper for wall-mounted kitchen tablets
|
- **Dedicated tablet app** — Full-screen WebView wrapper for wall-mounted kitchen tablets
|
||||||
@@ -389,35 +352,7 @@ The application uses no build tools — edit files directly and refresh.
|
|||||||
|
|
||||||
## 📋 Roadmap
|
## 📋 Roadmap
|
||||||
|
|
||||||
- [x] Multi-language support (i18n) — 3 languages (it/en/de), 347 keys
|
Feature requests, bug reports and planned work are tracked in the [**EverShelf Roadmap**](https://github.com/users/dadaloop82/projects/2) GitHub Project.
|
||||||
- [ ] User authentication / multi-user support
|
|
||||||
- [x] Docker container for easy deployment — see [Dockerfile](Dockerfile) + [docker-compose.yml](docker-compose.yml)
|
|
||||||
- [x] REST API documentation (OpenAPI/Swagger) — see [docs/openapi.yaml](docs/openapi.yaml)
|
|
||||||
- [x] First-run setup wizard — 4-step guided configuration
|
|
||||||
- [x] API rate limiting — file-based, 3 tiers (120/15/5 req/min)
|
|
||||||
- [x] CI/CD pipeline — GitHub Actions (lint, Docker build, translation validation)
|
|
||||||
- [x] Android kiosk mode — dedicated tablet app with screen pinning
|
|
||||||
- [x] Anomaly detection banner — suspicious quantities + consumption predictions
|
|
||||||
- [x] AI scan local matching — suggest existing pantry products before OFF lookup
|
|
||||||
- [x] Scale auto-fill improvements — 10g threshold, ml conversion hints
|
|
||||||
- [x] Update notification system — inline header pill (webapp) + kiosk checks GitHub releases
|
|
||||||
- [x] Kiosk OTA update — forced check button, `installUpdate()` bridge, graceful old-APK fallback
|
|
||||||
- [x] Kiosk consistent APK signing — project keystore eliminates signature conflicts on OTA
|
|
||||||
- [x] GitHub Actions kiosk CI — auto-builds and publishes versioned semver APK on every push to main
|
|
||||||
- [x] Kiosk live scale diagnostics — device, battery, real-time weight in Settings when connected
|
|
||||||
- [x] Nutrition analysis dashboard — category pie + health/variety/freshness scores, alternates with waste section
|
|
||||||
- [x] Screensaver nutrition panel — animated pie + donut ring scores rotate with facts
|
|
||||||
- [x] Automatic error reporting — JS/Android/PHP errors → GitHub Issues with deduplication
|
|
||||||
- [x] Generic shopping name grouping — compound-phrase + keyword map (100+ entries) + Gemini AI fallback
|
|
||||||
- [x] Auto-add to Bring! on product depletion — no confirmation step when stock reaches zero
|
|
||||||
- [x] Native Android TTS in kiosk — bypasses Web Speech API voice detection issues
|
|
||||||
- [x] AI product storage hint — background Gemini call suggests location + shelf-life in the add form
|
|
||||||
- [x] AI shopping tips enrichment — each suggestion enriched with a short practical tip
|
|
||||||
- [x] AI anomaly explanation — "🤖 Spiega" button explains discrepancies in plain language
|
|
||||||
- [x] Security hardening — no raw key exposure, SETTINGS_TOKEN auth, DEMO_MODE native blocking
|
|
||||||
- [ ] Offline mode with service worker
|
|
||||||
- [ ] Export/import inventory data
|
|
||||||
- [ ] Notification system (Telegram, email) for expiring products
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -464,11 +399,12 @@ This project is licensed under the **MIT License** — see the [LICENSE](LICENSE
|
|||||||
|
|
||||||
## 📸 Screenshots
|
## 📸 Screenshots
|
||||||
|
|
||||||
| | | |
|
<div align="center">
|
||||||
|:---:|:---:|:---:|
|
|
||||||
|  |  |  |
|

|
||||||
| **Dashboard** — Inventory overview with counters by location (pantry, fridge, freezer), upcoming expiry alerts, and consumed vs. wasted tracking over the last 30 days. | **Inventory** — Full product list filterable by location (All / Pantry / Fridge / Freezer) and searchable by name, with category, quantity, and expiry date. | **Barcode Scanner** — Scan barcodes with the camera (QuaggaJS) or enter manually. Shopping mode lets you register purchased products in quick sequence. |
|
|
||||||
|  |  |  |
|
</div>
|
||||||
| **AI Recipe Detail** — Recipe generated by Gemini AI using expiring ingredients: each ingredient is matched to the real inventory with quantity and location, ready to scale. | **Recipes** — History of AI-generated recipes, organized by day and meal (lunch / dinner / other), with preparation and cooking time. | **Cooking Mode** — Fullscreen step-by-step guide with Text-to-Speech. Each step shows the ingredient to use from your pantry with an integrated "Use" button. |
|
|
||||||
|  |  |  |
|
For a live walkthrough with real data and full AI enabled, visit the **[live demo](https://evershelfproject.dadaloop.it/demo)** — no installation required.
|
||||||
| **Gemini Chat** — AI assistant that knows your pantry, your appliances, and your preferences. Suggests snacks, smoothies, or quick meals with a single tap. | **Shopping List** — List synced with Bring!, organized by product category, with urgency indicators and links to search for prices online. | **Smart Predictions** — AI analysis of historical consumption: shows what is running low, how much time is left, and why restocking is recommended (regular use, nearly empty, opened). |
|
|
||||||
|
> Want to contribute additional screenshots? See [CONTRIBUTING.md](CONTRIBUTING.md) — PRs welcome!
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Only the latest released version of EverShelf receives security fixes.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
|---------|-----------|
|
||||||
|
| Latest (1.7.x) | ✅ |
|
||||||
|
| Older releases | ❌ |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
**Please do NOT open a public GitHub issue for security vulnerabilities.**
|
||||||
|
|
||||||
|
Report security issues privately via email:
|
||||||
|
|
||||||
|
**📧 evershelfproject@gmail.com**
|
||||||
|
|
||||||
|
Include:
|
||||||
|
- A description of the vulnerability
|
||||||
|
- Steps to reproduce
|
||||||
|
- Potential impact
|
||||||
|
- Your GitHub username (optional — for credit)
|
||||||
|
|
||||||
|
I aim to acknowledge reports within **48 hours** and release a fix within **7 days** for critical issues.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
EverShelf is a **self-hosted** application. The security model assumes:
|
||||||
|
|
||||||
|
- It runs on a trusted private network (home LAN)
|
||||||
|
- Access from the internet requires the user to set up their own authentication layer (e.g. reverse proxy with Authelia, Nginx `auth_basic`)
|
||||||
|
|
||||||
|
Out-of-scope issues:
|
||||||
|
- Vulnerabilities that require physical access to the server
|
||||||
|
- Issues only affecting users who have not followed the security recommendations in the README
|
||||||
|
- Denial-of-service attacks on the demo server
|
||||||
|
|
||||||
|
## Security Features
|
||||||
|
|
||||||
|
- API keys stored server-side in `.env`, never sent to the browser
|
||||||
|
- `get_settings` returns only boolean flags (`gemini_key_set`), never raw key values
|
||||||
|
- Optional `SETTINGS_TOKEN` protects write operations (`hash_equals` to prevent timing attacks)
|
||||||
|
- `DEMO_MODE=true` blocks all write operations at the router level
|
||||||
|
- Parameterized SQL queries (PDO prepared statements) throughout
|
||||||
|
- Input validation and length limits on all user-supplied fields
|
||||||
|
- `.env` and `data/` directories denied via web server config (see README)
|
||||||
@@ -95,6 +95,7 @@ function initializeDB(PDO $db): void {
|
|||||||
quantity REAL NOT NULL,
|
quantity REAL NOT NULL,
|
||||||
location TEXT NOT NULL DEFAULT 'dispensa',
|
location TEXT NOT NULL DEFAULT 'dispensa',
|
||||||
notes TEXT DEFAULT '',
|
notes TEXT DEFAULT '',
|
||||||
|
undone INTEGER DEFAULT 0,
|
||||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE
|
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
@@ -117,10 +118,12 @@ function migrateDB(PDO $db): void {
|
|||||||
$cols = $db->query("PRAGMA table_info(products)")->fetchAll();
|
$cols = $db->query("PRAGMA table_info(products)")->fetchAll();
|
||||||
$colNames = array_column($cols, 'name');
|
$colNames = array_column($cols, 'name');
|
||||||
if (!in_array('package_unit', $colNames)) {
|
if (!in_array('package_unit', $colNames)) {
|
||||||
$db->exec("ALTER TABLE products ADD COLUMN package_unit TEXT DEFAULT ''");
|
try { $db->exec("ALTER TABLE products ADD COLUMN package_unit TEXT DEFAULT ''"); }
|
||||||
|
catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; }
|
||||||
}
|
}
|
||||||
if (!in_array('shopping_name', $colNames)) {
|
if (!in_array('shopping_name', $colNames)) {
|
||||||
$db->exec("ALTER TABLE products ADD COLUMN shopping_name TEXT DEFAULT ''");
|
try { $db->exec("ALTER TABLE products ADD COLUMN shopping_name TEXT DEFAULT ''"); }
|
||||||
|
catch (PDOException $e) { if (strpos($e->getMessage(), 'duplicate column') === false) throw $e; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate transactions CHECK constraint to allow 'waste' type
|
// Migrate transactions CHECK constraint to allow 'waste' type
|
||||||
@@ -135,11 +138,14 @@ function migrateDB(PDO $db): void {
|
|||||||
quantity REAL NOT NULL,
|
quantity REAL NOT NULL,
|
||||||
location TEXT NOT NULL DEFAULT 'dispensa',
|
location TEXT NOT NULL DEFAULT 'dispensa',
|
||||||
notes TEXT DEFAULT '',
|
notes TEXT DEFAULT '',
|
||||||
|
undone INTEGER DEFAULT 0,
|
||||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE
|
FOREIGN KEY (product_id) REFERENCES products(id) ON DELETE CASCADE
|
||||||
)
|
)
|
||||||
");
|
");
|
||||||
$db->exec("INSERT INTO transactions SELECT * FROM transactions_old");
|
// Insert with explicit columns: transactions_old may lack 'undone' (pre-v1.7.x DB)
|
||||||
|
$db->exec("INSERT INTO transactions (id, product_id, type, quantity, location, notes, created_at)
|
||||||
|
SELECT id, product_id, type, quantity, location, notes, created_at FROM transactions_old");
|
||||||
$db->exec("DROP TABLE transactions_old");
|
$db->exec("DROP TABLE transactions_old");
|
||||||
$db->exec("CREATE INDEX IF NOT EXISTS idx_transactions_product ON transactions(product_id)");
|
$db->exec("CREATE INDEX IF NOT EXISTS idx_transactions_product ON transactions(product_id)");
|
||||||
$db->exec("CREATE INDEX IF NOT EXISTS idx_transactions_date ON transactions(created_at)");
|
$db->exec("CREATE INDEX IF NOT EXISTS idx_transactions_date ON transactions(created_at)");
|
||||||
@@ -357,6 +363,10 @@ function estimateOpenedExpiryDaysPHP(string $name, string $category, string $loc
|
|||||||
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 2;
|
if (preg_match('/\b(yogurt|yaourt|yoghurt)\b/', $n)) return 2;
|
||||||
if (preg_match('/\blatte\b/', $n)) return 1;
|
if (preg_match('/\blatte\b/', $n)) return 1;
|
||||||
if (preg_match('/\bformaggio\b/', $n)) return 2;
|
if (preg_match('/\bformaggio\b/', $n)) return 2;
|
||||||
|
// Root vegetables / tubers in pantry: sfusi in un sacchetto, durano 3-5 settimane
|
||||||
|
if (preg_match('/\b(patata|patate|tubero)\b/', $n)) return 30;
|
||||||
|
if (preg_match('/\b(cipolla|cipolle|aglio|scalogno|porro)\b/', $n)) return 30;
|
||||||
|
if (preg_match('/\b(carota|carote)\b/', $n)) return 14;
|
||||||
return 60; // generic pantry fallback
|
return 60; // generic pantry fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +416,7 @@ function estimateOpenedExpiryDaysPHP(string $name, string $category, string $loc
|
|||||||
if (preg_match('/\b(senape|mustard)\b/', $n)) return 90;
|
if (preg_match('/\b(senape|mustard)\b/', $n)) return 90;
|
||||||
if (preg_match('/salsa\s+di\s+soia|soy\s*sauce/', $n)) return 90;
|
if (preg_match('/salsa\s+di\s+soia|soy\s*sauce/', $n)) return 90;
|
||||||
if (preg_match('/\b(tabasco|worcestershire|sriracha)\b/', $n)) return 180;
|
if (preg_match('/\b(tabasco|worcestershire|sriracha)\b/', $n)) return 180;
|
||||||
if (preg_match('/confettura|marmellata/', $n)) return 60;
|
if (preg_match('/confettura|marmellata/', $n)) return 180;
|
||||||
if (preg_match('/nutella|cioccolat/', $n)) return 60;
|
if (preg_match('/nutella|cioccolat/', $n)) return 60;
|
||||||
|
|
||||||
// ── H: Category fallbacks ────────────────────────────────────────────
|
// ── H: Category fallbacks ────────────────────────────────────────────
|
||||||
@@ -464,7 +474,7 @@ function estimateSealedExpiryDaysPHP(string $name, string $category, string $loc
|
|||||||
elseif (preg_match('/carota|carote|zucchina|zucchine|peperoni|melanzane/', $n)) $days = 7;
|
elseif (preg_match('/carota|carote|zucchina|zucchine|peperoni|melanzane/', $n)) $days = 7;
|
||||||
elseif (preg_match('/broccoli|cavolfiore|cavolo|spinaci|bietola/', $n)) $days = 5;
|
elseif (preg_match('/broccoli|cavolfiore|cavolo|spinaci|bietola/', $n)) $days = 5;
|
||||||
elseif (preg_match('/cipolla|cipolle/', $n)) $days = 10;
|
elseif (preg_match('/cipolla|cipolle/', $n)) $days = 10;
|
||||||
elseif (preg_match('/patata|patate/', $n)) $days = 14;
|
elseif (preg_match('/patata|patate/', $n)) $days = 30; // whole tubers in a bag, pantry: 3-5 weeks
|
||||||
elseif (preg_match('/biscott|cracker|grissini|fette\s+biscott/', $n)) $days = 180;
|
elseif (preg_match('/biscott|cracker|grissini|fette\s+biscott/', $n)) $days = 180;
|
||||||
elseif (preg_match('/nutella|marmellata|miele/', $n)) $days = 365;
|
elseif (preg_match('/nutella|marmellata|miele/', $n)) $days = 365;
|
||||||
elseif (preg_match('/passata|pelati|pomodor/', $n)) $days = 730;
|
elseif (preg_match('/passata|pelati|pomodor/', $n)) $days = 730;
|
||||||
|
|||||||
@@ -438,6 +438,10 @@ try {
|
|||||||
reportError();
|
reportError();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'report_bug':
|
||||||
|
reportBugManual();
|
||||||
|
break;
|
||||||
|
|
||||||
case 'check_update':
|
case 'check_update':
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
break;
|
break;
|
||||||
@@ -2132,9 +2136,9 @@ function getConsumptionPredictions(PDO $db): void {
|
|||||||
$daySpan = ($lastDate - $firstDate) / 86400;
|
$daySpan = ($lastDate - $firstDate) / 86400;
|
||||||
// If all transactions are clustered within a week, the rate is unreliable
|
// If all transactions are clustered within a week, the rate is unreliable
|
||||||
if ($daySpan < 7) continue;
|
if ($daySpan < 7) continue;
|
||||||
$dailyRate = $totalUsed / $daySpan;
|
$historicalRate = $totalUsed / $daySpan;
|
||||||
|
|
||||||
if ($dailyRate < 0.01) continue; // negligible consumption
|
if ($historicalRate < 0.01) continue; // negligible consumption
|
||||||
|
|
||||||
// Get the most recent restock (last 'in' transaction)
|
// Get the most recent restock (last 'in' transaction)
|
||||||
$lastIn = $db->prepare("
|
$lastIn = $db->prepare("
|
||||||
@@ -2166,16 +2170,35 @@ function getConsumptionPredictions(PDO $db): void {
|
|||||||
$baselineQty = floatval($item['quantity']) + $usedSinceRestock;
|
$baselineQty = floatval($item['quantity']) + $usedSinceRestock;
|
||||||
$daysSinceRestock = max(1, (time() - $restockDate) / 86400);
|
$daysSinceRestock = max(1, (time() - $restockDate) / 86400);
|
||||||
|
|
||||||
|
// Recalculate the expected consumption with an adaptive rate:
|
||||||
|
// blend long-term history with post-restock behavior when available.
|
||||||
|
$txSinceRestock = 0;
|
||||||
|
foreach ($rows as $r) {
|
||||||
|
if (strtotime($r['created_at']) >= $restockDate) $txSinceRestock++;
|
||||||
|
}
|
||||||
|
$observedRate = $daysSinceRestock > 0 ? ($usedSinceRestock / $daysSinceRestock) : 0;
|
||||||
|
$dailyRate = $historicalRate;
|
||||||
|
if ($observedRate > 0) {
|
||||||
|
if ($txSinceRestock >= 3) {
|
||||||
|
$dailyRate = ($historicalRate * 0.45) + ($observedRate * 0.55);
|
||||||
|
} elseif ($txSinceRestock >= 1) {
|
||||||
|
$dailyRate = ($historicalRate * 0.70) + ($observedRate * 0.30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If the model predicts you should have consumed less than 15% of baseline
|
// If the model predicts you should have consumed less than 15% of baseline
|
||||||
// in this period, the daily rate is too low to make reliable predictions:
|
// in this period, the daily rate is too low to make reliable predictions:
|
||||||
// any single normal use will look like an anomaly. Skip it.
|
// any single normal use will look like an anomaly. Skip it.
|
||||||
$predictedConsumption = $dailyRate * $daysSinceRestock;
|
$predictedConsumption = $dailyRate * $daysSinceRestock;
|
||||||
if ($baselineQty > 0 && $predictedConsumption < $baselineQty * 0.15) continue;
|
if ($baselineQty > 0 && $predictedConsumption < $baselineQty * 0.15) continue;
|
||||||
|
|
||||||
// Predicted remaining qty = baseline - (daily rate * days since restock)
|
// Predicted remaining qty = baseline - (adaptive daily rate * days since restock)
|
||||||
$expectedQty = max(0, $baselineQty - ($dailyRate * $daysSinceRestock));
|
$expectedQty = max(0, $baselineQty - ($dailyRate * $daysSinceRestock));
|
||||||
$actualQty = floatval($item['quantity']);
|
$actualQty = floatval($item['quantity']);
|
||||||
|
|
||||||
|
// Need at least some post-restock usage observations before warning.
|
||||||
|
if ($txSinceRestock < 2) continue;
|
||||||
|
|
||||||
// Flag if deviation > 30% and absolute diff > meaningful threshold
|
// Flag if deviation > 30% and absolute diff > meaningful threshold
|
||||||
$deviation = abs($actualQty - $expectedQty);
|
$deviation = abs($actualQty - $expectedQty);
|
||||||
$threshold = max($dailyRate * 3, 0.5); // at least 3 days worth or 0.5 units
|
$threshold = max($dailyRate * 3, 0.5); // at least 3 days worth or 0.5 units
|
||||||
@@ -2188,10 +2211,12 @@ function getConsumptionPredictions(PDO $db): void {
|
|||||||
|
|
||||||
$pctDev = $expectedQty > 0 ? ($deviation / $expectedQty) : ($actualQty > 0 ? 1 : 0);
|
$pctDev = $expectedQty > 0 ? ($deviation / $expectedQty) : ($actualQty > 0 ? 1 : 0);
|
||||||
|
|
||||||
// "more than expected" is almost always a restock the model doesn't know about yet.
|
// "More than expected" usually means slower real consumption, not bad data.
|
||||||
// Only flag it at very high deviation (>400%) to catch truly impossible values.
|
// Suppress this direction to avoid noisy/accusatory banners.
|
||||||
// "less than expected" is more actionable: user may have consumed without registering.
|
if ($actualQty > $expectedQty) continue;
|
||||||
$flagThreshold = ($actualQty > $expectedQty) ? 4.0 : 0.30;
|
|
||||||
|
// Only keep meaningful "less than expected" deviations.
|
||||||
|
$flagThreshold = 0.45;
|
||||||
|
|
||||||
if ($pctDev > $flagThreshold && $deviation > $threshold) {
|
if ($pctDev > $flagThreshold && $deviation > $threshold) {
|
||||||
$unit = $item['unit'];
|
$unit = $item['unit'];
|
||||||
@@ -2220,7 +2245,7 @@ function getConsumptionPredictions(PDO $db): void {
|
|||||||
'daily_rate' => round($dailyRate, 3),
|
'daily_rate' => round($dailyRate, 3),
|
||||||
'deviation_pct' => round($pctDev * 100),
|
'deviation_pct' => round($pctDev * 100),
|
||||||
'days_since_restock' => (int)round($daysSinceRestock),
|
'days_since_restock' => (int)round($daysSinceRestock),
|
||||||
'direction' => $actualQty > $expectedQty ? 'more' : 'less',
|
'direction' => 'less',
|
||||||
'tx_count' => count($rows),
|
'tx_count' => count($rows),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -2248,6 +2273,12 @@ function getServerSettings(): void {
|
|||||||
'tts_content_type' => env('TTS_CONTENT_TYPE', 'application/json'),
|
'tts_content_type' => env('TTS_CONTENT_TYPE', 'application/json'),
|
||||||
'tts_payload_key' => env('TTS_PAYLOAD_KEY', 'message'),
|
'tts_payload_key' => env('TTS_PAYLOAD_KEY', 'message'),
|
||||||
'tts_enabled' => env('TTS_ENABLED', 'false') === 'true',
|
'tts_enabled' => env('TTS_ENABLED', 'false') === 'true',
|
||||||
|
'tts_engine' => env('TTS_ENGINE', ''),
|
||||||
|
'tts_rate' => (float)env('TTS_RATE', '1'),
|
||||||
|
'tts_pitch' => (float)env('TTS_PITCH', '1'),
|
||||||
|
'tts_auth_header_name' => env('TTS_AUTH_HEADER_NAME', ''),
|
||||||
|
'tts_auth_header_value' => env('TTS_AUTH_HEADER_VALUE', ''),
|
||||||
|
'tts_extra_fields' => env('TTS_EXTRA_FIELDS', ''),
|
||||||
// User preferences (now server-side)
|
// User preferences (now server-side)
|
||||||
'default_persons' => intval(env('DEFAULT_PERSONS', '1')),
|
'default_persons' => intval(env('DEFAULT_PERSONS', '1')),
|
||||||
'pref_veloce' => env('PREF_VELOCE', 'false') === 'true',
|
'pref_veloce' => env('PREF_VELOCE', 'false') === 'true',
|
||||||
@@ -2298,11 +2329,15 @@ function saveSettings(): void {
|
|||||||
'tts_auth_type' => 'TTS_AUTH_TYPE',
|
'tts_auth_type' => 'TTS_AUTH_TYPE',
|
||||||
'tts_content_type'=> 'TTS_CONTENT_TYPE',
|
'tts_content_type'=> 'TTS_CONTENT_TYPE',
|
||||||
'tts_payload_key' => 'TTS_PAYLOAD_KEY',
|
'tts_payload_key' => 'TTS_PAYLOAD_KEY',
|
||||||
'camera_facing' => 'CAMERA_FACING',
|
'camera_facing' => 'CAMERA_FACING',
|
||||||
'dietary' => 'DIETARY',
|
'dietary' => 'DIETARY',
|
||||||
'scale_gateway_url' => 'SCALE_GATEWAY_URL',
|
'scale_gateway_url' => 'SCALE_GATEWAY_URL',
|
||||||
'price_country' => 'PRICE_COUNTRY',
|
'price_country' => 'PRICE_COUNTRY',
|
||||||
'price_currency' => 'PRICE_CURRENCY',
|
'price_currency' => 'PRICE_CURRENCY',
|
||||||
|
'tts_engine' => 'TTS_ENGINE',
|
||||||
|
'tts_auth_header_name' => 'TTS_AUTH_HEADER_NAME',
|
||||||
|
'tts_auth_header_value' => 'TTS_AUTH_HEADER_VALUE',
|
||||||
|
'tts_extra_fields' => 'TTS_EXTRA_FIELDS',
|
||||||
];
|
];
|
||||||
// Boolean keys
|
// Boolean keys
|
||||||
$boolMap = [
|
$boolMap = [
|
||||||
@@ -2324,6 +2359,11 @@ function saveSettings(): void {
|
|||||||
'screensaver_timeout' => 'SCREENSAVER_TIMEOUT',
|
'screensaver_timeout' => 'SCREENSAVER_TIMEOUT',
|
||||||
'price_update_months' => 'PRICE_UPDATE_MONTHS',
|
'price_update_months' => 'PRICE_UPDATE_MONTHS',
|
||||||
];
|
];
|
||||||
|
// Float keys
|
||||||
|
$floatMap = [
|
||||||
|
'tts_rate' => 'TTS_RATE',
|
||||||
|
'tts_pitch' => 'TTS_PITCH',
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($keyMap as $inKey => $envKey) {
|
foreach ($keyMap as $inKey => $envKey) {
|
||||||
if (array_key_exists($inKey, $input)) {
|
if (array_key_exists($inKey, $input)) {
|
||||||
@@ -2340,6 +2380,11 @@ function saveSettings(): void {
|
|||||||
$envVars[$envKey] = (string)intval($input[$inKey]);
|
$envVars[$envKey] = (string)intval($input[$inKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach ($floatMap as $inKey => $envKey) {
|
||||||
|
if (array_key_exists($inKey, $input)) {
|
||||||
|
$envVars[$envKey] = (string)(float)$input[$inKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
// Arrays stored as comma-separated
|
// Arrays stored as comma-separated
|
||||||
if (array_key_exists('appliances', $input)) {
|
if (array_key_exists('appliances', $input)) {
|
||||||
$envVars['APPLIANCES'] = is_array($input['appliances']) ? implode(',', $input['appliances']) : (string)$input['appliances'];
|
$envVars['APPLIANCES'] = is_array($input['appliances']) ? implode(',', $input['appliances']) : (string)$input['appliances'];
|
||||||
@@ -2844,6 +2889,8 @@ function geminiChat(PDO $db): void {
|
|||||||
$history = $input['history'] ?? [];
|
$history = $input['history'] ?? [];
|
||||||
$appliances = $input['appliances'] ?? [];
|
$appliances = $input['appliances'] ?? [];
|
||||||
$dietaryRestrictions = $input['dietary_restrictions'] ?? '';
|
$dietaryRestrictions = $input['dietary_restrictions'] ?? '';
|
||||||
|
$lang = recipeNormalizeLang($input['lang'] ?? 'it');
|
||||||
|
$langName = recipeLangName($lang);
|
||||||
|
|
||||||
if (empty($message)) {
|
if (empty($message)) {
|
||||||
echo json_encode(['success' => false, 'error' => 'Messaggio vuoto']);
|
echo json_encode(['success' => false, 'error' => 'Messaggio vuoto']);
|
||||||
@@ -2891,27 +2938,29 @@ function geminiChat(PDO $db): void {
|
|||||||
|
|
||||||
$dietaryText = '';
|
$dietaryText = '';
|
||||||
if (!empty($dietaryRestrictions)) {
|
if (!empty($dietaryRestrictions)) {
|
||||||
$dietaryText = "\nRestrizioni alimentari dell'utente: {$dietaryRestrictions}. Rispetta SEMPRE queste restrizioni.";
|
$dietaryText = "\nUser dietary restrictions: {$dietaryRestrictions}. Always respect these restrictions.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$langName = recipeLangName($lang);
|
||||||
$systemPrompt = <<<PROMPT
|
$systemPrompt = <<<PROMPT
|
||||||
Sei un assistente cucina italiano esperto, amichevole e conciso. L'utente ha una dispensa e ti chiede consigli su cosa preparare.
|
You are an expert kitchen assistant, friendly and concise. The user has a pantry and asks you for advice on what to prepare.
|
||||||
|
IMPORTANT: Always respond in {$langName}, using a colloquial and friendly tone.
|
||||||
|
|
||||||
CONTESTO - INGREDIENTI DISPONIBILI IN DISPENSA:
|
CONTEXT - AVAILABLE PANTRY INGREDIENTS:
|
||||||
{$ingredientsText}
|
{$ingredientsText}
|
||||||
{$appliancesText}{$dietaryText}
|
{$appliancesText}{$dietaryText}
|
||||||
|
|
||||||
REGOLE:
|
RULES:
|
||||||
1. Rispondi SEMPRE in italiano, in modo colloquiale e amichevole
|
1. Always respond in {$langName}
|
||||||
2. Usa SOLO gli ingredienti dalla dispensa dell'utente (più acqua, sale, pepe, olio che si presumono sempre disponibili)
|
2. Use ONLY ingredients from the user's pantry (plus water, salt, pepper, oil which are assumed always available)
|
||||||
3. Dai priorità agli ingredienti in scadenza
|
3. Prioritize ingredients that expire soon
|
||||||
4. Sii conciso: non fare liste chilometriche, vai al sodo
|
4. Be concise: no lengthy lists, get to the point
|
||||||
5. Se l'utente chiede una ricetta o preparazione, dai istruzioni chiare con quantità
|
5. If the user asks for a recipe or preparation, give clear instructions with quantities
|
||||||
6. Se non ci sono ingredienti adatti per la richiesta, dillo onestamente e suggerisci alternative
|
6. If there are no suitable ingredients for the request, say so honestly and suggest alternatives
|
||||||
7. Puoi suggerire combinazioni creative
|
7. You can suggest creative combinations
|
||||||
8. Quando menzioni quantità, usa le stesse unità di misura della dispensa
|
8. When mentioning quantities, use the same units as in the pantry
|
||||||
9. Ricorda il contesto della conversazione precedente
|
9. Remember the context of the previous conversation
|
||||||
10. Se l'utente chiede esplicitamente una ricetta per un apparecchio specifico (es. macchina del pane, Cookeo, friggitrice ad aria), fornisci la ricetta SOLO per quell'apparecchio, con istruzioni specifiche per quel dispositivo (programmi, ordine degli ingredienti, tempi, temperature)
|
10. If the user explicitly asks for a recipe for a specific appliance (e.g. bread machine, Cookeo, air fryer), provide the recipe ONLY for that appliance, with device-specific instructions (programs, ingredient order, times, temperatures)
|
||||||
PROMPT;
|
PROMPT;
|
||||||
|
|
||||||
// Build conversation for Gemini
|
// Build conversation for Gemini
|
||||||
@@ -2999,6 +3048,7 @@ PROMPT;
|
|||||||
'error_empty_reply' => 'Risposta vuota da Gemini',
|
'error_empty_reply' => 'Risposta vuota da Gemini',
|
||||||
'prompt_lang_rule' => 'IMPORTANTE: scrivi tutti i campi testuali della ricetta in Italiano.',
|
'prompt_lang_rule' => 'IMPORTANTE: scrivi tutti i campi testuali della ricetta in Italiano.',
|
||||||
'prompt_step_example' => 'Passo 1…',
|
'prompt_step_example' => 'Passo 1…',
|
||||||
|
'tools_title' => 'Strumenti necessari',
|
||||||
],
|
],
|
||||||
'en' => [
|
'en' => [
|
||||||
'status_analyze_pantry' => '📦 Analyzing pantry...',
|
'status_analyze_pantry' => '📦 Analyzing pantry...',
|
||||||
@@ -3021,6 +3071,7 @@ PROMPT;
|
|||||||
'error_empty_reply' => 'Empty response from Gemini',
|
'error_empty_reply' => 'Empty response from Gemini',
|
||||||
'prompt_lang_rule' => 'IMPORTANT: write all textual recipe fields in English only. Do not use Italian or German.',
|
'prompt_lang_rule' => 'IMPORTANT: write all textual recipe fields in English only. Do not use Italian or German.',
|
||||||
'prompt_step_example' => 'Step 1…',
|
'prompt_step_example' => 'Step 1…',
|
||||||
|
'tools_title' => 'Equipment needed',
|
||||||
],
|
],
|
||||||
'de' => [
|
'de' => [
|
||||||
'status_analyze_pantry' => '📦 Vorrat wird analysiert...',
|
'status_analyze_pantry' => '📦 Vorrat wird analysiert...',
|
||||||
@@ -3043,6 +3094,7 @@ PROMPT;
|
|||||||
'error_empty_reply' => 'Leere Antwort von Gemini',
|
'error_empty_reply' => 'Leere Antwort von Gemini',
|
||||||
'prompt_lang_rule' => 'WICHTIG: schreibe alle textuellen Rezeptfelder nur auf Deutsch. Verwende kein Italienisch oder Englisch.',
|
'prompt_lang_rule' => 'WICHTIG: schreibe alle textuellen Rezeptfelder nur auf Deutsch. Verwende kein Italienisch oder Englisch.',
|
||||||
'prompt_step_example' => 'Schritt 1…',
|
'prompt_step_example' => 'Schritt 1…',
|
||||||
|
'tools_title' => 'Benötigte Geräte',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$text = $dict[$lang][$key] ?? $dict['it'][$key] ?? $key;
|
$text = $dict[$lang][$key] ?? $dict['it'][$key] ?? $key;
|
||||||
@@ -3420,14 +3472,15 @@ REGOLE:
|
|||||||
4. "qty_number": valore NUMERICO nella STESSA unità della dispensa (g/ml/pz/conf, MAI kg o litri). Per non-dispensa: 0. IMPORTANTE: per ingredienti con unità "pz" scrivi qty_number come numero di PEZZI (es. 2, non 200g).
|
4. "qty_number": valore NUMERICO nella STESSA unità della dispensa (g/ml/pz/conf, MAI kg o litri). Per non-dispensa: 0. IMPORTANTE: per ingredienti con unità "pz" scrivi qty_number come numero di PEZZI (es. 2, non 200g).
|
||||||
5. "name": usa ESATTAMENTE il nome dalla lista (il sistema lo usa per scalare l'inventario).
|
5. "name": usa ESATTAMENTE il nome dalla lista (il sistema lo usa per scalare l'inventario).
|
||||||
6. Includi nella lista ingredienti TUTTI quelli citati nei passi (tranne acqua/sale/pepe/olio).
|
6. Includi nella lista ingredienti TUTTI quelli citati nei passi (tranne acqua/sale/pepe/olio).
|
||||||
7. Language rule: {$recipeLangName} only for all textual fields (`title`, `tags`, `expiry_note`, `ingredients.qty`, `steps`, `nutrition_note`). Keep `meal` unchanged.
|
7. Language rule: {$recipeLangName} only for all textual fields (`title`, `tags`, `expiry_note`, `ingredients.qty`, `steps`, `nutrition_note`, `tools_needed`). Keep `meal` unchanged.
|
||||||
|
8. `tools_needed`: array of kitchen tools/appliances actually required by this recipe (e.g. ["Forno","Frullatore"]). Use the same language as all other text fields. Empty array [] if only stovetop/knife/pan needed.
|
||||||
|
|
||||||
DISPENSA:
|
DISPENSA:
|
||||||
$ingredientsText
|
$ingredientsText
|
||||||
|
|
||||||
Rispondi SOLO JSON valido (no markdown):
|
Rispondi SOLO JSON valido (no markdown):
|
||||||
{$promptLanguageRule}
|
{$promptLanguageRule}
|
||||||
{"title":"…","meal":"$mealType","persons":$persons,"prep_time":"…","cook_time":"…","tags":["…"],"expiry_note":"…","ingredients":[{"name":"…","qty":"200 g","qty_number":200,"from_pantry":true}],"steps":["{$promptStepExample}"],"nutrition_note":"…"}
|
{"title":"…","meal":"$mealType","persons":$persons,"prep_time":"…","cook_time":"…","tags":["…"],"expiry_note":"…","tools_needed":["…"],"ingredients":[{"name":"…","qty":"200 g","qty_number":200,"from_pantry":true}],"steps":["{$promptStepExample}"],"nutrition_note":"…"}
|
||||||
PROMPT;
|
PROMPT;
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
@@ -3781,6 +3834,8 @@ function recipeFromIngredient(PDO $db): void {
|
|||||||
echo json_encode(['success' => false, 'error' => 'empty_ingredient']);
|
echo json_encode(['success' => false, 'error' => 'empty_ingredient']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$lang = recipeNormalizeLang($input['lang'] ?? 'it');
|
||||||
|
$langName = recipeLangName($lang);
|
||||||
|
|
||||||
// Fetch inventory (same as generateRecipe)
|
// Fetch inventory (same as generateRecipe)
|
||||||
$stmt = $db->query("
|
$stmt = $db->query("
|
||||||
@@ -3796,18 +3851,18 @@ function recipeFromIngredient(PDO $db): void {
|
|||||||
$safeName = htmlspecialchars($ingredientName, ENT_QUOTES, 'UTF-8');
|
$safeName = htmlspecialchars($ingredientName, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$prompt = <<<PROMPT
|
$prompt = <<<PROMPT
|
||||||
Generate a recipe in Italian that uses "{$safeName}" as a main ingredient.
|
Generate a recipe in {$langName} that uses "{$safeName}" as a main ingredient.
|
||||||
Return ONLY a JSON object, no markdown.
|
Return ONLY a JSON object, no markdown.
|
||||||
|
|
||||||
Fields:
|
Fields:
|
||||||
- title: string (Italian recipe name)
|
- title: string (recipe name in {$langName})
|
||||||
- meal: null (do NOT categorize)
|
- meal: null (do NOT categorize)
|
||||||
- persons: 2
|
- persons: 2
|
||||||
- prep_time: string or null
|
- prep_time: string or null
|
||||||
- cook_time: string or null
|
- cook_time: string or null
|
||||||
- ingredients: array of {"name":"...","qty":"...","qty_number":0.0,"unit":"g|ml|pz|conf|kg|l","from_pantry":true}
|
- ingredients: array of {"name":"...","qty":"...","qty_number":0.0,"unit":"g|ml|pz|conf|kg|l","from_pantry":true}
|
||||||
— "{$safeName}" MUST be the first ingredient; set from_pantry=true for ALL
|
— "{$safeName}" MUST be the first ingredient; set from_pantry=true for ALL
|
||||||
- steps: array of strings (step text only, no numbers)
|
- steps: array of strings (step text only, no numbers, in {$langName})
|
||||||
- nutrition_note: string or null
|
- nutrition_note: string or null
|
||||||
PROMPT;
|
PROMPT;
|
||||||
|
|
||||||
@@ -4296,14 +4351,15 @@ REGOLE:
|
|||||||
4. "qty_number": valore NUMERICO nella STESSA unità della dispensa (g/ml/pz/conf, MAI kg o litri). Per non-dispensa: 0. IMPORTANTE: per ingredienti con unità "pz" scrivi qty_number come numero di PEZZI (es. 2, non 200g).
|
4. "qty_number": valore NUMERICO nella STESSA unità della dispensa (g/ml/pz/conf, MAI kg o litri). Per non-dispensa: 0. IMPORTANTE: per ingredienti con unità "pz" scrivi qty_number come numero di PEZZI (es. 2, non 200g).
|
||||||
5. "name": usa ESATTAMENTE il nome dalla lista (il sistema lo usa per scalare l'inventario).
|
5. "name": usa ESATTAMENTE il nome dalla lista (il sistema lo usa per scalare l'inventario).
|
||||||
6. Includi nella lista ingredienti TUTTI quelli citati nei passi (tranne acqua/sale/pepe/olio).
|
6. Includi nella lista ingredienti TUTTI quelli citati nei passi (tranne acqua/sale/pepe/olio).
|
||||||
7. Language rule: {$recipeLangName} only for all textual fields (`title`, `tags`, `expiry_note`, `ingredients.qty`, `steps`, `nutrition_note`). Keep `meal` unchanged.
|
7. Language rule: {$recipeLangName} only for all textual fields (`title`, `tags`, `expiry_note`, `ingredients.qty`, `steps`, `nutrition_note`, `tools_needed`). Keep `meal` unchanged.
|
||||||
|
8. `tools_needed`: array of kitchen tools/appliances actually required by this recipe (e.g. ["Forno","Frullatore"]). Use the same language as all other text fields. Empty array [] if only stovetop/knife/pan needed.
|
||||||
|
|
||||||
DISPENSA:
|
DISPENSA:
|
||||||
$ingredientsText
|
$ingredientsText
|
||||||
|
|
||||||
Rispondi SOLO JSON valido (no markdown):
|
Rispondi SOLO JSON valido (no markdown):
|
||||||
{$promptLanguageRule}
|
{$promptLanguageRule}
|
||||||
{"title":"…","meal":"$mealType","persons":$persons,"prep_time":"…","cook_time":"…","tags":["…"],"expiry_note":"…","ingredients":[{"name":"…","qty":"200 g","qty_number":200,"from_pantry":true}],"steps":["{$promptStepExample}"],"nutrition_note":"…"}
|
{"title":"…","meal":"$mealType","persons":$persons,"prep_time":"…","cook_time":"…","tags":["…"],"expiry_note":"…","tools_needed":["…"],"ingredients":[{"name":"…","qty":"200 g","qty_number":200,"from_pantry":true}],"steps":["{$promptStepExample}"],"nutrition_note":"…"}
|
||||||
PROMPT;
|
PROMPT;
|
||||||
|
|
||||||
$genConfig = [
|
$genConfig = [
|
||||||
@@ -6871,6 +6927,86 @@ function reportError(): void {
|
|||||||
echo json_encode(['ok' => true]);
|
echo json_encode(['ok' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POST /api/?action=report_bug
|
||||||
|
*
|
||||||
|
* Manual bug/feature/question report submitted by the user via the in-app form.
|
||||||
|
* Creates a GitHub issue directly with the provided title and description.
|
||||||
|
*
|
||||||
|
* Expected JSON body:
|
||||||
|
* type string 'bug'|'feature'|'question'
|
||||||
|
* title string Issue title (required, max 150 chars)
|
||||||
|
* description string Main description (required, max 3000 chars)
|
||||||
|
* steps string? Steps to reproduce (optional, max 2000 chars)
|
||||||
|
* lang string? UI language the user is running
|
||||||
|
* url string? Page URL
|
||||||
|
* user_agent string? Navigator UA
|
||||||
|
* version string? App version
|
||||||
|
*/
|
||||||
|
function reportBugManual(): void {
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true) ?: [];
|
||||||
|
|
||||||
|
$allowedTypes = ['bug', 'feature', 'question'];
|
||||||
|
$type = in_array($input['type'] ?? '', $allowedTypes, true) ? $input['type'] : 'bug';
|
||||||
|
$title = substr(trim($input['title'] ?? ''), 0, 150);
|
||||||
|
$desc = substr(trim($input['description'] ?? ''), 0, 3000);
|
||||||
|
$steps = substr(trim($input['steps'] ?? ''), 0, 2000);
|
||||||
|
$ua = substr(trim($input['user_agent'] ?? ($_SERVER['HTTP_USER_AGENT'] ?? '')), 0, 300);
|
||||||
|
$url = substr(trim($input['url'] ?? ''), 0, 300);
|
||||||
|
$ver = substr(trim($input['version'] ?? ''), 0, 50);
|
||||||
|
$lang = preg_replace('/[^a-z\-]/', '', strtolower($input['lang'] ?? 'it'));
|
||||||
|
|
||||||
|
if (empty($title) || empty($desc)) {
|
||||||
|
echo json_encode(['ok' => false, 'error' => 'title and description required']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = _ghToken();
|
||||||
|
if (!$token) {
|
||||||
|
// No GitHub token configured — log locally and return ok so the UX is not broken
|
||||||
|
_appendErrorLog('pwa', 'manual_report', $title, $desc, $url, $ua, ['type' => $type, 'version' => $ver, 'lang' => $lang]);
|
||||||
|
echo json_encode(['ok' => true, 'issue' => null]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Labels: always 'user-report' + type-specific label
|
||||||
|
$labelMap = [
|
||||||
|
'bug' => ['bug', 'user-report'],
|
||||||
|
'feature' => ['enhancement', 'user-report'],
|
||||||
|
'question' => ['question', 'user-report'],
|
||||||
|
];
|
||||||
|
$labels = $labelMap[$type];
|
||||||
|
|
||||||
|
$typeEmoji = ['bug' => '🐛', 'feature' => '💡', 'question' => '❓'][$type];
|
||||||
|
$ts = date('Y-m-d H:i:s T');
|
||||||
|
|
||||||
|
$body = "## {$typeEmoji} User Report\n\n";
|
||||||
|
$body .= "**Description:**\n{$desc}\n\n";
|
||||||
|
if ($steps) {
|
||||||
|
$body .= "**Steps to reproduce:**\n{$steps}\n\n";
|
||||||
|
}
|
||||||
|
$body .= "---\n";
|
||||||
|
$body .= "**Version:** `{$ver}` \n";
|
||||||
|
$body .= "**Language:** `{$lang}` \n";
|
||||||
|
if ($url) $body .= "**URL:** `{$url}` \n";
|
||||||
|
if ($ua) $body .= "**User-Agent:** `{$ua}` \n";
|
||||||
|
$body .= "**Reported at:** {$ts}\n\n";
|
||||||
|
$body .= "_This issue was submitted via the in-app bug report form._";
|
||||||
|
|
||||||
|
$res = _githubRequest($token, 'POST',
|
||||||
|
'https://api.github.com/repos/' . GH_REPO . '/issues',
|
||||||
|
['title' => $title, 'body' => $body, 'labels' => $labels]
|
||||||
|
);
|
||||||
|
|
||||||
|
$issueNum = $res['body']['number'] ?? null;
|
||||||
|
$issueUrl = $res['body']['html_url'] ?? null;
|
||||||
|
if ($issueNum) {
|
||||||
|
echo json_encode(['ok' => true, 'issue' => $issueNum, 'url' => $issueUrl]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['ok' => false, 'error' => 'github_api_error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append to data/error_reports.log (local safety net, max 500 KB)
|
* Append to data/error_reports.log (local safety net, max 500 KB)
|
||||||
*/
|
*/
|
||||||
|
|||||||
|
After Width: | Height: | Size: 9.7 MiB |
@@ -104,10 +104,17 @@ body {
|
|||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
.app-preloader-logo {
|
.app-preloader-logo {
|
||||||
height: 120px;
|
height: 160px;
|
||||||
width: auto;
|
width: auto;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
|
filter: drop-shadow(0 4px 16px rgba(74,222,128,0.2));
|
||||||
|
}
|
||||||
|
.app-preloader-version {
|
||||||
|
color: rgba(255,255,255,0.35);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-family: monospace;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
margin-top: -8px;
|
||||||
}
|
}
|
||||||
.header-logo-icon {
|
.header-logo-icon {
|
||||||
height: 28px;
|
height: 28px;
|
||||||
@@ -272,6 +279,7 @@ body {
|
|||||||
height: 48px;
|
height: 48px;
|
||||||
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
|
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
|
||||||
animation: pulse-scan 2s ease-in-out infinite;
|
animation: pulse-scan 2s ease-in-out infinite;
|
||||||
|
touch-action: manipulation; /* prevent 300ms delay and double-tap zoom on mobile */
|
||||||
}
|
}
|
||||||
.header-scan-btn:active {
|
.header-scan-btn:active {
|
||||||
background: rgba(255,255,255,0.45);
|
background: rgba(255,255,255,0.45);
|
||||||
@@ -1267,6 +1275,16 @@ body.server-offline .bottom-nav {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#btn-report-bug {
|
||||||
|
background: #f97316;
|
||||||
|
color: #fff;
|
||||||
|
border-color: #ea580c;
|
||||||
|
}
|
||||||
|
#btn-report-bug:hover {
|
||||||
|
background: #ea580c;
|
||||||
|
border-color: #c2410c;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-secondary {
|
.btn-secondary {
|
||||||
background: var(--bg-card);
|
background: var(--bg-card);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
@@ -3103,6 +3121,36 @@ body.server-offline .bottom-nav {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Bug report form ── */
|
||||||
|
.bug-type-pills {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
.bug-type-pill {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 80px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
border: 1.5px solid #cbd5e1;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #fff;
|
||||||
|
color: #475569;
|
||||||
|
font-size: 0.88rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
}
|
||||||
|
.bug-type-pill.active {
|
||||||
|
border-color: var(--primary, #2d5016);
|
||||||
|
background: var(--primary, #2d5016);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.bug-type-pill:not(.active):hover {
|
||||||
|
border-color: var(--primary, #2d5016);
|
||||||
|
color: var(--primary, #2d5016);
|
||||||
|
}
|
||||||
|
|
||||||
.modal-detail {
|
.modal-detail {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -3918,6 +3966,29 @@ body.server-offline .bottom-nav {
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.recipe-tools-banner {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: #f0f4ff;
|
||||||
|
border: 1px solid #c7d2fe;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
padding: 8px 12px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #3730a3;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
.recipe-tool-chip {
|
||||||
|
background: #e0e7ff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #3730a3;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
/* Recipe ingredient use buttons */
|
/* Recipe ingredient use buttons */
|
||||||
.recipe-ingredients {
|
.recipe-ingredients {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@@ -4294,14 +4365,153 @@ body.cooking-mode-active .app-header {
|
|||||||
transform: scale(1.35);
|
transform: scale(1.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cooking-step-text {
|
.cooking-wheel {
|
||||||
font-size: clamp(1.4rem, 5vw, 2.2rem);
|
position: relative;
|
||||||
line-height: 1.5;
|
--wheel-tilt-x: 0deg;
|
||||||
font-weight: 500;
|
--wheel-tilt-y: 0deg;
|
||||||
color: #fff;
|
--wheel-glow: 0.45;
|
||||||
|
width: min(90vw, 680px);
|
||||||
|
max-width: 680px;
|
||||||
|
min-height: clamp(240px, 36vh, 340px);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
perspective: 1100px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 24px;
|
||||||
|
background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.07), rgba(255,255,255,0.02) 58%, transparent 100%);
|
||||||
|
border: 1px solid rgba(255,255,255,0.08);
|
||||||
|
box-shadow: inset 0 0 48px rgba(0,0,0,0.35);
|
||||||
|
touch-action: pan-y;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel::before,
|
||||||
|
.cooking-wheel::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel::before {
|
||||||
|
background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.18), rgba(251, 191, 36, 0.08) 36%, transparent 72%);
|
||||||
|
opacity: var(--wheel-glow);
|
||||||
|
transition: opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel::after {
|
||||||
|
background: linear-gradient(180deg, rgba(0,0,0,0.34) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.34) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-text,
|
||||||
|
.cooking-step-ghost {
|
||||||
|
width: min(88vw, 620px);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
max-width: 560px;
|
line-height: 1.5;
|
||||||
width: 100%;
|
padding: 18px 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
transition: transform 0.22s ease, opacity 0.22s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-text {
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
font-size: clamp(1.35rem, 4.6vw, 2.1rem);
|
||||||
|
font-weight: 600;
|
||||||
|
color: #fff;
|
||||||
|
background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
|
||||||
|
border: 1px solid rgba(255,255,255,0.20);
|
||||||
|
box-shadow: 0 18px 35px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.24);
|
||||||
|
transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y));
|
||||||
|
animation: cookingCardFloat 4.2s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-ghost {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 0;
|
||||||
|
transform-origin: center center;
|
||||||
|
font-size: clamp(1.08rem, 3.9vw, 1.52rem);
|
||||||
|
font-weight: 560;
|
||||||
|
color: rgba(255,255,255,0.95);
|
||||||
|
background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
|
||||||
|
border: 1px solid rgba(255,255,255,0.22);
|
||||||
|
box-shadow: 0 12px 28px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.22);
|
||||||
|
text-shadow: 0 1px 2px rgba(0,0,0,0.34);
|
||||||
|
opacity: 0.66;
|
||||||
|
max-height: 42%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-prev {
|
||||||
|
color: rgba(255, 243, 210, 0.97);
|
||||||
|
background: linear-gradient(180deg, rgba(251, 191, 36, 0.24), rgba(251, 191, 36, 0.10));
|
||||||
|
border-color: rgba(251, 191, 36, 0.36);
|
||||||
|
transform: translateX(-50%) rotateX(56deg) rotateY(calc(var(--wheel-tilt-y) * 0.28)) scale(0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-next {
|
||||||
|
color: rgba(220, 243, 255, 0.97);
|
||||||
|
background: linear-gradient(180deg, rgba(56, 189, 248, 0.24), rgba(56, 189, 248, 0.10));
|
||||||
|
border-color: rgba(56, 189, 248, 0.36);
|
||||||
|
transform: translateX(-50%) rotateX(-56deg) rotateY(calc(var(--wheel-tilt-y) * 0.28)) scale(0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-ghost.is-empty {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel.turn-next .cooking-step-text {
|
||||||
|
animation: cookingWheelCenterNext 0.34s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel.turn-prev .cooking-step-text {
|
||||||
|
animation: cookingWheelCenterPrev 0.34s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel.turn-next .cooking-step-prev {
|
||||||
|
animation: cookingWheelGhostNext 0.34s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel.turn-prev .cooking-step-next {
|
||||||
|
animation: cookingWheelGhostPrev 0.34s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-wheel.snap .cooking-step-text {
|
||||||
|
animation: cookingWheelSnap 0.28s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingWheelCenterNext {
|
||||||
|
from { transform: translateY(20px) rotateX(-10deg); opacity: 0.75; }
|
||||||
|
to { transform: translateY(0) rotateX(0); opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingWheelCenterPrev {
|
||||||
|
from { transform: translateY(-20px) rotateX(10deg); opacity: 0.75; }
|
||||||
|
to { transform: translateY(0) rotateX(0); opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingWheelGhostNext {
|
||||||
|
from { opacity: 0.1; transform: translateX(-50%) rotateX(68deg) scale(0.84); }
|
||||||
|
to { opacity: 0.66; transform: translateX(-50%) rotateX(56deg) scale(0.9); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingWheelGhostPrev {
|
||||||
|
from { opacity: 0.1; transform: translateX(-50%) rotateX(-68deg) scale(0.84); }
|
||||||
|
to { opacity: 0.66; transform: translateX(-50%) rotateX(-56deg) scale(0.9); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingCardFloat {
|
||||||
|
0%, 100% { transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y)) translateY(0); }
|
||||||
|
50% { transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y)) translateY(-3px); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cookingWheelSnap {
|
||||||
|
0% { transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y)) scale(0.97); }
|
||||||
|
70% { transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y)) scale(1.018); }
|
||||||
|
100% { transform: rotateX(var(--wheel-tilt-x)) rotateY(var(--wheel-tilt-y)) scale(1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.cooking-replay-btn {
|
.cooking-replay-btn {
|
||||||
@@ -4341,6 +4551,28 @@ body.cooking-mode-active .app-header {
|
|||||||
}
|
}
|
||||||
.cooking-timers-bar::-webkit-scrollbar { display: none; }
|
.cooking-timers-bar::-webkit-scrollbar { display: none; }
|
||||||
|
|
||||||
|
.cooking-tools-bar {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 7px 14px;
|
||||||
|
background: rgba(99,102,241,0.15);
|
||||||
|
border-bottom: 1px solid rgba(99,102,241,0.25);
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
color: #c7d2fe;
|
||||||
|
}
|
||||||
|
.cooking-tool-chip {
|
||||||
|
background: rgba(99,102,241,0.25);
|
||||||
|
border: 1px solid rgba(99,102,241,0.4);
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 2px 9px;
|
||||||
|
font-size: 0.76rem;
|
||||||
|
color: #e0e7ff;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.cooking-timer-card {
|
.cooking-timer-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -4576,6 +4808,32 @@ body.cooking-mode-active .app-header {
|
|||||||
background: rgba(255,255,255,0.2);
|
background: rgba(255,255,255,0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.cooking-wheel {
|
||||||
|
min-height: clamp(210px, 34vh, 300px);
|
||||||
|
border-radius: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cooking-step-text,
|
||||||
|
.cooking-step-ghost {
|
||||||
|
padding: 14px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.cooking-step-text,
|
||||||
|
.cooking-step-ghost,
|
||||||
|
.cooking-wheel.turn-next .cooking-step-text,
|
||||||
|
.cooking-wheel.turn-prev .cooking-step-text,
|
||||||
|
.cooking-wheel.turn-next .cooking-step-prev,
|
||||||
|
.cooking-wheel.turn-prev .cooking-step-next,
|
||||||
|
.cooking-wheel.snap .cooking-step-text {
|
||||||
|
animation: none !important;
|
||||||
|
transition: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Cooking button in recipe dialog */
|
/* Cooking button in recipe dialog */
|
||||||
.btn-cooking {
|
.btn-cooking {
|
||||||
background: linear-gradient(135deg, #1e3a5f, #2d5016);
|
background: linear-gradient(135deg, #1e3a5f, #2d5016);
|
||||||
|
|||||||
|
After Width: | Height: | Size: 9.7 MiB |
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 238 KiB After Width: | Height: | Size: 237 KiB |
|
After Width: | Height: | Size: 144 KiB |
@@ -1,170 +0,0 @@
|
|||||||
{
|
|
||||||
"226887def70e33ef73290ebfe75ed4d0": {
|
|
||||||
"days": 7,
|
|
||||||
"source": "ai",
|
|
||||||
"name": "Polpa di pomodoro finissima",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1777444819
|
|
||||||
},
|
|
||||||
"0ed51c9496aa9edfe38caf41772f54ed": {
|
|
||||||
"days": 7,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Latte di Montagna",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1777444820
|
|
||||||
},
|
|
||||||
"2d63d0216a75d46b465150e925d2e7ad": {
|
|
||||||
"days": 30,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Burro",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1777444821
|
|
||||||
},
|
|
||||||
"9afdf35c4a256867ef47c32495349eb6": {
|
|
||||||
"days": 5,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Yaourt Vanille",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1777480477
|
|
||||||
},
|
|
||||||
"584f57418733a1f2acd29fe2e8816129": {
|
|
||||||
"days": 5,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Passata di pomodoro",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778133522
|
|
||||||
},
|
|
||||||
"baeb7f2021b4bb91c368c9131a61f07c": {
|
|
||||||
"days": 10,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Formaggio Monte Maria",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778133523
|
|
||||||
},
|
|
||||||
"063f2d534407214786d039bb2bffbb93": {
|
|
||||||
"days": 5,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Carote",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778133524
|
|
||||||
},
|
|
||||||
"10a3d07c19bb1f889ebc9293862b4b36": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Ovomaltine",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419084
|
|
||||||
},
|
|
||||||
"0fbad7ccd8b6155c06aaa6b3c17a67d3": {
|
|
||||||
"days": 365,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Linguine pasta di Gragnano Igp",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419084
|
|
||||||
},
|
|
||||||
"b4a03e7356e7a0983b9c8af5f3cd8c57": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Polpa di pomodoro finissima",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419085
|
|
||||||
},
|
|
||||||
"b8334ff0febd5c0440c9b24c9f3132ed": {
|
|
||||||
"days": 180,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Basilico tritato surgelato",
|
|
||||||
"location": "freezer",
|
|
||||||
"ts": 1778419086
|
|
||||||
},
|
|
||||||
"0cb14384d0ba763ccf12e079d6aa8d34": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Salsa Pronta Ciliegini",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419086
|
|
||||||
},
|
|
||||||
"188634f49edb8b014a46942ee9fad689": {
|
|
||||||
"days": 180,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Farina Barilla",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419204
|
|
||||||
},
|
|
||||||
"c8db359d8709c69a95f0e6f68216d220": {
|
|
||||||
"days": 9999,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Bicarbonato",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419205
|
|
||||||
},
|
|
||||||
"a6d16a09fd9a6bfbd0a915f05dd71780": {
|
|
||||||
"days": 7,
|
|
||||||
"source": "ai",
|
|
||||||
"name": "Salsa Pronta Ciliegini",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778419205
|
|
||||||
},
|
|
||||||
"4f8f1bb04a00e5fc62d7a9cfb21e1796": {
|
|
||||||
"days": 365,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Riso Chicchi Ricchi Gran Risparmio",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419206
|
|
||||||
},
|
|
||||||
"e116e4c11084a463f9aaac02e1749fe7": {
|
|
||||||
"days": 90,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Salsa di soia",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419207
|
|
||||||
},
|
|
||||||
"b1ad9afd4139b3f225b79af4dae256ce": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Tè Al limone",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778419504
|
|
||||||
},
|
|
||||||
"7ff2b7d326dcba52a664cebbf12f78a2": {
|
|
||||||
"days": 3,
|
|
||||||
"source": "ai",
|
|
||||||
"name": "Piselli fini 1\/2 vapore",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778419505
|
|
||||||
},
|
|
||||||
"71062dc7ffd82b3ee4f40bad076a7c91": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Cioccolato bianco",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778419506
|
|
||||||
},
|
|
||||||
"38a0eaea422dfe970eba125494e75981": {
|
|
||||||
"days": 180,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Zucca a pezzi",
|
|
||||||
"location": "freezer",
|
|
||||||
"ts": 1778419506
|
|
||||||
},
|
|
||||||
"cde21270e1cd50c431742e49117b225d": {
|
|
||||||
"days": 7,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Pancetta Dolce",
|
|
||||||
"location": "frigo",
|
|
||||||
"ts": 1778419507
|
|
||||||
},
|
|
||||||
"9e4189bd3f8cb1121e7389967dd4f74c": {
|
|
||||||
"days": 180,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Farina di grano tenero tipo rossa",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778427005
|
|
||||||
},
|
|
||||||
"e3472dd051ed13ae18fc96bbebedc1ba": {
|
|
||||||
"days": 60,
|
|
||||||
"source": "rule",
|
|
||||||
"name": "Lievito di birra",
|
|
||||||
"location": "dispensa",
|
|
||||||
"ts": 1778427005
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ The EverShelf Kiosk app turns any Android tablet into a dedicated, locked-down k
|
|||||||
|
|
||||||
**[⬇ Download latest APK](https://github.com/dadaloop82/EverShelf/releases/latest/download/evershelf-kiosk.apk)**
|
**[⬇ Download latest APK](https://github.com/dadaloop82/EverShelf/releases/latest/download/evershelf-kiosk.apk)**
|
||||||
|
|
||||||
> Current version: **v1.5.0** — requires Android 7.0+
|
> Current version: **v1.6.0** — requires Android 7.0+
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ The EverShelf Kiosk app turns any Android tablet into a dedicated, locked-down k
|
|||||||
|
|
||||||
- Displays the EverShelf web app in a **full-screen WebView** (no browser chrome)
|
- Displays the EverShelf web app in a **full-screen WebView** (no browser chrome)
|
||||||
- **Locks the screen** with Android's `startLockTask` — home, recents, and back buttons are blocked
|
- **Locks the screen** with Android's `startLockTask` — home, recents, and back buttons are blocked
|
||||||
- Runs the **Scale Gateway** app in the background automatically on startup
|
- Runs the **built-in BLE scale gateway** as an integrated foreground service — no external app required
|
||||||
- Provides a **native TTS bridge** so Cooking Mode reads steps aloud via Android TextToSpeech
|
- Provides a **native TTS bridge** so Cooking Mode reads steps aloud via Android TextToSpeech
|
||||||
- Auto-detects your EverShelf server on the LAN with a **smart discovery scanner**
|
- Auto-detects your EverShelf server on the LAN with a **smart discovery scanner**
|
||||||
- Reports errors and install failures back to the developer automatically
|
- Reports errors and install failures back to the developer automatically
|
||||||
@@ -36,21 +36,23 @@ Overview of what the wizard will configure.
|
|||||||
### Step 3 — Permissions
|
### Step 3 — Permissions
|
||||||
Grant camera, microphone, and storage permissions needed by the web app.
|
Grant camera, microphone, and storage permissions needed by the web app.
|
||||||
|
|
||||||
The button transforms from "Concedi permessi" to **"✅ Permessi concessi — Continua →"** (green) once all permissions are granted.
|
The button transforms from **"Grant permissions"** to **"✅ Permissions granted — Continue →"** (green) once all permissions are granted.
|
||||||
|
|
||||||
### Step 4 — Server URL
|
### Step 4 — Server URL
|
||||||
Enter your EverShelf server URL (e.g. `https://192.168.1.100/dispensa`).
|
Enter your EverShelf server URL (e.g. `https://192.168.1.100/dispensa`).
|
||||||
|
|
||||||
**Or tap "Rileva automaticamente"** to let the wizard scan your LAN:
|
**Or tap "Auto-discover"** to let the wizard scan your LAN:
|
||||||
- 60 parallel threads, TCP pre-check, ports 80/443/8080/8443
|
- 60 parallel threads, TCP pre-check, ports 80/443/8080/8443
|
||||||
- Only scans your actual Wi-Fi/Ethernet subnet (VPN and cellular interfaces ignored)
|
- Only scans your actual Wi-Fi/Ethernet subnet (VPN and cellular interfaces ignored)
|
||||||
- Real-time feedback as hosts are tested
|
- Real-time feedback as hosts are tested
|
||||||
|
|
||||||
### Step 5 — Scale Gateway
|
### Step 5 — Smart Scale
|
||||||
If you have a BLE smart scale, install and configure the Scale Gateway:
|
If you have a Bluetooth LE smart scale, configure it here:
|
||||||
1. Tap **"Installa Gateway"** — the APK is downloaded from GitHub and installed via `PackageInstaller`
|
1. Tap **"Yes, I have a scale"** — the app scans for nearby BLE devices
|
||||||
2. If installation fails, a diagnostic dialog shows: status code, error message, APK size, Android version, and device model — plus a "Riprova" button
|
2. Tap your scale in the list (devices most likely to be scales are marked with ⭐)
|
||||||
3. On success, the wizard automatically writes `scale_enabled=true` and `scale_gateway_url=ws://127.0.0.1:8765` to your EverShelf server
|
3. On selection, the app automatically writes `scale_enabled=true` and `scale_gateway_url=ws://127.0.0.1:8765` to your EverShelf server
|
||||||
|
|
||||||
|
The BLE gateway runs as a built-in foreground service — **no external APK needed**.
|
||||||
|
|
||||||
### Step 6 — Screensaver
|
### Step 6 — Screensaver
|
||||||
Choose whether the screen should go dark after inactivity.
|
Choose whether the screen should go dark after inactivity.
|
||||||
@@ -60,9 +62,23 @@ All done — the web app loads in full-screen kiosk mode.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Header Overlay Buttons
|
||||||
|
|
||||||
|
Three buttons are injected into the top-left of the web header by the kiosk app:
|
||||||
|
|
||||||
|
| Button | Action |
|
||||||
|
|--------|--------|
|
||||||
|
| **✕** | Exit kiosk mode (confirmation dialog) |
|
||||||
|
| **↻** | Hard-refresh — clears WebView cache and reloads the app |
|
||||||
|
| **⚙️** | Open EverShelf Settings |
|
||||||
|
|
||||||
|
The native Android settings button is permanently hidden once the overlay is injected — the **⚙️** web button replaces it entirely.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Exiting Kiosk Mode
|
## Exiting Kiosk Mode
|
||||||
|
|
||||||
Tap the **✕** button in the header (top-left). A confirmation dialog appears.
|
Tap the **✕** button in the header overlay (top-left). A confirmation dialog appears.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -97,11 +113,6 @@ The WebView accepts self-signed certificates automatically. No configuration nee
|
|||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### "Impossibile installare il gateway"
|
|
||||||
- Make sure "Install from unknown sources" is enabled for the kiosk app in Android Settings → Apps → Special app access
|
|
||||||
- Check that there is enough free storage (the APK is ~15 MB)
|
|
||||||
- The diagnostic dialog shows the exact failure code — include it when opening an issue
|
|
||||||
|
|
||||||
### "Server non trovato" during auto-discovery
|
### "Server non trovato" during auto-discovery
|
||||||
- Make sure your tablet and server are on the same Wi-Fi network
|
- Make sure your tablet and server are on the same Wi-Fi network
|
||||||
- Ensure the server is not on a VPN-only interface
|
- Ensure the server is not on a VPN-only interface
|
||||||
@@ -136,6 +147,6 @@ Requires Android Studio or JDK 17+ with the Android SDK.
|
|||||||
| `CAMERA` | Barcode scanning and AI photo identification |
|
| `CAMERA` | Barcode scanning and AI photo identification |
|
||||||
| `RECORD_AUDIO` | Voice input in AI chat |
|
| `RECORD_AUDIO` | Voice input in AI chat |
|
||||||
| `WAKE_LOCK` | Keep the screen on |
|
| `WAKE_LOCK` | Keep the screen on |
|
||||||
| `REQUEST_INSTALL_PACKAGES` | Install the Scale Gateway APK |
|
| `REQUEST_INSTALL_PACKAGES` | Over-the-air kiosk self-updates (installs new APK from GitHub releases) |
|
||||||
| `ACCESS_WIFI_STATE` | LAN auto-discovery |
|
| `ACCESS_WIFI_STATE` | LAN auto-discovery |
|
||||||
| `REORDER_TASKS` | Bring app to foreground after gateway launch |
|
| `REORDER_TASKS` | Bring the kiosk app to foreground when needed |
|
||||||
|
|||||||
@@ -43,15 +43,13 @@ docker compose up -d
|
|||||||
|
|
||||||
## AI Features
|
## AI Features
|
||||||
|
|
||||||
### AI features don't work / "AI non disponibile"
|
### "AI not available" error
|
||||||
|
|
||||||
1. Check that `GEMINI_API_KEY` is set in `.env`
|
1. Check that `GEMINI_API_KEY` is set in `.env`
|
||||||
2. Verify the key is valid at [aistudio.google.com](https://aistudio.google.com)
|
2. Verify the key is valid at [aistudio.google.com](https://aistudio.google.com)
|
||||||
3. Check that you haven't exceeded the free tier quota (15 req/min, 1500 req/day)
|
3. Check that you haven't exceeded the free tier quota (15 req/min, 1500 req/day)
|
||||||
4. Look for errors in the PHP error log
|
4. Look for errors in the PHP error log
|
||||||
|
|
||||||
### Recipe generation stops midway
|
|
||||||
|
|
||||||
This is usually a Gemini API timeout. The app streams results via SSE — if the server PHP timeout is too low, the stream is cut short. Increase `max_execution_time` in `php.ini`:
|
This is usually a Gemini API timeout. The app streams results via SSE — if the server PHP timeout is too low, the stream is cut short. Increase `max_execution_time` in `php.ini`:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
@@ -62,7 +60,7 @@ max_execution_time = 120
|
|||||||
|
|
||||||
## Shopping List (Bring!)
|
## Shopping List (Bring!)
|
||||||
|
|
||||||
### "Bring! non configurato" message in the shopping tab
|
### "Bring! not configured" message in the shopping tab
|
||||||
|
|
||||||
Add your Bring! credentials to `.env`:
|
Add your Bring! credentials to `.env`:
|
||||||
|
|
||||||
@@ -90,7 +88,7 @@ BRING_PASSWORD=yourpassword
|
|||||||
### Scale shows weight but form doesn't auto-fill
|
### Scale shows weight but form doesn't auto-fill
|
||||||
|
|
||||||
- The auto-fill only triggers for products with unit `g` or `ml`
|
- The auto-fill only triggers for products with unit `g` or `ml`
|
||||||
- Make sure you tapped "⚖️ Leggi bilancia" first to activate the scale modal
|
- Make sure you tapped **"⚖️ Read Scale"** first to activate the scale modal
|
||||||
- The weight must stabilize (stay within 10g) for the countdown to start
|
- The weight must stabilize (stay within 10g) for the countdown to start
|
||||||
|
|
||||||
### Bluetooth scale not appearing in the gateway app
|
### Bluetooth scale not appearing in the gateway app
|
||||||
@@ -109,19 +107,19 @@ BRING_PASSWORD=yourpassword
|
|||||||
- Try entering the URL manually instead of using auto-discovery
|
- Try entering the URL manually instead of using auto-discovery
|
||||||
- Check that the server responds on the expected port (80/443/8080/8443)
|
- Check that the server responds on the expected port (80/443/8080/8443)
|
||||||
|
|
||||||
### Gateway install fails with an error dialog
|
### Kiosk app update fails
|
||||||
|
|
||||||
The dialog shows the exact failure code. Common causes:
|
The kiosk checks for a new release every 6 hours and downloads it from GitHub. If the install fails:
|
||||||
|
|
||||||
| Code | Cause | Fix |
|
| Symptom | Fix |
|
||||||
|------|-------|-----|
|
|---------|-----|
|
||||||
| `STATUS_FAILURE` (1) | Generic install failure — often OEM restriction | Enable "Install from unknown sources" for the kiosk app in Android Settings |
|
| "Install from unknown sources" dialog | Enable the setting for the EverShelf Kiosk app in Android Settings |
|
||||||
| `STATUS_FAILURE_CONFLICT` (3) | Signature mismatch with existing install | Uninstall the old gateway app, then retry |
|
| Persistent failure after download | Force-stop the app, clear its data, and relaunch the update flow |
|
||||||
| `STATUS_FAILURE_STORAGE` (6) | Not enough storage | Free up space on the device |
|
| Not enough space | Free up storage on the device |
|
||||||
|
|
||||||
### Exit button (✕) is not visible
|
### Exit button (✕) is not visible
|
||||||
|
|
||||||
The ✕ button is injected into the header by the kiosk app. If the web app's header is covered or the page failed to load, try the hard refresh (↻) button. If neither is visible, triple-tap the page title area to access the developer settings.
|
Three buttons are always visible in the kiosk header overlay: **✕** (exit), **↻** (refresh), **⚙️** (settings). If the page failed to load entirely, tap **↻** first. If nothing is visible, restart the device.
|
||||||
|
|
||||||
### App is stuck in kiosk mode after a crash
|
### App is stuck in kiosk mode after a crash
|
||||||
|
|
||||||
@@ -139,7 +137,7 @@ The version is cached by the browser. Do a hard refresh:
|
|||||||
|
|
||||||
### Transactions are missing from the log
|
### Transactions are missing from the log
|
||||||
|
|
||||||
The log shows the last 50 entries by default. Tap "Carica altri" to load more. Entries older than the database creation date won't appear.
|
The log shows the last 50 entries by default. Tap **"Load more"** to load more. Entries older than the database creation date won't appear.
|
||||||
|
|
||||||
### "Can only undo transactions within 24 hours"
|
### "Can only undo transactions within 24 hours"
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ Shown as an inline AI badge next to the expiry estimate. Does not block the form
|
|||||||
|
|
||||||
### Recipe Generation
|
### Recipe Generation
|
||||||
|
|
||||||
Tap **🍳 Ricette** → **Genera ricetta** to get a recipe using:
|
Tap **🍳 Recipes** → **Generate Recipe** to get a recipe using:
|
||||||
- Ingredients about to expire (prioritised)
|
- Ingredients about to expire (prioritised)
|
||||||
- What's currently in your pantry
|
- What's currently in your pantry
|
||||||
- Your language preference
|
- Your language preference
|
||||||
@@ -83,9 +83,9 @@ Recipes stream live via Server-Sent Events so results appear as they are generat
|
|||||||
### AI Chat Assistant
|
### AI Chat Assistant
|
||||||
|
|
||||||
Open **💬 Chat** to ask questions like:
|
Open **💬 Chat** to ask questions like:
|
||||||
- "Cosa posso fare con le uova e la pasta?"
|
- "What can I make with eggs and pasta?"
|
||||||
- "Quanti giorni dura il prosciutto cotto aperto in frigo?"
|
- "How long does cooked ham last once opened in the fridge?"
|
||||||
- "Suggeriscimi uno spuntino veloce"
|
- "Suggest a quick snack"
|
||||||
|
|
||||||
The assistant knows your current inventory.
|
The assistant knows your current inventory.
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ Configure `BRING_EMAIL` and `BRING_PASSWORD` in `.env` to enable.
|
|||||||
|
|
||||||
## 🍳 Cooking Mode
|
## 🍳 Cooking Mode
|
||||||
|
|
||||||
Start cooking mode from any recipe by tapping **▶ Avvia cottura**.
|
Start cooking mode from any recipe by tapping **▶ Start Cooking**.
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ Start cooking mode from any recipe by tapping **▶ Avvia cottura**.
|
|||||||
- Custom REST endpoint (e.g. Home Assistant)
|
- Custom REST endpoint (e.g. Home Assistant)
|
||||||
- **Built-in timers** — automatic timer suggestions based on recipe text; 10-second vocal countdown warning before expiry
|
- **Built-in timers** — automatic timer suggestions based on recipe text; 10-second vocal countdown warning before expiry
|
||||||
- **Ingredient tracking** — mark ingredients as used; leftover quantities prompt a "move to another location" flow
|
- **Ingredient tracking** — mark ingredients as used; leftover quantities prompt a "move to another location" flow
|
||||||
- **Recipe completion** — "Buon appetito!" spoken on the last step
|
- **Recipe completion** — "Buon appetito!" *(Enjoy your meal!)* spoken on the last step
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -155,8 +155,8 @@ Actions per item: Use, Throw away, Edit, Dismiss. Swipe or tap arrows to navigat
|
|||||||
Highlights suspicious quantities (e.g. "You have 0 eggs but used 12 this month"). Actions:
|
Highlights suspicious quantities (e.g. "You have 0 eggs but used 12 this month"). Actions:
|
||||||
- One-tap correction to the suggested quantity
|
- One-tap correction to the suggested quantity
|
||||||
- Inline edit with free-form quantity
|
- Inline edit with free-form quantity
|
||||||
- "🤖 Spiega" for AI explanation
|
- "🤖 Explain" for AI explanation
|
||||||
- Dismiss (with current quantity shown: "La quantità è giusta (2 pz)")
|
- Dismiss (with current quantity shown: "The quantity is correct (2 pcs)")
|
||||||
|
|
||||||
### Anti-Waste Report
|
### Anti-Waste Report
|
||||||
|
|
||||||
|
|||||||
@@ -46,18 +46,21 @@ All data stays on your server. No cloud, no subscriptions.
|
|||||||
|
|
||||||
## 🆕 What's New
|
## 🆕 What's New
|
||||||
|
|
||||||
### v1.7.1 (2026-05-04)
|
### v1.7.13 (2026-05-16)
|
||||||
- Destructive actions ("Butta tutto", "Finisci tutto") now require a **5-second countdown confirmation** before executing
|
- **Fix:** Kiosk Settings button (⚙️) added to the web overlay — tapping the camera button no longer accidentally opens kiosk settings
|
||||||
- History undo button ↩ is now clearly visible (red tint, larger)
|
- **Fix:** Opened-item expiry badge is now consistent with the top banner: low-risk items (jams, condiments) show amber ⚠️ "Check soon" instead of misleading red ⛔ "Expired"
|
||||||
- Undo confirmation uses the in-app modal instead of the native browser `confirm()`
|
- **Cooking Mode:** 3D wheel UI with perspective card flip, ghost steps (prev/next), float animation, and full `prefers-reduced-motion` support
|
||||||
|
- **CI:** `data/category_ai_cache.json` added to `.gitignore`
|
||||||
|
- **Critical fix (DB):** Fresh-install crash resolved — `transactions` schema was missing the `undone` column
|
||||||
|
|
||||||
### v1.7.0 (2026-05-04)
|
### v1.7.12 (2026-05-13)
|
||||||
- Smart auto-discovery rewrite (kiosk)
|
- "Use first" banner now shows opening date and location instead of a confusing calculated expiry
|
||||||
- Gateway auto-pre-configuration after install
|
- "Use All / Done" in recipes no longer deletes the inventory row — uses exact quantity instead
|
||||||
- ErrorReporter init at setup start
|
- Scan page fully redesigned: 2× zoom, torch, camera flip, 3 input tabs, AI Number OCR, recent products chips
|
||||||
- Graceful Bring! no-key state
|
- Anomaly detection: false positives eliminated (untracked direction removed, minimum 5 txn + 7-day span)
|
||||||
- Use-quantity guard with shake animation
|
- AI price estimation for each Bring! shopping item with real-time dashboard total badge
|
||||||
- Demo mode (`?demo=1`)
|
- Kiosk v1.6.0: BLE scale gateway is now built-in — no separate APK needed
|
||||||
|
- Complete i18n: 934 keys per language
|
||||||
|
|
||||||
→ See the full [CHANGELOG](https://github.com/dadaloop82/EverShelf/blob/main/CHANGELOG.md)
|
→ See the full [CHANGELOG](https://github.com/dadaloop82/EverShelf/blob/main/CHANGELOG.md)
|
||||||
|
|
||||||
@@ -81,7 +84,7 @@ EverShelf/
|
|||||||
├── translations/ # i18n JSON files (it, en, de)
|
├── translations/ # i18n JSON files (it, en, de)
|
||||||
├── docs/openapi.yaml # OpenAPI 3.0 spec
|
├── docs/openapi.yaml # OpenAPI 3.0 spec
|
||||||
├── evershelf-kiosk/ # Android kiosk app (Kotlin)
|
├── evershelf-kiosk/ # Android kiosk app (Kotlin)
|
||||||
└── evershelf-scale-gateway/ # Android BLE gateway app (Kotlin)
|
└── evershelf-scale-gateway/ # Android BLE gateway app (Kotlin) — DEPRECATED, built into kiosk since v1.6.0
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
# ⚖️ Scale Gateway
|
# ⚠️ Scale Gateway — Deprecated
|
||||||
|
|
||||||
The EverShelf Scale Gateway is an Android app that bridges a Bluetooth LE smart scale to EverShelf, enabling automatic weight-based inventory tracking.
|
> **As of EverShelf Kiosk v1.6.0, BLE scale support is fully integrated into the Kiosk app.**
|
||||||
|
> You no longer need to install or configure this separate gateway.
|
||||||
|
>
|
||||||
|
> 📱 **Using the EverShelf Kiosk app?** → See [Android Kiosk](Android-Kiosk) — configure your scale in Step 5 of the setup wizard.
|
||||||
|
>
|
||||||
|
> 💻 **Not using the kiosk app?** The legacy gateway APK below still works for non-kiosk setups, but receives no new updates.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Scale Gateway (legacy)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -52,8 +61,6 @@ The Gateway runs a local WebSocket server on port **8765**. The EverShelf server
|
|||||||
|
|
||||||
Download and install the APK. You may need to enable "Install from unknown sources" in Android Settings.
|
Download and install the APK. You may need to enable "Install from unknown sources" in Android Settings.
|
||||||
|
|
||||||
> **Kiosk users:** the Setup Wizard installs the gateway automatically in Step 5.
|
|
||||||
|
|
||||||
### 2. Launch the app
|
### 2. Launch the app
|
||||||
|
|
||||||
The gateway server starts immediately. Note the **Gateway URL** shown (e.g. `ws://192.168.1.100:8765`).
|
The gateway server starts immediately. Note the **Gateway URL** shown (e.g. `ws://192.168.1.100:8765`).
|
||||||
@@ -68,7 +75,7 @@ In EverShelf **Settings → Scale**:
|
|||||||
|
|
||||||
### 4. Connect your scale
|
### 4. Connect your scale
|
||||||
|
|
||||||
Tap **"Cerca Bilance Bluetooth"** (Find Bluetooth Scales). Make sure your scale is powered on. Tap it in the list to pair and connect.
|
Tap **"Find Bluetooth Scales"**. Make sure your scale is powered on. Tap it in the list to pair and connect.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -77,7 +84,7 @@ Tap **"Cerca Bilance Bluetooth"** (Find Bluetooth Scales). Make sure your scale
|
|||||||
When scale integration is enabled:
|
When scale integration is enabled:
|
||||||
|
|
||||||
1. Open the **Add** or **Use** form for any product with unit `g` or `ml`
|
1. Open the **Add** or **Use** form for any product with unit `g` or `ml`
|
||||||
2. A **"⚖️ Leggi bilancia"** button appears
|
2. A **"⚖️ Read Scale"** button appears
|
||||||
3. Tap it — a live weight display appears with a stability indicator
|
3. Tap it — a live weight display appears with a stability indicator
|
||||||
4. Step on or place the product on the scale
|
4. Step on or place the product on the scale
|
||||||
5. When the reading stabilizes, a **5-second countdown** starts
|
5. When the reading stabilizes, a **5-second countdown** starts
|
||||||
@@ -120,7 +127,7 @@ Every 6 hours the gateway app checks GitHub releases. If a newer version is avai
|
|||||||
### Weight not appearing in EverShelf
|
### Weight not appearing in EverShelf
|
||||||
- Confirm the Gateway URL in EverShelf Settings matches the URL shown in the gateway app
|
- Confirm the Gateway URL in EverShelf Settings matches the URL shown in the gateway app
|
||||||
- Check that the Android device and the EverShelf server are on the same network
|
- Check that the Android device and the EverShelf server are on the same network
|
||||||
- Tap "Disconnetti / Riconnetti" in the gateway app to refresh the WebSocket connection
|
- Tap "Disconnect / Reconnect" in the gateway app to refresh the WebSocket connection
|
||||||
|
|
||||||
### "Mixed content" error in browser
|
### "Mixed content" error in browser
|
||||||
- Make sure you are accessing EverShelf over HTTPS (not plain HTTP)
|
- Make sure you are accessing EverShelf over HTTPS (not plain HTTP)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ The kiosk app is fully self-contained. No separate gateway app is required.
|
|||||||
3. Choose your language
|
3. Choose your language
|
||||||
4. Grant camera, microphone and Bluetooth permissions when prompted
|
4. Grant camera, microphone and Bluetooth permissions when prompted
|
||||||
5. Enter your EverShelf server URL (e.g. `https://192.168.1.100/dispensa`) or use auto-discovery
|
5. Enter your EverShelf server URL (e.g. `https://192.168.1.100/dispensa`) or use auto-discovery
|
||||||
6. If you have a Bluetooth scale: tap **"Sì, ho una bilancia"**, wait for the BLE scan, then tap your scale in the list
|
6. If you have a Bluetooth scale: tap **"Yes, I have a scale"**, wait for the BLE scan, then tap your scale in the list
|
||||||
7. Done — the web app loads in full-screen kiosk mode
|
7. Done — the web app loads in full-screen kiosk mode
|
||||||
|
|
||||||
### Scale Configuration
|
### Scale Configuration
|
||||||
@@ -76,7 +76,7 @@ BLE scale setup happens inside the kiosk app itself — **no external app needed
|
|||||||
|
|
||||||
### Exiting Kiosk Mode
|
### Exiting Kiosk Mode
|
||||||
|
|
||||||
Tap the **✕** button in the header. A confirmation dialog appears — tap "Esci" to exit.
|
Tap the **✕** button in the header. A confirmation dialog appears — tap **"Exit"** to confirm.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId = "it.dadaloop.evershelf.kiosk"
|
applicationId = "it.dadaloop.evershelf.kiosk"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 11
|
versionCode = 16
|
||||||
versionName = "1.7.0"
|
versionName = "1.7.15"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package it.dadaloop.evershelf.kiosk
|
package it.dadaloop.evershelf.kiosk
|
||||||
|
|
||||||
|
import android.app.ActivityManager
|
||||||
|
import android.app.ApplicationExitInfo
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.io.OutputStreamWriter
|
import java.io.OutputStreamWriter
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
@@ -40,7 +43,9 @@ object ErrorReporter {
|
|||||||
|
|
||||||
// SharedPreferences for crash persistence
|
// SharedPreferences for crash persistence
|
||||||
private const val PREFS_NAME = "evershelf_kiosk_errors"
|
private const val PREFS_NAME = "evershelf_kiosk_errors"
|
||||||
private const val KEY_PENDING = "pending_crash_json"
|
private const val KEY_PENDING = "pending_crash_json"
|
||||||
|
private const val KEY_WAS_RUNNING = "was_running_dirty"
|
||||||
|
private const val KEY_LAST_EXIT_TS = "last_reported_exit_ts"
|
||||||
|
|
||||||
private val executor = Executors.newSingleThreadExecutor()
|
private val executor = Executors.newSingleThreadExecutor()
|
||||||
|
|
||||||
@@ -76,6 +81,9 @@ object ErrorReporter {
|
|||||||
// Send any crash that was saved to prefs during a previous session
|
// Send any crash that was saved to prefs during a previous session
|
||||||
sendPendingCrash()
|
sendPendingCrash()
|
||||||
|
|
||||||
|
// Detect ANR / OOM / native crashes from the previous run
|
||||||
|
detectPreviousCrash()
|
||||||
|
|
||||||
// Install a global UncaughtExceptionHandler so ANY unhandled crash is reported
|
// Install a global UncaughtExceptionHandler so ANY unhandled crash is reported
|
||||||
val previousHandler = Thread.getDefaultUncaughtExceptionHandler()
|
val previousHandler = Thread.getDefaultUncaughtExceptionHandler()
|
||||||
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
||||||
@@ -96,6 +104,17 @@ object ErrorReporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call from Activity.onDestroy() on a *clean* exit (back-pressed, settings, shutdown).
|
||||||
|
* Clears the dirty-launch sentinel so the next start does not report a false positive.
|
||||||
|
*/
|
||||||
|
fun markCleanStop() {
|
||||||
|
if (::appContext.isInitialized) {
|
||||||
|
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||||
|
.edit().putBoolean(KEY_WAS_RUNNING, false).apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report a caught [Throwable] asynchronously (does not block UI thread).
|
* Report a caught [Throwable] asynchronously (does not block UI thread).
|
||||||
*/
|
*/
|
||||||
@@ -132,6 +151,96 @@ object ErrorReporter {
|
|||||||
|
|
||||||
// ── Internal ─────────────────────────────────────────────────────────────
|
// ── Internal ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detects whether the *previous* run of the app ended with a crash, ANR or OOM kill.
|
||||||
|
*
|
||||||
|
* On Android 11+ (API 30) we use [ActivityManager.getHistoricalProcessExitReasons] which
|
||||||
|
* gives the exact reason and (for Java crashes) a stack trace.
|
||||||
|
*
|
||||||
|
* On Android 7–10 we use a "dirty-launch sentinel": a boolean in SharedPreferences that is
|
||||||
|
* set to `true` on every start and `false` only when the activity is destroyed cleanly via
|
||||||
|
* [markCleanStop]. If it is still `true` on the next start, the previous run was not clean.
|
||||||
|
*/
|
||||||
|
private fun detectPreviousCrash() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
detectExitReasonApi30()
|
||||||
|
} else {
|
||||||
|
// API 24–29: dirty-launch sentinel
|
||||||
|
val prefs = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||||
|
if (prefs.getBoolean(KEY_WAS_RUNNING, false)) {
|
||||||
|
reportAsync(
|
||||||
|
type = "crash-sentinel",
|
||||||
|
message = "App was not cleanly shut down on previous run (ANR / OOM / native crash suspected).",
|
||||||
|
stack = "",
|
||||||
|
context = mapOf(
|
||||||
|
"device" to deviceInfo,
|
||||||
|
"note" to "Detected via dirty-launch sentinel (API ${Build.VERSION.SDK_INT})"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Mark this launch as running — will be cleared by markCleanStop() on clean exit
|
||||||
|
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||||
|
.edit().putBoolean(KEY_WAS_RUNNING, true).apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.R)
|
||||||
|
private fun detectExitReasonApi30() {
|
||||||
|
try {
|
||||||
|
val am = appContext.getSystemService(ActivityManager::class.java) ?: return
|
||||||
|
// Check the last 5 exits; stop at the first we already reported
|
||||||
|
val exits = am.getHistoricalProcessExitReasons(null, 0, 5)
|
||||||
|
if (exits.isEmpty()) return
|
||||||
|
|
||||||
|
val prefs = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||||
|
val lastReportedTs = prefs.getLong(KEY_LAST_EXIT_TS, 0L)
|
||||||
|
|
||||||
|
val crashReasons = setOf(
|
||||||
|
ApplicationExitInfo.REASON_CRASH,
|
||||||
|
ApplicationExitInfo.REASON_CRASH_NATIVE,
|
||||||
|
ApplicationExitInfo.REASON_ANR,
|
||||||
|
ApplicationExitInfo.REASON_LOW_MEMORY
|
||||||
|
)
|
||||||
|
|
||||||
|
var newestTs = lastReportedTs
|
||||||
|
for (exit in exits) {
|
||||||
|
if (exit.timestamp <= lastReportedTs) continue // already reported
|
||||||
|
if (exit.reason !in crashReasons) continue
|
||||||
|
|
||||||
|
val reasonName = when (exit.reason) {
|
||||||
|
ApplicationExitInfo.REASON_CRASH -> "crash-java"
|
||||||
|
ApplicationExitInfo.REASON_CRASH_NATIVE -> "crash-native"
|
||||||
|
ApplicationExitInfo.REASON_ANR -> "anr"
|
||||||
|
ApplicationExitInfo.REASON_LOW_MEMORY -> "oom-kill"
|
||||||
|
else -> "exit-${exit.reason}"
|
||||||
|
}
|
||||||
|
val msg = exit.description?.takeIf { it.isNotEmpty() }
|
||||||
|
?: "${exit.processName ?: "app"} terminated (reason ${exit.reason})"
|
||||||
|
|
||||||
|
// Java crashes include a tombstone trace — read up to 4KB
|
||||||
|
var stack = ""
|
||||||
|
try {
|
||||||
|
exit.traceInputStream?.bufferedReader()?.use { stack = it.readText().take(4000) }
|
||||||
|
} catch (_: Exception) {}
|
||||||
|
|
||||||
|
val ctx = mutableMapOf<String, Any?>(
|
||||||
|
"device" to deviceInfo,
|
||||||
|
"reason" to exit.reason,
|
||||||
|
"process" to (exit.processName ?: ""),
|
||||||
|
"crash_ts" to SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date(exit.timestamp)),
|
||||||
|
"note" to "Detected via ApplicationExitInfo on restart (API ${Build.VERSION.SDK_INT})"
|
||||||
|
)
|
||||||
|
reportAsync(type = reasonName, message = msg, stack = stack, context = ctx)
|
||||||
|
|
||||||
|
if (exit.timestamp > newestTs) newestTs = exit.timestamp
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newestTs > lastReportedTs) {
|
||||||
|
prefs.edit().putLong(KEY_LAST_EXIT_TS, newestTs).apply()
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {}
|
||||||
|
}
|
||||||
|
|
||||||
private fun fingerprint(type: String, message: String): String {
|
private fun fingerprint(type: String, message: String): String {
|
||||||
val key = "$type:${message.take(120)}"
|
val key = "$type:${message.take(120)}"
|
||||||
return key.hashCode().toString(16)
|
return key.hashCode().toString(16)
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
private val pollHandler = Handler(Looper.getMainLooper())
|
private val pollHandler = Handler(Looper.getMainLooper())
|
||||||
private var activeDownloadId: Long = -1
|
private var activeDownloadId: Long = -1
|
||||||
|
|
||||||
|
// Periodic update-check handler (fires every 30 min; internal throttle in checkForUpdates limits real API calls to every 6h)
|
||||||
|
private val updateCheckHandler = Handler(Looper.getMainLooper())
|
||||||
|
private val updateCheckRunnable = Runnable { schedulePeriodicUpdateCheck() }
|
||||||
|
private val UPDATE_CHECK_INTERVAL_MS = 30L * 60 * 1000 // 30 minutes
|
||||||
|
|
||||||
|
private fun schedulePeriodicUpdateCheck() {
|
||||||
|
checkForUpdates(forceCheck = false)
|
||||||
|
updateCheckHandler.postDelayed(updateCheckRunnable, UPDATE_CHECK_INTERVAL_MS)
|
||||||
|
}
|
||||||
|
|
||||||
// File chooser
|
// File chooser
|
||||||
private var fileChooserCallback: ValueCallback<Array<Uri>>? = null
|
private var fileChooserCallback: ValueCallback<Array<Uri>>? = null
|
||||||
|
|
||||||
@@ -104,6 +114,9 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
private const val KIOSK_DOWNLOAD_URL = "https://github.com/dadaloop82/EverShelf/releases/download/kiosk-latest/evershelf-kiosk.apk"
|
private const val KIOSK_DOWNLOAD_URL = "https://github.com/dadaloop82/EverShelf/releases/download/kiosk-latest/evershelf-kiosk.apk"
|
||||||
private const val SPLASH_DURATION = 1500L
|
private const val SPLASH_DURATION = 1500L
|
||||||
private const val GITHUB_RELEASES_API = "https://api.github.com/repos/dadaloop82/EverShelf/releases/latest"
|
private const val GITHUB_RELEASES_API = "https://api.github.com/repos/dadaloop82/EverShelf/releases/latest"
|
||||||
|
// Keys for persisting a pending update across restarts
|
||||||
|
private const val KEY_PENDING_UPDATE_VERSION = "pending_update_version"
|
||||||
|
private const val KEY_PENDING_UPDATE_URL = "pending_update_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context) {
|
override fun attachBaseContext(newBase: Context) {
|
||||||
@@ -492,6 +505,27 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
if (apkUrl.isBlank()) return
|
if (apkUrl.isBlank()) return
|
||||||
runOnUiThread { triggerApkDownload(apkUrl) }
|
runOnUiThread { triggerApkDownload(apkUrl) }
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Called by the webapp when a modal is shown / hidden so the native settings
|
||||||
|
* button does not intercept touches that belong to the HTML modal content.
|
||||||
|
*/
|
||||||
|
@JavascriptInterface
|
||||||
|
fun setNativeSettingsVisible(visible: Boolean) {
|
||||||
|
runOnUiThread {
|
||||||
|
btnSettings.visibility = if (visible) View.VISIBLE else View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Open the native SettingsActivity from the webapp settings page.
|
||||||
|
* Allows configuring server URL, BLE scale and screensaver without
|
||||||
|
* the user having to find the native gear button.
|
||||||
|
*/
|
||||||
|
@JavascriptInterface
|
||||||
|
fun openNativeSettings() {
|
||||||
|
runOnUiThread {
|
||||||
|
startActivity(Intent(this@KioskActivity, SettingsActivity::class.java))
|
||||||
|
}
|
||||||
|
}
|
||||||
}, "_kioskBridge")
|
}, "_kioskBridge")
|
||||||
|
|
||||||
val url = prefs.getString(KEY_URL, "http://evershelf.local") ?: "http://evershelf.local"
|
val url = prefs.getString(KEY_URL, "http://evershelf.local") ?: "http://evershelf.local"
|
||||||
@@ -638,7 +672,17 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
notifyJs(result)
|
notifyJs(result)
|
||||||
|
|
||||||
if (!kioskNeedsUpdate) return@Thread
|
if (!kioskNeedsUpdate) {
|
||||||
|
// Clear any stale pending update if the current version is now up to date
|
||||||
|
prefs.edit().remove(KEY_PENDING_UPDATE_VERSION).remove(KEY_PENDING_UPDATE_URL).apply()
|
||||||
|
return@Thread
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist the pending update so the banner reappears after a crash/restart
|
||||||
|
prefs.edit()
|
||||||
|
.putString(KEY_PENDING_UPDATE_VERSION, latestTag)
|
||||||
|
.putString(KEY_PENDING_UPDATE_URL, kioskApkUrl)
|
||||||
|
.apply()
|
||||||
|
|
||||||
val label = if (isSemver) "$currentKiosk → $latestTag" else latestTag
|
val label = if (isSemver) "$currentKiosk → $latestTag" else latestTag
|
||||||
runOnUiThread { showNativeUpdateBanner("🔄 Kiosk $label", kioskApkUrl) }
|
runOnUiThread { showNativeUpdateBanner("🔄 Kiosk $label", kioskApkUrl) }
|
||||||
@@ -648,6 +692,33 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On resume: if a previous session detected an available update and saved it to prefs,
|
||||||
|
* restore the update banner immediately without a network round-trip.
|
||||||
|
*/
|
||||||
|
private fun restorePendingUpdateBanner() {
|
||||||
|
val savedVersion = prefs.getString(KEY_PENDING_UPDATE_VERSION, null) ?: return
|
||||||
|
val savedUrl = prefs.getString(KEY_PENDING_UPDATE_URL, null) ?: return
|
||||||
|
val currentKiosk = try { packageManager.getPackageInfo(packageName, 0).versionName ?: "" } catch (_: Exception) { "" }
|
||||||
|
// Normalise: strip non-numeric prefix for comparison
|
||||||
|
val norm = { v: String -> v.replace(Regex("^[^0-9]*"), "") }
|
||||||
|
fun semverNewer(remote: String, local: String): Boolean {
|
||||||
|
val r = remote.split(".").map { it.filter(Char::isDigit).toIntOrNull() ?: 0 }
|
||||||
|
val l = local.split(".").map { it.filter(Char::isDigit).toIntOrNull() ?: 0 }
|
||||||
|
for (i in 0 until maxOf(r.size, l.size)) {
|
||||||
|
val rv = r.getOrElse(i) { 0 }; val lv = l.getOrElse(i) { 0 }
|
||||||
|
if (rv != lv) return rv > lv
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (currentKiosk.isNotEmpty() && semverNewer(norm(savedVersion), norm(currentKiosk))) {
|
||||||
|
showNativeUpdateBanner("🔄 Kiosk $currentKiosk → $savedVersion", savedUrl)
|
||||||
|
} else {
|
||||||
|
// Update was installed or is no longer applicable — clear the saved entry
|
||||||
|
prefs.edit().remove(KEY_PENDING_UPDATE_VERSION).remove(KEY_PENDING_UPDATE_URL).apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun showNativeUpdateBanner(message: String, apkDownloadUrl: String) {
|
private fun showNativeUpdateBanner(message: String, apkDownloadUrl: String) {
|
||||||
pendingApkDownloadUrl = apkDownloadUrl
|
pendingApkDownloadUrl = apkDownloadUrl
|
||||||
tvUpdateMessage.text = "⬆️ Aggiornamento disponibile: $message"
|
tvUpdateMessage.text = "⬆️ Aggiornamento disponibile: $message"
|
||||||
@@ -952,6 +1023,16 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
// Re-apply screensaver flag in case the user changed it in Settings
|
// Re-apply screensaver flag in case the user changed it in Settings
|
||||||
applyScreensaverFlag()
|
applyScreensaverFlag()
|
||||||
}
|
}
|
||||||
|
// Show banner immediately if there is a pending update detected in a previous session
|
||||||
|
restorePendingUpdateBanner()
|
||||||
|
// Start (or restart) the periodic update check
|
||||||
|
updateCheckHandler.removeCallbacks(updateCheckRunnable)
|
||||||
|
updateCheckHandler.postDelayed(updateCheckRunnable, UPDATE_CHECK_INTERVAL_MS)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
updateCheckHandler.removeCallbacks(updateCheckRunnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@@ -1040,6 +1121,8 @@ class KioskActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
ErrorReporter.markCleanStop()
|
||||||
|
updateCheckHandler.removeCallbacks(updateCheckRunnable)
|
||||||
tts?.stop()
|
tts?.stop()
|
||||||
tts?.shutdown()
|
tts?.shutdown()
|
||||||
tts = null
|
tts = null
|
||||||
|
|||||||
@@ -43,17 +43,18 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<!-- Settings gear (shown after setup, over WebView) — top-right corner to avoid overlapping modals -->
|
<!-- Settings gear (shown after setup, over WebView) — bottom-right corner so it never
|
||||||
|
overlaps the webapp header buttons (e.g. the 📷 scan button at top-right) -->
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/btnSettings"
|
android:id="@+id/btnSettings"
|
||||||
android:layout_width="44dp"
|
android:layout_width="44dp"
|
||||||
android:layout_height="44dp"
|
android:layout_height="44dp"
|
||||||
android:layout_gravity="top|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginBottom="80dp"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:src="@android:drawable/ic_menu_manage"
|
android:src="@android:drawable/ic_menu_manage"
|
||||||
android:alpha="0.12"
|
android:alpha="0.28"
|
||||||
android:contentDescription="Settings"
|
android:contentDescription="Settings"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
# Build trigger: versionName 1.7.13 fix (8d87494)
|
||||||
# Build trigger: TTS bridge fix (95389eb)
|
# Build trigger: TTS bridge fix (95389eb)
|
||||||
|
# Build trigger: v1.7.14 with openNativeSettings fix (834d8ef)
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
.gradle/
|
|
||||||
build/
|
|
||||||
local.properties
|
|
||||||
*.apk
|
|
||||||
*.aab
|
|
||||||
*.class
|
|
||||||
*.dex
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
# ~~EverShelf Scale Gateway~~ — DEPRECATED
|
|
||||||
|
|
||||||
> ⚠️ **This app is deprecated and no longer maintained.**
|
|
||||||
>
|
|
||||||
> As of **EverShelf Kiosk v1.6.0**, BLE scale support is fully integrated into the kiosk app itself. You no longer need to install or configure this separate gateway app.
|
|
||||||
>
|
|
||||||
> **If you are using the EverShelf Kiosk app** → the scale gateway runs automatically as a background service. Configure your Bluetooth scale in **step 4 of the setup wizard**.
|
|
||||||
>
|
|
||||||
> **If you are NOT using the kiosk app** (standalone Android tablet) → you may still use this APK, but no new releases will be published.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# EverShelf Scale Gateway (legacy)
|
|
||||||
|
|
||||||
> Android gateway app that bridges Bluetooth LE smart scales with EverShelf via WebSocket.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## How it works
|
|
||||||
|
|
||||||
```
|
|
||||||
Smart Scale ──(BLE)──► Android Gateway App ──(WebSocket/LAN)──► EverShelf Server ──(SSE)──► Browser
|
|
||||||
```
|
|
||||||
|
|
||||||
The app runs a local WebSocket server (port **8765**) on your Android device. The EverShelf server connects to it via a server-side relay (`api/scale_relay.php` SSE + `api/scale_ping.php` WebSocket client), avoiding mixed-content (HTTPS→WS) issues. Weight readings are streamed to the browser in real time.
|
|
||||||
|
|
||||||
> **Kiosk integration (v1.6.0+):** The gateway is now **built into the EverShelf Kiosk app** as a foreground service. This separate app is not needed when using the kiosk.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Supported scale protocols
|
|
||||||
|
|
||||||
| Protocol | Service UUID | Notes |
|
|
||||||
|---|---|---|
|
|
||||||
| **Bluetooth SIG Weight Scale** | `0x181D` / char `0x2A9D` | Most compatible; works with most smart scales |
|
|
||||||
| **Bluetooth SIG Body Composition** | `0x181B` / char `0x2A9C` | Reports weight + body fat %, BMI |
|
|
||||||
| **Generic fallback** | Any notifiable characteristic | Auto-heuristic parsing for 100+ models |
|
|
||||||
|
|
||||||
### Verified compatible scales (community list)
|
|
||||||
- Xiaomi Mi Body Composition Scale 2
|
|
||||||
- Renpho Smart Body Fat Scale
|
|
||||||
- INEVIFIT Smart Body Fat Scale
|
|
||||||
- Any OpenScale-compatible scale (see [openScale supported devices](https://github.com/oliexdev/openScale/wiki/Supported-scales))
|
|
||||||
|
|
||||||
> **Your scale (B09MRXVBV6):** If it implements the standard BLE Weight Scale or Body Composition profile (very likely for modern Amazon smart scales), the gateway will connect automatically. If not, check the [openScale wiki](https://github.com/oliexdev/openScale/wiki/Supported-scales) and open an issue.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Download
|
|
||||||
|
|
||||||
Download the latest APK directly: **[evershelf-scale-gateway.apk](https://github.com/dadaloop82/EverShelf/releases/latest/download/evershelf-scale-gateway.apk)**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- Android **7.0** (API 24) or later
|
|
||||||
- Bluetooth LE (BLE) support
|
|
||||||
- Both the Android device and the device running EverShelf must be on the **same Wi-Fi network**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Setup (step by step)
|
|
||||||
|
|
||||||
### 1. Install the APK
|
|
||||||
Download and install the APK from the Releases page. You may need to allow "Install from unknown sources" in Android settings.
|
|
||||||
|
|
||||||
### 2. Launch the app
|
|
||||||
The app starts the WebSocket gateway server immediately. You will see the **gateway URL** (e.g. `ws://192.168.1.100:8765`) at the top.
|
|
||||||
|
|
||||||
### 3. Connect your scale
|
|
||||||
Tap **"Cerca Bilance Bluetooth"** (Find Bluetooth Scales). Make sure your scale is turned on. Tap it in the list to connect.
|
|
||||||
|
|
||||||
### 4. Configure EverShelf
|
|
||||||
In EverShelf → ⚙️ Settings → **⚖️ Bilancia Smart**:
|
|
||||||
1. Enable the toggle
|
|
||||||
2. Paste the gateway URL shown in the Android app
|
|
||||||
3. Tap **"Testa connessione"** — you should see ✅
|
|
||||||
|
|
||||||
### 5. Use it
|
|
||||||
When adding or consuming a product with unit **g** or **ml**, a **"⚖️ Leggi dalla bilancia"** button appears. Tap it, place the product on the scale, and the weight is filled in automatically.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## WebSocket protocol reference
|
|
||||||
|
|
||||||
All messages are JSON. The server sends these to connected clients:
|
|
||||||
|
|
||||||
```json
|
|
||||||
// Scale status update
|
|
||||||
{"type":"status","state":"connected","device":"Mi Scale 2","battery":85}
|
|
||||||
{"type":"status","state":"disconnected"}
|
|
||||||
|
|
||||||
// Weight reading (broadcast continuously while scale is active)
|
|
||||||
{"type":"weight","value":72.50,"unit":"kg","stable":true,"timestamp":1712345678000}
|
|
||||||
|
|
||||||
// Response to ping
|
|
||||||
{"type":"pong"}
|
|
||||||
```
|
|
||||||
|
|
||||||
Clients can send:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{"type":"get_status"} // Request current status
|
|
||||||
{"type":"get_weight"} // Request next stable weight reading
|
|
||||||
{"type":"ping"} // Keep-alive
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Build from source
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
- Android Studio Hedgehog (2023.1) or later
|
|
||||||
- Java 8+
|
|
||||||
|
|
||||||
### Steps
|
|
||||||
```bash
|
|
||||||
# 1. Clone the repo
|
|
||||||
git clone https://github.com/dadaloop82/EverShelf.git
|
|
||||||
cd EverShelf/evershelf-scale-gateway
|
|
||||||
|
|
||||||
# 2. Download the Gradle wrapper (if not included)
|
|
||||||
gradle wrapper --gradle-version 8.4
|
|
||||||
|
|
||||||
# 3. Build debug APK
|
|
||||||
./gradlew assembleDebug
|
|
||||||
|
|
||||||
# APK is at: app/build/outputs/apk/debug/app-debug.apk
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Project structure
|
|
||||||
|
|
||||||
```
|
|
||||||
evershelf-scale-gateway/
|
|
||||||
├── app/src/main/
|
|
||||||
│ ├── kotlin/it/dadaloop/evershelf/scalegate/
|
|
||||||
│ │ ├── MainActivity.kt — UI, orchestration
|
|
||||||
│ │ ├── BleScaleManager.kt — BLE scanning & GATT connection
|
|
||||||
│ │ ├── ScaleProtocol.kt — Parsing for all supported protocols
|
|
||||||
│ │ └── GatewayWebSocketServer.kt — WebSocket server (Java-WebSocket)
|
|
||||||
│ ├── res/layout/
|
|
||||||
│ │ ├── activity_main.xml
|
|
||||||
│ │ └── item_device.xml
|
|
||||||
│ └── AndroidManifest.xml
|
|
||||||
├── build.gradle.kts
|
|
||||||
└── settings.gradle.kts
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT — see [LICENSE](../LICENSE)
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("com.android.application")
|
|
||||||
id("org.jetbrains.kotlin.android")
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "it.dadaloop.evershelf.scalegate"
|
|
||||||
compileSdk = 34
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId = "it.dadaloop.evershelf.scalegate"
|
|
||||||
minSdk = 24
|
|
||||||
targetSdk = 34
|
|
||||||
versionCode = 8
|
|
||||||
versionName = "2.1.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildFeatures {
|
|
||||||
viewBinding = true
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("androidx.core:core-ktx:1.12.0")
|
|
||||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
||||||
implementation("com.google.android.material:material:1.11.0")
|
|
||||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
||||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
|
||||||
// WebSocket server
|
|
||||||
implementation("org.java-websocket:Java-WebSocket:1.5.5")
|
|
||||||
// Coroutines
|
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<!-- BLE permissions for Android < 12 -->
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH"
|
|
||||||
android:maxSdkVersion="30" />
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
|
|
||||||
android:maxSdkVersion="30" />
|
|
||||||
|
|
||||||
<!-- BLE permissions for Android 12+ -->
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
|
|
||||||
android:usesPermissionFlags="neverForLocation" />
|
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
|
|
||||||
|
|
||||||
<!-- Location (required for BLE scanning on Android 6–11) -->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
||||||
|
|
||||||
<!-- Network (for WebSocket server) -->
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
||||||
|
|
||||||
<!-- Keep screen on while gateway is active -->
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
|
|
||||||
<!-- Self-update: install APK downloaded at runtime -->
|
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:exported="true"
|
|
||||||
android:screenOrientation="portrait"
|
|
||||||
android:windowSoftInputMode="adjustResize">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<!-- FileProvider for serving the downloaded APK to the installer -->
|
|
||||||
<provider
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="${applicationId}.provider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/file_paths" />
|
|
||||||
</provider>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,455 +0,0 @@
|
|||||||
package it.dadaloop.evershelf.scalegate
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.bluetooth.*
|
|
||||||
import android.bluetooth.le.*
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
|
|
||||||
private const val TAG = "BleScaleManager"
|
|
||||||
private const val SCAN_PERIOD_MS = 15_000L
|
|
||||||
private const val PREFS_NAME = "evershelf_gateway"
|
|
||||||
private const val PREF_LAST_DEVICE = "last_device_address"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a discovered BLE device during scan.
|
|
||||||
*/
|
|
||||||
data class BleDeviceInfo(
|
|
||||||
val device: BluetoothDevice,
|
|
||||||
val name: String,
|
|
||||||
val rssi: Int,
|
|
||||||
val proximity: String,
|
|
||||||
val scaleScore: Int,
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback interface for BLE events dispatched back to the UI.
|
|
||||||
*/
|
|
||||||
interface BleScaleListener {
|
|
||||||
fun onDeviceFound(info: BleDeviceInfo)
|
|
||||||
fun onConnecting(device: BluetoothDevice)
|
|
||||||
fun onConnected(deviceName: String)
|
|
||||||
fun onDisconnected()
|
|
||||||
fun onWeightReceived(reading: WeightReading)
|
|
||||||
fun onBatteryReceived(level: Int)
|
|
||||||
fun onError(message: String)
|
|
||||||
fun onScanStopped()
|
|
||||||
fun onDebugEvent(message: String)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manages BLE scanning and connection to a smart scale.
|
|
||||||
* All listener callbacks are dispatched on the main thread.
|
|
||||||
*/
|
|
||||||
class BleScaleManager(
|
|
||||||
private val context: Context,
|
|
||||||
private val listener: BleScaleListener,
|
|
||||||
) {
|
|
||||||
private val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
|
||||||
private val bluetoothAdapter: BluetoothAdapter? get() = bluetoothManager.adapter
|
|
||||||
private val mainHandler = Handler(Looper.getMainLooper())
|
|
||||||
|
|
||||||
private var leScanner: BluetoothLeScanner? = null
|
|
||||||
private var gatt: BluetoothGatt? = null
|
|
||||||
private var isScanning = false
|
|
||||||
private var connectedDeviceName: String = ""
|
|
||||||
private var autoConnectAddress: String? = null
|
|
||||||
|
|
||||||
// The characteristics we will subscribe to (multiple may exist).
|
|
||||||
private val pendingSubscriptions = ArrayDeque<BluetoothGattCharacteristic>()
|
|
||||||
|
|
||||||
// ─── Public state ──────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
val isConnected: Boolean get() = gatt != null && connectedDeviceName.isNotEmpty()
|
|
||||||
|
|
||||||
// ─── Saved device (auto-reconnect) ─────────────────────────────────────────
|
|
||||||
|
|
||||||
fun getSavedDeviceAddress(): String? {
|
|
||||||
return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
||||||
.getString(PREF_LAST_DEVICE, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun saveDeviceAddress(address: String) {
|
|
||||||
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
||||||
.edit().putString(PREF_LAST_DEVICE, address).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun enableAutoConnect() {
|
|
||||||
autoConnectAddress = getSavedDeviceAddress()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Permissions helper ────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
fun hasRequiredPermissions(): Boolean {
|
|
||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
||||||
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED &&
|
|
||||||
ContextCompat.checkSelfPermission(context, Manifest.permission.BLUETOOTH_CONNECT) == PackageManager.PERMISSION_GRANTED
|
|
||||||
} else {
|
|
||||||
ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Scanning ──────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
fun startScan() {
|
|
||||||
val adapter = bluetoothAdapter ?: run {
|
|
||||||
listener.onError("Bluetooth not available on this device.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!adapter.isEnabled) {
|
|
||||||
listener.onError("Bluetooth is off. Enable it and try again.")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (isScanning) stopScan()
|
|
||||||
|
|
||||||
leScanner = adapter.bluetoothLeScanner
|
|
||||||
val settings = ScanSettings.Builder()
|
|
||||||
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
|
|
||||||
.build()
|
|
||||||
|
|
||||||
// No service UUID filters — many consumer scales use proprietary UUIDs
|
|
||||||
// and would be invisible with strict filtering. We show all named BLE devices.
|
|
||||||
isScanning = true
|
|
||||||
try {
|
|
||||||
leScanner?.startScan(null, settings, scanCallback)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
leScanner?.startScan(scanCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto-stop after SCAN_PERIOD_MS
|
|
||||||
mainHandler.postDelayed({
|
|
||||||
stopScan()
|
|
||||||
listener.onScanStopped()
|
|
||||||
}, SCAN_PERIOD_MS)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun stopScan() {
|
|
||||||
if (!isScanning) return
|
|
||||||
isScanning = false
|
|
||||||
try {
|
|
||||||
leScanner?.stopScan(scanCallback)
|
|
||||||
} catch (e: Exception) { /* ignore */ }
|
|
||||||
leScanner = null
|
|
||||||
}
|
|
||||||
|
|
||||||
private val scanCallback = object : ScanCallback() {
|
|
||||||
override fun onScanResult(callbackType: Int, result: ScanResult) {
|
|
||||||
val device = result.device
|
|
||||||
val name = result.scanRecord?.deviceName?.takeIf { it.isNotBlank() }
|
|
||||||
?: getDeviceName(device)
|
|
||||||
val proximity = rssiToProximity(result.rssi)
|
|
||||||
val score = scoreLikelyScale(name, result.scanRecord)
|
|
||||||
val info = BleDeviceInfo(device, name, result.rssi, proximity, score)
|
|
||||||
mainHandler.post { listener.onDeviceFound(info) }
|
|
||||||
|
|
||||||
// Auto-connect to saved device
|
|
||||||
if (autoConnectAddress != null && device.address == autoConnectAddress && !isConnected) {
|
|
||||||
autoConnectAddress = null // prevent re-trigger
|
|
||||||
mainHandler.post {
|
|
||||||
listener.onDebugEvent("\uD83D\uDD04 Auto-connecting to $name (${device.address})")
|
|
||||||
connect(device)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onScanFailed(errorCode: Int) {
|
|
||||||
isScanning = false
|
|
||||||
mainHandler.post { listener.onError("BLE scan failed (code: $errorCode)") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getDeviceName(device: BluetoothDevice): String {
|
|
||||||
return try {
|
|
||||||
device.name?.takeIf { it.isNotBlank() } ?: "Unnamed"
|
|
||||||
} catch (e: SecurityException) {
|
|
||||||
"Unnamed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun rssiToProximity(rssi: Int) = when {
|
|
||||||
rssi >= -60 -> "📶 Near"
|
|
||||||
rssi >= -80 -> "📶 Medium"
|
|
||||||
else -> "📶 Far"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun scoreLikelyScale(name: String, scanRecord: android.bluetooth.le.ScanRecord?): Int {
|
|
||||||
var score = 0
|
|
||||||
val lower = name.lowercase()
|
|
||||||
// Kitchen / food scale brand and model keywords
|
|
||||||
val foodKeywords = listOf(
|
|
||||||
"scale", "bilancia", "kitchen", "food", "cucina",
|
|
||||||
"coffee", "caffe", "balance", "weight", "waage",
|
|
||||||
"arboleaf", "ck10", "ck20", "ek-",
|
|
||||||
"acaia", "felicita", "decent", "skale",
|
|
||||||
"timemore", "brewista", "hario",
|
|
||||||
"greater goods", "ozeri", "etekcity", "nutri",
|
|
||||||
"nicewell", "koios", "renpho", "eatsmart",
|
|
||||||
)
|
|
||||||
if (foodKeywords.any { lower.contains(it) }) score += 10
|
|
||||||
|
|
||||||
// Negative: body/fitness scale keywords (demote but don't hide)
|
|
||||||
val bodyKeywords = listOf(
|
|
||||||
"body", "fat", "bmi", "composition", "fitness",
|
|
||||||
"mi body", "lepulse", "qardio", "garmin", "withings",
|
|
||||||
)
|
|
||||||
if (bodyKeywords.any { lower.contains(it) }) score -= 5
|
|
||||||
|
|
||||||
// Service UUID scoring
|
|
||||||
scanRecord?.serviceUuids?.let { uuids ->
|
|
||||||
val us = uuids.map { it.uuid.toString().lowercase() }
|
|
||||||
// SIG Weight Scale service
|
|
||||||
if (us.any { it.startsWith("0000181d") }) score += 15
|
|
||||||
// Common vendor services on kitchen scales
|
|
||||||
if (us.any { it.startsWith("0000ffe0") || it.startsWith("0000fff0") }) score += 10
|
|
||||||
// Acaia coffee scale
|
|
||||||
if (us.any { it.startsWith("49535343") }) score += 20
|
|
||||||
// Body Composition service = body scale, demote
|
|
||||||
if (us.any { it.startsWith("0000181b") }) score -= 10
|
|
||||||
}
|
|
||||||
return score
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Connection ────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
fun connect(device: BluetoothDevice) {
|
|
||||||
stopScan()
|
|
||||||
disconnect()
|
|
||||||
connectedDeviceName = ""
|
|
||||||
ScaleProtocol.resetState()
|
|
||||||
mainHandler.post { listener.onConnecting(device) }
|
|
||||||
try {
|
|
||||||
gatt = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
device.connectGatt(context, false, gattCallback, BluetoothDevice.TRANSPORT_LE)
|
|
||||||
} else {
|
|
||||||
device.connectGatt(context, false, gattCallback)
|
|
||||||
}
|
|
||||||
} catch (e: SecurityException) {
|
|
||||||
mainHandler.post { listener.onError("Missing permission: ${e.message}") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun disconnect() {
|
|
||||||
pendingSubscriptions.clear()
|
|
||||||
try {
|
|
||||||
gatt?.disconnect()
|
|
||||||
gatt?.close()
|
|
||||||
} catch (e: Exception) { /* ignore */ }
|
|
||||||
gatt = null
|
|
||||||
connectedDeviceName = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── GATT callbacks ────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private val gattCallback = object : BluetoothGattCallback() {
|
|
||||||
|
|
||||||
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
|
|
||||||
when (newState) {
|
|
||||||
BluetoothProfile.STATE_CONNECTED -> {
|
|
||||||
Log.d(TAG, "Connected — discovering services…")
|
|
||||||
mainHandler.postDelayed({ gatt.discoverServices() }, 500)
|
|
||||||
}
|
|
||||||
BluetoothProfile.STATE_DISCONNECTED -> {
|
|
||||||
Log.d(TAG, "Disconnected (status=$status)")
|
|
||||||
this@BleScaleManager.gatt?.close()
|
|
||||||
this@BleScaleManager.gatt = null
|
|
||||||
connectedDeviceName = ""
|
|
||||||
mainHandler.post { listener.onDisconnected() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
|
|
||||||
if (status != BluetoothGatt.GATT_SUCCESS) {
|
|
||||||
mainHandler.post { listener.onError("Servizi GATT non trovati (status=$status)") }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val targetChars = mutableListOf<BluetoothGattCharacteristic>()
|
|
||||||
|
|
||||||
// Priority 1: BLE SIG Weight Scale Service
|
|
||||||
gatt.getService(BleUuids.WEIGHT_SCALE_SERVICE)
|
|
||||||
?.getCharacteristic(BleUuids.WEIGHT_MEASUREMENT_CHAR)
|
|
||||||
?.let { targetChars.add(it) }
|
|
||||||
|
|
||||||
// Priority 2: Common vendor service FFE0 (arboleaf, generic kitchen scales)
|
|
||||||
gatt.getService(BleUuids.FFE0)?.let { svc ->
|
|
||||||
svc.getCharacteristic(BleUuids.FFE1)?.let { targetChars.add(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Priority 3: Common vendor service FFF0
|
|
||||||
gatt.getService(BleUuids.FFF0)?.let { svc ->
|
|
||||||
svc.getCharacteristic(BleUuids.FFF4)?.let { targetChars.add(it) }
|
|
||||||
?: svc.getCharacteristic(BleUuids.FFF1)?.let { targetChars.add(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Priority 4: Acaia coffee scale
|
|
||||||
gatt.getService(BleUuids.ACAIA_SERVICE)?.let { svc ->
|
|
||||||
svc.getCharacteristic(BleUuids.ACAIA_CHAR)?.let { targetChars.add(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback: any notifiable characteristic from remaining services
|
|
||||||
if (targetChars.isEmpty()) {
|
|
||||||
for (service in gatt.services) {
|
|
||||||
if (service.uuid.toString().startsWith("00001800") ||
|
|
||||||
service.uuid.toString().startsWith("00001801")) continue
|
|
||||||
for (char in service.characteristics) {
|
|
||||||
val props = char.properties
|
|
||||||
if ((props and BluetoothGattCharacteristic.PROPERTY_NOTIFY) != 0 ||
|
|
||||||
(props and BluetoothGattCharacteristic.PROPERTY_INDICATE) != 0) {
|
|
||||||
if (!targetChars.contains(char)) targetChars.add(char)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetChars.isEmpty()) {
|
|
||||||
mainHandler.post { listener.onError("No weight characteristic found. Make sure it's a BLE kitchen scale.") }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Battery (optional)
|
|
||||||
gatt.getService(BleUuids.BATTERY_SERVICE)
|
|
||||||
?.getCharacteristic(BleUuids.BATTERY_LEVEL_CHAR)
|
|
||||||
?.let { targetChars.add(it) }
|
|
||||||
|
|
||||||
// Debug: log all discovered services and characteristics
|
|
||||||
val dbg = buildString {
|
|
||||||
append("GATT services (${gatt.services.size}):\n")
|
|
||||||
for (svc in gatt.services) {
|
|
||||||
append(" SVC: ${svc.uuid}\n")
|
|
||||||
for (ch in svc.characteristics) {
|
|
||||||
val p = ch.properties
|
|
||||||
val flags = buildString {
|
|
||||||
if (p and BluetoothGattCharacteristic.PROPERTY_NOTIFY != 0) append("N")
|
|
||||||
if (p and BluetoothGattCharacteristic.PROPERTY_INDICATE != 0) append("I")
|
|
||||||
if (p and BluetoothGattCharacteristic.PROPERTY_READ != 0) append("R")
|
|
||||||
if (p and BluetoothGattCharacteristic.PROPERTY_WRITE != 0) append("W")
|
|
||||||
}
|
|
||||||
append(" CHAR: ${ch.uuid} [$flags]\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
append("Subscribed to ${targetChars.size} characteristics")
|
|
||||||
}
|
|
||||||
mainHandler.post { listener.onDebugEvent(dbg) }
|
|
||||||
|
|
||||||
// Save device for auto-reconnect
|
|
||||||
try { gatt.device?.address?.let { saveDeviceAddress(it) } } catch (_: SecurityException) {}
|
|
||||||
|
|
||||||
pendingSubscriptions.clear()
|
|
||||||
pendingSubscriptions.addAll(targetChars)
|
|
||||||
|
|
||||||
val deviceName = try { gatt.device?.name ?: "Scale" } catch (e: SecurityException) { "Scale" }
|
|
||||||
connectedDeviceName = deviceName
|
|
||||||
mainHandler.post { listener.onConnected(deviceName) }
|
|
||||||
|
|
||||||
// Subscribe one at a time (Android BLE requires sequential descriptor writes)
|
|
||||||
subscribeNext(gatt)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDescriptorWrite(gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int) {
|
|
||||||
// Subscribe to the next characteristic
|
|
||||||
subscribeNext(gatt)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
override fun onCharacteristicChanged(
|
|
||||||
gatt: BluetoothGatt,
|
|
||||||
characteristic: BluetoothGattCharacteristic,
|
|
||||||
) {
|
|
||||||
val data = characteristic.value ?: return
|
|
||||||
processCharacteristicData(characteristic, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Android 13+ override
|
|
||||||
override fun onCharacteristicChanged(
|
|
||||||
gatt: BluetoothGatt,
|
|
||||||
characteristic: BluetoothGattCharacteristic,
|
|
||||||
value: ByteArray,
|
|
||||||
) {
|
|
||||||
processCharacteristicData(characteristic, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
override fun onCharacteristicRead(
|
|
||||||
gatt: BluetoothGatt,
|
|
||||||
characteristic: BluetoothGattCharacteristic,
|
|
||||||
status: Int,
|
|
||||||
) {
|
|
||||||
if (status == BluetoothGatt.GATT_SUCCESS && characteristic.uuid == BleUuids.BATTERY_LEVEL_CHAR) {
|
|
||||||
val level = characteristic.value?.firstOrNull()?.toInt()?.and(0xFF)
|
|
||||||
if (level != null) mainHandler.post { listener.onBatteryReceived(level) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun subscribeNext(gatt: BluetoothGatt) {
|
|
||||||
val char = pendingSubscriptions.removeFirstOrNull() ?: return
|
|
||||||
|
|
||||||
// Battery characteristic — read once instead of notify
|
|
||||||
if (char.uuid == BleUuids.BATTERY_LEVEL_CHAR) {
|
|
||||||
try { gatt.readCharacteristic(char) } catch (e: SecurityException) { /* ignore */ }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val props = char.properties
|
|
||||||
val notifyType = when {
|
|
||||||
(props and BluetoothGattCharacteristic.PROPERTY_INDICATE) != 0 ->
|
|
||||||
BluetoothGattDescriptor.ENABLE_INDICATION_VALUE
|
|
||||||
else -> BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
gatt.setCharacteristicNotification(char, true)
|
|
||||||
val descriptor = char.getDescriptor(CCCD_UUID) ?: run {
|
|
||||||
// No CCCD — skip and try next
|
|
||||||
subscribeNext(gatt)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
gatt.writeDescriptor(descriptor, notifyType)
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
descriptor.value = notifyType
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
gatt.writeDescriptor(descriptor)
|
|
||||||
}
|
|
||||||
} catch (e: SecurityException) {
|
|
||||||
Log.e(TAG, "SecurityException enabling notification", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun processCharacteristicData(char: BluetoothGattCharacteristic, data: ByteArray) {
|
|
||||||
// Battery level
|
|
||||||
if (char.uuid == BleUuids.BATTERY_LEVEL_CHAR && data.isNotEmpty()) {
|
|
||||||
val level = data[0].toInt() and 0xFF
|
|
||||||
mainHandler.post { listener.onBatteryReceived(level) }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug: log raw bytes received
|
|
||||||
val hex = data.joinToString(" ") { "%02X".format(it) }
|
|
||||||
mainHandler.post { listener.onDebugEvent("📡 ${char.uuid}\n HEX [${data.size}B]: $hex") }
|
|
||||||
|
|
||||||
// Parse weight data
|
|
||||||
val reading = ScaleProtocol.parse(char, data) { msg ->
|
|
||||||
mainHandler.post { listener.onDebugEvent(msg) }
|
|
||||||
}
|
|
||||||
if (reading != null && reading.value > 0f) {
|
|
||||||
mainHandler.post { listener.onWeightReceived(reading) }
|
|
||||||
} else {
|
|
||||||
val rawDump = data.mapIndexed { i, b ->
|
|
||||||
val v = b.toInt() and 0xFF
|
|
||||||
val h = "%02X".format(v)
|
|
||||||
"[$i]=$v(0x$h)"
|
|
||||||
}.joinToString(" ")
|
|
||||||
mainHandler.post { listener.onDebugEvent("\u26a0\ufe0f Weight not decoded\n RAW: $rawDump") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,249 +0,0 @@
|
|||||||
package it.dadaloop.evershelf.scalegate
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Build
|
|
||||||
import android.util.Log
|
|
||||||
import org.json.JSONArray
|
|
||||||
import org.json.JSONObject
|
|
||||||
import java.io.BufferedReader
|
|
||||||
import java.io.InputStreamReader
|
|
||||||
import java.io.OutputStreamWriter
|
|
||||||
import java.net.HttpURLConnection
|
|
||||||
import java.net.URL
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
|
||||||
import java.util.Locale
|
|
||||||
import java.util.concurrent.Executors
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Centralized error reporter for EverShelf Scale Gateway.
|
|
||||||
*
|
|
||||||
* Unlike the Kiosk (which relays errors through the EverShelf PHP backend),
|
|
||||||
* the Scale Gateway has no knowledge of the EverShelf server URL, so it
|
|
||||||
* calls the GitHub Issues REST API directly.
|
|
||||||
*
|
|
||||||
* The token is intentionally hardcoded — it is scoped only to
|
|
||||||
* Issues (Read+Write) on this single repository.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ErrorReporter.init(applicationContext)
|
|
||||||
* ErrorReporter.report(exception, "methodName", mapOf("extra" to "info"))
|
|
||||||
* ErrorReporter.reportMessage("ble-disconnect", "Scale disconnected after 3 retries")
|
|
||||||
*/
|
|
||||||
object ErrorReporter {
|
|
||||||
|
|
||||||
private const val TAG = "ScaleGWErrorReporter"
|
|
||||||
|
|
||||||
// ── XOR-obfuscated GitHub token (scoped: Issues R+W on dadaloop82/EverShelf) ──
|
|
||||||
// Stored encoded so the literal token string never appears in source or git history.
|
|
||||||
private const val GH_TOKEN_ENC = "23580718460c2c444031290243627e7971622b29035e2a647726407d194f61440b6e05246a0c067c79730e77114b774501730043433d1866682225511b5443417170444443142941673c4046086c05737363293e7821006e470a466a1d"
|
|
||||||
private const val GH_TOKEN_KEY = "D1sp3ns4!Ev3r#26"
|
|
||||||
private const val GH_REPO = "dadaloop82/EverShelf"
|
|
||||||
|
|
||||||
private var _ghTokenCache: String? = null
|
|
||||||
private fun ghToken(): String {
|
|
||||||
_ghTokenCache?.let { return it }
|
|
||||||
val enc = GH_TOKEN_ENC.chunked(2).map { it.toInt(16).toByte() }.toByteArray()
|
|
||||||
val key = GH_TOKEN_KEY
|
|
||||||
val out = String(ByteArray(enc.size) { i -> (enc[i].toInt() xor key[i % key.length].code).toByte() })
|
|
||||||
_ghTokenCache = out
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// SharedPreferences key for pending (unsent) crash reports
|
|
||||||
private const val PREFS_NAME = "evershelf_scalegw_errors"
|
|
||||||
private const val KEY_PENDING = "pending_crash_json"
|
|
||||||
|
|
||||||
private val executor = Executors.newSingleThreadExecutor()
|
|
||||||
private val sentFingerprints = mutableSetOf<String>()
|
|
||||||
|
|
||||||
private var appVersion: String = "unknown"
|
|
||||||
private var deviceInfo: String = ""
|
|
||||||
private lateinit var appContext: Context
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call once in MainActivity.onCreate() or Application.onCreate().
|
|
||||||
*/
|
|
||||||
fun init(context: Context) {
|
|
||||||
appContext = context.applicationContext
|
|
||||||
deviceInfo = "${Build.MANUFACTURER} ${Build.MODEL} (Android ${Build.VERSION.RELEASE})"
|
|
||||||
try {
|
|
||||||
val pi = context.packageManager.getPackageInfo(context.packageName, 0)
|
|
||||||
appVersion = pi.versionName ?: "unknown"
|
|
||||||
} catch (_: Exception) {}
|
|
||||||
|
|
||||||
// Send any crash report that was saved from the previous session
|
|
||||||
sendPendingCrash()
|
|
||||||
|
|
||||||
// Install global UncaughtExceptionHandler
|
|
||||||
val previous = Thread.getDefaultUncaughtExceptionHandler()
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
|
||||||
try {
|
|
||||||
val crash = buildPayload(
|
|
||||||
type = "uncaught-exception",
|
|
||||||
message = "${throwable.javaClass.simpleName}: ${throwable.message}",
|
|
||||||
stack = throwable.stackTraceToString(),
|
|
||||||
context = mapOf("thread" to thread.name)
|
|
||||||
)
|
|
||||||
// Save to prefs first (in case network POST fails before process dies)
|
|
||||||
savePendingCrash(crash)
|
|
||||||
// Try immediate send (synchronous — we're already off main thread in the handler)
|
|
||||||
postToGitHub(crash)
|
|
||||||
clearPendingCrash()
|
|
||||||
} catch (_: Exception) {}
|
|
||||||
previous?.uncaughtException(thread, throwable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a caught [Throwable] asynchronously. */
|
|
||||||
fun report(throwable: Throwable, location: String = "", extra: Map<String, Any?> = emptyMap()) {
|
|
||||||
val ctx = mutableMapOf<String, Any?>("device" to deviceInfo)
|
|
||||||
if (location.isNotEmpty()) ctx["location"] = location
|
|
||||||
ctx.putAll(extra)
|
|
||||||
enqueue(
|
|
||||||
type = "scale-exception",
|
|
||||||
message = "${throwable.javaClass.simpleName}: ${throwable.message}",
|
|
||||||
stack = throwable.stackTraceToString(),
|
|
||||||
context = ctx
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Report a non-exception event (e.g. BLE disconnect, WebSocket error). */
|
|
||||||
fun reportMessage(type: String, message: String, extra: Map<String, Any?> = emptyMap()) {
|
|
||||||
val ctx = mutableMapOf<String, Any?>("device" to deviceInfo)
|
|
||||||
ctx.putAll(extra)
|
|
||||||
enqueue(type = type, message = message, stack = "", context = ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Internal ─────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun fingerprint(type: String, message: String) =
|
|
||||||
"${type}:${message.take(120)}".hashCode().toString(16)
|
|
||||||
|
|
||||||
private fun enqueue(type: String, message: String, stack: String, context: Map<String, Any?>) {
|
|
||||||
val fp = fingerprint(type, message)
|
|
||||||
synchronized(sentFingerprints) {
|
|
||||||
if (!sentFingerprints.add(fp)) return
|
|
||||||
}
|
|
||||||
val payload = buildPayload(type, message, stack, context)
|
|
||||||
executor.execute { postToGitHub(payload) }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun buildPayload(type: String, message: String, stack: String, context: Map<String, Any?>): JSONObject {
|
|
||||||
val ctxJson = JSONObject()
|
|
||||||
context.forEach { (k, v) -> ctxJson.put(k, v) }
|
|
||||||
return JSONObject().apply {
|
|
||||||
put("source", "scale")
|
|
||||||
put("type", type)
|
|
||||||
put("message", message)
|
|
||||||
put("stack", stack)
|
|
||||||
put("context", ctxJson)
|
|
||||||
put("version", appVersion)
|
|
||||||
put("user_agent", "EverShelf-ScaleGateway/$appVersion (Android ${Build.VERSION.RELEASE}; ${Build.MODEL})")
|
|
||||||
put("ts", SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Persist crash payload to SharedPreferences so it survives a process kill. */
|
|
||||||
private fun savePendingCrash(payload: JSONObject) {
|
|
||||||
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
||||||
.edit().putString(KEY_PENDING, payload.toString()).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clearPendingCrash() {
|
|
||||||
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
||||||
.edit().remove(KEY_PENDING).apply()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** On startup, check if there's an unsent crash report from the previous session. */
|
|
||||||
private fun sendPendingCrash() {
|
|
||||||
val json = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
|
||||||
.getString(KEY_PENDING, null) ?: return
|
|
||||||
clearPendingCrash() // remove before sending to prevent re-sending on next crash
|
|
||||||
executor.execute {
|
|
||||||
try {
|
|
||||||
val payload = JSONObject(json)
|
|
||||||
// Tag it as a "survived-crash" so we know it was saved and retried
|
|
||||||
payload.put("type", "uncaught-exception-survived")
|
|
||||||
payload.put("note", "Sent on next launch after crash")
|
|
||||||
postToGitHub(payload)
|
|
||||||
} catch (_: Exception) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a GitHub Issue (or add a comment to an existing one with the same fingerprint).
|
|
||||||
* Uses the GitHub Issues Search API to deduplicate.
|
|
||||||
*/
|
|
||||||
private fun postToGitHub(payload: JSONObject) {
|
|
||||||
val source = payload.optString("source", "scale")
|
|
||||||
val type = payload.optString("type", "error")
|
|
||||||
val message = payload.optString("message", "")
|
|
||||||
val stack = payload.optString("stack", "")
|
|
||||||
val version = payload.optString("version", "")
|
|
||||||
val ua = payload.optString("user_agent", "")
|
|
||||||
val ts = payload.optString("ts", "")
|
|
||||||
val ctxJson = payload.optJSONObject("context") ?: JSONObject()
|
|
||||||
|
|
||||||
val fp = fingerprint(type, message)
|
|
||||||
|
|
||||||
// ── 1. Search for existing open issue ──────────────────────────────
|
|
||||||
val searchQ = "repo:$GH_REPO is:issue is:open label:auto-report \"fp:$fp\" in:body"
|
|
||||||
val searchUrl = "https://api.github.com/search/issues?q=${java.net.URLEncoder.encode(searchQ, "UTF-8")}&per_page=1"
|
|
||||||
val searchResult = ghGet(searchUrl) ?: JSONObject()
|
|
||||||
val existingNumber = searchResult.optJSONArray("items")?.optJSONObject(0)?.optInt("number", 0)?.takeIf { it > 0 }
|
|
||||||
|
|
||||||
// ── 2. Build body ─────────────────────────────────────────────────
|
|
||||||
val ctxMd = if (ctxJson.length() > 0) "\n**Context:**\n```json\n${ctxJson.toString(2)}\n```\n" else ""
|
|
||||||
val stackMd = if (stack.isNotEmpty()) "\n**Stack trace:**\n```\n$stack\n```\n" else ""
|
|
||||||
|
|
||||||
if (existingNumber != null) {
|
|
||||||
// Comment on existing issue
|
|
||||||
val body = "### 🔁 Recurrence — $ts\n**Source:** `$source` | **Type:** `$type`\n**UA:** `$ua`\n$ctxMd$stackMd\n---\n_fp:${fp}_"
|
|
||||||
ghPost("https://api.github.com/repos/$GH_REPO/issues/$existingNumber/comments", JSONObject().put("body", body))
|
|
||||||
} else {
|
|
||||||
// Create new issue
|
|
||||||
val shortMsg = if (message.length > 70) "${message.take(70)}…" else message
|
|
||||||
val title = "[SCALE] $shortMsg"
|
|
||||||
val body = "## 🚨 Automatic Error Report\n\n**Source:** `$source` \n**Type:** `$type` \n**Reported at:** $ts \n**UA:** `$ua` \n**Version:** `$version`\n\n**Error message:**\n> $message\n$stackMd$ctxMd\n---\n<!-- auto-report fp:$fp -->\n_This issue was created automatically by EverShelf Scale Gateway error reporter. fp:`${fp}`_"
|
|
||||||
ghPost(
|
|
||||||
"https://api.github.com/repos/$GH_REPO/issues",
|
|
||||||
JSONObject()
|
|
||||||
.put("title", title)
|
|
||||||
.put("body", body)
|
|
||||||
.put("labels", JSONArray().put("auto-report").put("scale-error"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun ghGet(url: String): JSONObject? = try {
|
|
||||||
val conn = URL(url).openConnection() as HttpURLConnection
|
|
||||||
conn.setRequestProperty("Authorization", "token ${ghToken()}")
|
|
||||||
conn.setRequestProperty("Accept", "application/vnd.github+json")
|
|
||||||
conn.setRequestProperty("X-GitHub-Api-Version", "2022-11-28")
|
|
||||||
conn.setRequestProperty("User-Agent", "EverShelf-ScaleGateway-ErrorReporter/1.0")
|
|
||||||
conn.connectTimeout = 8000
|
|
||||||
conn.readTimeout = 8000
|
|
||||||
val raw = BufferedReader(InputStreamReader(conn.inputStream)).readText()
|
|
||||||
conn.disconnect()
|
|
||||||
JSONObject(raw)
|
|
||||||
} catch (e: Exception) { Log.w(TAG, "ghGet failed: ${e.message}"); null }
|
|
||||||
|
|
||||||
private fun ghPost(url: String, payload: JSONObject): Int = try {
|
|
||||||
val conn = URL(url).openConnection() as HttpURLConnection
|
|
||||||
conn.requestMethod = "POST"
|
|
||||||
conn.setRequestProperty("Authorization", "token ${ghToken()}")
|
|
||||||
conn.setRequestProperty("Accept", "application/vnd.github+json")
|
|
||||||
conn.setRequestProperty("X-GitHub-Api-Version", "2022-11-28")
|
|
||||||
conn.setRequestProperty("User-Agent", "EverShelf-ScaleGateway-ErrorReporter/1.0")
|
|
||||||
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8")
|
|
||||||
conn.doOutput = true
|
|
||||||
conn.connectTimeout = 8000
|
|
||||||
conn.readTimeout = 8000
|
|
||||||
OutputStreamWriter(conn.outputStream, Charsets.UTF_8).use { it.write(payload.toString()) }
|
|
||||||
val code = conn.responseCode
|
|
||||||
conn.disconnect()
|
|
||||||
Log.d(TAG, "ghPost $url → HTTP $code")
|
|
||||||
code
|
|
||||||
} catch (e: Exception) { Log.w(TAG, "ghPost failed: ${e.message}"); -1 }
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
package it.dadaloop.evershelf.scalegate
|
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import org.java_websocket.WebSocket
|
|
||||||
import org.java_websocket.handshake.ClientHandshake
|
|
||||||
import org.java_websocket.server.WebSocketServer
|
|
||||||
import org.json.JSONObject
|
|
||||||
import java.net.InetSocketAddress
|
|
||||||
import java.util.Collections
|
|
||||||
|
|
||||||
private const val TAG = "GatewayWsServer"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callbacks for the WebSocket server, dispatched on the server's internal thread.
|
|
||||||
* The caller (MainActivity) is responsible for switching to the main thread if needed.
|
|
||||||
*/
|
|
||||||
interface ServerEventListener {
|
|
||||||
fun onClientConnected(address: String)
|
|
||||||
fun onClientDisconnected(address: String)
|
|
||||||
fun onClientRequestedWeight()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* WebSocket server that exposes smart-scale data to EverShelf running in a browser.
|
|
||||||
*
|
|
||||||
* Message protocol (JSON):
|
|
||||||
*
|
|
||||||
* Server -> Client:
|
|
||||||
* {"type":"status","state":"connected"|"disconnected","device":"QN-KS","battery":80}
|
|
||||||
* {"type":"weight","value":17.0,"unit":"g","stable":true,"timestamp":1712345678000}
|
|
||||||
* {"type":"pong"}
|
|
||||||
*
|
|
||||||
* Client → Server:
|
|
||||||
* {"type":"get_status"} → server responds with current status message
|
|
||||||
* {"type":"get_weight"} → server will push the next stable weight reading
|
|
||||||
* {"type":"ping"} → server responds with {"type":"pong"}
|
|
||||||
*/
|
|
||||||
class GatewayWebSocketServer(
|
|
||||||
port: Int,
|
|
||||||
private val eventListener: ServerEventListener?,
|
|
||||||
) : WebSocketServer(InetSocketAddress(port)) {
|
|
||||||
|
|
||||||
// Thread-safe set of clients waiting for the next stable weight reading
|
|
||||||
private val pendingWeightRequests: MutableSet<WebSocket> =
|
|
||||||
Collections.synchronizedSet(mutableSetOf())
|
|
||||||
|
|
||||||
// Last known scale state (to send to new clients immediately)
|
|
||||||
@Volatile private var lastStatusJson: String = buildStatusJson("disconnected", null, null)
|
|
||||||
@Volatile private var lastWeightJson: String? = null
|
|
||||||
|
|
||||||
// ─── Server lifecycle ──────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
Log.i(TAG, "WebSocket server started on port ${address.port}")
|
|
||||||
connectionLostTimeout = 30
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onOpen(conn: WebSocket, handshake: ClientHandshake) {
|
|
||||||
val addr = conn.remoteSocketAddress?.toString() ?: "?"
|
|
||||||
Log.d(TAG, "Client connected: $addr")
|
|
||||||
|
|
||||||
// Immediately send current status so the web app knows the scale state
|
|
||||||
conn.send(lastStatusJson)
|
|
||||||
lastWeightJson?.let { conn.send(it) }
|
|
||||||
|
|
||||||
eventListener?.onClientConnected(addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClose(conn: WebSocket, code: Int, reason: String, remote: Boolean) {
|
|
||||||
val addr = conn.remoteSocketAddress?.toString() ?: "?"
|
|
||||||
Log.d(TAG, "Client disconnected: $addr (code=$code)")
|
|
||||||
pendingWeightRequests.remove(conn)
|
|
||||||
eventListener?.onClientDisconnected(addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onMessage(conn: WebSocket, message: String) {
|
|
||||||
try {
|
|
||||||
val json = JSONObject(message)
|
|
||||||
when (json.optString("type")) {
|
|
||||||
"ping" -> conn.send("""{"type":"pong"}""")
|
|
||||||
"get_status" -> conn.send(lastStatusJson)
|
|
||||||
"get_weight" -> {
|
|
||||||
// Add to pending set; next stable weight will be sent to this client
|
|
||||||
pendingWeightRequests.add(conn)
|
|
||||||
eventListener?.onClientRequestedWeight()
|
|
||||||
// If we already have a recent weight, send it immediately
|
|
||||||
lastWeightJson?.let { conn.send(it) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.w(TAG, "Malformed message: $message")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(conn: WebSocket?, ex: Exception) {
|
|
||||||
Log.e(TAG, "WebSocket error on ${conn?.remoteSocketAddress}", ex)
|
|
||||||
ErrorReporter.report(ex, "GatewayWebSocketServer.onError",
|
|
||||||
mapOf("remote_addr" to (conn?.remoteSocketAddress?.toString() ?: "null")))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Publishing API ────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcast scale connection status to all connected WebSocket clients.
|
|
||||||
*/
|
|
||||||
fun publishStatus(state: String, deviceName: String?, battery: Int?) {
|
|
||||||
lastStatusJson = buildStatusJson(state, deviceName, battery)
|
|
||||||
broadcast(lastStatusJson)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Broadcast a weight reading to all clients.
|
|
||||||
* If [stable] is true, also fulfil pending on-demand weight requests.
|
|
||||||
*/
|
|
||||||
fun publishWeight(value: Float, unit: String, stable: Boolean, battery: Int? = null) {
|
|
||||||
val json = buildWeightJson(value, unit, stable)
|
|
||||||
lastWeightJson = json
|
|
||||||
broadcast(json)
|
|
||||||
|
|
||||||
if (stable) {
|
|
||||||
synchronized(pendingWeightRequests) {
|
|
||||||
// Clients that requested on-demand readings are already served by broadcast;
|
|
||||||
// just clear the pending set.
|
|
||||||
pendingWeightRequests.clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── JSON builders ─────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun buildStatusJson(state: String, device: String?, battery: Int?): String {
|
|
||||||
val obj = JSONObject()
|
|
||||||
obj.put("type", "status")
|
|
||||||
obj.put("state", state)
|
|
||||||
if (device != null) obj.put("device", device)
|
|
||||||
if (battery != null) obj.put("battery", battery)
|
|
||||||
return obj.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun buildWeightJson(value: Float, unit: String, stable: Boolean): String {
|
|
||||||
val obj = JSONObject()
|
|
||||||
obj.put("type", "weight")
|
|
||||||
// Round to 1 decimal to avoid floating point noise (e.g. 17.000001)
|
|
||||||
val rounded = Math.round(value * 10f) / 10.0
|
|
||||||
obj.put("value", rounded)
|
|
||||||
obj.put("unit", unit)
|
|
||||||
obj.put("stable", stable)
|
|
||||||
obj.put("timestamp", System.currentTimeMillis())
|
|
||||||
return obj.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,674 +0,0 @@
|
|||||||
package it.dadaloop.evershelf.scalegate
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.DownloadManager
|
|
||||||
import android.bluetooth.BluetoothAdapter
|
|
||||||
import android.bluetooth.BluetoothDevice
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.IntentFilter
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.content.pm.PackageInstaller
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.provider.Settings
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import com.google.android.material.button.MaterialButton
|
|
||||||
import it.dadaloop.evershelf.scalegate.databinding.ActivityMainBinding
|
|
||||||
import java.net.Inet4Address
|
|
||||||
import java.net.NetworkInterface
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
|
||||||
import java.util.Locale
|
|
||||||
import org.json.JSONObject
|
|
||||||
|
|
||||||
private const val WS_PORT = 8765
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity(), BleScaleListener, ServerEventListener {
|
|
||||||
|
|
||||||
private lateinit var binding: ActivityMainBinding
|
|
||||||
private lateinit var bleManager: BleScaleManager
|
|
||||||
private var wsServer: GatewayWebSocketServer? = null
|
|
||||||
|
|
||||||
private val devices = mutableListOf<BleDeviceInfo>()
|
|
||||||
private lateinit var deviceAdapter: DeviceAdapter
|
|
||||||
|
|
||||||
private var batteryLevel: Int? = null
|
|
||||||
private val debugLines = mutableListOf<String>()
|
|
||||||
private var debugVisible = false
|
|
||||||
private var lastDebugUpdate = 0L
|
|
||||||
private val debugTimeFmt = SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault())
|
|
||||||
private var isAutoReconnecting = false
|
|
||||||
// Update banner
|
|
||||||
private var pendingApkDownloadUrl = ""
|
|
||||||
private var pendingInstallFile: java.io.File? = null
|
|
||||||
private companion object {
|
|
||||||
const val MAX_DEBUG_LINES = 150
|
|
||||||
const val DEBUG_THROTTLE_MS = 200L
|
|
||||||
const val GITHUB_RELEASES_API = "https://api.github.com/repos/dadaloop82/EverShelf/releases/latest"
|
|
||||||
const val APK_DOWNLOAD_URL = "https://github.com/dadaloop82/EverShelf/releases/latest/download/evershelf-scale-gateway.apk"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Permission launcher ───────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private val permissionLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.RequestMultiplePermissions()
|
|
||||||
) { granted ->
|
|
||||||
if (granted.values.all { it }) {
|
|
||||||
startGatewayServer()
|
|
||||||
} else {
|
|
||||||
showDialog("Missing permissions",
|
|
||||||
"The app requires Bluetooth and Location permissions to function.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val enableBtLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { result ->
|
|
||||||
if (result.resultCode == RESULT_OK) checkPermissionsAndStart()
|
|
||||||
else showDialog("Bluetooth required", "Please enable Bluetooth to use the gateway.")
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns from ACTION_MANAGE_UNKNOWN_APP_SOURCES — retry the download. */
|
|
||||||
private val installPermLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { _ ->
|
|
||||||
val url = pendingApkDownloadUrl
|
|
||||||
if (url.isNotEmpty()) triggerApkDownload(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns from system installer dialog — if not OK the install failed (signature conflict?). */
|
|
||||||
private val installConfirmLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { result ->
|
|
||||||
if (result.resultCode != RESULT_OK) {
|
|
||||||
val f = pendingInstallFile
|
|
||||||
if (f != null && f.exists()) {
|
|
||||||
runOnUiThread {
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle("⚠️ Installazione non riuscita")
|
|
||||||
.setMessage("Se hai visto un errore di conflitto firma, devi disinstallare la versione precedente.\n\nDisinstalla ora? L'installazione ripartirà automaticamente.")
|
|
||||||
.setPositiveButton("Disinstalla") { _, _ ->
|
|
||||||
uninstallLauncher.launch(
|
|
||||||
Intent(Intent.ACTION_DELETE, android.net.Uri.parse("package:$packageName"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.setNegativeButton("Annulla", null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns from uninstall screen — auto-retry the install with the saved APK file. */
|
|
||||||
private val uninstallLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { _ ->
|
|
||||||
val f = pendingInstallFile
|
|
||||||
if (f != null && f.exists()) installApk(f)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Lifecycle ─────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
|
|
||||||
bleManager = BleScaleManager(this, this)
|
|
||||||
|
|
||||||
// Initialise error reporter early so the UncaughtExceptionHandler is installed
|
|
||||||
// and any pending crash from a previous session is sent
|
|
||||||
ErrorReporter.init(this)
|
|
||||||
|
|
||||||
deviceAdapter = DeviceAdapter(devices) { info ->
|
|
||||||
bleManager.connect(info.device)
|
|
||||||
}
|
|
||||||
binding.rvDevices.apply {
|
|
||||||
layoutManager = LinearLayoutManager(this@MainActivity)
|
|
||||||
adapter = deviceAdapter
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.btnScan.setOnClickListener { startScanIfPermitted() }
|
|
||||||
binding.btnDisconnect.setOnClickListener {
|
|
||||||
bleManager.disconnect()
|
|
||||||
updateUiDisconnected()
|
|
||||||
}
|
|
||||||
binding.btnDebug.setOnClickListener {
|
|
||||||
debugVisible = !debugVisible
|
|
||||||
binding.svDebugLog.visibility = if (debugVisible) View.VISIBLE else View.GONE
|
|
||||||
binding.btnCopyLog.visibility = if (debugVisible) View.VISIBLE else View.GONE
|
|
||||||
binding.btnShareLog.visibility = if (debugVisible) View.VISIBLE else View.GONE
|
|
||||||
binding.btnDebug.text = if (debugVisible) "\uD83D\uDC1B Hide Debug" else "\uD83D\uDC1B Debug"
|
|
||||||
}
|
|
||||||
binding.btnCopyLog.setOnClickListener {
|
|
||||||
val log = debugLines.joinToString("\n")
|
|
||||||
val cm = getSystemService(CLIPBOARD_SERVICE) as android.content.ClipboardManager
|
|
||||||
cm.setPrimaryClip(android.content.ClipData.newPlainText("EverShelf Scale Log", log))
|
|
||||||
Toast.makeText(this, "Log copied to clipboard", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
|
||||||
binding.btnShareLog.setOnClickListener {
|
|
||||||
val log = debugLines.joinToString("\n")
|
|
||||||
val intent = Intent(Intent.ACTION_SEND).apply {
|
|
||||||
type = "text/plain"
|
|
||||||
putExtra(Intent.EXTRA_SUBJECT, "EverShelf Scale Gateway - Debug Log")
|
|
||||||
putExtra(Intent.EXTRA_TEXT, log)
|
|
||||||
}
|
|
||||||
startActivity(Intent.createChooser(intent, "Share log"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show app version
|
|
||||||
try {
|
|
||||||
val pInfo = packageManager.getPackageInfo(packageName, 0)
|
|
||||||
binding.tvVersion.text = "v${pInfo.versionName} (${pInfo.longVersionCode})"
|
|
||||||
} catch (_: Exception) { }
|
|
||||||
|
|
||||||
updateGatewayUrl()
|
|
||||||
checkPermissionsAndStart()
|
|
||||||
|
|
||||||
// Wire update banner buttons
|
|
||||||
binding.btnDismissUpdate.setOnClickListener { binding.updateBanner.visibility = View.GONE }
|
|
||||||
binding.btnInstallUpdate.setOnClickListener { triggerApkDownload(pendingApkDownloadUrl) }
|
|
||||||
|
|
||||||
// Check for a newer release (background thread, at most once every 6 h)
|
|
||||||
checkForUpdates()
|
|
||||||
|
|
||||||
// Auto-connect: if we have a saved device, start scanning with auto-connect enabled
|
|
||||||
if (bleManager.getSavedDeviceAddress() != null) {
|
|
||||||
binding.tvScanHint.visibility = View.VISIBLE
|
|
||||||
binding.tvScanHint.text = "\uD83D\uDD04 Reconnecting to saved scale\u2026"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
bleManager.disconnect()
|
|
||||||
wsServer?.stop(1000)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Permissions & startup ─────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun checkPermissionsAndStart() {
|
|
||||||
val required = buildList {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
||||||
add(Manifest.permission.BLUETOOTH_SCAN)
|
|
||||||
add(Manifest.permission.BLUETOOTH_CONNECT)
|
|
||||||
} else {
|
|
||||||
add(Manifest.permission.ACCESS_FINE_LOCATION)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val missing = required.filter {
|
|
||||||
ContextCompat.checkSelfPermission(this, it) != PackageManager.PERMISSION_GRANTED
|
|
||||||
}
|
|
||||||
when {
|
|
||||||
missing.isNotEmpty() -> permissionLauncher.launch(missing.toTypedArray())
|
|
||||||
!isBluetoothEnabled() -> enableBtLauncher.launch(Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE))
|
|
||||||
else -> startGatewayServer()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isBluetoothEnabled(): Boolean {
|
|
||||||
val adapter = android.bluetooth.BluetoothManager::class.java.let {
|
|
||||||
getSystemService(it)
|
|
||||||
} as? android.bluetooth.BluetoothManager
|
|
||||||
return adapter?.adapter?.isEnabled == true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startScanIfPermitted() {
|
|
||||||
if (!bleManager.hasRequiredPermissions()) {
|
|
||||||
checkPermissionsAndStart()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
devices.clear()
|
|
||||||
deviceAdapter.notifyDataSetChanged()
|
|
||||||
debugLines.clear()
|
|
||||||
binding.tvDebugLog.text = ""
|
|
||||||
binding.tvScanHint.visibility = View.VISIBLE
|
|
||||||
binding.tvScanHint.text = "Scanning for BLE scales\u2026"
|
|
||||||
binding.btnScan.isEnabled = false
|
|
||||||
bleManager.enableAutoConnect()
|
|
||||||
isAutoReconnecting = false // manual scan — stop any pending auto-reconnect cycle
|
|
||||||
bleManager.startScan()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── WebSocket gateway ─────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun startGatewayServer() {
|
|
||||||
if (wsServer != null) return
|
|
||||||
try {
|
|
||||||
wsServer = GatewayWebSocketServer(WS_PORT, this)
|
|
||||||
wsServer!!.start()
|
|
||||||
updateGatewayUrl()
|
|
||||||
binding.tvGatewayStatus.text = "\u2705 Gateway active on port $WS_PORT"
|
|
||||||
} catch (e: Exception) {
|
|
||||||
binding.tvGatewayStatus.text = "\u274C Failed to start gateway: ${e.message}"
|
|
||||||
ErrorReporter.report(e, "startGatewayServer", mapOf("port" to WS_PORT))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto-scan if there's a saved device
|
|
||||||
if (bleManager.getSavedDeviceAddress() != null && bleManager.hasRequiredPermissions()) {
|
|
||||||
bleManager.enableAutoConnect()
|
|
||||||
bleManager.startScan()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateGatewayUrl() {
|
|
||||||
val ip = getLocalIpAddress() ?: "—"
|
|
||||||
val url = "ws://$ip:$WS_PORT"
|
|
||||||
binding.tvGatewayUrl.text = url
|
|
||||||
binding.tvGatewayUrlHint.text = "Paste this URL in EverShelf \u2192 Settings \u2192 Smart Scale"
|
|
||||||
binding.btnCopyUrl.setOnClickListener {
|
|
||||||
val cm = getSystemService(CLIPBOARD_SERVICE) as android.content.ClipboardManager
|
|
||||||
cm.setPrimaryClip(android.content.ClipData.newPlainText("EverShelf Gateway URL", url))
|
|
||||||
binding.btnCopyUrl.text = "\u2705 Copied!"
|
|
||||||
binding.btnCopyUrl.postDelayed({ binding.btnCopyUrl.text = "\uD83D\uDCCB Copy URL" }, 2000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── BleScaleListener ─────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
override fun onDeviceFound(info: BleDeviceInfo) {
|
|
||||||
if (devices.none { it.device.address == info.device.address }) {
|
|
||||||
// Insert keeping descending scaleScore order (scale-likely devices first)
|
|
||||||
val insertAt = devices.indexOfFirst { it.scaleScore < info.scaleScore }
|
|
||||||
.let { if (it < 0) devices.size else it }
|
|
||||||
devices.add(insertAt, info)
|
|
||||||
deviceAdapter.notifyItemInserted(insertAt)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConnecting(device: BluetoothDevice) {
|
|
||||||
val name = try { device.name ?: device.address } catch (e: SecurityException) { device.address }
|
|
||||||
binding.tvScaleStatus.text = "\u23f3 Connecting to $name\u2026"
|
|
||||||
binding.tvWeight.text = "— — —"
|
|
||||||
binding.cardConnection.setCardBackgroundColor(getColor(android.R.color.holo_orange_light))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConnected(deviceName: String) {
|
|
||||||
isAutoReconnecting = false
|
|
||||||
binding.tvScaleStatus.text = "\u2705 Connected: $deviceName"
|
|
||||||
binding.tvWeight.text = "Waiting for weight\u2026"
|
|
||||||
binding.cardConnection.setCardBackgroundColor(getColor(android.R.color.holo_green_light))
|
|
||||||
binding.btnDisconnect.visibility = View.VISIBLE
|
|
||||||
binding.rvDevices.visibility = View.GONE
|
|
||||||
binding.btnScan.visibility = View.GONE
|
|
||||||
binding.tvScanHint.visibility = View.GONE
|
|
||||||
wsServer?.publishStatus("connected", deviceName, batteryLevel)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDisconnected() {
|
|
||||||
wsServer?.publishStatus("disconnected", null, null)
|
|
||||||
updateUiDisconnected()
|
|
||||||
// Auto-reconnect: if a saved device exists, restart scan after a short delay.
|
|
||||||
// This handles the scale turning off by itself (auto-off) — when it powers
|
|
||||||
// back on it will start advertising again and we will pick it up.
|
|
||||||
if (bleManager.getSavedDeviceAddress() != null && bleManager.hasRequiredPermissions()) {
|
|
||||||
isAutoReconnecting = true
|
|
||||||
binding.tvScanHint.visibility = View.VISIBLE
|
|
||||||
binding.tvScanHint.text = "\uD83D\uDD04 Reconnecting to saved scale in 5 s\u2026"
|
|
||||||
binding.root.postDelayed({
|
|
||||||
if (!bleManager.isConnected && isAutoReconnecting) {
|
|
||||||
bleManager.enableAutoConnect()
|
|
||||||
bleManager.startScan()
|
|
||||||
}
|
|
||||||
}, 5_000L)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onWeightReceived(reading: WeightReading) {
|
|
||||||
val displayValue = if (reading.value % 1f == 0f) reading.value.toInt().toString()
|
|
||||||
else "%.1f".format(reading.value)
|
|
||||||
binding.tvWeight.text = "$displayValue ${reading.unit}"
|
|
||||||
|
|
||||||
if (reading.stable) {
|
|
||||||
binding.tvWeightHint.text = "\u2713 Stable reading"
|
|
||||||
} else {
|
|
||||||
binding.tvWeightHint.text = "\u23f3 Measuring\u2026"
|
|
||||||
}
|
|
||||||
wsServer?.publishWeight(reading.value, reading.unit, reading.stable, batteryLevel)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBatteryReceived(level: Int) {
|
|
||||||
batteryLevel = level
|
|
||||||
binding.tvBattery.text = "🔋 $level%"
|
|
||||||
binding.tvBattery.visibility = View.VISIBLE
|
|
||||||
wsServer?.publishStatus("connected", binding.tvScaleStatus.text.toString()
|
|
||||||
.removePrefix("\u2705 Connected: "), level)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(message: String) {
|
|
||||||
binding.tvScaleStatus.text = "❌ $message"
|
|
||||||
binding.cardConnection.setCardBackgroundColor(getColor(android.R.color.holo_red_light))
|
|
||||||
ErrorReporter.reportMessage(
|
|
||||||
type = "ble-error",
|
|
||||||
message = message,
|
|
||||||
extra = mapOf("connected_device" to (bleManager.getSavedDeviceAddress() ?: "none"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onScanStopped() {
|
|
||||||
binding.btnScan.isEnabled = true
|
|
||||||
if (isAutoReconnecting && !bleManager.isConnected && bleManager.getSavedDeviceAddress() != null) {
|
|
||||||
// Scale not found yet — retry scan after 10 s indefinitely until reconnected
|
|
||||||
binding.tvScanHint.visibility = View.VISIBLE
|
|
||||||
binding.tvScanHint.text = "\uD83D\uDD04 Bilancia non trovata, riprovo tra 10 s\u2026"
|
|
||||||
binding.root.postDelayed({
|
|
||||||
if (!bleManager.isConnected && isAutoReconnecting) {
|
|
||||||
binding.tvScanHint.text = "\uD83D\uDD04 Cerco la bilancia\u2026"
|
|
||||||
bleManager.enableAutoConnect()
|
|
||||||
bleManager.startScan()
|
|
||||||
}
|
|
||||||
}, 10_000L)
|
|
||||||
} else if (devices.isEmpty()) {
|
|
||||||
binding.tvScanHint.text = "No scale found. Make sure it's on, then scan again."
|
|
||||||
} else {
|
|
||||||
binding.tvScanHint.text = "Tap a scale to connect."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDebugEvent(message: String) {
|
|
||||||
runOnUiThread {
|
|
||||||
val ts = debugTimeFmt.format(Date())
|
|
||||||
debugLines.add("[$ts] $message")
|
|
||||||
// Keep only last MAX_DEBUG_LINES
|
|
||||||
while (debugLines.size > MAX_DEBUG_LINES) debugLines.removeAt(0)
|
|
||||||
// Throttle UI updates to avoid freezing
|
|
||||||
val now = System.currentTimeMillis()
|
|
||||||
if (now - lastDebugUpdate >= DEBUG_THROTTLE_MS) {
|
|
||||||
lastDebugUpdate = now
|
|
||||||
binding.tvDebugLog.text = debugLines.joinToString("\n")
|
|
||||||
if (debugVisible) {
|
|
||||||
binding.svDebugLog.post { binding.svDebugLog.fullScroll(View.FOCUS_DOWN) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── ServerEventListener ──────────────────────────────────────────────────
|
|
||||||
|
|
||||||
override fun onClientConnected(address: String) {
|
|
||||||
runOnUiThread {
|
|
||||||
binding.tvClientCount.text = "\uD83C\uDF10 Client connected: $address"
|
|
||||||
binding.tvClientCount.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClientDisconnected(address: String) {
|
|
||||||
runOnUiThread {
|
|
||||||
binding.tvClientCount.visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onClientRequestedWeight() { /* Nothing extra needed */ }
|
|
||||||
|
|
||||||
// ─── UI helpers ───────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun updateUiDisconnected() {
|
|
||||||
binding.tvScaleStatus.text = "\u26a1 Ready \u2014 scan for a scale"
|
|
||||||
binding.tvWeight.text = "— — —"
|
|
||||||
binding.tvWeightHint.text = ""
|
|
||||||
binding.tvBattery.visibility = View.GONE
|
|
||||||
binding.cardConnection.setCardBackgroundColor(getColor(android.R.color.darker_gray))
|
|
||||||
binding.btnDisconnect.visibility = View.GONE
|
|
||||||
binding.rvDevices.visibility = View.VISIBLE
|
|
||||||
binding.btnScan.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getLocalIpAddress(): String? {
|
|
||||||
return try {
|
|
||||||
NetworkInterface.getNetworkInterfaces().toList()
|
|
||||||
.flatMap { it.inetAddresses.toList() }
|
|
||||||
.filterIsInstance<Inet4Address>()
|
|
||||||
.firstOrNull { !it.isLoopbackAddress }
|
|
||||||
?.hostAddress
|
|
||||||
} catch (e: Exception) { null }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showDialog(title: String, message: String) {
|
|
||||||
AlertDialog.Builder(this)
|
|
||||||
.setTitle(title)
|
|
||||||
.setMessage(message)
|
|
||||||
.setPositiveButton("OK", null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Update check ─────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
private fun checkForUpdates() {
|
|
||||||
Thread {
|
|
||||||
try {
|
|
||||||
val conn = java.net.URL(GITHUB_RELEASES_API).openConnection() as java.net.HttpURLConnection
|
|
||||||
conn.setRequestProperty("Accept", "application/vnd.github+json")
|
|
||||||
conn.connectTimeout = 5000
|
|
||||||
conn.readTimeout = 5000
|
|
||||||
val body = conn.inputStream.bufferedReader().readText()
|
|
||||||
conn.disconnect()
|
|
||||||
val json = JSONObject(body)
|
|
||||||
val latestTag = json.optString("tag_name", "").ifEmpty { return@Thread }
|
|
||||||
val current = try { packageManager.getPackageInfo(packageName, 0).versionName ?: "" } catch (_: Exception) { "" }
|
|
||||||
val norm = { v: String -> v.trimStart('v') }
|
|
||||||
val isSemver = latestTag.trimStart('v').matches(Regex("\\d+\\.\\d+.*"))
|
|
||||||
|
|
||||||
// Find scale-gateway APK in release assets
|
|
||||||
var apkUrl = ""
|
|
||||||
val assets = json.optJSONArray("assets")
|
|
||||||
if (assets != null) {
|
|
||||||
for (i in 0 until assets.length()) {
|
|
||||||
val a = assets.getJSONObject(i)
|
|
||||||
val name = a.optString("name", "").lowercase()
|
|
||||||
val url = a.optString("browser_download_url", "")
|
|
||||||
if ((name.contains("gateway") || name.contains("scale")) && url.isNotEmpty()) {
|
|
||||||
apkUrl = url; break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Only show banner if the release actually contains our APK
|
|
||||||
if (apkUrl.isEmpty()) return@Thread
|
|
||||||
|
|
||||||
// Proper semver comparison: only update if remote is strictly newer
|
|
||||||
fun semverNewer(remote: String, local: String): Boolean {
|
|
||||||
val r = remote.split(".").map { it.filter(Char::isDigit).toIntOrNull() ?: 0 }
|
|
||||||
val l = local.split(".").map { it.filter(Char::isDigit).toIntOrNull() ?: 0 }
|
|
||||||
val len = maxOf(r.size, l.size)
|
|
||||||
for (i in 0 until len) {
|
|
||||||
val rv = r.getOrElse(i) { 0 }
|
|
||||||
val lv = l.getOrElse(i) { 0 }
|
|
||||||
if (rv != lv) return rv > lv
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current.isEmpty()) return@Thread
|
|
||||||
if (isSemver && !semverNewer(norm(latestTag), norm(current))) return@Thread
|
|
||||||
|
|
||||||
val label = if (isSemver) "$current → $latestTag" else latestTag
|
|
||||||
val msg = "⬆️ Scale Gateway $label"
|
|
||||||
runOnUiThread { showNativeUpdateBanner(msg, apkUrl) }
|
|
||||||
} catch (_: Exception) {}
|
|
||||||
}.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showNativeUpdateBanner(message: String, apkUrl: String) {
|
|
||||||
pendingApkDownloadUrl = apkUrl
|
|
||||||
binding.tvUpdateMessage.text = message
|
|
||||||
binding.updateBanner.visibility = View.VISIBLE
|
|
||||||
binding.updateBanner.postDelayed({ binding.updateBanner.visibility = View.GONE }, 30_000)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun triggerApkDownload(apkUrl: String) {
|
|
||||||
if (apkUrl.isEmpty()) return
|
|
||||||
try {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
|
||||||
!packageManager.canRequestPackageInstalls()) {
|
|
||||||
pendingApkDownloadUrl = apkUrl // remember for retry
|
|
||||||
installPermLauncher.launch(
|
|
||||||
Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:$packageName"))
|
|
||||||
)
|
|
||||||
Toast.makeText(this, "Abilita 'Installa app sconosciute', poi torna qui", Toast.LENGTH_LONG).show()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Download to app-private external dir — no storage permission needed
|
|
||||||
val destDir = getExternalFilesDir(null) ?: filesDir
|
|
||||||
val destFile = java.io.File(destDir, "evershelf-scale-update.apk")
|
|
||||||
pendingInstallFile = destFile
|
|
||||||
val dm = getSystemService(DOWNLOAD_SERVICE) as DownloadManager
|
|
||||||
val req = DownloadManager.Request(Uri.parse(apkUrl)).apply {
|
|
||||||
setTitle("EverShelf Scale Gateway — Aggiornamento")
|
|
||||||
setDescription("Scaricamento aggiornamento…")
|
|
||||||
setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
|
||||||
setDestinationUri(Uri.fromFile(destFile))
|
|
||||||
setMimeType("application/vnd.android.package-archive")
|
|
||||||
}
|
|
||||||
val downloadId = dm.enqueue(req)
|
|
||||||
Toast.makeText(this, "Download avviato…", Toast.LENGTH_SHORT).show()
|
|
||||||
val receiver = object : BroadcastReceiver() {
|
|
||||||
override fun onReceive(ctx: Context?, intent: Intent?) {
|
|
||||||
val id = intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
|
|
||||||
if (id != downloadId) return
|
|
||||||
unregisterReceiver(this)
|
|
||||||
val q = DownloadManager.Query().setFilterById(downloadId)
|
|
||||||
val c = (getSystemService(DOWNLOAD_SERVICE) as DownloadManager).query(q)
|
|
||||||
var ok = false
|
|
||||||
if (c.moveToFirst()) {
|
|
||||||
val status = c.getInt(c.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS))
|
|
||||||
ok = (status == DownloadManager.STATUS_SUCCESSFUL)
|
|
||||||
}
|
|
||||||
c.close()
|
|
||||||
if (ok) installApk(destFile)
|
|
||||||
else runOnUiThread {
|
|
||||||
Toast.makeText(this@MainActivity, "Download fallito, riprova", Toast.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
// RECEIVER_EXPORTED required: ACTION_DOWNLOAD_COMPLETE is sent by the system DownloadManager
|
|
||||||
// (an external process), so NOT_EXPORTED would silently block the broadcast on API 33+.
|
|
||||||
registerReceiver(receiver, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE), RECEIVER_EXPORTED)
|
|
||||||
} else {
|
|
||||||
@Suppress("UnspecifiedRegisterReceiverFlag")
|
|
||||||
registerReceiver(receiver, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Toast.makeText(this, "Errore download: ${e.message}", Toast.LENGTH_LONG).show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun installApk(file: java.io.File) {
|
|
||||||
if (!file.exists() || file.length() == 0L) {
|
|
||||||
runOnUiThread { Toast.makeText(this, "File APK non trovato", Toast.LENGTH_LONG).show() }
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
val pi = packageManager.packageInstaller
|
|
||||||
val params = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
|
|
||||||
params.setAppPackageName(packageName)
|
|
||||||
val sessionId = pi.createSession(params)
|
|
||||||
pi.openSession(sessionId).use { session ->
|
|
||||||
file.inputStream().use { input ->
|
|
||||||
session.openWrite("package", 0, file.length()).use { out ->
|
|
||||||
input.copyTo(out)
|
|
||||||
session.fsync(out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val action = "it.dadaloop.evershelf.scalegate.INSTALL_RESULT_$sessionId"
|
|
||||||
val resultReceiver = object : BroadcastReceiver() {
|
|
||||||
override fun onReceive(ctx: Context?, intent: Intent?) {
|
|
||||||
unregisterReceiver(this)
|
|
||||||
val status = intent?.getIntExtra(
|
|
||||||
PackageInstaller.EXTRA_STATUS,
|
|
||||||
PackageInstaller.STATUS_FAILURE
|
|
||||||
) ?: PackageInstaller.STATUS_FAILURE
|
|
||||||
when (status) {
|
|
||||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
|
||||||
// Use launcher so we get notified if system installer fails
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val confirmIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
|
|
||||||
intent?.getParcelableExtra(Intent.EXTRA_INTENT, Intent::class.java)
|
|
||||||
else intent?.getParcelableExtra(Intent.EXTRA_INTENT)
|
|
||||||
if (confirmIntent != null) installConfirmLauncher.launch(confirmIntent)
|
|
||||||
}
|
|
||||||
PackageInstaller.STATUS_SUCCESS ->
|
|
||||||
runOnUiThread { Toast.makeText(this@MainActivity, "✅ Aggiornamento installato", Toast.LENGTH_SHORT).show() }
|
|
||||||
PackageInstaller.STATUS_FAILURE_INCOMPATIBLE,
|
|
||||||
PackageInstaller.STATUS_FAILURE_CONFLICT -> {
|
|
||||||
runOnUiThread {
|
|
||||||
AlertDialog.Builder(this@MainActivity)
|
|
||||||
.setTitle("⚠️ Conflitto firma APK")
|
|
||||||
.setMessage("L'app installata usa una firma diversa.\n\nDisinstalla la versione precedente: al termine l'installazione riparte automaticamente.")
|
|
||||||
.setPositiveButton("Disinstalla") { _, _ ->
|
|
||||||
uninstallLauncher.launch(
|
|
||||||
Intent(Intent.ACTION_DELETE, android.net.Uri.parse("package:$packageName"))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.setNegativeButton("Annulla", null)
|
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
val msg = intent?.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)
|
|
||||||
?: "status=$status"
|
|
||||||
runOnUiThread { Toast.makeText(this@MainActivity, "Installazione: $msg", Toast.LENGTH_LONG).show() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU)
|
|
||||||
RECEIVER_NOT_EXPORTED else 0
|
|
||||||
registerReceiver(resultReceiver, IntentFilter(action), flags)
|
|
||||||
val pi2 = PendingIntent.getBroadcast(
|
|
||||||
this, sessionId,
|
|
||||||
Intent(action).setPackage(packageName),
|
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
||||||
)
|
|
||||||
session.commit(pi2.intentSender)
|
|
||||||
}
|
|
||||||
Toast.makeText(this, "Installazione in corso…", Toast.LENGTH_SHORT).show()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
runOnUiThread { Toast.makeText(this, "Errore installazione: ${e.message}", Toast.LENGTH_LONG).show() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── RecyclerView adapter ──────────────────────────────────────────────────
|
|
||||||
|
|
||||||
inner class DeviceAdapter(
|
|
||||||
private val items: List<BleDeviceInfo>,
|
|
||||||
private val onClick: (BleDeviceInfo) -> Unit,
|
|
||||||
) : RecyclerView.Adapter<DeviceAdapter.VH>() {
|
|
||||||
|
|
||||||
inner class VH(view: View) : RecyclerView.ViewHolder(view) {
|
|
||||||
val tvName: TextView = view.findViewById(R.id.tv_device_name)
|
|
||||||
val tvAddr: TextView = view.findViewById(R.id.tv_device_addr)
|
|
||||||
val tvRssi: TextView = view.findViewById(R.id.tv_device_rssi)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
|
||||||
val view = LayoutInflater.from(parent.context)
|
|
||||||
.inflate(R.layout.item_device, parent, false)
|
|
||||||
return VH(view)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: VH, position: Int) {
|
|
||||||
val info = items[position]
|
|
||||||
holder.tvName.text = info.name
|
|
||||||
holder.tvAddr.text = info.device.address
|
|
||||||
holder.tvRssi.text = info.proximity
|
|
||||||
holder.itemView.setOnClickListener { onClick(info) }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
package it.dadaloop.evershelf.scalegate
|
|
||||||
|
|
||||||
import android.bluetooth.BluetoothGattCharacteristic
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
// --- Data model ---
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A single weight reading from a BLE scale.
|
|
||||||
* [value] is in the scale's current display unit (grams, oz, ml, lb).
|
|
||||||
* [unit] is "g", "oz", "ml", or "lb".
|
|
||||||
*/
|
|
||||||
data class WeightReading(
|
|
||||||
val value: Float,
|
|
||||||
val unit: String,
|
|
||||||
val stable: Boolean,
|
|
||||||
)
|
|
||||||
|
|
||||||
// --- UUIDs ---
|
|
||||||
|
|
||||||
val CCCD_UUID: UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
|
|
||||||
|
|
||||||
object BleUuids {
|
|
||||||
// BLE SIG Weight Scale (some kitchen scales use this)
|
|
||||||
val WEIGHT_SCALE_SERVICE = UUID.fromString("0000181d-0000-1000-8000-00805f9b34fb")
|
|
||||||
val WEIGHT_MEASUREMENT_CHAR = UUID.fromString("00002a9d-0000-1000-8000-00805f9b34fb")
|
|
||||||
|
|
||||||
// Battery
|
|
||||||
val BATTERY_SERVICE = UUID.fromString("0000180f-0000-1000-8000-00805f9b34fb")
|
|
||||||
val BATTERY_LEVEL_CHAR = UUID.fromString("00002a19-0000-1000-8000-00805f9b34fb")
|
|
||||||
|
|
||||||
// Common vendor services used by kitchen scales
|
|
||||||
val FFE0 = UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb")
|
|
||||||
val FFE1 = UUID.fromString("0000ffe1-0000-1000-8000-00805f9b34fb")
|
|
||||||
val FFF0 = UUID.fromString("0000fff0-0000-1000-8000-00805f9b34fb")
|
|
||||||
val FFF1 = UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb")
|
|
||||||
val FFF4 = UUID.fromString("0000fff4-0000-1000-8000-00805f9b34fb")
|
|
||||||
|
|
||||||
// Acaia / Brewista coffee scales
|
|
||||||
val ACAIA_SERVICE = UUID.fromString("49535343-fe7d-4ae5-8fa9-9fafd205e455")
|
|
||||||
val ACAIA_CHAR = UUID.fromString("49535343-8841-43f4-a8d4-ecbe34729bb3")
|
|
||||||
|
|
||||||
// QN/Yolanda food scale secondary service (QN-KS, etc.)
|
|
||||||
val QN_AE00 = UUID.fromString("0000ae00-0000-1000-8000-00805f9b34fb")
|
|
||||||
val QN_AE02 = UUID.fromString("0000ae02-0000-1000-8000-00805f9b34fb")
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Food scale protocol parser ---
|
|
||||||
|
|
||||||
object ScaleProtocol {
|
|
||||||
|
|
||||||
// Plausible kitchen scale range
|
|
||||||
private const val MAX_GRAMS = 15000f
|
|
||||||
private const val MIN_GRAMS = 0.5f // allow tare/small values
|
|
||||||
|
|
||||||
fun resetState() { /* reserved for future use */ }
|
|
||||||
|
|
||||||
fun parse(
|
|
||||||
char: BluetoothGattCharacteristic,
|
|
||||||
data: ByteArray,
|
|
||||||
debug: ((String) -> Unit)? = null,
|
|
||||||
): WeightReading? {
|
|
||||||
if (data.size < 2) {
|
|
||||||
debug?.invoke("skip: packet too short (" + data.size + "B)")
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
// UUID-specific parsers
|
|
||||||
when (char.uuid) {
|
|
||||||
BleUuids.WEIGHT_MEASUREMENT_CHAR -> return parseSigWeight(data, debug)
|
|
||||||
}
|
|
||||||
|
|
||||||
// QN/Yolanda food scale (QN-KS, BC-KS, etc.):
|
|
||||||
// 18-byte frame starting with 0x10 0x12 on FFF1
|
|
||||||
if (data.size == 18
|
|
||||||
&& (data[0].toInt() and 0xFF) == 0x10
|
|
||||||
&& (data[1].toInt() and 0xFF) == 0x12) {
|
|
||||||
return parseQNFood(data, debug)
|
|
||||||
}
|
|
||||||
|
|
||||||
return parseGeneric(data, debug)
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// BLE SIG 0x2A9D Weight Measurement
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
private fun parseSigWeight(data: ByteArray, debug: ((String) -> Unit)? = null): WeightReading? {
|
|
||||||
if (data.size < 3) return null
|
|
||||||
val flags = data[0].toInt() and 0xFF
|
|
||||||
val isImperial = (flags and 0x01) != 0
|
|
||||||
val raw = u16le(data, 1)
|
|
||||||
|
|
||||||
return if (isImperial) {
|
|
||||||
val lb = raw * 0.01f
|
|
||||||
debug?.invoke("SIG 2A9D: raw=$raw -> ${lb}lb")
|
|
||||||
if (lb < 0.01f || lb > 33f) null
|
|
||||||
else WeightReading(lb, "lb", stable = true)
|
|
||||||
} else {
|
|
||||||
val g = raw * 5f // 0.005 kg resolution = 5 g/unit
|
|
||||||
debug?.invoke("SIG 2A9D: raw=$raw -> ${g}g")
|
|
||||||
if (g < MIN_GRAMS || g > MAX_GRAMS) null
|
|
||||||
else WeightReading(g, "g", stable = true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// QN / Yolanda food scale (QN-KS, BC-KS, YolandaKS, ...)
|
|
||||||
//
|
|
||||||
// 18-byte notification on service 0xFFF0, char 0xFFF1:
|
|
||||||
// [0x10][0x12][00][??][unit][02][05][01][flags][w_hi][w_lo][7E][1F][02][58][02][01][crc]
|
|
||||||
// index: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
|
||||||
//
|
|
||||||
// weight = u16BE(data, 9) / 10.0 (0.1-unit resolution)
|
|
||||||
// unit = byte[4]: 0x01=g, 0x02=oz, 0x03=ml(water), 0x04=ml(milk)
|
|
||||||
// stable = bit3 of byte[8] != 0 (0xF8=stable, 0xF0=settling)
|
|
||||||
// crc = sum(bytes[0..16]) mod 256
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
private fun parseQNFood(data: ByteArray, debug: ((String) -> Unit)? = null): WeightReading? {
|
|
||||||
// Verify checksum
|
|
||||||
val calc = data.take(17).sumOf { it.toInt() and 0xFF } and 0xFF
|
|
||||||
if (calc != (data[17].toInt() and 0xFF)) {
|
|
||||||
debug?.invoke("QN-KS: CRC mismatch (calc=0x%02X got=0x%02X)".format(calc, data[17].toInt() and 0xFF))
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
val rawValue = u16be(data, 9)
|
|
||||||
val stable = (data[8].toInt() and 0x08) != 0
|
|
||||||
val unit = when (data[4].toInt() and 0xFF) {
|
|
||||||
0x01 -> "g"
|
|
||||||
0x02 -> "oz"
|
|
||||||
0x03 -> "ml" // water mode
|
|
||||||
0x04 -> "ml" // milk mode
|
|
||||||
else -> "g"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolution is 0.1 unit (e.g. 170 raw = 17.0 g, 195 raw = 19.5 g)
|
|
||||||
val value = rawValue / 10f
|
|
||||||
|
|
||||||
debug?.invoke("QN-KS: ${value}${unit} stable=$stable (raw=$rawValue unit_byte=0x%02X)".format(data[4].toInt() and 0xFF))
|
|
||||||
|
|
||||||
if (rawValue == 0) return null
|
|
||||||
// Convert to grams for range check
|
|
||||||
val valueG = if (unit == "oz") value * 28.3495f else value
|
|
||||||
if (valueG < MIN_GRAMS || valueG > MAX_GRAMS) return null
|
|
||||||
|
|
||||||
return WeightReading(value, unit, stable)
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Generic fallback parser
|
|
||||||
// Tries common frame layouts used by many BLE kitchen scales.
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
private fun parseGeneric(data: ByteArray, debug: ((String) -> Unit)? = null): WeightReading? {
|
|
||||||
if (data.size < 3) {
|
|
||||||
debug?.invoke("generic: skip short packet (" + data.size + "B)")
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
data class C(val pos: Int, val be: Boolean, val div: Float, val label: String)
|
|
||||||
|
|
||||||
val candidates = listOf(
|
|
||||||
// Direct grams (1g resolution)
|
|
||||||
C(1, false, 1f, "pos1 LE g"),
|
|
||||||
C(1, true, 1f, "pos1 BE g"),
|
|
||||||
C(2, false, 1f, "pos2 LE g"),
|
|
||||||
C(2, true, 1f, "pos2 BE g"),
|
|
||||||
C(3, false, 1f, "pos3 LE g"),
|
|
||||||
C(3, true, 1f, "pos3 BE g"),
|
|
||||||
// 0.1g resolution (high-precision scales)
|
|
||||||
C(1, false, 10f, "pos1 LE 0.1g"),
|
|
||||||
C(1, true, 10f, "pos1 BE 0.1g"),
|
|
||||||
C(2, false, 10f, "pos2 LE 0.1g"),
|
|
||||||
C(2, true, 10f, "pos2 BE 0.1g"),
|
|
||||||
C(3, false, 10f, "pos3 LE 0.1g"),
|
|
||||||
C(3, true, 10f, "pos3 BE 0.1g"),
|
|
||||||
// 0.5g resolution
|
|
||||||
C(1, false, 2f, "pos1 LE 0.5g"),
|
|
||||||
C(1, true, 2f, "pos1 BE 0.5g"),
|
|
||||||
// Raw = centgrams (raw*10 = g)
|
|
||||||
C(1, false, 0.1f, "pos1 LE cg"),
|
|
||||||
C(1, true, 0.1f, "pos1 BE cg"),
|
|
||||||
C(3, false, 0.1f, "pos3 LE cg"),
|
|
||||||
C(3, true, 0.1f, "pos3 BE cg"),
|
|
||||||
)
|
|
||||||
|
|
||||||
for (c in candidates) {
|
|
||||||
if (c.pos + 1 >= data.size) continue
|
|
||||||
val raw = if (c.be) u16be(data, c.pos) else u16le(data, c.pos)
|
|
||||||
if (raw == 0) continue
|
|
||||||
val g = raw / c.div
|
|
||||||
if (g in MIN_GRAMS..MAX_GRAMS) {
|
|
||||||
debug?.invoke("generic [${c.label}]: raw=$raw -> ${g}g (unstable)")
|
|
||||||
return WeightReading(g, "g", stable = false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debug?.invoke("generic: no valid candidate in " + data.size + " bytes")
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Helpers
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
private fun u16le(b: ByteArray, off: Int): Int =
|
|
||||||
(b[off].toInt() and 0xFF) or ((b[off + 1].toInt() and 0xFF) shl 8)
|
|
||||||
|
|
||||||
private fun u16be(b: ByteArray, off: Int): Int =
|
|
||||||
((b[off].toInt() and 0xFF) shl 8) or (b[off + 1].toInt() and 0xFF)
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#6C63FF"
|
|
||||||
android:pathData="M0,0h108v108H0z" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportWidth="108"
|
|
||||||
android:viewportHeight="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:pathData="M54,30L54,70 M40,38L68,38 M36,54L44,38 M64,54L72,38 M36,54C36,56 44,56 44,54 M64,54C64,56 72,56 72,54" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="#F3F4F6">
|
|
||||||
|
|
||||||
<!-- ── Update banner (shown at the TOP when a new version is available) ─ -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/updateBanner"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:background="#1e293b"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="8dp"
|
|
||||||
android:paddingTop="10dp"
|
|
||||||
android:paddingBottom="10dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvUpdateMessage"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:textColor="#fbbf24"
|
|
||||||
android:textSize="13sp"
|
|
||||||
android:text="" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnInstallUpdate"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:text="⬇ Scarica"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#1e293b"
|
|
||||||
android:backgroundTint="#fbbf24"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/btnDismissUpdate"
|
|
||||||
android:layout_width="36dp"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:text="✕"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="#94a3b8"
|
|
||||||
android:backgroundTint="@android:color/transparent"
|
|
||||||
style="@style/Widget.MaterialComponents.Button.TextButton" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<!-- ── Header ─────────────────────────────────────────────────────── -->
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="⚖️ EverShelf Scale Gateway"
|
|
||||||
android:textSize="22sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="#1E293B"
|
|
||||||
android:paddingBottom="4dp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingBottom="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="Connect your smart scale to EverShelf via Bluetooth"
|
|
||||||
android:textSize="13sp"
|
|
||||||
android:textColor="#64748B" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_version"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="v?.?.?"
|
|
||||||
android:textSize="11sp"
|
|
||||||
android:textColor="#94A3B8"
|
|
||||||
android:fontFamily="monospace"
|
|
||||||
android:gravity="end" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<!-- ── Gateway URL card ───────────────────────────────────────────── -->
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
app:cardCornerRadius="12dp"
|
|
||||||
app:cardElevation="2dp"
|
|
||||||
app:cardBackgroundColor="#EFF6FF">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="🌐 Gateway URL (paste into EverShelf)"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#64748B"
|
|
||||||
android:paddingBottom="4dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_gateway_url"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="ws://…:8765"
|
|
||||||
android:textSize="18sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="#1D4ED8"
|
|
||||||
android:fontFamily="monospace"
|
|
||||||
android:paddingBottom="4dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_gateway_url_hint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Settings → Smart Scale"
|
|
||||||
android:textSize="11sp"
|
|
||||||
android:textColor="#94A3B8"
|
|
||||||
android:paddingBottom="8dp" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_copy_url"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="📋 Copy URL"
|
|
||||||
android:backgroundTint="#1D4ED8"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<!-- ── Gateway status ────────────────────────────────────────────── -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_gateway_status"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="⏳ Starting gateway…"
|
|
||||||
android:textSize="13sp"
|
|
||||||
android:textColor="#64748B"
|
|
||||||
android:paddingBottom="4dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_client_count"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#059669"
|
|
||||||
android:paddingBottom="12dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<!-- ── Scale connection card ──────────────────────────────────────── -->
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
android:id="@+id/card_connection"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
app:cardCornerRadius="12dp"
|
|
||||||
app:cardElevation="2dp"
|
|
||||||
app:cardBackgroundColor="@android:color/darker_gray">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_scale_status"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="⚡ Ready — scan for a scale"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:paddingBottom="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_weight"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="— — —"
|
|
||||||
android:textSize="46sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:gravity="center"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="4dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_weight_hint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#E2E8F0"
|
|
||||||
android:gravity="center"
|
|
||||||
android:paddingBottom="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_battery"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#E2E8F0"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_disconnect"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="🔌 Disconnect scale"
|
|
||||||
android:backgroundTint="#EF4444"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
<!-- ── Scan controls ──────────────────────────────────────────────── -->
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_scan"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="🔍 Scan for Bluetooth Scales"
|
|
||||||
android:backgroundTint="#7C3AED"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_marginBottom="8dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_debug"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="\uD83D\uDC1B Debug"
|
|
||||||
android:backgroundTint="#374151"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:layout_marginEnd="4dp"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_copy_log"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="\uD83D\uDCCB"
|
|
||||||
android:backgroundTint="#374151"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:minWidth="48dp"
|
|
||||||
android:layout_marginEnd="4dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_share_log"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="\uD83D\uDCE4"
|
|
||||||
android:backgroundTint="#374151"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:minWidth="48dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
style="@style/Widget.MaterialComponents.Button" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/sv_debug_log"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="220dp"
|
|
||||||
android:layout_marginBottom="12dp"
|
|
||||||
android:background="#111827"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_debug_log"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=""
|
|
||||||
android:textSize="10sp"
|
|
||||||
android:fontFamily="monospace"
|
|
||||||
android:textColor="#4ADE80"
|
|
||||||
android:padding="8dp" />
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_scan_hint"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Press to scan for nearby BLE scales.\nMake sure the scale is turned on."
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:textColor="#64748B"
|
|
||||||
android:paddingBottom="12dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<!-- ── Device list ─────────────────────────────────────────────────── -->
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv_devices"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:nestedScrollingEnabled="false" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
app:cardCornerRadius="10dp"
|
|
||||||
app:cardElevation="1dp"
|
|
||||||
app:cardBackgroundColor="#FFFFFF">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="14dp"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:text="⚖️"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_marginEnd="12dp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_device_name"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="#1E293B" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_device_addr"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="11sp"
|
|
||||||
android:fontFamily="monospace"
|
|
||||||
android:textColor="#94A3B8" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_device_rssi"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="11sp"
|
|
||||||
android:textColor="#64748B" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 165 B |
|
Before Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 413 B |
|
Before Width: | Height: | Size: 413 B |
|
Before Width: | Height: | Size: 546 B |
|
Before Width: | Height: | Size: 546 B |
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="purple_500">#FF6200EE</color>
|
|
||||||
<color name="purple_700">#FF3700B3</color>
|
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
|
||||||
<color name="white">#FFFFFFFF</color>
|
|
||||||
<color name="black">#FF000000</color>
|
|
||||||
<color name="accent">#7C3AED</color>
|
|
||||||
<color name="green">#059669</color>
|
|
||||||
<color name="red">#EF4444</color>
|
|
||||||
<color name="blue">#1D4ED8</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="app_name">EverShelf Scale Gateway</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths>
|
|
||||||
<!-- App-private external dir: no storage permission needed -->
|
|
||||||
<external-files-path name="apk_downloads" path="." />
|
|
||||||
</paths>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// Top-level build file
|
|
||||||
plugins {
|
|
||||||
id("com.android.application") version "8.2.2" apply false
|
|
||||||
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
android.useAndroidX=true
|
|
||||||
android.enableJetifier=true
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
|
||||||
networkTimeout=10000
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
gradlePluginPortal()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencyResolutionManagement {
|
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.name = "EverShelf Scale Gateway"
|
|
||||||
include(":app")
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<title>EverShelf</title>
|
<title>EverShelf</title>
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
<link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png">
|
<link rel="icon" type="image/png" href="assets/img/logo/logo_icon.png">
|
||||||
<link rel="stylesheet" href="assets/css/style.css?v=20260513a">
|
<link rel="stylesheet" href="assets/css/style.css?v=20260516b">
|
||||||
<!-- QuaggaJS for barcode scanning -->
|
<!-- QuaggaJS for barcode scanning -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/@ericblade/quagga2@1.8.4/dist/quagga.min.js"></script>
|
||||||
<!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise -->
|
<!-- @xenova/transformers: ES-module bootstrap that exposes a lazy category-classifier as window._categoryPipelinePromise -->
|
||||||
@@ -53,8 +53,9 @@
|
|||||||
<!-- ===== APP PRELOADER (hidden by JS once _initApp completes) ===== -->
|
<!-- ===== APP PRELOADER (hidden by JS once _initApp completes) ===== -->
|
||||||
<div id="app-preloader" aria-hidden="true">
|
<div id="app-preloader" aria-hidden="true">
|
||||||
<div class="app-preloader-inner">
|
<div class="app-preloader-inner">
|
||||||
<div class="app-preloader-spinner"></div>
|
|
||||||
<img src="assets/img/logo/logo.png" alt="EverShelf" class="app-preloader-logo" />
|
<img src="assets/img/logo/logo.png" alt="EverShelf" class="app-preloader-logo" />
|
||||||
|
<div class="app-preloader-spinner"></div>
|
||||||
|
<span class="app-preloader-version" id="preloader-version">v1.7.15</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
<!-- Title — left-aligned; grows to fill space -->
|
<!-- Title — left-aligned; grows to fill space -->
|
||||||
<div class="header-title-wrap">
|
<div class="header-title-wrap">
|
||||||
<h1 class="header-title" onclick="showPage('dashboard')">
|
<h1 class="header-title" onclick="showPage('dashboard')">
|
||||||
<img src="assets/img/logo/logo_icon.png" alt="" class="header-logo-icon" aria-hidden="true" /><span data-i18n="nav.title">EverShelf</span><span class="header-version">v1.7.12</span>
|
<img src="assets/img/logo/logo_icon.png" alt="" class="header-logo-icon" aria-hidden="true" /><span data-i18n="nav.title">EverShelf</span><span class="header-version">v1.7.15</span>
|
||||||
</h1>
|
</h1>
|
||||||
<!-- Update badge — shown alongside title, never replaces it -->
|
<!-- Update badge — shown alongside title, never replaces it -->
|
||||||
<span class="header-update-badge" id="header-update-badge" style="display:none"></span>
|
<span class="header-update-badge" id="header-update-badge" style="display:none"></span>
|
||||||
@@ -187,10 +188,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="location-tabs" id="location-tabs">
|
<div class="location-tabs" id="location-tabs">
|
||||||
<button class="tab active" onclick="filterLocation('')" data-loc="" data-i18n="inventory.filter_all">Tutti</button>
|
<button class="tab active" onclick="filterLocation('')" data-loc="" data-i18n="inventory.filter_all">Tutti</button>
|
||||||
<button class="tab" onclick="filterLocation('dispensa')" data-loc="dispensa">🗄️ Dispensa</button>
|
<button class="tab" onclick="filterLocation('dispensa')" data-loc="dispensa">🗄️ <span data-i18n="locations.dispensa">Dispensa</span></button>
|
||||||
<button class="tab" onclick="filterLocation('frigo')" data-loc="frigo">🧊 Frigo</button>
|
<button class="tab" onclick="filterLocation('frigo')" data-loc="frigo">🧊 <span data-i18n="locations.frigo">Frigo</span></button>
|
||||||
<button class="tab" onclick="filterLocation('freezer')" data-loc="freezer">❄️ Freezer</button>
|
<button class="tab" onclick="filterLocation('freezer')" data-loc="freezer">❄️ <span data-i18n="locations.freezer">Freezer</span></button>
|
||||||
<button class="tab" onclick="filterLocation('altro')" data-loc="altro">📦 Altro</button>
|
<button class="tab" onclick="filterLocation('altro')" data-loc="altro">📦 <span data-i18n="locations.altro">Altro</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<input type="text" id="inventory-search" placeholder="🔍 Cerca prodotto..." oninput="filterInventory()" data-i18n-placeholder="inventory.search_placeholder">
|
<input type="text" id="inventory-search" placeholder="🔍 Cerca prodotto..." oninput="filterInventory()" data-i18n-placeholder="inventory.search_placeholder">
|
||||||
@@ -325,11 +326,11 @@
|
|||||||
<div class="action-buttons" id="action-buttons-container">
|
<div class="action-buttons" id="action-buttons-container">
|
||||||
<button class="btn btn-huge btn-success" onclick="showAddForm()">
|
<button class="btn btn-huge btn-success" onclick="showAddForm()">
|
||||||
<span class="btn-icon">📥</span>
|
<span class="btn-icon">📥</span>
|
||||||
<span class="btn-text">AGGIUNGI<br><small>in dispensa/frigo</small></span>
|
<span class="btn-text"><span data-i18n="action.add_btn">AGGIUNGI</span><br><small data-i18n="action.add_sub">in dispensa/frigo</small></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-huge btn-danger" onclick="showUseForm()">
|
<button class="btn btn-huge btn-danger" onclick="showUseForm()">
|
||||||
<span class="btn-icon">📤</span>
|
<span class="btn-icon">📤</span>
|
||||||
<span class="btn-text">USA / CONSUMA<br><small>dalla dispensa/frigo</small></span>
|
<span class="btn-text"><span data-i18n="action.use_btn">USA / CONSUMA</span><br><small data-i18n="action.use_sub">dalla dispensa/frigo</small></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -337,23 +338,23 @@
|
|||||||
<!-- ===== ADD TO INVENTORY FORM ===== -->
|
<!-- ===== ADD TO INVENTORY FORM ===== -->
|
||||||
<section class="page" id="page-add">
|
<section class="page" id="page-add">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<button class="back-btn" onclick="showPage('action')">← Indietro</button>
|
<button class="back-btn" onclick="showPage('action')" data-i18n="btn.back">← Indietro</button>
|
||||||
<h2>Aggiungi alla Dispensa</h2>
|
<h2 data-i18n="add.title">Aggiungi alla Dispensa</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="product-preview-small" id="add-product-preview"></div>
|
<div class="product-preview-small" id="add-product-preview"></div>
|
||||||
<form class="form" onsubmit="submitAdd(event)">
|
<form class="form" onsubmit="submitAdd(event)">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📍 Dove lo metti?</label>
|
<label data-i18n="add.location_label">📍 Dove lo metti?</label>
|
||||||
<div class="location-selector">
|
<div class="location-selector">
|
||||||
<button type="button" class="loc-btn active" onclick="selectLocation(this, 'dispensa')">🗄️ Dispensa</button>
|
<button type="button" class="loc-btn active" onclick="selectLocation(this, 'dispensa')">🗄️ <span data-i18n="locations.dispensa">Dispensa</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectLocation(this, 'frigo')">🧊 Frigo</button>
|
<button type="button" class="loc-btn" onclick="selectLocation(this, 'frigo')">🧊 <span data-i18n="locations.frigo">Frigo</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectLocation(this, 'freezer')">❄️ Freezer</button>
|
<button type="button" class="loc-btn" onclick="selectLocation(this, 'freezer')">❄️ <span data-i18n="locations.freezer">Freezer</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectLocation(this, 'altro')">📦 Altro</button>
|
<button type="button" class="loc-btn" onclick="selectLocation(this, 'altro')">📦 <span data-i18n="locations.altro">Altro</span></button>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="add-location" value="dispensa">
|
<input type="hidden" id="add-location" value="dispensa">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📦 Quantità</label>
|
<label data-i18n="add.quantity_label">📦 Quantità</label>
|
||||||
<div class="qty-unit-row">
|
<div class="qty-unit-row">
|
||||||
<div class="qty-control flex-1">
|
<div class="qty-control flex-1">
|
||||||
<button type="button" class="qty-btn" onclick="adjustAddQty(-1)">−</button>
|
<button type="button" class="qty-btn" onclick="adjustAddQty(-1)">−</button>
|
||||||
@@ -369,7 +370,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<button type="button" id="btn-scale-add" class="btn btn-secondary scale-read-btn" style="display:none" onclick="readScaleWeight('add-quantity', function(){ return document.getElementById('add-unit').value; })" data-i18n="scale.read_btn">⚖️ Leggi dalla bilancia</button>
|
<button type="button" id="btn-scale-add" class="btn btn-secondary scale-read-btn" style="display:none" onclick="readScaleWeight('add-quantity', function(){ return document.getElementById('add-unit').value; })" data-i18n="scale.read_btn">⚖️ Leggi dalla bilancia</button>
|
||||||
<div id="add-conf-size-row" class="conf-size-row" style="display:none">
|
<div id="add-conf-size-row" class="conf-size-row" style="display:none">
|
||||||
<label class="conf-size-label">📦 Ogni confezione contiene:</label>
|
<label class="conf-size-label" data-i18n="add.conf_size_label">📦 Ogni confezione contiene:</label>
|
||||||
<div class="conf-size-inputs">
|
<div class="conf-size-inputs">
|
||||||
<input type="number" id="add-conf-size" class="form-input conf-size-input" min="1" step="any" placeholder="es. 300">
|
<input type="number" id="add-conf-size" class="form-input conf-size-input" min="1" step="any" placeholder="es. 300">
|
||||||
<select id="add-conf-unit" class="form-input conf-size-unit">
|
<select id="add-conf-unit" class="form-input conf-size-unit">
|
||||||
@@ -382,43 +383,43 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="add-vacuum-group">
|
<div class="form-group" id="add-vacuum-group">
|
||||||
<label class="toggle-row" onclick="toggleVacuumSealed()">
|
<label class="toggle-row" onclick="toggleVacuumSealed()">
|
||||||
<span>🫙 Sotto vuoto</span>
|
<span data-i18n="add.vacuum_label">🫙 Sotto vuoto</span>
|
||||||
<span class="toggle-switch" id="add-vacuum-toggle">
|
<span class="toggle-switch" id="add-vacuum-toggle">
|
||||||
<input type="checkbox" id="add-vacuum-sealed" onchange="onVacuumSealedChange()">
|
<input type="checkbox" id="add-vacuum-sealed" onchange="onVacuumSealedChange()">
|
||||||
<span class="toggle-slider"></span>
|
<span class="toggle-slider"></span>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<p class="form-hint" id="add-vacuum-hint" style="display:none">La scadenza verrà estesa automaticamente</p>
|
<p class="form-hint" id="add-vacuum-hint" style="display:none" data-i18n="add.vacuum_hint">La scadenza verrà estesa automaticamente</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="add-expiry-section">
|
<div class="form-group" id="add-expiry-section">
|
||||||
<!-- Populated dynamically by showAddForm() -->
|
<!-- Populated dynamically by showAddForm() -->
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-large btn-success full-width">✅ Aggiungi</button>
|
<button type="submit" class="btn btn-large btn-success full-width" data-i18n="add.submit">✅ Aggiungi</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== USE FROM INVENTORY FORM ===== -->
|
<!-- ===== USE FROM INVENTORY FORM ===== -->
|
||||||
<section class="page" id="page-use">
|
<section class="page" id="page-use">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<button class="back-btn" onclick="showPage('action')">← Indietro</button>
|
<button class="back-btn" onclick="showPage('action')" data-i18n="btn.back">← Indietro</button>
|
||||||
<h2>Usa / Consuma</h2>
|
<h2 data-i18n="use.title">Usa / Consuma</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="product-preview-small" id="use-product-preview"></div>
|
<div class="product-preview-small" id="use-product-preview"></div>
|
||||||
<div class="use-inventory-info" id="use-inventory-info"></div>
|
<div class="use-inventory-info" id="use-inventory-info"></div>
|
||||||
<div id="use-expiry-hint" style="display:none"></div>
|
<div id="use-expiry-hint" style="display:none"></div>
|
||||||
<form class="form" onsubmit="submitUse(event)">
|
<form class="form" onsubmit="submitUse(event)">
|
||||||
<div class="form-group">
|
<div class="form-group" id="use-location-group">
|
||||||
<label>📍 Da dove?</label>
|
<label data-i18n="use.location_label">📍 Da dove?</label>
|
||||||
<div class="location-selector" id="use-location-selector">
|
<div class="location-selector" id="use-location-selector">
|
||||||
<button type="button" class="loc-btn active" onclick="selectUseLocation(this, 'dispensa')">🗄️ Dispensa</button>
|
<button type="button" class="loc-btn active" onclick="selectUseLocation(this, 'dispensa')">🗄️ <span data-i18n="locations.dispensa">Dispensa</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'frigo')">🧊 Frigo</button>
|
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'frigo')">🧊 <span data-i18n="locations.frigo">Frigo</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'freezer')">❄️ Freezer</button>
|
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'freezer')">❄️ <span data-i18n="locations.freezer">Freezer</span></button>
|
||||||
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'altro')">📦 Altro</button>
|
<button type="button" class="loc-btn" onclick="selectUseLocation(this, 'altro')">📦 <span data-i18n="locations.altro">Altro</span></button>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="use-location" value="dispensa">
|
<input type="hidden" id="use-location" value="dispensa">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Quanto hai usato?</label>
|
<label data-i18n="use.quantity_label">Quanto hai usato?</label>
|
||||||
<button type="button" id="btn-scale-use" class="btn btn-secondary scale-read-btn" style="display:none" onclick="readScaleWeight('use-quantity', function(){ return _useNormalUnit || 'g'; })" data-i18n="scale.read_btn">⚖️ Leggi dalla bilancia</button>
|
<button type="button" id="btn-scale-use" class="btn btn-secondary scale-read-btn" style="display:none" onclick="readScaleWeight('use-quantity', function(){ return _useNormalUnit || 'g'; })" data-i18n="scale.read_btn">⚖️ Leggi dalla bilancia</button>
|
||||||
<!-- Live scale weight box (visible when scale connected and unit is g/ml) -->
|
<!-- Live scale weight box (visible when scale connected and unit is g/ml) -->
|
||||||
<div id="scale-live-box" class="scale-live-box" style="display:none">
|
<div id="scale-live-box" class="scale-live-box" style="display:none">
|
||||||
@@ -431,21 +432,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="use-unit-switch" id="use-unit-switch" style="display:none">
|
<div class="use-unit-switch" id="use-unit-switch" style="display:none">
|
||||||
<button type="button" class="use-unit-btn active" id="use-unit-sub" onclick="switchUseUnit('sub')"></button>
|
<button type="button" class="use-unit-btn active" id="use-unit-sub" onclick="switchUseUnit('sub')"></button>
|
||||||
<button type="button" class="use-unit-btn" id="use-unit-conf" onclick="switchUseUnit('conf')">Confezioni</button>
|
<button type="button" class="use-unit-btn" id="use-unit-conf" onclick="switchUseUnit('conf')" data-i18n="units.boxes">Confezioni</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="use-options">
|
<div class="use-options">
|
||||||
<button type="button" class="btn btn-large btn-danger full-width use-all-btn" onclick="submitUseAll()">
|
<button type="button" class="btn btn-large btn-danger full-width use-all-btn" onclick="submitUseAll()" data-i18n="use.use_all">
|
||||||
🗑️ Usato TUTTO / Finito
|
🗑️ Usato TUTTO / Finito
|
||||||
</button>
|
</button>
|
||||||
<div class="use-partial">
|
<div class="use-partial">
|
||||||
<p id="use-partial-hint">Oppure specifica la quantità usata:</p>
|
<p id="use-partial-hint" data-i18n="use.partial_hint">Oppure specifica la quantità usata:</p>
|
||||||
<div class="qty-control">
|
<div class="qty-control">
|
||||||
<button type="button" class="qty-btn" id="use-qty-minus" onclick="adjustUseQty(-1)">−</button>
|
<button type="button" class="qty-btn" id="use-qty-minus" onclick="adjustUseQty(-1)">−</button>
|
||||||
<input type="number" id="use-quantity" value="1" min="0.1" step="any" class="qty-input"
|
<input type="number" id="use-quantity" value="1" min="0.1" step="any" class="qty-input"
|
||||||
oninput="_scaleUserDismissed=true; _cancelScaleTimersOnly();">
|
oninput="_scaleUserDismissed=true; _cancelScaleTimersOnly();">
|
||||||
<button type="button" class="qty-btn" id="use-qty-plus" onclick="adjustUseQty(1)">+</button>
|
<button type="button" class="qty-btn" id="use-qty-plus" onclick="adjustUseQty(1)">+</button>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" id="btn-use-submit" class="btn btn-large btn-warning full-width mt-2 move-countdown-btn">📤 Usa questa quantità</button>
|
<button type="submit" id="btn-use-submit" class="btn btn-large btn-warning full-width mt-2 move-countdown-btn" data-i18n="use.submit">📤 Usa questa quantità</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -456,19 +457,19 @@
|
|||||||
<!-- ===== MANUAL / EDIT PRODUCT FORM ===== -->
|
<!-- ===== MANUAL / EDIT PRODUCT FORM ===== -->
|
||||||
<section class="page" id="page-product-form">
|
<section class="page" id="page-product-form">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<button class="back-btn" onclick="showPage('scan')">← Indietro</button>
|
<button class="back-btn" onclick="showPage('scan')" data-i18n="btn.back">← Indietro</button>
|
||||||
<h2 id="product-form-title">Nuovo Prodotto</h2>
|
<h2 id="product-form-title">Nuovo Prodotto</h2>
|
||||||
</div>
|
</div>
|
||||||
<form class="form" onsubmit="submitProduct(event)">
|
<form class="form" onsubmit="submitProduct(event)">
|
||||||
<input type="hidden" id="pf-id">
|
<input type="hidden" id="pf-id">
|
||||||
<div id="pf-ai-fill-row" class="form-group">
|
<div id="pf-ai-fill-row" class="form-group">
|
||||||
<button type="button" class="btn btn-accent full-width" onclick="captureForAIFormFill()">
|
<button type="button" class="btn btn-accent full-width" onclick="captureForAIFormFill()" data-i18n="product.ai_fill">
|
||||||
📷 Scatta foto e identifica con AI
|
📷 Scatta foto e identifica con AI
|
||||||
</button>
|
</button>
|
||||||
<p class="form-hint" style="text-align:center;margin-top:4px">L'AI compilerà automaticamente i campi del prodotto</p>
|
<p class="form-hint" style="text-align:center;margin-top:4px" data-i18n="product.ai_fill_hint">L'AI compilerà automaticamente i campi del prodotto</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🏷️ Nome Prodotto *</label>
|
<label data-i18n="product.name_label">🏷️ Nome Prodotto *</label>
|
||||||
<input type="text" id="pf-name" class="form-input" required placeholder="Es: Latte intero, Pasta penne rigate..."
|
<input type="text" id="pf-name" class="form-input" required placeholder="Es: Latte intero, Pasta penne rigate..."
|
||||||
list="common-products" autocomplete="off">
|
list="common-products" autocomplete="off">
|
||||||
<datalist id="common-products">
|
<datalist id="common-products">
|
||||||
@@ -535,7 +536,7 @@
|
|||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🏢 Marca</label>
|
<label data-i18n="product.brand_label">🏢 Marca</label>
|
||||||
<input type="text" id="pf-brand" class="form-input" placeholder="Es: Barilla, Granarolo, Mutti..."
|
<input type="text" id="pf-brand" class="form-input" placeholder="Es: Barilla, Granarolo, Mutti..."
|
||||||
list="common-brands" autocomplete="off">
|
list="common-brands" autocomplete="off">
|
||||||
<datalist id="common-brands">
|
<datalist id="common-brands">
|
||||||
@@ -575,9 +576,9 @@
|
|||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📂 Categoria</label>
|
<label data-i18n="product.category_label">📂 Categoria</label>
|
||||||
<select id="pf-category" class="form-input" onchange="onCategoryChange(false)">
|
<select id="pf-category" class="form-input" onchange="onCategoryChange(false)">
|
||||||
<option value="">-- Seleziona --</option>
|
<option value="" data-i18n="form.select_placeholder">-- Seleziona --</option>
|
||||||
<option value="latticini">🥛 Latticini</option>
|
<option value="latticini">🥛 Latticini</option>
|
||||||
<option value="carne">🥩 Carne</option>
|
<option value="carne">🥩 Carne</option>
|
||||||
<option value="pesce">🐟 Pesce</option>
|
<option value="pesce">🐟 Pesce</option>
|
||||||
@@ -598,21 +599,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group flex-1">
|
<div class="form-group flex-1">
|
||||||
<label>📏 Unità di misura</label>
|
<label data-i18n="product.unit_label">📏 Unità di misura</label>
|
||||||
<select id="pf-unit" class="form-input" onchange="onPfUnitChange()">
|
<select id="pf-unit" class="form-input" onchange="onPfUnitChange()">
|
||||||
<option value="pz">Pezzi</option>
|
<option value="pz" data-i18n="units.pieces">Pezzi</option>
|
||||||
<option value="g">Grammi</option>
|
<option value="g" data-i18n="units.grams">Grammi</option>
|
||||||
<option value="ml">ml</option>
|
<option value="ml">ml</option>
|
||||||
<option value="conf">Confezione</option>
|
<option value="conf" data-i18n="units.box">Confezione</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group flex-1">
|
<div class="form-group flex-1">
|
||||||
<label>🔢 Quantità default</label>
|
<label data-i18n="product.default_qty_label">🔢 Quantità default</label>
|
||||||
<input type="number" id="pf-defqty" class="form-input" value="1" min="0.1" step="any">
|
<input type="number" id="pf-defqty" class="form-input" value="1" min="0.1" step="any">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="pf-conf-size-row" class="conf-size-row" style="display:none">
|
<div id="pf-conf-size-row" class="conf-size-row" style="display:none">
|
||||||
<label class="conf-size-label">📦 Ogni confezione contiene:</label>
|
<label class="conf-size-label" data-i18n="product.conf_size_label">📦 Ogni confezione contiene:</label>
|
||||||
<div class="conf-size-inputs">
|
<div class="conf-size-inputs">
|
||||||
<input type="number" id="pf-conf-size" class="form-input conf-size-input" min="1" step="any" placeholder="es. 300">
|
<input type="number" id="pf-conf-size" class="form-input conf-size-input" min="1" step="any" placeholder="es. 300">
|
||||||
<select id="pf-conf-unit" class="form-input conf-size-unit">
|
<select id="pf-conf-unit" class="form-input conf-size-unit">
|
||||||
@@ -622,30 +623,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📝 Note</label>
|
<label data-i18n="product.notes_label">📝 Note</label>
|
||||||
<textarea id="pf-notes" class="form-input" rows="2" placeholder="Es: senza lattosio, bio, conservare in frigo dopo apertura..."></textarea>
|
<textarea id="pf-notes" class="form-input" rows="2" placeholder="Es: senza lattosio, bio, conservare in frigo dopo apertura..."></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🔖 Barcode</label>
|
<label data-i18n="product.barcode_label">🔖 Barcode</label>
|
||||||
<div class="expiry-input-row">
|
<div class="expiry-input-row">
|
||||||
<input type="text" id="pf-barcode" class="form-input" placeholder="Codice a barre (se disponibile)" inputmode="numeric">
|
<input type="text" id="pf-barcode" class="form-input" placeholder="Codice a barre (se disponibile)" inputmode="numeric" data-i18n-placeholder="product.barcode_placeholder">
|
||||||
<button type="button" class="btn btn-accent btn-scan-expiry" id="pf-barcode-scan-btn" onclick="scanBarcodeForForm()" title="Scansiona barcode">📷</button>
|
<button type="button" class="btn btn-accent btn-scan-expiry" id="pf-barcode-scan-btn" onclick="scanBarcodeForForm()" title="Scansiona barcode">📷</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="form-hint" id="pf-barcode-hint" style="display:none">⚠️ Aggiungi il barcode così al prossimo acquisto basta scansionarlo!</p>
|
<p class="form-hint" id="pf-barcode-hint" style="display:none" data-i18n="product.barcode_hint">⚠️ Aggiungi il barcode così al prossimo acquisto basta scansionarlo!</p>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="pf-image">
|
<input type="hidden" id="pf-image">
|
||||||
<div class="product-image-preview" id="pf-image-preview" style="display:none">
|
<div class="product-image-preview" id="pf-image-preview" style="display:none">
|
||||||
<img id="pf-image-img" src="" alt="Product">
|
<img id="pf-image-img" src="" alt="Product">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-large btn-primary full-width">💾 Salva Prodotto</button>
|
<button type="submit" class="btn btn-large btn-primary full-width" data-i18n="btn.save_product">💾 Salva Prodotto</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== ALL PRODUCTS PAGE ===== -->
|
<!-- ===== ALL PRODUCTS PAGE ===== -->
|
||||||
<section class="page" id="page-products">
|
<section class="page" id="page-products">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<button class="back-btn" onclick="showPage('dashboard')">← Indietro</button>
|
<button class="back-btn" onclick="showPage('dashboard')" data-i18n="btn.back">← Indietro</button>
|
||||||
<h2>📦 Tutti i Prodotti</h2>
|
<h2 data-i18n="products.title">📦 Tutti i Prodotti</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<input type="text" id="products-search" placeholder="🔍 Cerca prodotto..." oninput="searchAllProducts()">
|
<input type="text" id="products-search" placeholder="🔍 Cerca prodotto..." oninput="searchAllProducts()">
|
||||||
@@ -778,8 +779,8 @@
|
|||||||
<!-- ===== AI IDENTIFICATION PAGE ===== -->
|
<!-- ===== AI IDENTIFICATION PAGE ===== -->
|
||||||
<section class="page" id="page-ai">
|
<section class="page" id="page-ai">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<button class="back-btn" onclick="stopScanner(); showPage('scan')">← Indietro</button>
|
<button class="back-btn" onclick="stopScanner(); showPage('scan')" data-i18n="btn.back">← Indietro</button>
|
||||||
<h2>🤖 Identificazione AI</h2>
|
<h2 data-i18n="ai.title">🤖 Identificazione AI</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-container">
|
<div class="ai-container">
|
||||||
<div class="ai-capture" id="ai-capture">
|
<div class="ai-capture" id="ai-capture">
|
||||||
@@ -790,15 +791,15 @@
|
|||||||
<img id="ai-image" src="" alt="Captured">
|
<img id="ai-image" src="" alt="Captured">
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-actions">
|
<div class="ai-actions">
|
||||||
<button class="btn btn-large btn-accent" onclick="takePhotoForAI()" id="ai-capture-btn">
|
<button class="btn btn-large btn-accent" onclick="takePhotoForAI()" id="ai-capture-btn" data-i18n="ai.capture">
|
||||||
📸 Scatta Foto
|
📸 Scatta Foto
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-large btn-secondary" onclick="retakePhotoAI()" id="ai-retake-btn" style="display:none">
|
<button class="btn btn-large btn-secondary" onclick="retakePhotoAI()" id="ai-retake-btn" style="display:none" data-i18n="ai.retake">
|
||||||
🔄 Riscatta
|
🔄 Riscatta
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="ai-result" id="ai-result" style="display:none"></div>
|
<div class="ai-result" id="ai-result" style="display:none"></div>
|
||||||
<p class="scan-hint">Scatta una foto del prodotto e l'AI cercherà di identificarlo</p>
|
<p class="scan-hint" data-i18n="ai.hint">Scatta una foto del prodotto e l'AI cercherà di identificarlo</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -838,9 +839,9 @@
|
|||||||
<h4 data-i18n="settings.gemini.title">🤖 Google Gemini AI</h4>
|
<h4 data-i18n="settings.gemini.title">🤖 Google Gemini AI</h4>
|
||||||
<p class="settings-hint" data-i18n="settings.gemini.hint">Chiave API per identificazione prodotti, scadenze e ricette.</p>
|
<p class="settings-hint" data-i18n="settings.gemini.hint">Chiave API per identificazione prodotti, scadenze e ricette.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>API Key Gemini</label>
|
<label data-i18n="settings.gemini.key_label">API Key Gemini</label>
|
||||||
<input type="password" id="setting-gemini-key" class="form-input" placeholder="AIza...">
|
<input type="password" id="setting-gemini-key" class="form-input" placeholder="AIza...">
|
||||||
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-gemini-key')">👁️ Mostra/Nascondi</button>
|
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-gemini-key')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -850,13 +851,13 @@
|
|||||||
<h4 data-i18n="settings.bring.title">🛒 Bring! Shopping List</h4>
|
<h4 data-i18n="settings.bring.title">🛒 Bring! Shopping List</h4>
|
||||||
<p class="settings-hint" data-i18n="settings.bring.hint">Credenziali per l'integrazione con la lista della spesa Bring!</p>
|
<p class="settings-hint" data-i18n="settings.bring.hint">Credenziali per l'integrazione con la lista della spesa Bring!</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📧 Email Bring!</label>
|
<label data-i18n="settings.bring.email_label">📧 Email Bring!</label>
|
||||||
<input type="email" id="setting-bring-email" class="form-input" placeholder="email@esempio.com">
|
<input type="email" id="setting-bring-email" class="form-input" placeholder="email@esempio.com">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🔒 Password Bring!</label>
|
<label data-i18n="settings.bring.password_label">🔒 Password Bring!</label>
|
||||||
<input type="password" id="setting-bring-password" class="form-input" placeholder="Password">
|
<input type="password" id="setting-bring-password" class="form-input" placeholder="Password">
|
||||||
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-bring-password')">👁️ Mostra/Nascondi</button>
|
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-bring-password')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Price Estimation Settings -->
|
<!-- Price Estimation Settings -->
|
||||||
@@ -927,7 +928,7 @@
|
|||||||
<h4 data-i18n="settings.recipe.title">🍳 Preferenze Ricette</h4>
|
<h4 data-i18n="settings.recipe.title">🍳 Preferenze Ricette</h4>
|
||||||
<p class="settings-hint" data-i18n="settings.recipe.hint">Configura le opzioni predefinite per la generazione delle ricette.</p>
|
<p class="settings-hint" data-i18n="settings.recipe.hint">Configura le opzioni predefinite per la generazione delle ricette.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>👥 Persone predefinite</label>
|
<label data-i18n="settings.recipe.persons_label">👥 Persone predefinite</label>
|
||||||
<div class="qty-control">
|
<div class="qty-control">
|
||||||
<button type="button" class="qty-btn" onclick="adjustQty('setting-default-persons', -1)">−</button>
|
<button type="button" class="qty-btn" onclick="adjustQty('setting-default-persons', -1)">−</button>
|
||||||
<input type="number" id="setting-default-persons" value="1" min="1" max="20" class="qty-input">
|
<input type="number" id="setting-default-persons" value="1" min="1" max="20" class="qty-input">
|
||||||
@@ -935,18 +936,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🎯 Opzioni ricetta predefinite</label>
|
<label data-i18n="settings.recipe.options_label">🎯 Opzioni ricetta predefinite</label>
|
||||||
<div class="recipe-pref-checks">
|
<div class="recipe-pref-checks">
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-veloce"> ⚡ Pasto Veloce</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-veloce"> <span data-i18n="settings.recipe.fast">⚡ Pasto Veloce</span></label>
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-pocafame"> 🥗 Poca Fame</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-pocafame"> <span data-i18n="settings.recipe.light">🥗 Poca Fame</span></label>
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-scadenze"> ⏰ Priorità Scadenze</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-scadenze"> <span data-i18n="settings.recipe.expiry">⏰ Priorità Scadenze</span></label>
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-healthy"> 💚 Extra Salutare</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-healthy"> <span data-i18n="settings.recipe.healthy">💚 Extra Salutare</span></label>
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-opened"> 📦 Priorità Cose Aperte</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-opened"> <span data-i18n="settings.recipe.opened">📦 Priorità Cose Aperte</span></label>
|
||||||
<label class="checkbox-label"><input type="checkbox" id="setting-pref-zerowaste"> ♻️ Zero Sprechi</label>
|
<label class="checkbox-label"><input type="checkbox" id="setting-pref-zerowaste"> <span data-i18n="settings.recipe.zerowaste">♻️ Zero Sprechi</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🚫 Intolleranze / Restrizioni</label>
|
<label data-i18n="settings.recipe.dietary_label">🚫 Intolleranze / Restrizioni</label>
|
||||||
<textarea id="setting-dietary" class="form-input" rows="2" placeholder="Es: senza glutine, senza lattosio, vegetariano..."></textarea>
|
<textarea id="setting-dietary" class="form-input" rows="2" placeholder="Es: senza glutine, senza lattosio, vegetariano..."></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -958,7 +959,7 @@
|
|||||||
<p class="settings-hint" data-i18n="settings.mealplan.hint">Imposta la tipologia di pasto per ogni giorno. Sarà usata come guida nella generazione delle ricette.</p>
|
<p class="settings-hint" data-i18n="settings.mealplan.hint">Imposta la tipologia di pasto per ogni giorno. Sarà usata come guida nella generazione delle ricette.</p>
|
||||||
<div class="form-group" style="margin-bottom:10px">
|
<div class="form-group" style="margin-bottom:10px">
|
||||||
<label class="toggle-row">
|
<label class="toggle-row">
|
||||||
<span>✅ Attiva piano pasti settimanale</span>
|
<span data-i18n="settings.mealplan.enabled">✅ Attiva piano pasti settimanale</span>
|
||||||
<span class="toggle-switch">
|
<span class="toggle-switch">
|
||||||
<input type="checkbox" id="setting-meal-plan-enabled" onchange="onMealPlanEnabledChange(this)">
|
<input type="checkbox" id="setting-meal-plan-enabled" onchange="onMealPlanEnabledChange(this)">
|
||||||
<span class="toggle-slider"></span>
|
<span class="toggle-slider"></span>
|
||||||
@@ -969,15 +970,15 @@
|
|||||||
<div id="meal-plan-grid" class="mplan-grid"></div>
|
<div id="meal-plan-grid" class="mplan-grid"></div>
|
||||||
<div id="meal-plan-picker" class="mplan-picker" style="display:none"></div>
|
<div id="meal-plan-picker" class="mplan-picker" style="display:none"></div>
|
||||||
<div style="margin-top:12px; display:flex; gap:8px; flex-wrap:wrap">
|
<div style="margin-top:12px; display:flex; gap:8px; flex-wrap:wrap">
|
||||||
<button class="btn btn-small btn-secondary" onclick="resetMealPlan()">↺ Ripristina default</button>
|
<button class="btn btn-small btn-secondary" onclick="resetMealPlan()" data-i18n="settings.mealplan.reset_btn">↺ Ripristina default</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-hint" style="margin-top:10px">
|
<div class="settings-hint" style="margin-top:10px" data-i18n-html="settings.mealplan.legend">
|
||||||
🌤️ = Pranzo · 🌙 = Cena · Tocca un badge per cambiarlo.
|
🌤️ = Pranzo · 🌙 = Cena · Tocca un badge per cambiarlo.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-card" id="meal-plan-legend-card">
|
<div class="settings-card" id="meal-plan-legend-card">
|
||||||
<h4>📋 Tipologie disponibili</h4>
|
<h4 data-i18n="settings.mealplan.types_title">📋 Tipologie disponibili</h4>
|
||||||
<div class="mplan-legend"></div>
|
<div class="mplan-legend"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -994,18 +995,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="common-appliances mt-2">
|
<div class="common-appliances mt-2">
|
||||||
<p class="settings-hint">Aggiungi velocemente:</p>
|
<p class="settings-hint" data-i18n="settings.appliances.quick_title">Aggiungi velocemente:</p>
|
||||||
<div class="appliance-quick-tags">
|
<div class="appliance-quick-tags">
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Forno')">🔥 Forno</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Forno')" data-i18n="settings.appliances.oven">🔥 Forno</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Microonde')">📡 Microonde</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Microonde')" data-i18n="settings.appliances.microwave">📡 Microonde</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Friggitrice ad aria')">🍟 Friggitrice ad aria</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Friggitrice ad aria')" data-i18n="settings.appliances.air_fryer">🍟 Friggitrice ad aria</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Macchina del pane')">🍞 Macchina pane</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Macchina del pane')" data-i18n="settings.appliances.bread_maker">🍞 Macchina pane</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Bimby/Moulinex Cookeo')">🤖 Bimby/Cookeo</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Bimby/Moulinex Cookeo')" data-i18n="settings.appliances.bimby">🤖 Bimby/Cookeo</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Planetaria')">🌀 Planetaria</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Planetaria')" data-i18n="settings.appliances.mixer">🌀 Planetaria</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Vaporiera')">♨️ Vaporiera</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Vaporiera')" data-i18n="settings.appliances.steamer">♨️ Vaporiera</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Pentola a pressione')">🫕 Pentola pressione</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Pentola a pressione')" data-i18n="settings.appliances.pressure_cooker">🫕 Pentola pressione</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Tostapane')">🍞 Tostapane</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Tostapane')" data-i18n="settings.appliances.toaster">🍞 Tostapane</button>
|
||||||
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Frullatore/Mixer')">🍹 Frullatore</button>
|
<button class="btn btn-small btn-secondary" onclick="addApplianceQuick('Frullatore/Mixer')" data-i18n="settings.appliances.blender">🍹 Frullatore</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1016,35 +1017,35 @@
|
|||||||
<h4 data-i18n="settings.camera.title">📷 Fotocamera</h4>
|
<h4 data-i18n="settings.camera.title">📷 Fotocamera</h4>
|
||||||
<p class="settings-hint" data-i18n="settings.camera.hint">Scegli quale fotocamera utilizzare per la scansione barcode e l'identificazione AI.</p>
|
<p class="settings-hint" data-i18n="settings.camera.hint">Scegli quale fotocamera utilizzare per la scansione barcode e l'identificazione AI.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📸 Fotocamera predefinita</label>
|
<label data-i18n="settings.camera.device_label">📸 Fotocamera predefinita</label>
|
||||||
<select id="setting-camera-facing" class="form-input">
|
<select id="setting-camera-facing" class="form-input">
|
||||||
<option value="environment">📱 Posteriore (default)</option>
|
<option value="environment" data-i18n="settings.camera.back">📱 Posteriore (default)</option>
|
||||||
<option value="user">🤳 Anteriore</option>
|
<option value="user" data-i18n="settings.camera.front">🤳 Anteriore</option>
|
||||||
</select>
|
</select>
|
||||||
<p class="settings-hint mt-2">Se hai più fotocamere, puoi selezionarne una specifica dall'elenco sopra dopo aver concesso i permessi.</p>
|
<p class="settings-hint mt-2" data-i18n="settings.camera.devices_hint">Se hai più fotocamere, puoi selezionarne una specifica dall'elenco sopra dopo aver concesso i permessi.</p>
|
||||||
<button class="btn btn-small btn-secondary mt-2" onclick="loadCameraDevices()">🔄 Rileva fotocamere</button>
|
<button class="btn btn-small btn-secondary mt-2" onclick="loadCameraDevices()" data-i18n="settings.camera.detect_btn">🔄 Rileva fotocamere</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Security Tab -->
|
<!-- Security Tab -->
|
||||||
<div class="settings-panel" id="tab-security">
|
<div class="settings-panel" id="tab-security">
|
||||||
<div class="settings-card">
|
<div class="settings-card">
|
||||||
<h4>🔑 Token Impostazioni</h4>
|
<h4 data-i18n="settings.security.token_title">🔑 Token Impostazioni</h4>
|
||||||
<p class="settings-hint">Se <code>SETTINGS_TOKEN</code> è configurato nel <code>.env</code> server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.</p>
|
<p class="settings-hint" data-i18n="settings.security.token_hint">Se <code>SETTINGS_TOKEN</code> è configurato nel <code>.env</code> server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Token di accesso</label>
|
<label data-i18n="settings.security.token_label">Token di accesso</label>
|
||||||
<input type="password" id="setting-settings-token" class="form-input" placeholder="(vuoto = nessuna protezione)">
|
<input type="password" id="setting-settings-token" class="form-input" placeholder="(vuoto = nessuna protezione)" data-i18n-placeholder="settings.security.token_placeholder">
|
||||||
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-settings-token')">👁️ Mostra/Nascondi</button>
|
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-settings-token')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="settings-hint" id="settings-token-status-hint" style="display:none;color:var(--accent)">🔒 Questo server richiede un token per salvare le impostazioni.</p>
|
<p class="settings-hint" id="settings-token-status-hint" style="display:none;color:var(--accent)" data-i18n="settings.security.token_required_hint">🔒 Questo server richiede un token per salvare le impostazioni.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-card">
|
<div class="settings-card">
|
||||||
<h4>🔒 Certificato HTTPS</h4>
|
<h4 data-i18n="settings.security.title">🔒 Certificato HTTPS</h4>
|
||||||
<p class="settings-hint">Se il browser mostra l'errore "La connessione non è privata" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.</p>
|
<p class="settings-hint" data-i18n="settings.security.hint">Se il browser mostra l'errore "La connessione non è privata" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<a href="ca.crt" download="EverShelf_CA.crt" class="btn btn-large btn-accent full-width" style="text-align:center;text-decoration:none;display:block">📥 Scarica Certificato CA</a>
|
<a href="ca.crt" download="EverShelf_CA.crt" class="btn btn-large btn-accent full-width" style="text-align:center;text-decoration:none;display:block" data-i18n="settings.security.download_btn">📥 Scarica Certificato CA</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="settings-hint" style="margin-top:12px;line-height:1.6">
|
<div class="settings-hint" style="margin-top:12px;line-height:1.6" data-i18n-html="settings.security.cert_instructions">
|
||||||
<strong>Istruzioni per Chrome (Android):</strong><br>
|
<strong>Istruzioni per Chrome (Android):</strong><br>
|
||||||
1. Scarica il certificato qui sopra<br>
|
1. Scarica il certificato qui sopra<br>
|
||||||
2. Vai in <em>Impostazioni → Sicurezza e privacy → Altre impostazioni di sicurezza → Installa da archivio dispositivo</em><br>
|
2. Vai in <em>Impostazioni → Sicurezza e privacy → Altre impostazioni di sicurezza → Installa da archivio dispositivo</em><br>
|
||||||
@@ -1067,7 +1068,7 @@
|
|||||||
<p class="settings-hint" data-i18n="settings.tts.hint">Configura la sintesi vocale. Puoi usare la voce offline del browser oppure un endpoint REST esterno (Home Assistant, ecc.).</p>
|
<p class="settings-hint" data-i18n="settings.tts.hint">Configura la sintesi vocale. Puoi usare la voce offline del browser oppure un endpoint REST esterno (Home Assistant, ecc.).</p>
|
||||||
<div class="form-group" style="margin-bottom:10px">
|
<div class="form-group" style="margin-bottom:10px">
|
||||||
<label class="toggle-row">
|
<label class="toggle-row">
|
||||||
<span>✅ Attiva TTS</span>
|
<span data-i18n="settings.tts.enabled">✅ Attiva TTS</span>
|
||||||
<span class="toggle-switch">
|
<span class="toggle-switch">
|
||||||
<input type="checkbox" id="setting-tts-enabled">
|
<input type="checkbox" id="setting-tts-enabled">
|
||||||
<span class="toggle-slider"></span>
|
<span class="toggle-slider"></span>
|
||||||
@@ -1075,31 +1076,31 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>⚙️ Motore TTS</label>
|
<label data-i18n="settings.tts.engine_label">⚙️ Motore TTS</label>
|
||||||
<select id="setting-tts-engine" class="form-input" onchange="onTtsEngineChange(this.value)">
|
<select id="setting-tts-engine" class="form-input" onchange="onTtsEngineChange(this.value)">
|
||||||
<option value="browser">🔇 Browser (offline, nessuna configurazione)</option>
|
<option value="browser" data-i18n="settings.tts.engine_browser">🔇 Browser (offline, nessuna configurazione)</option>
|
||||||
<option value="server">🌐 Server esterno (Home Assistant, API REST...)</option>
|
<option value="server" data-i18n="settings.tts.engine_server">🌐 Server esterno (Home Assistant, API REST...)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Browser TTS section -->
|
<!-- Browser TTS section -->
|
||||||
<div id="tts-browser-section">
|
<div id="tts-browser-section">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🗣️ Voce</label>
|
<label data-i18n="settings.tts.voice_label">🗣️ Voce</label>
|
||||||
<div style="display:flex;gap:8px;align-items:center">
|
<div style="display:flex;gap:8px;align-items:center">
|
||||||
<select id="setting-tts-voice" class="form-input" style="flex:1">
|
<select id="setting-tts-voice" class="form-input" style="flex:1">
|
||||||
<option value="">— Caricamento voci… —</option>
|
<option value="" data-i18n="settings.tts.voices_loading">— Caricamento voci… —</option>
|
||||||
</select>
|
</select>
|
||||||
<button type="button" class="btn btn-secondary" style="padding:8px 12px;white-space:nowrap;flex-shrink:0" onclick="_initBrowserTtsVoices(document.getElementById('setting-tts-voice').value)">↺</button>
|
<button type="button" class="btn btn-secondary" style="padding:8px 12px;white-space:nowrap;flex-shrink:0" onclick="_initBrowserTtsVoices(document.getElementById('setting-tts-voice').value)">↺</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="settings-hint">Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce <strong>Paola</strong> (italiano). Premi ↺ se la lista non si carica.</p>
|
<p class="settings-hint" data-i18n="settings.tts.voices_hint">Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce <strong>Paola</strong> (italiano). Premi ↺ se la lista non si carica.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>⚡ Velocità: <span id="tts-rate-label">1.0</span>×</label>
|
<label><span data-i18n="settings.tts.rate_label">⚡ Velocità</span>: <span id="tts-rate-label">1.0</span>×</label>
|
||||||
<input type="range" id="setting-tts-rate" class="form-input" min="0.5" max="2" step="0.1" value="1" oninput="document.getElementById('tts-rate-label').textContent=parseFloat(this.value).toFixed(1)">
|
<input type="range" id="setting-tts-rate" class="form-input" min="0.5" max="2" step="0.1" value="1" oninput="document.getElementById('tts-rate-label').textContent=parseFloat(this.value).toFixed(1)">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🎵 Tono: <span id="tts-pitch-label">1.0</span></label>
|
<label><span data-i18n="settings.tts.pitch_label">🎵 Tono</span>: <span id="tts-pitch-label">1.0</span></label>
|
||||||
<input type="range" id="setting-tts-pitch" class="form-input" min="0" max="2" step="0.1" value="1" oninput="document.getElementById('tts-pitch-label').textContent=parseFloat(this.value).toFixed(1)">
|
<input type="range" id="setting-tts-pitch" class="form-input" min="0" max="2" step="0.1" value="1" oninput="document.getElementById('tts-pitch-label').textContent=parseFloat(this.value).toFixed(1)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1107,11 +1108,11 @@
|
|||||||
<!-- Server TTS section -->
|
<!-- Server TTS section -->
|
||||||
<div id="tts-server-section" style="display:none">
|
<div id="tts-server-section" style="display:none">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🌐 URL Endpoint</label>
|
<label data-i18n="settings.tts.url_label">🌐 URL Endpoint</label>
|
||||||
<input type="url" id="setting-tts-url" class="form-input" placeholder="https://...">
|
<input type="url" id="setting-tts-url" class="form-input" placeholder="https://...">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📡 Metodo HTTP</label>
|
<label data-i18n="settings.tts.method_label">📡 Metodo HTTP</label>
|
||||||
<select id="setting-tts-method" class="form-input">
|
<select id="setting-tts-method" class="form-input">
|
||||||
<option value="POST">POST</option>
|
<option value="POST">POST</option>
|
||||||
<option value="PUT">PUT</option>
|
<option value="PUT">PUT</option>
|
||||||
@@ -1120,30 +1121,30 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🔐 Autenticazione</label>
|
<label data-i18n="settings.tts.auth_label">🔐 Autenticazione</label>
|
||||||
<select id="setting-tts-auth-type" class="form-input" onchange="onTtsAuthTypeChange(this.value)">
|
<select id="setting-tts-auth-type" class="form-input" onchange="onTtsAuthTypeChange(this.value)">
|
||||||
<option value="bearer">Bearer Token</option>
|
<option value="bearer" data-i18n="settings.tts.auth_bearer">Bearer Token</option>
|
||||||
<option value="header">Header personalizzato</option>
|
<option value="header" data-i18n="settings.tts.auth_custom">Header personalizzato</option>
|
||||||
<option value="none">Nessuna</option>
|
<option value="none" data-i18n="settings.tts.auth_none">Nessuna</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="tts-token-group">
|
<div class="form-group" id="tts-token-group">
|
||||||
<label>🔑 Bearer Token</label>
|
<label data-i18n="settings.tts.token_label">🔑 Bearer Token</label>
|
||||||
<input type="password" id="setting-tts-token" class="form-input" placeholder="eyJhbGci...">
|
<input type="password" id="setting-tts-token" class="form-input" placeholder="eyJhbGci...">
|
||||||
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-tts-token')">👁️ Mostra/Nascondi</button>
|
<button class="btn btn-small btn-secondary mt-2" onclick="togglePasswordVisibility('setting-tts-token')" data-i18n="btn.toggle_password">👁️ Mostra/Nascondi</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="tts-custom-header-group" style="display:none">
|
<div id="tts-custom-header-group" style="display:none">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📋 Nome header</label>
|
<label data-i18n="settings.tts.custom_header_name">📋 Nome header</label>
|
||||||
<input type="text" id="setting-tts-auth-header-name" class="form-input" placeholder="X-API-Key">
|
<input type="text" id="setting-tts-auth-header-name" class="form-input" placeholder="X-API-Key">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📋 Valore header</label>
|
<label data-i18n="settings.tts.custom_header_value">📋 Valore header</label>
|
||||||
<input type="text" id="setting-tts-auth-header-value" class="form-input" placeholder="...">
|
<input type="text" id="setting-tts-auth-header-value" class="form-input" placeholder="...">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>📄 Content-Type</label>
|
<label data-i18n="settings.tts.content_type_label">📄 Content-Type</label>
|
||||||
<select id="setting-tts-content-type" class="form-input">
|
<select id="setting-tts-content-type" class="form-input">
|
||||||
<option value="application/json">application/json</option>
|
<option value="application/json">application/json</option>
|
||||||
<option value="application/x-www-form-urlencoded">application/x-www-form-urlencoded</option>
|
<option value="application/x-www-form-urlencoded">application/x-www-form-urlencoded</option>
|
||||||
@@ -1151,18 +1152,18 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>🗝️ Campo testo nel payload</label>
|
<label data-i18n="settings.tts.payload_key_label">🗝️ Campo testo nel payload</label>
|
||||||
<input type="text" id="setting-tts-payload-key" class="form-input" placeholder="message">
|
<input type="text" id="setting-tts-payload-key" class="form-input" placeholder="message">
|
||||||
<p class="settings-hint">Nome del campo JSON che conterrà il testo da leggere (es: <code>message</code>, <code>text</code>).</p>
|
<p class="settings-hint">Nome del campo JSON che conterrà il testo da leggere (es: <code>message</code>, <code>text</code>).</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>➕ Campi extra (JSON)</label>
|
<label data-i18n="settings.tts.extra_fields_label">➕ Campi extra (JSON)</label>
|
||||||
<textarea id="setting-tts-extra-fields" class="form-input" rows="3" placeholder='{"entity_id": "media_player.living_room"}'></textarea>
|
<textarea id="setting-tts-extra-fields" class="form-input" rows="3" placeholder='{"entity_id": "media_player.living_room"}'></textarea>
|
||||||
<p class="settings-hint">Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.</p>
|
<p class="settings-hint" data-i18n="settings.tts.extra_fields_hint">Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.</p>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /tts-server-section -->
|
</div><!-- /tts-server-section -->
|
||||||
|
|
||||||
<button class="btn btn-large btn-accent full-width mt-2" onclick="testTTS()">🔊 Invia Test Vocale</button>
|
<button class="btn btn-large btn-accent full-width mt-2" onclick="testTTS()" data-i18n="settings.tts.test_btn">🔊 Invia Test Vocale</button>
|
||||||
<div id="tts-test-status" style="display:none;margin-top:8px"></div>
|
<div id="tts-test-status" style="display:none;margin-top:8px"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1174,14 +1175,14 @@
|
|||||||
|
|
||||||
<!-- Kiosk-mode panel: replace WebSocket config with native reconfigure button -->
|
<!-- Kiosk-mode panel: replace WebSocket config with native reconfigure button -->
|
||||||
<div id="scale-kiosk-panel" style="display:none;background:rgba(16,185,129,0.07);border:1px solid rgba(16,185,129,0.25);border-radius:10px;padding:14px;margin-bottom:16px">
|
<div id="scale-kiosk-panel" style="display:none;background:rgba(16,185,129,0.07);border:1px solid rgba(16,185,129,0.25);border-radius:10px;padding:14px;margin-bottom:16px">
|
||||||
<p style="margin:0 0 6px;font-weight:600">📡 Bilancia BLE integrata nel Kiosk</p>
|
<p style="margin:0 0 6px;font-weight:600" data-i18n="settings.scale.kiosk_title">📡 Bilancia BLE integrata nel Kiosk</p>
|
||||||
<p class="settings-hint" style="margin-bottom:12px">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p>
|
<p class="settings-hint" style="margin-bottom:12px" data-i18n="settings.scale.kiosk_hint">La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.</p>
|
||||||
<button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()">🔄 Riconfigura bilancia BLE</button>
|
<button class="btn btn-secondary full-width" onclick="_kioskReconfigureScale()" data-i18n="settings.scale.kiosk_reconfigure">🔄 Riconfigura bilancia BLE</button>
|
||||||
<!-- shown when kiosk APK is too old to have reconfigureScale() -->
|
<!-- shown when kiosk APK is too old to have reconfigureScale() -->
|
||||||
<div id="kiosk-needs-update-notice" style="display:none;margin-top:10px;padding:8px 12px;background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.35);border-radius:8px;font-size:0.83rem">
|
<div id="kiosk-needs-update-notice" style="display:none;margin-top:10px;padding:8px 12px;background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.35);border-radius:8px;font-size:0.83rem">
|
||||||
⚠️ Il kiosk installato non supporta questa funzione.
|
<span data-i18n="settings.kiosk.needs_update">⚠️ Il kiosk installato non supporta questa funzione.
|
||||||
Aggiorna l'app kiosk per abilitarla.
|
Aggiorna l'app kiosk per abilitarla.</span>
|
||||||
<a href="https://github.com/dadaloop82/EverShelf/releases/download/kiosk-latest/evershelf-kiosk.apk" target="_blank" rel="noopener noreferrer" style="display:block;margin-top:6px;color:#d97706;font-weight:600;text-decoration:none">📥 Scarica aggiornamento kiosk</a>
|
<a href="https://github.com/dadaloop82/EverShelf/releases/download/kiosk-latest/evershelf-kiosk.apk" target="_blank" rel="noopener noreferrer" style="display:block;margin-top:6px;color:#d97706;font-weight:600;text-decoration:none" data-i18n="settings.kiosk.download_btn">📥 Scarica aggiornamento kiosk</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1229,16 +1230,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<div id="scale-diag-weight" style="font-size:2rem;font-weight:700;line-height:1;letter-spacing:1px">— g</div>
|
<div id="scale-diag-weight" style="font-size:2rem;font-weight:700;line-height:1;letter-spacing:1px">— g</div>
|
||||||
<div style="font-size:0.72rem;color:var(--text-secondary);margin-top:3px">peso in tempo reale</div>
|
<div style="font-size:0.72rem;color:var(--text-secondary);margin-top:3px" data-i18n="settings.scale.live_weight">peso in tempo reale</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:10px;display:flex;gap:8px;font-size:0.78rem;color:var(--text-secondary)">
|
<div style="margin-top:10px;display:flex;gap:8px;font-size:0.78rem;color:var(--text-secondary)">
|
||||||
<span>🔁 Riconnessione: automatica</span>
|
<span data-i18n="settings.scale.auto_reconnect">🔁 Riconnessione: automatica</span>
|
||||||
<span style="margin-left:auto" id="scale-diag-proto">—</span>
|
<span style="margin-left:auto" id="scale-diag-proto">—</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Protocol info -->
|
<!-- Protocol info -->
|
||||||
<div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px">
|
<div class="settings-hint" style="margin-top:16px;padding:10px;background:var(--bg-secondary,#f8fafc);border-radius:8px" data-i18n-html="settings.scale.ble_protocols">
|
||||||
<p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p>
|
<p style="margin:0 0 6px;font-weight:600">🔌 Protocolli BLE supportati:</p>
|
||||||
<ul style="margin:0 0 0 16px;padding:0;font-size:0.8rem">
|
<ul style="margin:0 0 0 16px;padding:0;font-size:0.8rem">
|
||||||
<li>Bluetooth SIG Weight Scale (0x181D)</li>
|
<li>Bluetooth SIG Weight Scale (0x181D)</li>
|
||||||
@@ -1274,15 +1275,15 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="screensaver-timeout-row" style="margin-top:10px">
|
<div class="form-group" id="screensaver-timeout-row" style="margin-top:10px">
|
||||||
<label for="setting-screensaver-timeout" style="font-size:0.85rem;font-weight:600;color:var(--text-secondary)">⏱️ Avvia dopo</label>
|
<label for="setting-screensaver-timeout" style="font-size:0.85rem;font-weight:600;color:var(--text-secondary)" data-i18n="settings.screensaver.start_after">⏱️ Avvia dopo</label>
|
||||||
<select id="setting-screensaver-timeout" class="form-control" style="margin-top:6px;max-width:200px">
|
<select id="setting-screensaver-timeout" class="form-control" style="margin-top:6px;max-width:200px">
|
||||||
<option value="1">1 minuto</option>
|
<option value="1" data-i18n="settings.screensaver.timeout_1">1 minuto</option>
|
||||||
<option value="2">2 minuti</option>
|
<option value="2" data-i18n="settings.screensaver.timeout_2">2 minuti</option>
|
||||||
<option value="5" selected>5 minuti</option>
|
<option value="5" selected data-i18n="settings.screensaver.timeout_5">5 minuti</option>
|
||||||
<option value="10">10 minuti</option>
|
<option value="10" data-i18n="settings.screensaver.timeout_10">10 minuti</option>
|
||||||
<option value="15">15 minuti</option>
|
<option value="15" data-i18n="settings.screensaver.timeout_15">15 minuti</option>
|
||||||
<option value="30">30 minuti</option>
|
<option value="30" data-i18n="settings.screensaver.timeout_30">30 minuti</option>
|
||||||
<option value="60">1 ora</option>
|
<option value="60" data-i18n="settings.screensaver.timeout_60">1 ora</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1302,17 +1303,29 @@
|
|||||||
<p class="settings-hint" style="margin-top:8px" data-i18n="settings.kiosk.download_sub">Modalità kiosk full-screen + gateway bilancia integrato. Sorgente: <code>evershelf-kiosk/</code></p>
|
<p class="settings-hint" style="margin-top:8px" data-i18n="settings.kiosk.download_sub">Modalità kiosk full-screen + gateway bilancia integrato. Sorgente: <code>evershelf-kiosk/</code></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Kiosk native settings panel (visible only inside kiosk WebView) -->
|
||||||
|
<div id="kiosk-native-settings-panel" style="display:none;background:rgba(99,102,241,0.06);border:1.5px solid rgba(99,102,241,0.2);border-radius:12px;padding:16px;margin-top:16px">
|
||||||
|
<div style="display:flex;align-items:center;gap:10px;margin-bottom:10px">
|
||||||
|
<span style="font-size:1.4rem">🖥️</span>
|
||||||
|
<div>
|
||||||
|
<p style="margin:0;font-weight:700;font-size:0.9rem" data-i18n="settings.kiosk.native_title">Configurazione Kiosk</p>
|
||||||
|
<p class="settings-hint" style="margin:2px 0 0" data-i18n="settings.kiosk.native_hint">URL server, bilancia BLE, salvaschermo e setup wizard.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-secondary full-width" onclick="_openKioskNativeSettings()">⚙️ <span data-i18n="settings.kiosk.native_btn">Apri configurazione kiosk</span></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Kiosk self-update panel (visible only inside kiosk WebView) -->
|
<!-- Kiosk self-update panel (visible only inside kiosk WebView) -->
|
||||||
<div id="kiosk-update-panel" style="display:none;background:rgba(16,185,129,0.06);border:1.5px solid rgba(16,185,129,0.2);border-radius:12px;padding:16px;margin-top:16px">
|
<div id="kiosk-update-panel" style="display:none;background:rgba(16,185,129,0.06);border:1.5px solid rgba(16,185,129,0.2);border-radius:12px;padding:16px;margin-top:16px">
|
||||||
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px">
|
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px">
|
||||||
<div style="display:flex;align-items:center;gap:8px">
|
<div style="display:flex;align-items:center;gap:8px">
|
||||||
<span style="font-size:1.4rem">📦</span>
|
<span style="font-size:1.4rem">📦</span>
|
||||||
<div>
|
<div>
|
||||||
<p style="margin:0;font-weight:700;font-size:0.9rem">Aggiornamento Kiosk</p>
|
<p style="margin:0;font-weight:700;font-size:0.9rem" data-i18n="settings.kiosk.update_title">Aggiornamento Kiosk</p>
|
||||||
<p class="settings-hint" style="margin:2px 0 0" id="kiosk-update-version-label">—</p>
|
<p class="settings-hint" style="margin:2px 0 0" id="kiosk-update-version-label">—</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-secondary" style="white-space:nowrap;min-width:120px" id="btn-kiosk-check-update" onclick="_kioskCheckForUpdates()">🔍 Cerca aggiornamenti</button>
|
<button class="btn btn-secondary" style="white-space:nowrap;min-width:120px" id="btn-kiosk-check-update" onclick="_kioskCheckForUpdates()" data-i18n="settings.kiosk.check_updates_btn">🔍 Cerca aggiornamenti</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="kiosk-update-status" style="display:none;padding:10px 12px;border-radius:8px;font-size:0.85rem;line-height:1.4"></div>
|
<div id="kiosk-update-status" style="display:none;padding:10px 12px;border-radius:8px;font-size:0.85rem;line-height:1.4"></div>
|
||||||
<button id="btn-kiosk-install-update" style="display:none;width:100%;margin-top:10px" class="btn btn-accent btn-large" onclick="_kioskInstallUpdate()">⬇️ Installa aggiornamento</button>
|
<button id="btn-kiosk-install-update" style="display:none;width:100%;margin-top:10px" class="btn btn-accent btn-large" onclick="_kioskInstallUpdate()">⬇️ Installa aggiornamento</button>
|
||||||
@@ -1320,6 +1333,29 @@
|
|||||||
|
|
||||||
<button class="btn btn-large btn-success full-width mt-2" onclick="saveSettings()" data-i18n="btn.save_config">💾 Salva Configurazione</button>
|
<button class="btn btn-large btn-success full-width mt-2" onclick="saveSettings()" data-i18n="btn.save_config">💾 Salva Configurazione</button>
|
||||||
<div id="settings-status" class="settings-status" style="display:none"></div>
|
<div id="settings-status" class="settings-status" style="display:none"></div>
|
||||||
|
|
||||||
|
<!-- About & Support -->
|
||||||
|
<div class="settings-section" style="margin-top:24px">
|
||||||
|
<h3 class="settings-section-title" data-i18n="about.title">About</h3>
|
||||||
|
<div class="settings-row" style="justify-content:space-between;align-items:center">
|
||||||
|
<span class="settings-label" data-i18n="about.version">Version</span>
|
||||||
|
<span id="about-version-label" class="settings-hint" style="font-family:monospace">—</span>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top:10px;display:flex;flex-direction:column;gap:8px">
|
||||||
|
<button class="btn btn-outline full-width" onclick="reportBugManual()" id="btn-report-bug">
|
||||||
|
🐛 <span data-i18n="about.report_bug">Segnala un problema</span>
|
||||||
|
</button>
|
||||||
|
<p class="settings-hint" style="text-align:center;margin:0" data-i18n="about.report_bug_hint">Qualcosa non funziona? Inviaci una segnalazione direttamente dall'app.</p>
|
||||||
|
<div style="display:flex;gap:8px">
|
||||||
|
<a class="btn btn-outline full-width" style="text-decoration:none;text-align:center"
|
||||||
|
href="https://github.com/dadaloop82/EverShelf/blob/main/CHANGELOG.md"
|
||||||
|
target="_blank" rel="noopener" data-i18n="about.changelog">Changelog</a>
|
||||||
|
<a class="btn btn-outline full-width" style="text-decoration:none;text-align:center"
|
||||||
|
href="https://github.com/dadaloop82/EverShelf"
|
||||||
|
target="_blank" rel="noopener" data-i18n="about.github">GitHub</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- ===== GEMINI CHAT ===== -->
|
<!-- ===== GEMINI CHAT ===== -->
|
||||||
@@ -1380,7 +1416,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button class="nav-btn" onclick="showPage('settings')" data-page="settings">
|
<button class="nav-btn" onclick="showPage('settings')" data-page="settings">
|
||||||
<span class="nav-icon">⚙️</span>
|
<span class="nav-icon">⚙️</span>
|
||||||
<span class="nav-label">Config</span>
|
<span class="nav-label" data-i18n="nav.settings">Config</span>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@@ -1430,9 +1466,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="recipe-result" style="display:none" class="recipe-result">
|
<div id="recipe-result" style="display:none" class="recipe-result">
|
||||||
<div id="recipe-content"></div>
|
<div id="recipe-content"></div>
|
||||||
<button class="btn btn-large btn-cooking full-width mt-2" onclick="startCookingMode()" data-i18n="recipes.start_cooking">
|
|
||||||
👨🍳 Modalità Cucina
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-large btn-secondary full-width mt-2" onclick="regenerateRecipe()" data-i18n="recipes.regenerate">
|
<button class="btn btn-large btn-secondary full-width mt-2" onclick="regenerateRecipe()" data-i18n="recipes.regenerate">
|
||||||
🔄 Generane un'altra
|
🔄 Generane un'altra
|
||||||
</button>
|
</button>
|
||||||
@@ -1452,8 +1485,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="setup-body" id="setup-body"></div>
|
<div class="setup-body" id="setup-body"></div>
|
||||||
<div class="setup-footer">
|
<div class="setup-footer">
|
||||||
<button class="btn btn-secondary" id="setup-prev" onclick="setupWizardNav(-1)" style="display:none">← Indietro</button>
|
<button class="btn btn-secondary" id="setup-prev" onclick="setupWizardNav(-1)" style="display:none" data-i18n="btn.back">← Indietro</button>
|
||||||
<button class="btn btn-accent" id="setup-next" onclick="setupWizardNav(1)">Avanti →</button>
|
<button class="btn btn-accent" id="setup-next" onclick="setupWizardNav(1)" data-i18n="btn.next">Avanti →</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1501,13 +1534,18 @@
|
|||||||
<button class="cooking-tts-btn" id="cooking-tts-btn" onclick="toggleCookingTTS()" title="Leggi ad alta voce">🔊</button>
|
<button class="cooking-tts-btn" id="cooking-tts-btn" onclick="toggleCookingTTS()" title="Leggi ad alta voce">🔊</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="cooking-timers-bar" class="cooking-timers-bar" style="display:none"></div>
|
<div id="cooking-timers-bar" class="cooking-timers-bar" style="display:none"></div>
|
||||||
|
<div id="cooking-tools-bar" class="cooking-tools-bar" style="display:none"></div>
|
||||||
<div class="cooking-body">
|
<div class="cooking-body">
|
||||||
<div class="cooking-step-header">
|
<div class="cooking-step-header">
|
||||||
<div class="cooking-step-num" id="cooking-step-num">1 / 1</div>
|
<div class="cooking-step-num" id="cooking-step-num">1 / 1</div>
|
||||||
<button class="cooking-restart-btn" onclick="restartCookingMode()" title="Ricomincia dall'inizio">↺ Ricomincia</button>
|
<button class="cooking-restart-btn" onclick="restartCookingMode()" title="Ricomincia dall'inizio">↺ Ricomincia</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="cooking-progress-dots" id="cooking-progress-dots"></div>
|
<div class="cooking-progress-dots" id="cooking-progress-dots"></div>
|
||||||
<div class="cooking-step-text" id="cooking-step-text"></div>
|
<div class="cooking-wheel" id="cooking-wheel" tabindex="0" aria-label="Navigazione passi ricetta">
|
||||||
|
<div class="cooking-step-ghost cooking-step-prev" id="cooking-step-prev"></div>
|
||||||
|
<div class="cooking-step-text" id="cooking-step-text"></div>
|
||||||
|
<div class="cooking-step-ghost cooking-step-next" id="cooking-step-next"></div>
|
||||||
|
</div>
|
||||||
<button class="cooking-replay-btn" id="cooking-replay" onclick="replayCookingTTS()" title="Rileggi questo passo">🔊 Rileggi</button>
|
<button class="cooking-replay-btn" id="cooking-replay" onclick="replayCookingTTS()" title="Rileggi questo passo">🔊 Rileggi</button>
|
||||||
<div class="cooking-timer-suggest" id="cooking-timer-suggest" style="display:none">
|
<div class="cooking-timer-suggest" id="cooking-timer-suggest" style="display:none">
|
||||||
<button class="cooking-timer-add-btn" onclick="addSuggestedCookingTimer()">
|
<button class="cooking-timer-add-btn" onclick="addSuggestedCookingTimer()">
|
||||||
@@ -1522,6 +1560,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="assets/js/app.js?v=20260513a"></script>
|
<script src="assets/js/app.js?v=20260516b"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "EverShelf",
|
"name": "EverShelf",
|
||||||
"short_name": "EverShelf",
|
"short_name": "EverShelf",
|
||||||
"description": "Gestione completa della dispensa di casa con scansione barcode",
|
"description": "Gestione completa della dispensa di casa con scansione barcode",
|
||||||
"version": "1.7.12",
|
"version": "1.7.15",
|
||||||
"start_url": "/evershelf/",
|
"start_url": "/evershelf/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#f0f4e8",
|
"background_color": "#f0f4e8",
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"inventory": "Vorrat",
|
"inventory": "Vorrat",
|
||||||
"recipes": "Rezepte",
|
"recipes": "Rezepte",
|
||||||
"shopping": "Einkauf",
|
"shopping": "Einkauf",
|
||||||
"log": "Verlauf"
|
"log": "Verlauf",
|
||||||
|
"settings": "Einstellungen"
|
||||||
},
|
},
|
||||||
"btn": {
|
"btn": {
|
||||||
"back": "← Zurück",
|
"back": "← Zurück",
|
||||||
@@ -19,6 +20,8 @@
|
|||||||
"add": "✅ Hinzufügen",
|
"add": "✅ Hinzufügen",
|
||||||
"delete": "Löschen",
|
"delete": "Löschen",
|
||||||
"edit": "✏️ Bearbeiten",
|
"edit": "✏️ Bearbeiten",
|
||||||
|
"use": "Verwenden",
|
||||||
|
"edit_item": "Bearbeiten",
|
||||||
"search": "🔍 Suchen",
|
"search": "🔍 Suchen",
|
||||||
"go": "✅ Los",
|
"go": "✅ Los",
|
||||||
"toggle_password": "👁️ Anzeigen/Ausblenden",
|
"toggle_password": "👁️ Anzeigen/Ausblenden",
|
||||||
@@ -28,7 +31,12 @@
|
|||||||
"restart": "↺ Neustart",
|
"restart": "↺ Neustart",
|
||||||
"reset_default": "↺ Standard wiederherstellen",
|
"reset_default": "↺ Standard wiederherstellen",
|
||||||
"save_info": "💾 Info speichern",
|
"save_info": "💾 Info speichern",
|
||||||
"retry": "🔄 Erneut versuchen"
|
"retry": "🔄 Erneut versuchen",
|
||||||
|
"yes_short": "Ja",
|
||||||
|
"no_short": "Nein"
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"select_placeholder": "-- Auswählen --"
|
||||||
},
|
},
|
||||||
"locations": {
|
"locations": {
|
||||||
"dispensa": "Vorratskammer",
|
"dispensa": "Vorratskammer",
|
||||||
@@ -63,7 +71,9 @@
|
|||||||
"pieces": "Stück",
|
"pieces": "Stück",
|
||||||
"grams": "Gramm",
|
"grams": "Gramm",
|
||||||
"box": "Packung",
|
"box": "Packung",
|
||||||
"boxes": "Packungen"
|
"boxes": "Packungen",
|
||||||
|
"millilitres": "Milliliter",
|
||||||
|
"from": "von"
|
||||||
},
|
},
|
||||||
"shopping_sections": {
|
"shopping_sections": {
|
||||||
"frutta_verdura": "Obst & Gemüse",
|
"frutta_verdura": "Obst & Gemüse",
|
||||||
@@ -91,8 +101,8 @@
|
|||||||
"banner_review_action_edit": "Korrigieren",
|
"banner_review_action_edit": "Korrigieren",
|
||||||
"banner_review_action_weigh": "Wiegen",
|
"banner_review_action_weigh": "Wiegen",
|
||||||
"banner_review_dismiss": "Ignorieren",
|
"banner_review_dismiss": "Ignorieren",
|
||||||
"banner_prediction_title": "Ungewöhnlicher Verbrauch",
|
"banner_prediction_title": "Verbrauch zur Prüfung",
|
||||||
"banner_prediction_hint": "Laut Vorhersage stimmt diese Menge nicht mit dem erwarteten Verbrauch überein.",
|
"banner_prediction_hint": "Die Verbrauchsschätzung passt sich aktuellen Daten an: bitte nur die aktuelle Menge bestätigen.",
|
||||||
"banner_prediction_action_confirm": "{qty} {unit} bestätigen",
|
"banner_prediction_action_confirm": "{qty} {unit} bestätigen",
|
||||||
"banner_prediction_action_weigh": "Jetzt wiegen",
|
"banner_prediction_action_weigh": "Jetzt wiegen",
|
||||||
"banner_prediction_action_edit": "Menge aktualisieren",
|
"banner_prediction_action_edit": "Menge aktualisieren",
|
||||||
@@ -128,8 +138,8 @@
|
|||||||
"banner_prediction_rate_day": "Durchschnitt ~{n} {unit}/Tag",
|
"banner_prediction_rate_day": "Durchschnitt ~{n} {unit}/Tag",
|
||||||
"banner_prediction_rate_week": "Durchschnitt ~{n} {unit}/Woche",
|
"banner_prediction_rate_week": "Durchschnitt ~{n} {unit}/Woche",
|
||||||
"banner_prediction_days_ago": "Vor {n} Tagen aufgefüllt",
|
"banner_prediction_days_ago": "Vor {n} Tagen aufgefüllt",
|
||||||
"banner_prediction_more": "Ich erwartete {expected} {unit}{time}, du hast aber {actual} {unit}. Hast du Bestand ohne Buchung hinzugefügt?",
|
"banner_prediction_more": "frühere Schätzung: {expected} {unit}{time}; aktuelle Menge: {actual} {unit}.",
|
||||||
"banner_prediction_less": "Ich erwartete {expected} {unit}{time}, du hast aber nur {actual} {unit}. Hast du mehr als üblich verbraucht?",
|
"banner_prediction_less": "Schätzung: {expected} {unit}{time}; aktuelle Menge: {actual} {unit}. Wenn sich dein Verbrauch geändert hat, aktualisiert sich die Prognose automatisch.",
|
||||||
"banner_finished_zero": "Bestand zeigt null, aber gespeicherte Buchungen deuten an, dass es nicht leer sein sollte.",
|
"banner_finished_zero": "Bestand zeigt null, aber gespeicherte Buchungen deuten an, dass es nicht leer sein sollte.",
|
||||||
"banner_finished_expected": "Laut Aufzeichnungen solltest du noch {qty} {unit} haben.",
|
"banner_finished_expected": "Laut Aufzeichnungen solltest du noch {qty} {unit} haben.",
|
||||||
"banner_finished_check": "Kannst du nachschauen?",
|
"banner_finished_check": "Kannst du nachschauen?",
|
||||||
@@ -215,7 +225,7 @@
|
|||||||
"throw_btn": "🗑️ ENTSORGEN",
|
"throw_btn": "🗑️ ENTSORGEN",
|
||||||
"throw_sub": "wegwerfen",
|
"throw_sub": "wegwerfen",
|
||||||
"edit_sub": "Ablauf, Ort…",
|
"edit_sub": "Ablauf, Ort…",
|
||||||
"create_recipe_btn": "Rezept damit erstellen"
|
"create_recipe_btn": "Rezept"
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
"title": "Zum Vorrat hinzufügen",
|
"title": "Zum Vorrat hinzufügen",
|
||||||
@@ -240,7 +250,9 @@
|
|||||||
"scan_expiry_title": "📷 Ablaufdatum scannen",
|
"scan_expiry_title": "📷 Ablaufdatum scannen",
|
||||||
"product_added": "✅ {name} hinzugefügt!{qty}",
|
"product_added": "✅ {name} hinzugefügt!{qty}",
|
||||||
"suffix_freezer_vacuum": "(Tiefkühler + vakuumversiegelt)",
|
"suffix_freezer_vacuum": "(Tiefkühler + vakuumversiegelt)",
|
||||||
"history_badge_tip": "Durchschnitt aus {n} früheren Einträgen"
|
"history_badge_tip": "Durchschnitt aus {n} früheren Einträgen",
|
||||||
|
"vacuum_question": "Vakuumiert?",
|
||||||
|
"vacuum_saved": "🔒 Als vakuumiert gespeichert"
|
||||||
},
|
},
|
||||||
"use": {
|
"use": {
|
||||||
"title": "Verwenden / Verbrauchen",
|
"title": "Verwenden / Verbrauchen",
|
||||||
@@ -312,7 +324,13 @@
|
|||||||
"edit_info": "✏️ Informationen bearbeiten",
|
"edit_info": "✏️ Informationen bearbeiten",
|
||||||
"modify_details": "BEARBEITEN\nAblauf, Ort…",
|
"modify_details": "BEARBEITEN\nAblauf, Ort…",
|
||||||
"already_in_pantry": "📋 Bereits im Vorratsschrank",
|
"already_in_pantry": "📋 Bereits im Vorratsschrank",
|
||||||
"no_barcode": "Kein Barcode"
|
"no_barcode": "Kein Barcode",
|
||||||
|
"unknown_product": "Unbekanntes Produkt",
|
||||||
|
"edit_name_brand": "Name/Marke bearbeiten",
|
||||||
|
"weight_label": "Gewicht",
|
||||||
|
"origin_label": "Herkunft",
|
||||||
|
"labels_label": "Etiketten",
|
||||||
|
"select_variant": "Genaue Variante auswählen oder KI-Daten nutzen:"
|
||||||
},
|
},
|
||||||
"products": {
|
"products": {
|
||||||
"title": "📦 Alle Produkte",
|
"title": "📦 Alle Produkte",
|
||||||
@@ -341,6 +359,7 @@
|
|||||||
"regenerate": "🔄 Noch eins generieren",
|
"regenerate": "🔄 Noch eins generieren",
|
||||||
"close_btn": "✅ Schließen",
|
"close_btn": "✅ Schließen",
|
||||||
"ingredients_title": "🧾 Zutaten",
|
"ingredients_title": "🧾 Zutaten",
|
||||||
|
"tools_title": "Benötigte Geräte",
|
||||||
"steps_title": "👨🍳 Zubereitung",
|
"steps_title": "👨🍳 Zubereitung",
|
||||||
"no_steps": "Keine Zubereitungsschritte verfügbar",
|
"no_steps": "Keine Zubereitungsschritte verfügbar",
|
||||||
"generate_error": "Fehler bei der Generierung",
|
"generate_error": "Fehler bei der Generierung",
|
||||||
@@ -501,7 +520,8 @@
|
|||||||
"transfer_to_recipes": "Zu Rezepten hinzufügen",
|
"transfer_to_recipes": "Zu Rezepten hinzufügen",
|
||||||
"transferring": "Übertrage...",
|
"transferring": "Übertrage...",
|
||||||
"transferred": "Zu Rezepten hinzugefügt!",
|
"transferred": "Zu Rezepten hinzugefügt!",
|
||||||
"open_recipe": "Rezept öffnen"
|
"open_recipe": "Rezept öffnen",
|
||||||
|
"quick_recipe_prompt": "Schlage mir ein schnelles Rezept FÜR EINE PERSON vor, das die Produkte mit dem nächsten Ablaufdatum verwendet! Ignoriere Tiefkühlprodukte, konzentriere dich auf Kühlschrank und Vorratsschrank."
|
||||||
},
|
},
|
||||||
"cooking": {
|
"cooking": {
|
||||||
"close": "Schließen",
|
"close": "Schließen",
|
||||||
@@ -518,7 +538,8 @@
|
|||||||
"timer_warning_tts": "Achtung! {label}: noch 10 Sekunden!",
|
"timer_warning_tts": "Achtung! {label}: noch 10 Sekunden!",
|
||||||
"recipe_done_tts": "Rezept abgeschlossen! Guten Appetit!",
|
"recipe_done_tts": "Rezept abgeschlossen! Guten Appetit!",
|
||||||
"expires_chip": "läuft ab {date}",
|
"expires_chip": "läuft ab {date}",
|
||||||
"finish": "✅ Fertig"
|
"finish": "✅ Fertig",
|
||||||
|
"step_fallback": "Schritt {n}"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "⚙️ Einstellungen",
|
"title": "⚙️ Einstellungen",
|
||||||
@@ -571,8 +592,9 @@
|
|||||||
"title": "📅 Wöchentlicher Essensplan",
|
"title": "📅 Wöchentlicher Essensplan",
|
||||||
"hint": "Lege die Mahlzeitenart für jeden Tag fest. Wird als Leitfaden bei der Rezeptgenerierung verwendet.",
|
"hint": "Lege die Mahlzeitenart für jeden Tag fest. Wird als Leitfaden bei der Rezeptgenerierung verwendet.",
|
||||||
"enabled": "✅ Wöchentlichen Essensplan aktivieren",
|
"enabled": "✅ Wöchentlichen Essensplan aktivieren",
|
||||||
"legend": "🌤️ = Mittagessen · 🌙 = Abendessen · Tippe auf ein Badge, um es zu ändern.",
|
"legend": "🌤️ = Mittagessen · 🌙 = Abendessen · Tippe auf ein Badge, um es zu ändern.",
|
||||||
"types_title": "📋 Verfügbare Typen"
|
"types_title": "📋 Verfügbare Typen",
|
||||||
|
"reset_btn": "↺ Standard wiederherstellen"
|
||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"title": "🔌 Verfügbare Geräte",
|
"title": "🔌 Verfügbare Geräte",
|
||||||
@@ -626,12 +648,24 @@
|
|||||||
"security": {
|
"security": {
|
||||||
"title": "🔒 HTTPS-Zertifikat",
|
"title": "🔒 HTTPS-Zertifikat",
|
||||||
"hint": "Wenn der Browser den Fehler \"Verbindung nicht sicher\" (ERR_CERT_AUTHORITY_INVALID) zeigt, installiere das CA-Zertifikat auf dem Gerät.",
|
"hint": "Wenn der Browser den Fehler \"Verbindung nicht sicher\" (ERR_CERT_AUTHORITY_INVALID) zeigt, installiere das CA-Zertifikat auf dem Gerät.",
|
||||||
"download_btn": "📥 CA-Zertifikat herunterladen"
|
"download_btn": "📥 CA-Zertifikat herunterladen",
|
||||||
|
"token_title": "🔑 Einstellungs-Token",
|
||||||
|
"token_label": "Zugriffstoken",
|
||||||
|
"token_hint": "Falls `SETTINGS_TOKEN` in der Server-`.env` konfiguriert ist, gib hier den Token ein, bevor du die Einstellungen speicherst. Leer lassen, wenn nicht konfiguriert.",
|
||||||
|
"token_placeholder": "(leer = kein Schutz)",
|
||||||
|
"token_required_hint": "🔒 Dieser Server benötigt einen Token zum Speichern der Einstellungen.",
|
||||||
|
"cert_instructions": "<strong>Anleitung für Chrome (Android):</strong><br>1. Zertifikat oben herunterladen<br>2. Gehe zu <em>Einstellungen → Sicherheit & Datenschutz → Weitere Sicherheitseinstellungen → Vom Gerätespeicher installieren</em><br>3. Wähle die heruntergeladene <em>EverShelf_CA.crt</em> Datei<br>4. Wähle \"CA\" und bestätige<br>5. Chrome neu starten<br><br><strong>Anleitung für Chrome (PC):</strong><br>1. Zertifikat oben herunterladen<br>2. Gehe zu <em>chrome://settings/certificates</em> (oder Einstellungen → Datenschutz und Sicherheit → Sicherheit → Zertifikate verwalten)<br>3. Tab \"Zertifizierungsstellen\" → Importieren → Datei auswählen<br>4. Häkchen bei \"Dieser Zertifizierungsstelle für die Identifikation von Webseiten vertrauen\"<br>5. Chrome neu starten"
|
||||||
},
|
},
|
||||||
"tts": {
|
"tts": {
|
||||||
"title": "🔊 Sprache & TTS",
|
"title": "🔊 Sprache & TTS",
|
||||||
"hint": "Sprachsynthese über externe REST-API konfigurieren. Rezeptschritte und abgelaufene Timer werden an den Endpunkt gesendet.",
|
"hint": "Sprachsynthese über externe REST-API konfigurieren. Rezeptschritte und abgelaufene Timer werden an den Endpunkt gesendet.",
|
||||||
"enabled": "✅ TTS aktivieren",
|
"enabled": "✅ TTS aktivieren",
|
||||||
|
"engine_label": "⚙️ TTS-Engine",
|
||||||
|
"engine_browser": "🔇 Browser (offline, keine Konfiguration erforderlich)",
|
||||||
|
"engine_server": "🌐 Externer Server (Home Assistant, REST API...)",
|
||||||
|
"voice_label": "🗣️ Stimme",
|
||||||
|
"rate_label": "⚡ Geschwindigkeit",
|
||||||
|
"pitch_label": "🎵 Tonhöhe",
|
||||||
"url_label": "🌐 Endpunkt-URL",
|
"url_label": "🌐 Endpunkt-URL",
|
||||||
"method_label": "📡 HTTP-Methode",
|
"method_label": "📡 HTTP-Methode",
|
||||||
"auth_label": "🔐 Authentifizierung",
|
"auth_label": "🔐 Authentifizierung",
|
||||||
@@ -647,7 +681,14 @@
|
|||||||
"extra_fields_label": "➕ Zusätzliche Felder (JSON)",
|
"extra_fields_label": "➕ Zusätzliche Felder (JSON)",
|
||||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||||
"extra_fields_hint": "Zusätzliche Felder im Payload, im JSON-Format. Leer lassen wenn nicht benötigt.",
|
"extra_fields_hint": "Zusätzliche Felder im Payload, im JSON-Format. Leer lassen wenn nicht benötigt.",
|
||||||
"test_btn": "🔊 Testansage senden"
|
"test_btn": "🔊 Testansage senden",
|
||||||
|
"voices_loading": "Stimmen werden geladen…",
|
||||||
|
"voice_not_supported": "Stimme vom Browser nicht unterstützt",
|
||||||
|
"voices_none": "Keine Stimmen auf diesem Gerät verfügbar",
|
||||||
|
"voices_hint": "Verfügbare Stimmen hängen vom Betriebssystem und Browser ab. Auf macOS/iOS ist die Stimme Paola (Italienisch) verfügbar. Drücken Sie ↺ wenn die Liste nicht lädt.",
|
||||||
|
"url_missing": "⚠️ Endpunkt-URL fehlt.",
|
||||||
|
"test_sending": "⏳ Wird gesendet…",
|
||||||
|
"test_ok": "✅ Antwort {code} — prüfe ob der Lautsprecher gesprochen hat."
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"title": "🌐 Sprache",
|
"title": "🌐 Sprache",
|
||||||
@@ -658,7 +699,15 @@
|
|||||||
"screensaver": {
|
"screensaver": {
|
||||||
"label": "Bildschirmschoner aktivieren",
|
"label": "Bildschirmschoner aktivieren",
|
||||||
"card_title": "🌙 Bildschirmschoner",
|
"card_title": "🌙 Bildschirmschoner",
|
||||||
"card_hint": "Zeigt nach 5 Minuten Inaktivität eine Uhr mit nützlichen Fakten. Standardmäßig deaktiviert."
|
"card_hint": "Zeigt nach 5 Minuten Inaktivität eine Uhr mit nützlichen Fakten. Standardmäßig deaktiviert.",
|
||||||
|
"timeout_1": "1 Minute",
|
||||||
|
"timeout_2": "2 Minuten",
|
||||||
|
"timeout_5": "5 Minuten",
|
||||||
|
"timeout_10": "10 Minuten",
|
||||||
|
"timeout_15": "15 Minuten",
|
||||||
|
"timeout_30": "30 Minuten",
|
||||||
|
"timeout_60": "1 Stunde",
|
||||||
|
"start_after": "⏱️ Starten nach"
|
||||||
},
|
},
|
||||||
"scale": {
|
"scale": {
|
||||||
"title": "⚖️ Smart-Waage",
|
"title": "⚖️ Smart-Waage",
|
||||||
@@ -671,12 +720,26 @@
|
|||||||
"test_btn": "🔗 Verbindung testen",
|
"test_btn": "🔗 Verbindung testen",
|
||||||
"download_btn": "📥 Android-Gateway herunterladen (APK)",
|
"download_btn": "📥 Android-Gateway herunterladen (APK)",
|
||||||
"download_hint": "Android-App als Brücke zwischen BLE-Waage und EverShelf.",
|
"download_hint": "Android-App als Brücke zwischen BLE-Waage und EverShelf.",
|
||||||
"download_sub": "Quellcode: evershelf-scale-gateway/ im Projektstamm"
|
"download_sub": "Quellcode: evershelf-scale-gateway/ im Projektstamm",
|
||||||
|
"live_weight": "Echtzeit-Gewicht",
|
||||||
|
"auto_reconnect": "🔁 Verbindung: automatisch",
|
||||||
|
"kiosk_title": "📡 BLE-Waage im Kiosk integriert",
|
||||||
|
"kiosk_hint": "Die Waage wird direkt vom internen BLE-Gateway des Kiosks verwaltet. Um ein neues Gerät zu koppeln, verwende den Konfigurationsassistenten.",
|
||||||
|
"kiosk_reconfigure": "🔄 BLE-Waage neu konfigurieren",
|
||||||
|
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Unterstützte BLE-Protokolle:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) — Gewicht, Fett, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generisch — automatische Heuristik für 100+ Modelle</li></ul>"
|
||||||
},
|
},
|
||||||
"kiosk": {
|
"kiosk": {
|
||||||
"hint": "Verwandeln Sie ein Android-Tablet in ein EverShelf-Panel mit integriertem BLE-Waagen-Gateway.",
|
"hint": "Verwandeln Sie ein Android-Tablet in ein EverShelf-Panel mit integriertem BLE-Waagen-Gateway.",
|
||||||
"download_btn": "📥 EverShelf Kiosk herunterladen (APK)",
|
"download_btn": "📥 EverShelf Kiosk herunterladen (APK)",
|
||||||
"download_sub": "Vollbild-Kioskmodus + integriertes Waagen-Gateway. Quellcode: evershelf-kiosk/"
|
"download_sub": "Vollbild-Kioskmodus + integriertes Waagen-Gateway. Quellcode: evershelf-kiosk/",
|
||||||
|
"native_title": "Kiosk-Konfiguration",
|
||||||
|
"native_hint": "Server-URL, BLE-Waage, Bildschirmschoner und Einrichtungsassistent.",
|
||||||
|
"native_btn": "Kiosk-Konfiguration öffnen",
|
||||||
|
"native_tap_hint": "Zahnrad oben rechts antippen",
|
||||||
|
"native_update_hint": "Kiosk-App aktualisieren, um diese Funktion zu nutzen",
|
||||||
|
"update_title": "Kiosk-Aktualisierung",
|
||||||
|
"check_updates_btn": "🔍 Nach Updates suchen",
|
||||||
|
"needs_update": "⚠️ Das installierte Kiosk unterstützt diese Funktion nicht. Aktualisiere die Kiosk-App, um sie zu aktivieren."
|
||||||
},
|
},
|
||||||
"saved": "✅ Konfiguration gespeichert!",
|
"saved": "✅ Konfiguration gespeichert!",
|
||||||
"saved_local": "✅ Konfiguration lokal gespeichert",
|
"saved_local": "✅ Konfiguration lokal gespeichert",
|
||||||
@@ -717,7 +780,8 @@
|
|||||||
"opened_suffix": "— Zu lange geöffnet!",
|
"opened_suffix": "— Zu lange geöffnet!",
|
||||||
"opened_suffix_ok": "— Geöffnet (noch ok)",
|
"opened_suffix_ok": "— Geöffnet (noch ok)",
|
||||||
"opened_suffix_warning": "— Geöffnet (erst prüfen)",
|
"opened_suffix_warning": "— Geöffnet (erst prüfen)",
|
||||||
"days_compact": "{n}T"
|
"days_compact": "{n}T",
|
||||||
|
"badge_check_soon": "Bald prüfen"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
@@ -809,7 +873,10 @@
|
|||||||
"select_items": "Wähle mindestens ein Produkt aus",
|
"select_items": "Wähle mindestens ein Produkt aus",
|
||||||
"server_offline": "Serververbindung unterbrochen",
|
"server_offline": "Serververbindung unterbrochen",
|
||||||
"server_restored": "Serververbindung wiederhergestellt",
|
"server_restored": "Serververbindung wiederhergestellt",
|
||||||
"server_retry": "Erneut versuchen"
|
"server_retry": "Erneut versuchen",
|
||||||
|
"unknown": "Unbekannter Fehler",
|
||||||
|
"prefix": "Fehler",
|
||||||
|
"no_inventory_entry": "Kein Inventareintrag gefunden"
|
||||||
},
|
},
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"remove_item": "Möchtest du dieses Produkt wirklich aus dem Bestand entfernen?",
|
"remove_item": "Möchtest du dieses Produkt wirklich aus dem Bestand entfernen?",
|
||||||
@@ -825,7 +892,9 @@
|
|||||||
"edit": {
|
"edit": {
|
||||||
"title": "{name} bearbeiten",
|
"title": "{name} bearbeiten",
|
||||||
"unknown_hint": "Produktname und Informationen eingeben",
|
"unknown_hint": "Produktname und Informationen eingeben",
|
||||||
"label_name": "🏷️ Produktname"
|
"label_name": "🏷️ Produktname",
|
||||||
|
"choose_location_title": "Welchen Ort?",
|
||||||
|
"choose_location_hint": "Wähle den zu bearbeitenden Ort:"
|
||||||
},
|
},
|
||||||
"screensaver": {
|
"screensaver": {
|
||||||
"recipe_btn": "Rezepte",
|
"recipe_btn": "Rezepte",
|
||||||
@@ -922,7 +991,8 @@
|
|||||||
"thing_rest": "den Rest",
|
"thing_rest": "den Rest",
|
||||||
"stay_btn": "Nein, bleibt in {location}",
|
"stay_btn": "Nein, bleibt in {location}",
|
||||||
"moved_toast": "📦 Offene Packung bewegt nach {location}",
|
"moved_toast": "📦 Offene Packung bewegt nach {location}",
|
||||||
"vacuum_restore": "🫙 Vakuum wiederherstellen"
|
"vacuum_restore": "🫙 Vakuum wiederherstellen",
|
||||||
|
"vacuum_seal_rest": "🔒 Rest vakuumieren"
|
||||||
},
|
},
|
||||||
"nova": {
|
"nova": {
|
||||||
"1": "Unverarbeitet",
|
"1": "Unverarbeitet",
|
||||||
@@ -1085,5 +1155,28 @@
|
|||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"empty": "Kein Haushaltsgerät hinzugefügt"
|
"empty": "Kein Haushaltsgerät hinzugefügt"
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"title": "Über",
|
||||||
|
"version": "Version",
|
||||||
|
"report_bug": "Fehler melden",
|
||||||
|
"report_bug_hint": "Etwas funktioniert nicht? Sende uns direkt aus der App eine Meldung.",
|
||||||
|
"report_bug_modal_title": "Fehler melden",
|
||||||
|
"report_type_bug": "Fehler",
|
||||||
|
"report_type_feature": "Funktion",
|
||||||
|
"report_type_question": "Frage",
|
||||||
|
"report_field_title": "Titel",
|
||||||
|
"report_field_title_ph": "Kurze Beschreibung des Problems",
|
||||||
|
"report_field_desc": "Beschreibung",
|
||||||
|
"report_field_desc_ph": "Problem detailliert beschreiben…",
|
||||||
|
"report_field_steps": "Schritte zum Reproduzieren (optional)",
|
||||||
|
"report_field_steps_ph": "1. Gehe zu…\n2. Tippe auf…\n3. Fehler erscheint…",
|
||||||
|
"report_auto_info": "Automatisch beigefügt: Version {version}, Sprache {lang}.",
|
||||||
|
"report_send_btn": "Bericht senden",
|
||||||
|
"report_bug_sending": "Wird gesendet…",
|
||||||
|
"report_bug_sent": "Bericht gesendet — danke!",
|
||||||
|
"report_bug_error": "Bericht konnte nicht gesendet werden. Verbindung prüfen.",
|
||||||
|
"changelog": "Changelog",
|
||||||
|
"github": "GitHub-Repository"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
"inventory": "Pantry",
|
"inventory": "Pantry",
|
||||||
"recipes": "Recipes",
|
"recipes": "Recipes",
|
||||||
"shopping": "Shopping",
|
"shopping": "Shopping",
|
||||||
"log": "Log"
|
"log": "Log",
|
||||||
|
"settings": "Settings"
|
||||||
},
|
},
|
||||||
"btn": {
|
"btn": {
|
||||||
"back": "← Back",
|
"back": "← Back",
|
||||||
@@ -19,6 +20,8 @@
|
|||||||
"add": "✅ Add",
|
"add": "✅ Add",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"edit": "✏️ Edit",
|
"edit": "✏️ Edit",
|
||||||
|
"use": "Use",
|
||||||
|
"edit_item": "Edit",
|
||||||
"search": "🔍 Search",
|
"search": "🔍 Search",
|
||||||
"go": "✅ Go",
|
"go": "✅ Go",
|
||||||
"toggle_password": "👁️ Show/Hide",
|
"toggle_password": "👁️ Show/Hide",
|
||||||
@@ -28,7 +31,12 @@
|
|||||||
"restart": "↺ Restart",
|
"restart": "↺ Restart",
|
||||||
"reset_default": "↺ Reset to default",
|
"reset_default": "↺ Reset to default",
|
||||||
"save_info": "💾 Save information",
|
"save_info": "💾 Save information",
|
||||||
"retry": "🔄 Retry"
|
"retry": "🔄 Retry",
|
||||||
|
"yes_short": "Yes",
|
||||||
|
"no_short": "No"
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"select_placeholder": "-- Select --"
|
||||||
},
|
},
|
||||||
"locations": {
|
"locations": {
|
||||||
"dispensa": "Pantry",
|
"dispensa": "Pantry",
|
||||||
@@ -63,7 +71,9 @@
|
|||||||
"pieces": "Pieces",
|
"pieces": "Pieces",
|
||||||
"grams": "Grams",
|
"grams": "Grams",
|
||||||
"box": "Package",
|
"box": "Package",
|
||||||
"boxes": "Packages"
|
"boxes": "Packages",
|
||||||
|
"millilitres": "Millilitres",
|
||||||
|
"from": "of"
|
||||||
},
|
},
|
||||||
"shopping_sections": {
|
"shopping_sections": {
|
||||||
"frutta_verdura": "Fruits & Vegetables",
|
"frutta_verdura": "Fruits & Vegetables",
|
||||||
@@ -91,9 +101,9 @@
|
|||||||
"banner_review_action_edit": "Correct",
|
"banner_review_action_edit": "Correct",
|
||||||
"banner_review_action_weigh": "Weigh",
|
"banner_review_action_weigh": "Weigh",
|
||||||
"banner_review_dismiss": "Dismiss",
|
"banner_review_dismiss": "Dismiss",
|
||||||
"banner_prediction_title": "Anomalous consumption",
|
"banner_prediction_title": "Consumption to review",
|
||||||
"banner_prediction_hint": "Based on predictions, this quantity doesn't match expected consumption.",
|
"banner_prediction_hint": "The consumption estimate adapts to recent data: confirm only if the current quantity is correct.",
|
||||||
"banner_prediction_action_confirm": "Confirm {qty} {unit} is correct",
|
"banner_prediction_action_confirm": "Confirm {qty} {unit}",
|
||||||
"banner_prediction_action_weigh": "Weigh now",
|
"banner_prediction_action_weigh": "Weigh now",
|
||||||
"banner_prediction_action_edit": "Update quantity",
|
"banner_prediction_action_edit": "Update quantity",
|
||||||
"banner_expired_title": "Expired product",
|
"banner_expired_title": "Expired product",
|
||||||
@@ -128,8 +138,8 @@
|
|||||||
"banner_prediction_rate_day": "Average ~{n} {unit}/day",
|
"banner_prediction_rate_day": "Average ~{n} {unit}/day",
|
||||||
"banner_prediction_rate_week": "Average ~{n} {unit}/week",
|
"banner_prediction_rate_week": "Average ~{n} {unit}/week",
|
||||||
"banner_prediction_days_ago": "{n} days ago you restocked",
|
"banner_prediction_days_ago": "{n} days ago you restocked",
|
||||||
"banner_prediction_more": "I expected {expected} {unit}{time}, but you have {actual} {unit}. Did you add stock without recording it?",
|
"banner_prediction_more": "previous estimate: {expected} {unit}{time}; current quantity: {actual} {unit}.",
|
||||||
"banner_prediction_less": "I expected {expected} {unit}{time}, but you only have {actual} {unit}. Did you use more than usual?",
|
"banner_prediction_less": "estimate: {expected} {unit}{time}; current quantity: {actual} {unit}. If your usage pace changed, the forecast updates automatically.",
|
||||||
"banner_finished_zero": "Inventory shows zero, but recorded movements suggest it shouldn't be empty.",
|
"banner_finished_zero": "Inventory shows zero, but recorded movements suggest it shouldn't be empty.",
|
||||||
"banner_finished_expected": "According to records you should still have {qty} {unit}.",
|
"banner_finished_expected": "According to records you should still have {qty} {unit}.",
|
||||||
"banner_finished_check": "Can you check?",
|
"banner_finished_check": "Can you check?",
|
||||||
@@ -215,7 +225,7 @@
|
|||||||
"throw_btn": "🗑️ DISCARD",
|
"throw_btn": "🗑️ DISCARD",
|
||||||
"throw_sub": "throw away",
|
"throw_sub": "throw away",
|
||||||
"edit_sub": "expiry, location…",
|
"edit_sub": "expiry, location…",
|
||||||
"create_recipe_btn": "Create a recipe with this"
|
"create_recipe_btn": "Recipe"
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
"title": "Add to Pantry",
|
"title": "Add to Pantry",
|
||||||
@@ -240,7 +250,9 @@
|
|||||||
"scan_expiry_title": "📷 Scan Expiry Date",
|
"scan_expiry_title": "📷 Scan Expiry Date",
|
||||||
"product_added": "✅ {name} added!{qty}",
|
"product_added": "✅ {name} added!{qty}",
|
||||||
"suffix_freezer_vacuum": "(freezer + vacuum sealed)",
|
"suffix_freezer_vacuum": "(freezer + vacuum sealed)",
|
||||||
"history_badge_tip": "Average from {n} previous entries"
|
"history_badge_tip": "Average from {n} previous entries",
|
||||||
|
"vacuum_question": "Vacuum sealed?",
|
||||||
|
"vacuum_saved": "🔒 Vacuum sealed!"
|
||||||
},
|
},
|
||||||
"use": {
|
"use": {
|
||||||
"title": "Use / Consume",
|
"title": "Use / Consume",
|
||||||
@@ -312,7 +324,13 @@
|
|||||||
"edit_info": "✏️ Edit information",
|
"edit_info": "✏️ Edit information",
|
||||||
"modify_details": "EDIT\nexpiry, location…",
|
"modify_details": "EDIT\nexpiry, location…",
|
||||||
"already_in_pantry": "📋 Already in pantry",
|
"already_in_pantry": "📋 Already in pantry",
|
||||||
"no_barcode": "No barcode"
|
"no_barcode": "No barcode",
|
||||||
|
"unknown_product": "Unrecognized product",
|
||||||
|
"edit_name_brand": "Edit name/brand",
|
||||||
|
"weight_label": "Weight",
|
||||||
|
"origin_label": "Origin",
|
||||||
|
"labels_label": "Labels",
|
||||||
|
"select_variant": "Select the exact variant or use AI data:"
|
||||||
},
|
},
|
||||||
"products": {
|
"products": {
|
||||||
"title": "📦 All Products",
|
"title": "📦 All Products",
|
||||||
@@ -341,6 +359,7 @@
|
|||||||
"regenerate": "🔄 Generate another one",
|
"regenerate": "🔄 Generate another one",
|
||||||
"close_btn": "✅ Close",
|
"close_btn": "✅ Close",
|
||||||
"ingredients_title": "🧾 Ingredients",
|
"ingredients_title": "🧾 Ingredients",
|
||||||
|
"tools_title": "Equipment needed",
|
||||||
"steps_title": "👨🍳 Steps",
|
"steps_title": "👨🍳 Steps",
|
||||||
"no_steps": "No steps available",
|
"no_steps": "No steps available",
|
||||||
"generate_error": "Generation error",
|
"generate_error": "Generation error",
|
||||||
@@ -481,7 +500,8 @@
|
|||||||
"undo_success": "↩ Operation undone for {name}",
|
"undo_success": "↩ Operation undone for {name}",
|
||||||
"already_undone": "Operation already undone",
|
"already_undone": "Operation already undone",
|
||||||
"too_old": "Cannot undo operations older than 24 hours",
|
"too_old": "Cannot undo operations older than 24 hours",
|
||||||
"undo_error": "Error during undo"
|
"undo_error": "Error during undo",
|
||||||
|
"recipe_prefix": "Recipe"
|
||||||
},
|
},
|
||||||
"chat": {
|
"chat": {
|
||||||
"title": "Gemini Chef",
|
"title": "Gemini Chef",
|
||||||
@@ -501,7 +521,8 @@
|
|||||||
"transfer_to_recipes": "Transfer to Recipes",
|
"transfer_to_recipes": "Transfer to Recipes",
|
||||||
"transferring": "Transferring...",
|
"transferring": "Transferring...",
|
||||||
"transferred": "Added to Recipes!",
|
"transferred": "Added to Recipes!",
|
||||||
"open_recipe": "Open recipe"
|
"open_recipe": "Open recipe",
|
||||||
|
"quick_recipe_prompt": "Suggest a quick recipe FOR ONE PERSON using the products that expire first! Ignore freezer items, focus on fridge and pantry."
|
||||||
},
|
},
|
||||||
"cooking": {
|
"cooking": {
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
@@ -518,7 +539,8 @@
|
|||||||
"timer_warning_tts": "Heads up! {label}: 10 seconds left!",
|
"timer_warning_tts": "Heads up! {label}: 10 seconds left!",
|
||||||
"recipe_done_tts": "Recipe complete! Enjoy your meal!",
|
"recipe_done_tts": "Recipe complete! Enjoy your meal!",
|
||||||
"expires_chip": "exp. {date}",
|
"expires_chip": "exp. {date}",
|
||||||
"finish": "✅ Finish"
|
"finish": "✅ Finish",
|
||||||
|
"step_fallback": "Step {n}"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "⚙️ Settings",
|
"title": "⚙️ Settings",
|
||||||
@@ -571,8 +593,9 @@
|
|||||||
"title": "📅 Weekly Meal Plan",
|
"title": "📅 Weekly Meal Plan",
|
||||||
"hint": "Set the meal type for each day. It will be used as a guide in recipe generation.",
|
"hint": "Set the meal type for each day. It will be used as a guide in recipe generation.",
|
||||||
"enabled": "✅ Enable weekly meal plan",
|
"enabled": "✅ Enable weekly meal plan",
|
||||||
"legend": "🌤️ = Lunch · 🌙 = Dinner · Tap a badge to change it.",
|
"legend": "🌤️ = Lunch · 🌙 = Dinner · Tap a badge to change it.",
|
||||||
"types_title": "📋 Available types"
|
"types_title": "📋 Available types",
|
||||||
|
"reset_btn": "↺ Restore defaults"
|
||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"title": "🔌 Available Appliances",
|
"title": "🔌 Available Appliances",
|
||||||
@@ -626,12 +649,24 @@
|
|||||||
"security": {
|
"security": {
|
||||||
"title": "🔒 HTTPS Certificate",
|
"title": "🔒 HTTPS Certificate",
|
||||||
"hint": "If the browser shows the error \"Your connection is not private\" (ERR_CERT_AUTHORITY_INVALID), you need to install the CA certificate on the device.",
|
"hint": "If the browser shows the error \"Your connection is not private\" (ERR_CERT_AUTHORITY_INVALID), you need to install the CA certificate on the device.",
|
||||||
"download_btn": "📥 Download CA Certificate"
|
"download_btn": "📥 Download CA Certificate",
|
||||||
|
"token_title": "🔑 Settings Token",
|
||||||
|
"token_label": "Access token",
|
||||||
|
"token_hint": "If `SETTINGS_TOKEN` is configured in the server's `.env`, enter the token here before saving settings. Leave empty if not configured.",
|
||||||
|
"token_placeholder": "(empty = no protection)",
|
||||||
|
"token_required_hint": "🔒 This server requires a token to save settings.",
|
||||||
|
"cert_instructions": "<strong>Instructions for Chrome (Android):</strong><br>1. Download the certificate above<br>2. Go to <em>Settings → Security & Privacy → More security settings → Install from device storage</em><br>3. Select the downloaded <em>EverShelf_CA.crt</em> file<br>4. Choose \"CA\" and confirm<br>5. Restart Chrome<br><br><strong>Instructions for Chrome (PC):</strong><br>1. Download the certificate above<br>2. Go to <em>chrome://settings/certificates</em> (or Settings → Privacy and security → Security → Manage certificates)<br>3. Tab \"Authorities\" → Import → select the file<br>4. Check \"Trust this certificate for identifying websites\"<br>5. Restart Chrome"
|
||||||
},
|
},
|
||||||
"tts": {
|
"tts": {
|
||||||
"title": "🔊 Voice & TTS",
|
"title": "🔊 Voice & TTS",
|
||||||
"hint": "Configure text-to-speech via any external REST API. Recipe steps and expired timers will be sent to the configured endpoint.",
|
"hint": "Configure text-to-speech via any external REST API. Recipe steps and expired timers will be sent to the configured endpoint.",
|
||||||
"enabled": "✅ Enable TTS",
|
"enabled": "✅ Enable TTS",
|
||||||
|
"engine_label": "⚙️ TTS Engine",
|
||||||
|
"engine_browser": "🔇 Browser (offline, no configuration required)",
|
||||||
|
"engine_server": "🌐 External server (Home Assistant, REST API...)",
|
||||||
|
"voice_label": "🗣️ Voice",
|
||||||
|
"rate_label": "⚡ Speed",
|
||||||
|
"pitch_label": "🎵 Pitch",
|
||||||
"url_label": "🌐 Endpoint URL",
|
"url_label": "🌐 Endpoint URL",
|
||||||
"method_label": "📡 HTTP Method",
|
"method_label": "📡 HTTP Method",
|
||||||
"auth_label": "🔐 Authentication",
|
"auth_label": "🔐 Authentication",
|
||||||
@@ -647,7 +682,14 @@
|
|||||||
"extra_fields_label": "➕ Extra fields (JSON)",
|
"extra_fields_label": "➕ Extra fields (JSON)",
|
||||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||||
"extra_fields_hint": "Additional fields to include in the payload, in JSON format. Leave empty if not needed.",
|
"extra_fields_hint": "Additional fields to include in the payload, in JSON format. Leave empty if not needed.",
|
||||||
"test_btn": "🔊 Send Test Voice"
|
"test_btn": "🔊 Send Test Voice",
|
||||||
|
"voices_loading": "Loading voices…",
|
||||||
|
"voice_not_supported": "Voice not supported by this browser",
|
||||||
|
"voices_none": "No voices available on this device",
|
||||||
|
"voices_hint": "Available voices depend on the OS and browser. On macOS/iOS the Paola (Italian) voice is available. Press ↺ if the list does not load.",
|
||||||
|
"url_missing": "⚠️ Endpoint URL missing.",
|
||||||
|
"test_sending": "⏳ Sending…",
|
||||||
|
"test_ok": "✅ Response {code} — check that the speaker has spoken."
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"title": "🌐 Language",
|
"title": "🌐 Language",
|
||||||
@@ -658,7 +700,15 @@
|
|||||||
"screensaver": {
|
"screensaver": {
|
||||||
"label": "Enable screensaver",
|
"label": "Enable screensaver",
|
||||||
"card_title": "🌙 Screensaver",
|
"card_title": "🌙 Screensaver",
|
||||||
"card_hint": "Shows a clock with useful facts after 5 minutes of inactivity. Disabled by default."
|
"card_hint": "Shows a clock with useful facts after 5 minutes of inactivity. Disabled by default.",
|
||||||
|
"timeout_1": "1 minute",
|
||||||
|
"timeout_2": "2 minutes",
|
||||||
|
"timeout_5": "5 minutes",
|
||||||
|
"timeout_10": "10 minutes",
|
||||||
|
"timeout_15": "15 minutes",
|
||||||
|
"timeout_30": "30 minutes",
|
||||||
|
"timeout_60": "1 hour",
|
||||||
|
"start_after": "⏱️ Start after"
|
||||||
},
|
},
|
||||||
"scale": {
|
"scale": {
|
||||||
"title": "⚖️ Smart Scale",
|
"title": "⚖️ Smart Scale",
|
||||||
@@ -671,12 +721,26 @@
|
|||||||
"test_btn": "🔗 Test connection",
|
"test_btn": "🔗 Test connection",
|
||||||
"download_btn": "📥 Download Android Gateway (APK)",
|
"download_btn": "📥 Download Android Gateway (APK)",
|
||||||
"download_hint": "Android app that bridges your BLE scale and EverShelf.",
|
"download_hint": "Android app that bridges your BLE scale and EverShelf.",
|
||||||
"download_sub": "Source: evershelf-scale-gateway/ in the project root"
|
"download_sub": "Source: evershelf-scale-gateway/ in the project root",
|
||||||
|
"live_weight": "real-time weight",
|
||||||
|
"auto_reconnect": "🔁 Reconnect: automatic",
|
||||||
|
"kiosk_title": "📡 BLE Scale integrated in Kiosk",
|
||||||
|
"kiosk_hint": "The scale is directly managed by the internal BLE Gateway of the kiosk. To pair a new device, use the configuration wizard.",
|
||||||
|
"kiosk_reconfigure": "🔄 Reconfigure BLE Scale",
|
||||||
|
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Supported BLE protocols:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) — weight, fat, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generic — automatic heuristic for 100+ models</li></ul>"
|
||||||
},
|
},
|
||||||
"kiosk": {
|
"kiosk": {
|
||||||
"hint": "Turn an Android tablet into an always-on EverShelf panel with built-in BLE scale gateway.",
|
"hint": "Turn an Android tablet into an always-on EverShelf panel with built-in BLE scale gateway.",
|
||||||
"download_btn": "📥 Download EverShelf Kiosk (APK)",
|
"download_btn": "📥 Download EverShelf Kiosk (APK)",
|
||||||
"download_sub": "Full-screen kiosk mode + integrated scale gateway. Source: evershelf-kiosk/"
|
"download_sub": "Full-screen kiosk mode + integrated scale gateway. Source: evershelf-kiosk/",
|
||||||
|
"native_title": "Kiosk Configuration",
|
||||||
|
"native_hint": "Server URL, BLE scale, screensaver and setup wizard.",
|
||||||
|
"native_btn": "Open kiosk configuration",
|
||||||
|
"native_tap_hint": "Tap the gear button at the top right",
|
||||||
|
"native_update_hint": "Update the kiosk app to use this feature",
|
||||||
|
"update_title": "Kiosk Update",
|
||||||
|
"check_updates_btn": "🔍 Check for updates",
|
||||||
|
"needs_update": "⚠️ The installed kiosk does not support this feature. Update the kiosk app to enable it."
|
||||||
},
|
},
|
||||||
"saved": "✅ Configuration saved!",
|
"saved": "✅ Configuration saved!",
|
||||||
"saved_local": "✅ Configuration saved locally",
|
"saved_local": "✅ Configuration saved locally",
|
||||||
@@ -717,7 +781,8 @@
|
|||||||
"opened_suffix": "— Opened too long!",
|
"opened_suffix": "— Opened too long!",
|
||||||
"opened_suffix_ok": "— Opened (still ok)",
|
"opened_suffix_ok": "— Opened (still ok)",
|
||||||
"opened_suffix_warning": "— Opened (check first)",
|
"opened_suffix_warning": "— Opened (check first)",
|
||||||
"days_compact": "{n}d"
|
"days_compact": "{n}d",
|
||||||
|
"badge_check_soon": "Check soon"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
@@ -809,7 +874,10 @@
|
|||||||
"select_items": "Select at least one product",
|
"select_items": "Select at least one product",
|
||||||
"server_offline": "Server connection lost",
|
"server_offline": "Server connection lost",
|
||||||
"server_restored": "Server connection restored",
|
"server_restored": "Server connection restored",
|
||||||
"server_retry": "Retry"
|
"server_retry": "Retry",
|
||||||
|
"unknown": "Unknown error",
|
||||||
|
"prefix": "Error",
|
||||||
|
"no_inventory_entry": "No inventory entry found"
|
||||||
},
|
},
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"remove_item": "Do you really want to remove this product from inventory?",
|
"remove_item": "Do you really want to remove this product from inventory?",
|
||||||
@@ -825,7 +893,9 @@
|
|||||||
"edit": {
|
"edit": {
|
||||||
"title": "Edit {name}",
|
"title": "Edit {name}",
|
||||||
"unknown_hint": "Enter the product name and information",
|
"unknown_hint": "Enter the product name and information",
|
||||||
"label_name": "🏷️ Product name"
|
"label_name": "🏷️ Product name",
|
||||||
|
"choose_location_title": "Which location?",
|
||||||
|
"choose_location_hint": "Choose the location to edit:"
|
||||||
},
|
},
|
||||||
"screensaver": {
|
"screensaver": {
|
||||||
"recipe_btn": "Recipes",
|
"recipe_btn": "Recipes",
|
||||||
@@ -922,7 +992,8 @@
|
|||||||
"thing_rest": "rest",
|
"thing_rest": "rest",
|
||||||
"stay_btn": "No, stay in {location}",
|
"stay_btn": "No, stay in {location}",
|
||||||
"moved_toast": "📦 Opened package moved to {location}",
|
"moved_toast": "📦 Opened package moved to {location}",
|
||||||
"vacuum_restore": "🫙 Restore vacuum sealed"
|
"vacuum_restore": "🫙 Restore vacuum sealed",
|
||||||
|
"vacuum_seal_rest": "🔒 Vacuum seal the rest"
|
||||||
},
|
},
|
||||||
"nova": {
|
"nova": {
|
||||||
"1": "Unprocessed",
|
"1": "Unprocessed",
|
||||||
@@ -1085,5 +1156,28 @@
|
|||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"empty": "No appliances added"
|
"empty": "No appliances added"
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"title": "About",
|
||||||
|
"version": "Version",
|
||||||
|
"report_bug": "Report a Bug",
|
||||||
|
"report_bug_hint": "Something not working? Send us a report directly from the app.",
|
||||||
|
"report_bug_modal_title": "Report a Bug",
|
||||||
|
"report_type_bug": "Bug",
|
||||||
|
"report_type_feature": "Feature",
|
||||||
|
"report_type_question": "Question",
|
||||||
|
"report_field_title": "Title",
|
||||||
|
"report_field_title_ph": "Brief description of the issue",
|
||||||
|
"report_field_desc": "Description",
|
||||||
|
"report_field_desc_ph": "Describe the issue in detail…",
|
||||||
|
"report_field_steps": "Steps to reproduce (optional)",
|
||||||
|
"report_field_steps_ph": "1. Go to…\n2. Tap…\n3. See the error…",
|
||||||
|
"report_auto_info": "Automatically attached: version {version}, language {lang}.",
|
||||||
|
"report_send_btn": "Send report",
|
||||||
|
"report_bug_sending": "Sending…",
|
||||||
|
"report_bug_sent": "Report sent — thank you!",
|
||||||
|
"report_bug_error": "Could not send the report. Check your connection.",
|
||||||
|
"changelog": "Changelog",
|
||||||
|
"github": "GitHub Repository"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
"inventory": "Dispensa",
|
"inventory": "Dispensa",
|
||||||
"recipes": "Ricette",
|
"recipes": "Ricette",
|
||||||
"shopping": "Spesa",
|
"shopping": "Spesa",
|
||||||
"log": "Storico"
|
"log": "Storico",
|
||||||
|
"settings": "Config"
|
||||||
},
|
},
|
||||||
"btn": {
|
"btn": {
|
||||||
"back": "← Indietro",
|
"back": "← Indietro",
|
||||||
@@ -19,6 +20,8 @@
|
|||||||
"add": "✅ Aggiungi",
|
"add": "✅ Aggiungi",
|
||||||
"delete": "Elimina",
|
"delete": "Elimina",
|
||||||
"edit": "✏️ Modifica",
|
"edit": "✏️ Modifica",
|
||||||
|
"use": "Usa",
|
||||||
|
"edit_item": "Modifica",
|
||||||
"search": "🔍 Cerca",
|
"search": "🔍 Cerca",
|
||||||
"go": "✅ Vai",
|
"go": "✅ Vai",
|
||||||
"toggle_password": "👁️ Mostra/Nascondi",
|
"toggle_password": "👁️ Mostra/Nascondi",
|
||||||
@@ -28,7 +31,12 @@
|
|||||||
"restart": "↺ Ricomincia",
|
"restart": "↺ Ricomincia",
|
||||||
"reset_default": "↺ Ripristina default",
|
"reset_default": "↺ Ripristina default",
|
||||||
"save_info": "💾 Salva informazioni",
|
"save_info": "💾 Salva informazioni",
|
||||||
"retry": "🔄 Riprova"
|
"retry": "🔄 Riprova",
|
||||||
|
"yes_short": "Sì",
|
||||||
|
"no_short": "No"
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"select_placeholder": "-- Seleziona --"
|
||||||
},
|
},
|
||||||
"locations": {
|
"locations": {
|
||||||
"dispensa": "Dispensa",
|
"dispensa": "Dispensa",
|
||||||
@@ -63,7 +71,9 @@
|
|||||||
"pieces": "Pezzi",
|
"pieces": "Pezzi",
|
||||||
"grams": "Grammi",
|
"grams": "Grammi",
|
||||||
"box": "Confezione",
|
"box": "Confezione",
|
||||||
"boxes": "Confezioni"
|
"boxes": "Confezioni",
|
||||||
|
"millilitres": "Millilitri",
|
||||||
|
"from": "da"
|
||||||
},
|
},
|
||||||
"shopping_sections": {
|
"shopping_sections": {
|
||||||
"frutta_verdura": "Frutta & Verdura",
|
"frutta_verdura": "Frutta & Verdura",
|
||||||
@@ -91,9 +101,9 @@
|
|||||||
"banner_review_action_edit": "Correggi",
|
"banner_review_action_edit": "Correggi",
|
||||||
"banner_review_action_weigh": "Pesa",
|
"banner_review_action_weigh": "Pesa",
|
||||||
"banner_review_dismiss": "Ignora",
|
"banner_review_dismiss": "Ignora",
|
||||||
"banner_prediction_title": "Consumo anomalo",
|
"banner_prediction_title": "Consumo da verificare",
|
||||||
"banner_prediction_hint": "Secondo le previsioni, questa quantità non corrisponde al consumo previsto.",
|
"banner_prediction_hint": "La stima di consumo si adatta ai dati recenti: verifica solo se la quantità corrente è corretta.",
|
||||||
"banner_prediction_action_confirm": "Confermo la quantità di {qty} {unit}",
|
"banner_prediction_action_confirm": "Confermo {qty} {unit}",
|
||||||
"banner_prediction_action_weigh": "Pesa ora",
|
"banner_prediction_action_weigh": "Pesa ora",
|
||||||
"banner_prediction_action_edit": "Aggiorna quantità",
|
"banner_prediction_action_edit": "Aggiorna quantità",
|
||||||
"banner_expired_title": "Prodotto scaduto",
|
"banner_expired_title": "Prodotto scaduto",
|
||||||
@@ -128,8 +138,8 @@
|
|||||||
"banner_prediction_rate_day": "Media ~{n} {unit}/giorno",
|
"banner_prediction_rate_day": "Media ~{n} {unit}/giorno",
|
||||||
"banner_prediction_rate_week": "Media ~{n} {unit}/settimana",
|
"banner_prediction_rate_week": "Media ~{n} {unit}/settimana",
|
||||||
"banner_prediction_days_ago": "{n} giorni fa hai rifornito",
|
"banner_prediction_days_ago": "{n} giorni fa hai rifornito",
|
||||||
"banner_prediction_more": "mi aspettavo {expected} {unit}{time}, ne hai invece {actual} {unit}. Hai aggiunto scorte senza registrarle?",
|
"banner_prediction_more": "stima precedente: {expected} {unit}{time}; quantità attuale: {actual} {unit}.",
|
||||||
"banner_prediction_less": "mi aspettavo {expected} {unit}{time}, ne hai solo {actual} {unit}. Hai consumato di più del solito?",
|
"banner_prediction_less": "stima: {expected} {unit}{time}; quantità attuale: {actual} {unit}. Se hai cambiato ritmo d'uso, la previsione si aggiorna automaticamente.",
|
||||||
"banner_finished_zero": "L'inventario segna zero, ma i movimenti registrati dicono che non dovrebbe essere finito.",
|
"banner_finished_zero": "L'inventario segna zero, ma i movimenti registrati dicono che non dovrebbe essere finito.",
|
||||||
"banner_finished_expected": "Secondo le registrazioni dovresti averne ancora {qty} {unit}.",
|
"banner_finished_expected": "Secondo le registrazioni dovresti averne ancora {qty} {unit}.",
|
||||||
"banner_finished_check": "Puoi controllare?",
|
"banner_finished_check": "Puoi controllare?",
|
||||||
@@ -215,7 +225,7 @@
|
|||||||
"throw_btn": "🗑️ BUTTA",
|
"throw_btn": "🗑️ BUTTA",
|
||||||
"throw_sub": "butta il prodotto",
|
"throw_sub": "butta il prodotto",
|
||||||
"edit_sub": "scadenza, luogo…",
|
"edit_sub": "scadenza, luogo…",
|
||||||
"create_recipe_btn": "Crea una ricetta con questo"
|
"create_recipe_btn": "Ricetta"
|
||||||
},
|
},
|
||||||
"add": {
|
"add": {
|
||||||
"title": "Aggiungi alla Dispensa",
|
"title": "Aggiungi alla Dispensa",
|
||||||
@@ -240,7 +250,9 @@
|
|||||||
"scan_expiry_title": "📷 Scansiona Data Scadenza",
|
"scan_expiry_title": "📷 Scansiona Data Scadenza",
|
||||||
"product_added": "✅ {name} aggiunto!{qty}",
|
"product_added": "✅ {name} aggiunto!{qty}",
|
||||||
"suffix_freezer_vacuum": "(freezer + sotto vuoto)",
|
"suffix_freezer_vacuum": "(freezer + sotto vuoto)",
|
||||||
"history_badge_tip": "Media da {n} inserimenti precedenti"
|
"history_badge_tip": "Media da {n} inserimenti precedenti",
|
||||||
|
"vacuum_question": "Messo sotto vuoto?",
|
||||||
|
"vacuum_saved": "🔒 Sotto vuoto registrato"
|
||||||
},
|
},
|
||||||
"use": {
|
"use": {
|
||||||
"title": "Usa / Consuma",
|
"title": "Usa / Consuma",
|
||||||
@@ -312,7 +324,13 @@
|
|||||||
"edit_info": "✏️ Modifica informazioni",
|
"edit_info": "✏️ Modifica informazioni",
|
||||||
"modify_details": "MODIFICA\nscadenza, luogo…",
|
"modify_details": "MODIFICA\nscadenza, luogo…",
|
||||||
"already_in_pantry": "📋 Già in dispensa",
|
"already_in_pantry": "📋 Già in dispensa",
|
||||||
"no_barcode": "Senza barcode"
|
"no_barcode": "Senza barcode",
|
||||||
|
"unknown_product": "Prodotto non riconosciuto",
|
||||||
|
"edit_name_brand": "Modifica nome/marca",
|
||||||
|
"weight_label": "Peso",
|
||||||
|
"origin_label": "Origine",
|
||||||
|
"labels_label": "Etichette",
|
||||||
|
"select_variant": "Seleziona la variante esatta o usa i dati AI:"
|
||||||
},
|
},
|
||||||
"products": {
|
"products": {
|
||||||
"title": "📦 Tutti i Prodotti",
|
"title": "📦 Tutti i Prodotti",
|
||||||
@@ -341,6 +359,7 @@
|
|||||||
"regenerate": "🔄 Generane un'altra",
|
"regenerate": "🔄 Generane un'altra",
|
||||||
"close_btn": "✅ Chiudi",
|
"close_btn": "✅ Chiudi",
|
||||||
"ingredients_title": "🧾 Ingredienti",
|
"ingredients_title": "🧾 Ingredienti",
|
||||||
|
"tools_title": "Strumenti necessari",
|
||||||
"steps_title": "👨🍳 Procedimento",
|
"steps_title": "👨🍳 Procedimento",
|
||||||
"no_steps": "Nessun procedimento disponibile",
|
"no_steps": "Nessun procedimento disponibile",
|
||||||
"generate_error": "Errore nella generazione",
|
"generate_error": "Errore nella generazione",
|
||||||
@@ -481,7 +500,8 @@
|
|||||||
"undo_success": "↩ Operazione annullata per {name}",
|
"undo_success": "↩ Operazione annullata per {name}",
|
||||||
"already_undone": "Operazione già annullata",
|
"already_undone": "Operazione già annullata",
|
||||||
"too_old": "Non è possibile annullare operazioni più vecchie di 24 ore",
|
"too_old": "Non è possibile annullare operazioni più vecchie di 24 ore",
|
||||||
"undo_error": "Errore durante l'annullamento"
|
"undo_error": "Errore durante l'annullamento",
|
||||||
|
"recipe_prefix": "Ricetta"
|
||||||
},
|
},
|
||||||
"chat": {
|
"chat": {
|
||||||
"title": "Gemini Chef",
|
"title": "Gemini Chef",
|
||||||
@@ -501,7 +521,8 @@
|
|||||||
"transfer_to_recipes": "Trasferisci a Ricette",
|
"transfer_to_recipes": "Trasferisci a Ricette",
|
||||||
"transferring": "Trasferimento in corso...",
|
"transferring": "Trasferimento in corso...",
|
||||||
"transferred": "Aggiunta alle Ricette!",
|
"transferred": "Aggiunta alle Ricette!",
|
||||||
"open_recipe": "Apri la ricetta"
|
"open_recipe": "Apri la ricetta",
|
||||||
|
"quick_recipe_prompt": "Suggeriscimi una ricetta veloce PER UNA PERSONA usando i prodotti che scadono prima! Ignora i prodotti in freezer, concentrati su frigo e dispensa."
|
||||||
},
|
},
|
||||||
"cooking": {
|
"cooking": {
|
||||||
"close": "Chiudi",
|
"close": "Chiudi",
|
||||||
@@ -518,7 +539,8 @@
|
|||||||
"timer_warning_tts": "Attenzione! {label}: mancano 10 secondi!",
|
"timer_warning_tts": "Attenzione! {label}: mancano 10 secondi!",
|
||||||
"recipe_done_tts": "Ricetta completata! Buon appetito!",
|
"recipe_done_tts": "Ricetta completata! Buon appetito!",
|
||||||
"expires_chip": "scade {date}",
|
"expires_chip": "scade {date}",
|
||||||
"finish": "✅ Fine"
|
"finish": "✅ Fine",
|
||||||
|
"step_fallback": "Passo {n}"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"title": "⚙️ Configurazione",
|
"title": "⚙️ Configurazione",
|
||||||
@@ -571,8 +593,9 @@
|
|||||||
"title": "📅 Piano Pasti Settimanale",
|
"title": "📅 Piano Pasti Settimanale",
|
||||||
"hint": "Imposta la tipologia di pasto per ogni giorno. Sarà usata come guida nella generazione delle ricette.",
|
"hint": "Imposta la tipologia di pasto per ogni giorno. Sarà usata come guida nella generazione delle ricette.",
|
||||||
"enabled": "✅ Attiva piano pasti settimanale",
|
"enabled": "✅ Attiva piano pasti settimanale",
|
||||||
"legend": "🌤️ = Pranzo · 🌙 = Cena · Tocca un badge per cambiarlo.",
|
"legend": "🌤️ = Pranzo · 🌙 = Cena · Tocca un badge per cambiarlo.",
|
||||||
"types_title": "📋 Tipologie disponibili"
|
"types_title": "📋 Tipologie disponibili",
|
||||||
|
"reset_btn": "↺ Ripristina default"
|
||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"title": "🔌 Elettrodomestici Disponibili",
|
"title": "🔌 Elettrodomestici Disponibili",
|
||||||
@@ -626,12 +649,24 @@
|
|||||||
"security": {
|
"security": {
|
||||||
"title": "🔒 Certificato HTTPS",
|
"title": "🔒 Certificato HTTPS",
|
||||||
"hint": "Se il browser mostra l'errore \"La connessione non è privata\" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.",
|
"hint": "Se il browser mostra l'errore \"La connessione non è privata\" (ERR_CERT_AUTHORITY_INVALID), devi installare il certificato CA nel dispositivo.",
|
||||||
"download_btn": "📥 Scarica Certificato CA"
|
"download_btn": "📥 Scarica Certificato CA",
|
||||||
|
"token_title": "🔑 Token Impostazioni",
|
||||||
|
"token_label": "Token di accesso",
|
||||||
|
"token_hint": "Se `SETTINGS_TOKEN` è configurato nel `.env` server, inserisci qui il token prima di salvare le impostazioni. Lascia vuoto se non configurato.",
|
||||||
|
"token_placeholder": "(vuoto = nessuna protezione)",
|
||||||
|
"token_required_hint": "🔒 Questo server richiede un token per salvare le impostazioni.",
|
||||||
|
"cert_instructions": "<strong>Istruzioni per Chrome (Android):</strong><br>1. Scarica il certificato qui sopra<br>2. Vai in <em>Impostazioni → Sicurezza e privacy → Altre impostazioni di sicurezza → Installa da archivio dispositivo</em><br>3. Seleziona il file <em>EverShelf_CA.crt</em> scaricato<br>4. Scegli \"CA\" e conferma<br>5. Riavvia Chrome<br><br><strong>Istruzioni per Chrome (PC):</strong><br>1. Scarica il certificato qui sopra<br>2. Vai in <em>chrome://settings/certificates</em> (o Impostazioni → Privacy e sicurezza → Sicurezza → Gestisci certificati)<br>3. Tab \"Autorità\" → Importa → seleziona il file<br>4. Spunta \"Considera attendibile per identificare siti web\"<br>5. Riavvia Chrome"
|
||||||
},
|
},
|
||||||
"tts": {
|
"tts": {
|
||||||
"title": "🔊 Voce & TTS",
|
"title": "🔊 Voce & TTS",
|
||||||
"hint": "Configura la sintesi vocale tramite qualsiasi API REST esterna. I passi della ricetta e i timer scaduti verranno inviati all'endpoint configurato.",
|
"hint": "Configura la sintesi vocale tramite qualsiasi API REST esterna. I passi della ricetta e i timer scaduti verranno inviati all'endpoint configurato.",
|
||||||
"enabled": "✅ Attiva TTS",
|
"enabled": "✅ Attiva TTS",
|
||||||
|
"engine_label": "⚙️ Motore TTS",
|
||||||
|
"engine_browser": "🔇 Browser (offline, nessuna configurazione)",
|
||||||
|
"engine_server": "🌐 Server esterno (Home Assistant, API REST...)",
|
||||||
|
"voice_label": "🗣️ Voce",
|
||||||
|
"rate_label": "⚡ Velocità",
|
||||||
|
"pitch_label": "🎵 Tono",
|
||||||
"url_label": "🌐 URL Endpoint",
|
"url_label": "🌐 URL Endpoint",
|
||||||
"method_label": "📡 Metodo HTTP",
|
"method_label": "📡 Metodo HTTP",
|
||||||
"auth_label": "🔐 Autenticazione",
|
"auth_label": "🔐 Autenticazione",
|
||||||
@@ -647,7 +682,14 @@
|
|||||||
"extra_fields_label": "➕ Campi extra (JSON)",
|
"extra_fields_label": "➕ Campi extra (JSON)",
|
||||||
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
"extra_fields_placeholder": "{\"entity_id\": \"media_player.living_room\"}",
|
||||||
"extra_fields_hint": "Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.",
|
"extra_fields_hint": "Campi aggiuntivi da includere nel payload, in formato JSON. Lascia vuoto se non necessario.",
|
||||||
"test_btn": "🔊 Invia Test Vocale"
|
"test_btn": "🔊 Invia Test Vocale",
|
||||||
|
"voices_loading": "Caricamento voci…",
|
||||||
|
"voice_not_supported": "Voce non supportata dal browser",
|
||||||
|
"voices_none": "Nessuna voce disponibile su questo dispositivo",
|
||||||
|
"voices_hint": "Le voci disponibili dipendono dal sistema operativo e dal browser. Su macOS/iOS è disponibile la voce Paola (italiano). Premi ↺ se la lista non si carica.",
|
||||||
|
"url_missing": "⚠️ URL endpoint mancante.",
|
||||||
|
"test_sending": "⏳ Invio in corso…",
|
||||||
|
"test_ok": "✅ Risposta {code} — controlla che l'altoparlante abbia parlato."
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"title": "🌐 Lingua / Language",
|
"title": "🌐 Lingua / Language",
|
||||||
@@ -658,7 +700,15 @@
|
|||||||
"screensaver": {
|
"screensaver": {
|
||||||
"label": "Attiva salvaschermo",
|
"label": "Attiva salvaschermo",
|
||||||
"card_title": "🌙 Salvaschermo",
|
"card_title": "🌙 Salvaschermo",
|
||||||
"card_hint": "Mostra un orologio con fatti utili dopo 5 minuti di inattività. Di default è disattivato."
|
"card_hint": "Mostra un orologio con fatti utili dopo 5 minuti di inattività. Di default è disattivato.",
|
||||||
|
"timeout_1": "1 minuto",
|
||||||
|
"timeout_2": "2 minuti",
|
||||||
|
"timeout_5": "5 minuti",
|
||||||
|
"timeout_10": "10 minuti",
|
||||||
|
"timeout_15": "15 minuti",
|
||||||
|
"timeout_30": "30 minuti",
|
||||||
|
"timeout_60": "1 ora",
|
||||||
|
"start_after": "⏱️ Avvia dopo"
|
||||||
},
|
},
|
||||||
"scale": {
|
"scale": {
|
||||||
"title": "⚖️ Bilancia Smart",
|
"title": "⚖️ Bilancia Smart",
|
||||||
@@ -671,12 +721,26 @@
|
|||||||
"test_btn": "🔗 Testa connessione",
|
"test_btn": "🔗 Testa connessione",
|
||||||
"download_btn": "📥 Scarica Gateway Android (APK)",
|
"download_btn": "📥 Scarica Gateway Android (APK)",
|
||||||
"download_hint": "App Android che fa da ponte tra la bilancia BLE e questo sito.",
|
"download_hint": "App Android che fa da ponte tra la bilancia BLE e questo sito.",
|
||||||
"download_sub": "Sorgente: evershelf-scale-gateway/ nella root del progetto"
|
"download_sub": "Sorgente: evershelf-scale-gateway/ nella root del progetto",
|
||||||
|
"live_weight": "peso in tempo reale",
|
||||||
|
"auto_reconnect": "🔁 Riconnessione: automatica",
|
||||||
|
"kiosk_title": "📡 Bilancia BLE integrata nel Kiosk",
|
||||||
|
"kiosk_hint": "La bilancia è gestita direttamente dal Gateway BLE interno al kiosk. Per abbinare un nuovo dispositivo usa il wizard di configurazione.",
|
||||||
|
"kiosk_reconfigure": "🔄 Riconfigura bilancia BLE",
|
||||||
|
"ble_protocols": "<p style=\"margin:0 0 6px;font-weight:600\">🔌 Protocolli BLE supportati:</p><ul style=\"margin:0 0 0 16px;padding:0;font-size:0.8rem\"><li>Bluetooth SIG Weight Scale (0x181D)</li><li>Bluetooth SIG Body Composition (0x181B) — peso, grasso, BMI</li><li>Xiaomi Mi Body Composition Scale 2</li><li>Generico — heuristica automatica su 100+ modelli</li></ul>"
|
||||||
},
|
},
|
||||||
"kiosk": {
|
"kiosk": {
|
||||||
"hint": "Trasforma un tablet Android in un pannello EverShelf sempre acceso, con bilancia BLE integrata.",
|
"hint": "Trasforma un tablet Android in un pannello EverShelf sempre acceso, con bilancia BLE integrata.",
|
||||||
"download_btn": "📥 Scarica EverShelf Kiosk (APK)",
|
"download_btn": "📥 Scarica EverShelf Kiosk (APK)",
|
||||||
"download_sub": "Modalità kiosk full-screen + gateway bilancia integrato. Sorgente: evershelf-kiosk/"
|
"download_sub": "Modalità kiosk full-screen + gateway bilancia integrato. Sorgente: evershelf-kiosk/",
|
||||||
|
"native_title": "Configurazione Kiosk",
|
||||||
|
"native_hint": "URL server, bilancia BLE, salvaschermo e setup wizard.",
|
||||||
|
"native_btn": "Apri configurazione kiosk",
|
||||||
|
"native_tap_hint": "Tocca la rotella in alto a destra",
|
||||||
|
"native_update_hint": "Aggiorna l'app kiosk per usare questa funzione",
|
||||||
|
"update_title": "Aggiornamento Kiosk",
|
||||||
|
"check_updates_btn": "🔍 Cerca aggiornamenti",
|
||||||
|
"needs_update": "⚠️ Il kiosk installato non supporta questa funzione. Aggiorna l'app kiosk per abilitarla."
|
||||||
},
|
},
|
||||||
"saved": "✅ Configurazione salvata!",
|
"saved": "✅ Configurazione salvata!",
|
||||||
"saved_local": "✅ Configurazione salvata localmente",
|
"saved_local": "✅ Configurazione salvata localmente",
|
||||||
@@ -717,7 +781,8 @@
|
|||||||
"opened_suffix": "— Aperto da troppo tempo!",
|
"opened_suffix": "— Aperto da troppo tempo!",
|
||||||
"opened_suffix_ok": "— Aperto (ancora ok)",
|
"opened_suffix_ok": "— Aperto (ancora ok)",
|
||||||
"opened_suffix_warning": "— Aperto (controlla)",
|
"opened_suffix_warning": "— Aperto (controlla)",
|
||||||
"days_compact": "{n}gg"
|
"days_compact": "{n}gg",
|
||||||
|
"badge_check_soon": "Controlla presto"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
@@ -809,7 +874,10 @@
|
|||||||
"select_items": "Seleziona almeno un prodotto",
|
"select_items": "Seleziona almeno un prodotto",
|
||||||
"server_offline": "Connessione al server persa",
|
"server_offline": "Connessione al server persa",
|
||||||
"server_restored": "Connessione al server ripristinata",
|
"server_restored": "Connessione al server ripristinata",
|
||||||
"server_retry": "Riprova"
|
"server_retry": "Riprova",
|
||||||
|
"unknown": "Errore sconosciuto",
|
||||||
|
"prefix": "Errore",
|
||||||
|
"no_inventory_entry": "Nessuna voce di inventario trovata"
|
||||||
},
|
},
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"remove_item": "Vuoi davvero rimuovere questo prodotto dall'inventario?",
|
"remove_item": "Vuoi davvero rimuovere questo prodotto dall'inventario?",
|
||||||
@@ -825,7 +893,9 @@
|
|||||||
"edit": {
|
"edit": {
|
||||||
"title": "Modifica {name}",
|
"title": "Modifica {name}",
|
||||||
"unknown_hint": "Inserisci il nome e le informazioni del prodotto",
|
"unknown_hint": "Inserisci il nome e le informazioni del prodotto",
|
||||||
"label_name": "🏷️ Nome prodotto"
|
"label_name": "🏷️ Nome prodotto",
|
||||||
|
"choose_location_title": "Quale modifica?",
|
||||||
|
"choose_location_hint": "Scegli la posizione da modificare:"
|
||||||
},
|
},
|
||||||
"screensaver": {
|
"screensaver": {
|
||||||
"recipe_btn": "Ricette",
|
"recipe_btn": "Ricette",
|
||||||
@@ -922,7 +992,8 @@
|
|||||||
"thing_rest": "il resto",
|
"thing_rest": "il resto",
|
||||||
"stay_btn": "No, resta in {location}",
|
"stay_btn": "No, resta in {location}",
|
||||||
"moved_toast": "📦 Confezione aperta spostata in {location}",
|
"moved_toast": "📦 Confezione aperta spostata in {location}",
|
||||||
"vacuum_restore": "🫙 Torna sotto vuoto"
|
"vacuum_restore": "🫙 Torna sotto vuoto",
|
||||||
|
"vacuum_seal_rest": "🔒 Metti sotto vuoto il resto"
|
||||||
},
|
},
|
||||||
"nova": {
|
"nova": {
|
||||||
"1": "Non trasformato",
|
"1": "Non trasformato",
|
||||||
@@ -1085,5 +1156,28 @@
|
|||||||
},
|
},
|
||||||
"appliances": {
|
"appliances": {
|
||||||
"empty": "Nessun elettrodomestico aggiunto"
|
"empty": "Nessun elettrodomestico aggiunto"
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"title": "Informazioni",
|
||||||
|
"version": "Versione",
|
||||||
|
"report_bug": "Segnala un problema",
|
||||||
|
"report_bug_hint": "Qualcosa non funziona? Inviaci una segnalazione direttamente dall'app.",
|
||||||
|
"report_bug_modal_title": "Segnala un problema",
|
||||||
|
"report_type_bug": "Bug",
|
||||||
|
"report_type_feature": "Funzionalità",
|
||||||
|
"report_type_question": "Domanda",
|
||||||
|
"report_field_title": "Titolo",
|
||||||
|
"report_field_title_ph": "Breve descrizione del problema",
|
||||||
|
"report_field_desc": "Descrizione",
|
||||||
|
"report_field_desc_ph": "Descrivi il problema in dettaglio…",
|
||||||
|
"report_field_steps": "Passi per riprodurlo (opzionale)",
|
||||||
|
"report_field_steps_ph": "1. Vai su…\n2. Tocca…\n3. Vedi l'errore…",
|
||||||
|
"report_auto_info": "Saranno allegati automaticamente: versione {version}, lingua {lang}.",
|
||||||
|
"report_send_btn": "Invia segnalazione",
|
||||||
|
"report_bug_sending": "Invio in corso…",
|
||||||
|
"report_bug_sent": "Segnalazione inviata — grazie!",
|
||||||
|
"report_bug_error": "Impossibile inviare la segnalazione. Controlla la connessione.",
|
||||||
|
"changelog": "Changelog",
|
||||||
|
"github": "Repository GitHub"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||