import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useLicense } from '../../contexts/LicenseContext'; import api from '../../services/api'; import './LicenseManager.css'; export default function LicenseManager() { const navigate = useNavigate(); const { status, refreshStatus } = useLicense(); const [blob, setBlob] = useState(''); const [message, setMessage] = useState(''); const [error, setError] = useState(''); const [saving, setSaving] = useState(false); const [copied, setCopied] = useState(''); const copy = (text, label) => { navigator.clipboard?.writeText(text).then( () => { setCopied(label); setTimeout(() => setCopied(''), 2000); }, () => setError('Could not copy - select and copy manually') ); }; const handleInstall = async () => { if (!blob.trim()) return; setSaving(true); setError(''); setMessage(''); try { await api.post('/api/license/', { key_blob: blob.trim() }); await refreshStatus(); setBlob(''); setMessage('Licence installed.'); } catch (err) { setError(err.response?.data?.detail || 'Could not install licence'); } finally { setSaving(false); } }; if (!status) { return (
{status.reason}
{status.in_grace ? (Everything keeps working for {status.grace_days_left} more days. After that only {1} station can measure. Send the fingerprint below to your supplier to get a licence key.
) : (The grace period has ended, so only {status.stations} station can measure. Send the fingerprint below to your supplier.
)}Send this to your supplier to obtain a licence key. It identifies this server only — the values are one-way hashes, not hardware serial numbers.
{status.fingerprint}
{componentsJson}
| Station | COM port | Bridge version | Last seen |
|---|---|---|---|
| {s.station_key} | {s.com_port || '—'} | {s.bridge_version || '—'} | {new Date(s.last_seen).toLocaleTimeString()} |