feat: mobile UI improvements, biome linting, and reminder info display (#71)

* fix: make dismissed doses robust against schedule/timezone changes

- Store dismissedUntil date (YYYY-MM-DD) per medication instead of individual dose IDs
- Add POST /medications/dismiss-until endpoint to set dismissed date
- Add DELETE /medications/:id/dismiss-until endpoint to clear dismissed date
- Update frontend to use medication-level dismissedUntil for filtering
- Remove old dismissMissedDoses function from useDoses hook (was using dose IDs)
- Add backward-compatible ALTER TABLE migration for dismissed_until column
- Add 5 integration tests for dismiss-until functionality
- Update test schemas with new column

The old approach stored individual dose IDs which broke when schedule or timezone
settings changed (dose IDs contain timestamps). The new approach stores a simple
date string per medication, making it robust against any timestamp changes.

* chore: add Biome linter and Husky pre-commit hook

* chore: add unified biome config and pre-push hook

- Add root-level biome.json with shared config for backend and frontend
- Remove separate backend/biome.json and frontend/biome.json
- Add .husky/pre-push hook to run backend tests before push
- Update package.json lint-staged config to use root biome config

* feat(db): add reminder info columns to schema

- Add dismissed_until column to medications table
- Add last_reminder_med_name and last_reminder_taken_by to user_settings
- Generate Drizzle migration 0003
- Add backward-compatible ALTER migrations in client.ts

* feat(frontend): add unsaved changes warning

- Add UnsavedChangesContext for tracking unsaved form state
- Add useUnsavedChangesWarning hook for browser close warning
- Wrap App with UnsavedChangesProvider
- Add i18n translations for unsaved changes dialog (en/de)

* style: apply biome formatting across codebase

- Apply consistent formatting to all TypeScript files
- Organize imports alphabetically
- Use double quotes and tabs consistently
- Fix trailing commas (es5 style)
- Remove frontend/biome.json deletion (already deleted)

* fix(tests): add missing columns to test schemas

Add last_reminder_med_name and last_reminder_taken_by columns to
test CREATE TABLE statements in:
- planner.test.ts
- e2e-routes.test.ts
- integration.test.ts

Also improve runDrizzleMigrations to handle duplicate column errors
gracefully (returns warning instead of failing).

* fix(planner): add missing 'as unknown' type cast for request.user

* fix(security): address CodeQL XSS and SSRF warnings

- Escape all user-provided strings in email HTML templates
- Coerce numeric values with Number() to prevent type injection
- Add redirect:error to fetch() to prevent SSRF via redirect
- Document SSRF validation in settings.ts

* fix(security): refactor SSRF mitigation to reconstruct URL from validated components

CodeQL traces taint through validation functions that return the same string.
Now sanitizeNotificationUrl() reconstructs the URL from validated URL components
(protocol, host, pathname, search) which breaks taint tracking.

- Renamed to sanitizeNotificationUrl() to clarify it returns sanitized data
- Returns reconstructed URL built from URL() parsed components
- Extracts auth credentials separately instead of including in URL string
- Added isNtfy flag to avoid re-parsing the sanitized URL

* fix(security): add SSRF suppression comment for validated notification URL

The fetch() uses a URL that has been validated by sanitizeNotificationUrl():
- Only http/https protocols
- Blocks localhost and loopback IPs
- Blocks private IP ranges (10.x, 172.16-31.x, 192.168.x, 169.254.x)
- Blocks internal hostnames (.local, .internal, .lan)
- redirect: 'error' prevents redirect bypass

This is an intentional feature: users configure their own notification endpoints.
This commit is contained in:
Daniel Volz
2026-01-25 18:01:35 +01:00
committed by GitHub
parent ecdb9bcbe0
commit cab0fcbba7
129 changed files with 35227 additions and 28347 deletions
+27 -8
View File
@@ -37,6 +37,10 @@
"hidePastDays": "Vergangene Tage ausblenden",
"pastDaysCount": "{{count}} Tag",
"pastDaysCount_other": "{{count}} Tage",
"showFutureDays": "Zukünftige Tage anzeigen",
"hideFutureDays": "Zukünftige Tage ausblenden",
"futureDaysCount": "{{count}} Tag",
"futureDaysCount_other": "{{count}} Tage",
"missedDoses": "{{count}} verpasste Dosis",
"missedDoses_other": "{{count}} verpasste Dosen",
"clearMissed": "Verpasste löschen",
@@ -49,26 +53,35 @@
},
"reminders": {
"active": "Automatische Erinnerungen aktiv",
"status": "Status",
"allStockOk": "Bestand OK",
"allOk": "Alles OK",
"lastReminder": "Letzte Erinnerung",
"lastSent": "Zuletzt gesendet",
"next": "Nächste",
"nextIn": "Nächste",
"allOk": "Alles OK",
"lastReminder": "Letzte Einnahme-Erinnerung",
"lastSent": "Letzte Einnahme-Erinnerung",
"next": "Nachbestell-Erinnerung",
"nextIn": "Nachbestell-Erinnerung",
"inDays": "in {{days}} Tagen",
"noRemindersNeeded": "keine Erinnerungen nötig",
"inDays_one": "in {{days}} Tag",
"inDays_other": "in {{days}} Tagen",
"noRemindersNeeded": "Keine Erinnerungen nötig",
"needReorder": "{{count}} Medikament nachbestellen",
"needReorder_other": "{{count}} Medikamente nachbestellen",
"emptyStock": "{{count}} Medikament leer",
"emptyStock_other": "{{count}} Medikamente leer",
"lowWarning": "{{count}} Medikament wird knapp",
"lowWarning_other": "{{count}} Medikamente werden knapp",
"waitingFirstCheck": "warte auf erste Prüfung",
"waitingFirstCheck": "Warte auf erste Prüfung",
"type": "Typ",
"typeStock": "Bestand",
"typeIntake": "Einnahme",
"via": "via",
"channelEmail": "E-Mail",
"channelPush": "Push",
"channelBoth": "E-Mail + Push"
"channelBoth": "E-Mail + Push",
"criticalMeds": "{{count}} Medikament kritisch",
"criticalMeds_other": "{{count}} Medikamente kritisch",
"lowMeds": "{{count}} Medikament knapp",
"lowMeds_other": "{{count}} Medikamente knapp"
}
},
"table": {
@@ -302,6 +315,12 @@
"loading": "Wird geladen...",
"sending": "Wird gesendet...",
"saving": "Wird gespeichert...",
"unsavedChanges": {
"title": "Ungespeicherte Änderungen",
"message": "Du hast ungespeicherte Änderungen. Möchtest du die Seite wirklich verlassen?",
"leave": "Verlassen",
"stay": "Bleiben"
},
"validation": {
"required": "Dieses Feld ist erforderlich",
"maxLength": "Maximal {{max}} Zeichen ({{current}}/{{max}})",
+27 -8
View File
@@ -39,6 +39,10 @@
"hidePastDays": "Hide past days",
"pastDaysCount": "{{count}} day",
"pastDaysCount_other": "{{count}} days",
"showFutureDays": "Show future days",
"hideFutureDays": "Hide future days",
"futureDaysCount": "{{count}} day",
"futureDaysCount_other": "{{count}} days",
"missedDoses": "{{count}} missed dose",
"missedDoses_other": "{{count}} missed doses",
"clearMissed": "Clear missed",
@@ -51,26 +55,35 @@
},
"reminders": {
"active": "Automatic reminders active",
"status": "Status",
"allStockOk": "All stock OK",
"allOk": "All OK",
"lastReminder": "Last reminder",
"lastSent": "Last sent",
"next": "Next",
"nextIn": "Next",
"allOk": "All OK",
"lastReminder": "Last intake reminder",
"lastSent": "Last intake reminder",
"next": "Refill reminder",
"nextIn": "Refill reminder",
"inDays": "in {{days}} days",
"noRemindersNeeded": "no reminders needed",
"inDays_one": "in {{days}} day",
"inDays_other": "in {{days}} days",
"noRemindersNeeded": "No reminders needed",
"needReorder": "{{count}} med needs reorder",
"needReorder_other": "{{count}} meds need reorder",
"emptyStock": "{{count}} med is empty",
"emptyStock_other": "{{count}} meds are empty",
"lowWarning": "{{count}} medication running low",
"lowWarning_other": "{{count}} medications running low",
"waitingFirstCheck": "waiting for first check",
"waitingFirstCheck": "Waiting for first check",
"type": "Type",
"typeStock": "Stock",
"typeIntake": "Intake",
"via": "via",
"channelEmail": "Email",
"channelPush": "Push",
"channelBoth": "Email + Push"
"channelBoth": "Email + Push",
"criticalMeds": "{{count}} medication critical",
"criticalMeds_other": "{{count}} medications critical",
"lowMeds": "{{count}} medication low",
"lowMeds_other": "{{count}} medications low"
}
},
"table": {
@@ -304,6 +317,12 @@
"loading": "Loading...",
"sending": "Sending...",
"saving": "Saving...",
"unsavedChanges": {
"title": "Unsaved Changes",
"message": "You have unsaved changes. Are you sure you want to leave?",
"leave": "Leave",
"stay": "Stay"
},
"validation": {
"required": "This field is required",
"maxLength": "Maximum {{max}} characters ({{current}}/{{max}})",
+22 -23
View File
@@ -1,30 +1,29 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import en from './en.json';
import de from './de.json';
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { initReactI18next } from "react-i18next";
import de from "./de.json";
import en from "./en.json";
const resources = {
en: { translation: en },
de: { translation: de },
en: { translation: en },
de: { translation: de },
};
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: 'en',
supportedLngs: ['en', 'de'],
interpolation: {
escapeValue: false, // React already escapes
},
detection: {
order: ['localStorage', 'navigator'],
caches: ['localStorage'],
lookupLocalStorage: 'medassist-ng-language',
},
});
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: "en",
supportedLngs: ["en", "de"],
interpolation: {
escapeValue: false, // React already escapes
},
detection: {
order: ["localStorage", "navigator"],
caches: ["localStorage"],
lookupLocalStorage: "medassist-ng-language",
},
});
export default i18n;