From b7c5a19eca91277e2222d2b3a1a44d5e0a357f12 Mon Sep 17 00:00:00 2001 From: Niranjan Date: Tue, 7 Apr 2026 03:45:37 +0530 Subject: [PATCH] new changes --- YakPanel-server/frontend/src/api/client.ts | 5 ++- .../frontend/src/pages/SitePage.tsx | 31 +++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/YakPanel-server/frontend/src/api/client.ts b/YakPanel-server/frontend/src/api/client.ts index ba33bdea..2f1adef1 100644 --- a/YakPanel-server/frontend/src/api/client.ts +++ b/YakPanel-server/frontend/src/api/client.ts @@ -55,7 +55,10 @@ export async function getSite(siteId: number) { ) } -export async function updateSite(siteId: number, data: { path?: string; domains?: string[]; ps?: string }) { +export async function updateSite( + siteId: number, + data: { path?: string; domains?: string[]; ps?: string; php_version?: string; force_https?: boolean } +) { return apiRequest<{ status: boolean; msg: string }>(`/site/${siteId}`, { method: 'PUT', body: JSON.stringify(data), diff --git a/YakPanel-server/frontend/src/pages/SitePage.tsx b/YakPanel-server/frontend/src/pages/SitePage.tsx index acbaeda6..7f31310d 100644 --- a/YakPanel-server/frontend/src/pages/SitePage.tsx +++ b/YakPanel-server/frontend/src/pages/SitePage.tsx @@ -16,7 +16,7 @@ import { siteGitClone, siteGitPull, } from '../api/client' -import { Plus, Trash2, Download, Archive, RotateCcw, Pencil, Play, Square, Redirect, GitBranch } from 'lucide-react' +import { Plus, Trash2, Download, Archive, RotateCcw, Pencil, Play, Square, ArrowRightLeft, GitBranch } from 'lucide-react' interface Site { id: number @@ -209,6 +209,33 @@ export function SitePage() { .catch((err) => setError(err.message)) } + const handleGitClone = (e: React.FormEvent) => { + e.preventDefault() + if (!gitSiteId || !gitUrl.trim()) return + setGitLoading(true) + siteGitClone(gitSiteId, gitUrl.trim(), gitBranch.trim() || 'main') + .then(() => { + setGitSiteId(null) + setGitAction(null) + loadSites() + }) + .catch((err) => setError(err.message)) + .finally(() => setGitLoading(false)) + } + + const handleGitPull = () => { + if (!gitSiteId) return + setGitLoading(true) + siteGitPull(gitSiteId) + .then(() => { + setGitSiteId(null) + setGitAction(null) + loadSites() + }) + .catch((err) => setError(err.message)) + .finally(() => setGitLoading(false)) + } + const formatSize = (bytes: number) => { if (bytes < 1024) return bytes + ' B' if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB' @@ -386,7 +413,7 @@ export function SitePage() { className="p-2 text-purple-600 hover:bg-purple-50 dark:hover:bg-purple-900/20 rounded" title="Redirects" > - +