Fix DDNS registration and wizard pre-fill after installer run
Unit Tests / test (push) Successful in 15m29s

DDNS registration (setup_cell.py):
- Replace pyotp dependency with stdlib TOTP (HMAC-SHA1, RFC 6238)
  pyotp is only available inside the Docker container, not on the host
  where setup_cell.py runs — registration was silently skipped every time
- OTP header still sent if generation succeeds; omitted gracefully if not

Wizard pre-fill (setup_manager + Setup.jsx):
- GET /api/setup/status now returns 'preconfigured' dict with cell_name,
  domain_mode, domain_name, and provider tokens from installer-written config
- Setup.jsx fetches status on mount and pre-fills all form state so the
  user only needs to set password, services, and timezone — not re-enter
  the identity they already configured in the bash installer
- Fails silently so wizard still works on fresh installs with no config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 12:22:53 -04:00
parent 579f49ba13
commit f550f04ce2
4 changed files with 68 additions and 15 deletions
+20 -1
View File
@@ -1,4 +1,4 @@
import React, { useState, useMemo } from 'react';
import React, { useState, useMemo, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Eye, EyeOff, CheckCircle, AlertCircle, Globe } from 'lucide-react';
import { setupAPI } from '../services/api';
@@ -789,6 +789,25 @@ export default function Setup() {
const [submitting, setSubmitting] = useState(false);
const [submitError, setSubmitError] = useState('');
// Pre-fill from installer config if present
useEffect(() => {
setupAPI.getStatus()
.then(res => {
const pre = res.data?.preconfigured;
if (!pre) return;
if (pre.cell_name) setCellName(pre.cell_name);
if (pre.domain_mode) {
if (pre.domain_mode === 'pic_ngo') setDomainType('pic_ngo');
else if (pre.domain_mode === 'lan') setDomainType('lan');
else { setDomainType('custom'); setCustomMethod(pre.domain_mode); }
}
if (pre.domain_name) setCustomDomain(pre.domain_name);
if (pre.cloudflare_api_token) setCloudflareToken(pre.cloudflare_api_token);
if (pre.duckdns_token) setDuckdnsToken(pre.duckdns_token);
})
.catch(() => {}); // fail silently — wizard works from scratch
}, []);
const skipStep4 = domainType === 'lan';
const goNext = () => setStep(s => Math.min(s + 1, TOTAL_STEPS));