Add developer LAN mode detection and warning banner

Parse the MQTT "fun" field bit 0x20000000 to detect whether connected
printers have Developer LAN Mode enabled. Show a persistent orange
warning banner when any printer lacks it, since newer firmware silently
rejects MQTT write commands without developer mode.

- Parse fun field into developer_mode on PrinterState
- Add /printers/developer-mode-warnings lightweight polling endpoint
- Include developer_mode in printer status API and support bundle
- Orange banner with affected printer names and wiki link
- Translations for all 6 locales (en, de, fr, it, ja, pt-BR)
- 7 backend + 4 frontend tests
This commit is contained in:
maziggy
2026-02-21 12:06:16 +01:00
parent 055243683c
commit 0e87c377e6
17 changed files with 662 additions and 395 deletions
+28 -1
View File
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
import { NavLink, Outlet, useNavigate, useLocation } from 'react-router-dom';
import { Printer, Archive, Calendar, BarChart3, Cloud, Settings, Sun, Moon, ChevronLeft, ChevronRight, Keyboard, Github, GripVertical, ArrowUpCircle, Wrench, FolderKanban, FolderOpen, X, Menu, Info, Plug, Bug, LogOut, Key, Loader2, Disc3, type LucideIcon } from 'lucide-react';
import { Printer, Archive, Calendar, BarChart3, Cloud, Settings, Sun, Moon, ChevronLeft, ChevronRight, Keyboard, Github, GripVertical, ArrowUpCircle, Wrench, FolderKanban, FolderOpen, X, Menu, Info, Plug, Bug, LogOut, Key, Loader2, Disc3, ShieldAlert, type LucideIcon } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useTheme } from '../contexts/ThemeContext';
import { KeyboardShortcutsModal } from './KeyboardShortcutsModal';
@@ -149,6 +149,15 @@ export function Layout() {
refetchInterval: 60 * 1000, // Refresh every minute
});
// Check developer LAN mode warnings
const { data: devModeWarnings } = useQuery({
queryKey: ['developer-mode-warnings'],
queryFn: api.getDeveloperModeWarnings,
staleTime: 10 * 1000,
refetchInterval: 30 * 1000,
refetchOnWindowFocus: true,
});
// Fetch pending queue items count for badge
const { data: queueItems } = useQuery({
queryKey: ['queue', 'pending'],
@@ -807,6 +816,24 @@ export function Layout() {
</div>
</div>
)}
{devModeWarnings && devModeWarnings.length > 0 && (
<div className="bg-orange-500/20 border-b border-orange-500/30 px-4 py-2 flex items-center justify-between">
<div className="flex items-center gap-2 text-sm">
<ShieldAlert className="w-4 h-4 text-orange-500" />
<span className="text-orange-200">
{t('printers.developerModeWarning', {
names: devModeWarnings.map(w => w.name).join(', '),
defaultValue: `Developer LAN mode is not enabled on: ${devModeWarnings.map(w => w.name).join(', ')}. Some features may not work.`
})}
</span>
<a href="https://wiki.bambulab.com/en/knowledge-sharing/enable-developer-mode"
target="_blank" rel="noopener noreferrer"
className="text-orange-400 hover:text-orange-300 font-medium underline ml-2">
{t('printers.howToEnable', { defaultValue: 'How to enable' })}
</a>
</div>
</div>
)}
{/* Persistent update banner */}
{showUpdateBanner && (
<div className="bg-bambu-green/20 border-b border-bambu-green/30 px-4 py-2 flex items-center justify-between">