import React from "react"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Copy, Download } from "lucide-react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { copyToClipboard } from "@/utils/copyUtils"; interface OneClickInstallTabProps { serverToken: string; currentPocketBaseUrl: string; formData: { serverName: string; osType: string; checkInterval: string; retryAttempt: string; }; serverId: string; onDialogClose: () => void; } export const OneClickInstallTab: React.FC = ({ serverToken, currentPocketBaseUrl, formData, serverId, onDialogClose, }) => { const getOneClickInstallCommand = () => { const scriptUrl = "https://raw.githubusercontent.com/operacle/checkcle/refs/heads/main/scripts/server-agent.sh"; return `curl -L -o server-agent.sh "${scriptUrl}" chmod +x server-agent.sh SERVER_TOKEN="${serverToken}" \\ POCKETBASE_URL="${currentPocketBaseUrl}" \\ SERVER_NAME="${formData.serverName}" \\ AGENT_ID="${serverId}" \\ OS_TYPE="${formData.osType}" \\ CHECK_INTERVAL="${formData.checkInterval}" \\ RETRY_ATTEMPTS="${formData.retryAttempt}" \\ sudo -E bash ./server-agent.sh`; }; const handleCopyCommand = async (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); console.log('Copy button clicked'); // Debug log const command = getOneClickInstallCommand(); console.log('Copying command:', command); // Debug log await copyToClipboard(command); }; return ( One-Click Install Copy and paste this single command to install the monitoring agent instantly
              {getOneClickInstallCommand()}
            

Simply run this command on your server:

  1. SSH into your target server
  2. Paste and run the command above
  3. The agent will be installed and started automatically
); };