new changes

This commit is contained in:
Niranjan
2026-04-07 03:45:37 +05:30
parent 03e73a2c4c
commit b7c5a19eca
2 changed files with 33 additions and 3 deletions

View File

@@ -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),

View File

@@ -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<HTMLFormElement>) => {
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"
>
<Redirect className="w-4 h-4" />
<ArrowRightLeft className="w-4 h-4" />
</button>
<button
onClick={() => openEditModal(s.id)}