mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
dev day #89
This commit is contained in:
@@ -155,6 +155,14 @@ const SettingsAdminPage: React.FC = () => {
|
||||
setSettings((prev) => ({ ...prev, [key]: e.target.value }));
|
||||
};
|
||||
|
||||
const presetStorageThresholds = () => {
|
||||
setSettings((prev) => ({
|
||||
...prev,
|
||||
storage_warn_threshold: 80 as any,
|
||||
storage_critical_threshold: 95 as any,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
setSaving(true);
|
||||
try {
|
||||
@@ -167,7 +175,6 @@ const SettingsAdminPage: React.FC = () => {
|
||||
youtube_url: (settings as any).youtube_url,
|
||||
// generic gallery (preferred)
|
||||
gallery_url: (settings as any).gallery_url,
|
||||
gallery_label: (settings as any).gallery_label,
|
||||
// backward compatibility
|
||||
zonerama_url: (settings as any).zonerama_url,
|
||||
// SMTP
|
||||
@@ -203,6 +210,9 @@ const SettingsAdminPage: React.FC = () => {
|
||||
finished_match_display_days: (settings as any).finished_match_display_days as any,
|
||||
storage_warn_threshold: (settings as any).storage_warn_threshold as any,
|
||||
storage_critical_threshold: (settings as any).storage_critical_threshold as any,
|
||||
// error-review integration (domain managed via .env; only tokens are saved)
|
||||
error_review_admin_token: (settings as any).error_review_admin_token,
|
||||
error_review_ingest_token: (settings as any).error_review_ingest_token,
|
||||
};
|
||||
const saved = await updateAdminSettings(payload);
|
||||
setSettings((prev) => ({ ...prev, ...saved }));
|
||||
@@ -224,6 +234,11 @@ const SettingsAdminPage: React.FC = () => {
|
||||
try { (api as any).defaults.baseURL = ab; } catch {}
|
||||
setTimeout(() => { try { window.location.reload(); } catch {} }, 600);
|
||||
}
|
||||
// Persist ingest token for frontend errorReporter (URL is fixed by default wiring)
|
||||
try {
|
||||
const ingestToken = (saved as any).error_review_ingest_token || (settings as any).error_review_ingest_token;
|
||||
if (ingestToken) localStorage.setItem('fc_error_ingest_token', String(ingestToken));
|
||||
} catch {}
|
||||
} catch {}
|
||||
} catch (e: any) {
|
||||
toast({ title: 'Chyba', description: e?.message || 'Uložení nastavení se nezdařilo', status: 'error' });
|
||||
@@ -301,6 +316,10 @@ const SettingsAdminPage: React.FC = () => {
|
||||
onChange={handleNumChange('storage_critical_threshold' as any)}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>Přednastavit</FormLabel>
|
||||
<Button onClick={presetStorageThresholds} variant="outline">80 % / 95 %</Button>
|
||||
</FormControl>
|
||||
</SimpleGrid>
|
||||
<FormControl>
|
||||
<FormLabel>Logo klubu</FormLabel>
|
||||
@@ -369,10 +388,6 @@ const SettingsAdminPage: React.FC = () => {
|
||||
<FormLabel>Fotogalerie URL</FormLabel>
|
||||
<Input value={(settings as any).gallery_url || ''} onChange={handleChange('gallery_url')} />
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>Popisek fotogalerie</FormLabel>
|
||||
<Input value={(settings as any).gallery_label || ''} onChange={handleChange('gallery_label')} />
|
||||
</FormControl>
|
||||
|
||||
<HStack>
|
||||
<Button onClick={handleSave} isLoading={saving} bg="brand.primary" color="text.onPrimary" _hover={{ filter: 'brightness(0.95)' }}>Uložit nastavení</Button>
|
||||
@@ -435,27 +450,71 @@ const SettingsAdminPage: React.FC = () => {
|
||||
<SimpleGrid columns={{ base: 1, md: 2 }} spacing={4}>
|
||||
<FormControl>
|
||||
<FormLabel>SMTP Host</FormLabel>
|
||||
<Input value={(settings as any).smtp_host || ''} onChange={handleChange('smtp_host' as any)} />
|
||||
<Input
|
||||
value={(settings as any).smtp_host || ''}
|
||||
onChange={handleChange('smtp_host' as any)}
|
||||
placeholder="smtp.seznam.cz nebo smtp.gmail.com"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Adresa SMTP serveru. Příklad: smtp.seznam.cz, smtp.gmail.com, smtp.office365.com
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>SMTP Port</FormLabel>
|
||||
<Input type="number" value={(settings as any).smtp_port ?? ''} onChange={handleNumChange('smtp_port' as any)} />
|
||||
<Input
|
||||
type="number"
|
||||
value={(settings as any).smtp_port ?? ''}
|
||||
onChange={handleNumChange('smtp_port' as any)}
|
||||
placeholder="587 pro TLS, 465 pro SSL, 25 bez šifrování"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Nejčastěji 587 (TLS/STARTTLS) nebo 465 (SSL). Port 25 je bez šifrování a často blokovaný.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>SMTP Uživatel</FormLabel>
|
||||
<Input value={(settings as any).smtp_user || ''} onChange={handleChange('smtp_user' as any)} />
|
||||
<Input
|
||||
value={(settings as any).smtp_user || ''}
|
||||
onChange={handleChange('smtp_user' as any)}
|
||||
placeholder="většinou celá e‑mailová adresa"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Přihlašovací jméno k SMTP (obvykle e‑mailová adresa). Nechte prázdné, pokud server nevyžaduje přihlášení.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>SMTP Heslo</FormLabel>
|
||||
<Input type="password" value={(settings as any).smtp_password || ''} onChange={handleChange('smtp_password' as any)} />
|
||||
<Input
|
||||
type="password"
|
||||
value={(settings as any).smtp_password || ''}
|
||||
onChange={handleChange('smtp_password' as any)}
|
||||
placeholder="heslo nebo aplikační heslo"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Heslo k účtu nebo aplikační heslo (Gmail/Seznam/Office 365 často vyžadují). Vkládejte bez mezer.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>From e‑mail</FormLabel>
|
||||
<Input value={(settings as any).smtp_from || ''} onChange={handleChange('smtp_from' as any)} />
|
||||
<Input
|
||||
value={(settings as any).smtp_from || ''}
|
||||
onChange={handleChange('smtp_from' as any)}
|
||||
placeholder="noreply@vasklub.cz"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Adresa odesílatele uvedená v e‑mailech. Ideálně existující schránka na vašem SMTP serveru.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>From jméno</FormLabel>
|
||||
<Input value={(settings as any).smtp_from_name || ''} onChange={handleChange('smtp_from_name' as any)} />
|
||||
<Input
|
||||
value={(settings as any).smtp_from_name || ''}
|
||||
onChange={handleChange('smtp_from_name' as any)}
|
||||
placeholder="FK Váš Klub"
|
||||
/>
|
||||
<FormHelperText>
|
||||
Zobrazované jméno odesílatele (např. FK Váš Klub).
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>Šifrování</FormLabel>
|
||||
@@ -464,6 +523,9 @@ const SettingsAdminPage: React.FC = () => {
|
||||
<option value="ssl">SSL</option>
|
||||
<option value="tls">TLS</option>
|
||||
</Select>
|
||||
<FormHelperText>
|
||||
SSL = implicitní šifrování (obvykle port 465). TLS/STARTTLS = šifrování po navázání spojení (obvykle port 587).
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<FormLabel>Autentizace</FormLabel>
|
||||
@@ -472,11 +534,17 @@ const SettingsAdminPage: React.FC = () => {
|
||||
<option value="login">LOGIN</option>
|
||||
<option value="cram-md5">CRAM‑MD5</option>
|
||||
</Select>
|
||||
<FormHelperText>
|
||||
Mechanismus přihlášení k SMTP. Pokud si nejste jisti, zvolte PLAIN nebo LOGIN. Někteří poskytovatelé vyžadují konkrétní metodu.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</SimpleGrid>
|
||||
<FormControl display="flex" alignItems="center">
|
||||
<FormLabel mb={0}>Přeskočit ověření certifikátu</FormLabel>
|
||||
<Switch isChecked={!!(settings as any).smtp_skip_verify} onChange={handleBoolChange('smtp_skip_verify' as any)} />
|
||||
<FormHelperText ml={{ base: 0, md: 4 }}>
|
||||
Pokročilé: povolte pouze při chybách certifikátu (self‑signed apod.). Nedoporučeno v produkci – snižuje bezpečnost.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
|
||||
<Divider />
|
||||
|
||||
Reference in New Issue
Block a user