import { Alert, AlertTitle, Box, Button, Collapse, IconButton, Snackbar, useMediaQuery, useTheme } from '@mui/material';
import { Close, ContentCopy } from '@mui/icons-material';
import { useState } from 'react';
const INSTALL_COMMAND = 'bash <(curl -fsSL https://raw.githubusercontent.com/denpiligrim/3dp-manager/main/install.sh)';
export default function SecurityWarning() {
const [copied, setCopied] = useState(false);
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(INSTALL_COMMAND);
setCopied(true);
} catch {
// Fallback для старых браузеров
const textArea = document.createElement('textarea');
textArea.value = INSTALL_COMMAND;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
setCopied(true);
}
};
return (
<>
3DP-MANAGER работает в небезопасном режиме (HTTP)
Не вводите реальные пароли от 3x-ui панели и не меняйте пароль администратора в режиме работы по HTTP!{' '}
Для безопасной работы переустановите 3DP-MANAGER с SSL-сертификатами. Все ваши настройки сохранятся.
{INSTALL_COMMAND}
}
onClick={handleCopy}
sx={{
color: 'inherit',
borderColor: 'currentColor',
whiteSpace: 'nowrap',
flexShrink: 0,
'&:hover': {
backgroundColor: 'rgba(255, 255, 255, 0.2)',
},
minWidth: { xs: 'auto', sm: '140px' },
px: { xs: 1, sm: 2 },
}}
>
{isMobile ? : 'Копировать'}
setCopied(false)}
message="Скопировано"
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
action={
setCopied(false)}>
}
/>
>
);
}