diff --git a/CHANGELOG.md b/CHANGELOG.md index 0519a1e..12eeeec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,22 @@ + # Changelog ## [1.5.4](https://github.com/perfect-panel/ppanel-web/compare/v1.5.3...v1.5.4) (2025-10-26) - ### 🐛 Bug Fixes -* Update generateRealityKeyPair to use async key generation ([e60e369](https://github.com/perfect-panel/ppanel-web/commit/e60e369)) -* Update the wallet localization file and add new fields such as automatic reset and recharge ([88aa965](https://github.com/perfect-panel/ppanel-web/commit/88aa965)) +- Update generateRealityKeyPair to use async key generation ([e60e369](https://github.com/perfect-panel/ppanel-web/commit/e60e369)) +- Update the wallet localization file and add new fields such as automatic reset and recharge ([88aa965](https://github.com/perfect-panel/ppanel-web/commit/88aa965)) ## [1.5.3](https://github.com/perfect-panel/ppanel-web/compare/v1.5.2...v1.5.3) (2025-10-21) - ### 🐛 Bug Fixes -* Fix bugs ([a46657d](https://github.com/perfect-panel/ppanel-web/commit/a46657d)) -* Fix dependencies ([8bd25d6](https://github.com/perfect-panel/ppanel-web/commit/8bd25d6)) -* Remove unnecessary migration function code and add device configuration options ([521a7a9](https://github.com/perfect-panel/ppanel-web/commit/521a7a9)) -* Update bun.lockb to reflect dependency changes ([ca892dd](https://github.com/perfect-panel/ppanel-web/commit/ca892dd)) +- Fix bugs ([a46657d](https://github.com/perfect-panel/ppanel-web/commit/a46657d)) +- Fix dependencies ([8bd25d6](https://github.com/perfect-panel/ppanel-web/commit/8bd25d6)) +- Remove unnecessary migration function code and add device configuration options ([521a7a9](https://github.com/perfect-panel/ppanel-web/commit/521a7a9)) +- Update bun.lockb to reflect dependency changes ([ca892dd](https://github.com/perfect-panel/ppanel-web/commit/ca892dd)) diff --git a/apps/admin/app/dashboard/servers/page.tsx b/apps/admin/app/dashboard/servers/page.tsx index bfd0b63..6a06bfd 100644 --- a/apps/admin/app/dashboard/servers/page.tsx +++ b/apps/admin/app/dashboard/servers/page.tsx @@ -21,6 +21,7 @@ import DynamicMultiplier from './dynamic-multiplier'; import OnlineUsersCell from './online-users-cell'; import ServerConfig from './server-config'; import ServerForm from './server-form'; +import ServerInstall from './server-install'; function PctBar({ value }: { value: number }) { const v = value.toFixed(2); @@ -224,6 +225,7 @@ export default function ServersPage() { } }} />, + , { + const { data } = await getNodeConfig(); + return data.data as API.NodeConfig | undefined; + }, + enabled: open, + }); + + useEffect(() => { + if (open) { + const host = localStorage.getItem('API_HOST') ?? window.location.origin; + setDomain(host); + } + }, [open]); + + const installCommand = useMemo(() => { + const secret = cfgResp?.node_secret ?? ''; + return `wget -N https://raw.githubusercontent.com/perfect-panel/ppanel-node/master/scripts/install.sh && bash install.sh --api-host ${domain} --server-id ${server.id} --secret-key ${secret}`; + }, [domain, server.id, cfgResp?.node_secret]); + + async function handleCopy() { + try { + if (navigator?.clipboard?.writeText) { + await navigator.clipboard.writeText(installCommand); + } else { + // fallback for environments without clipboard API + const el = document.createElement('textarea'); + el.value = installCommand; + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + } + toast.success(t('copied')); + setOpen(false); + } catch (error) { + toast.error(t('copyFailed')); + } + } + + const onDomainChange = useCallback((e: React.ChangeEvent) => { + setDomain(e.target.value); + localStorage.setItem('API_HOST', e.target.value); + }, []); + return ( + + + + + + + + {t('oneClickInstall')} + + +
+
+ +
+ +
+
+ +
+ +
+