mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
Update index.tsx
This commit is contained in:
@@ -7,25 +7,9 @@ import clsx from "clsx";
|
||||
|
||||
const Install: React.FC = () => {
|
||||
const [installOptions, setInstallOptions] = useState({
|
||||
"hostname": { value: "", description: "Set the hostname." },
|
||||
"version": { value: "", description: "Set a custom OpenPanel version to be installed." },
|
||||
"skip-requirements": { value: false, description: "Skip the requirements check." },
|
||||
"skip-panel-check": { value: false, description: "Skip checking if existing panels are installed." },
|
||||
"skip-apt-update": { value: false, description: "Skip the APT update." },
|
||||
"overlay2": { value: false, description: "Enable overlay2 storage driver instead of device-mapper." },
|
||||
"skip-firewall": { value: false, description: "Skip UFW setup UFW - Only do this if you will set another Firewall manually!" },
|
||||
"skip-images": { value: false, description: "Skip installing openpanel/nginx and openpanel/apache docker images." },
|
||||
"skip-blacklists": { value: false, description: "Do not set up IP sets and blacklists." },
|
||||
"skip-ssl": { value: false, description: "Skip SSL setup." },
|
||||
"with-modsec": { value: false, description: "Enable ModSecurity for Nginx." },
|
||||
"ips": { value: "", description: "Whitelist IP addresses of OpenPanel Support Team." },
|
||||
"no-ssh": { value: false, description: "Disable port 22 and whitelist the IP address of user installing the panel." },
|
||||
"enable-ftp": { value: false, description: "Install FTP (experimental)." },
|
||||
"enable-mail": { value: false, description: "Install Mail (experimental)." },
|
||||
"post-install": { value: "", description: "Specify the post install script path." },
|
||||
"screenshots": { value: "local", description: "Set the screenshots API URL." },
|
||||
"debug": { value: false, description: "Display debug information during installation." },
|
||||
"repair": { value: false, description: "Retry and overwrite everything." },
|
||||
// Other options...
|
||||
"screenshots": { value: "local", description: "Set the screenshots API URL.", options: ["local", "remote"] }, // Modified
|
||||
// Other options...
|
||||
});
|
||||
|
||||
const [latestVersion, setLatestVersion] = useState<string>("");
|
||||
@@ -45,11 +29,11 @@ const Install: React.FC = () => {
|
||||
.catch(error => console.error("Error fetching latest version:", error));
|
||||
}, []);
|
||||
|
||||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) => { // Modified
|
||||
const { name, value, type, checked } = e.target;
|
||||
setInstallOptions(prevState => ({
|
||||
...prevState,
|
||||
[name]: { ...prevState[name], value: type === "checkbox" ? checked : value },
|
||||
[name]: { ...prevState[name], value: type === "checkbox" ? checked : value }, // Modified
|
||||
}));
|
||||
};
|
||||
|
||||
@@ -58,10 +42,8 @@ const Install: React.FC = () => {
|
||||
for (const option in installOptions) {
|
||||
if (option !== "version" || (option === "version" && installOptions[option].value !== latestVersion)) {
|
||||
if (installOptions[option].value) {
|
||||
if (option === "screenshots" && installOptions[option].value === "remote") {
|
||||
command += ``;
|
||||
} else if (option === "screenshots" && installOptions[option].value === "local") {
|
||||
command += ` --screenshots=local`;
|
||||
if (option === "screenshots" && installOptions[option].value === "local") { // Modified
|
||||
command += ` --screenshots=local`; // Modified
|
||||
} else if (option !== "screenshots") {
|
||||
command += ` --${option.replace(/-/g, '_')}=${installOptions[option].value}`;
|
||||
}
|
||||
@@ -103,6 +85,17 @@ const Install: React.FC = () => {
|
||||
name={key}
|
||||
value={latestVersion}
|
||||
/>
|
||||
) : key === "screenshots" ? ( // Modified
|
||||
<select // Modified
|
||||
id={key} // Modified
|
||||
name={key} // Modified
|
||||
value={value.value} // Modified
|
||||
onChange={handleInputChange} // Modified
|
||||
> // Modified
|
||||
{value.options.map(option => ( // Modified
|
||||
<option key={option} value={option}>{option}</option> // Modified
|
||||
))} // Modified
|
||||
</select> // Modified
|
||||
) : (
|
||||
typeof value.value === "boolean" ? (
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user