feat: implement certificate upload and deletion functionality, enhance certificate management in the API and frontend

This commit is contained in:
Wikid82
2025-11-22 23:05:23 -05:00
parent 155bedcf66
commit ce89c63afc
14 changed files with 618 additions and 66 deletions

View File

@@ -1,13 +1,34 @@
import client from './client'
export interface Certificate {
id?: number
name?: string
domain: string
issuer: string
expires_at: string
status: 'valid' | 'expiring' | 'expired'
provider: string
}
export async function getCertificates(): Promise<Certificate[]> {
const response = await client.get<Certificate[]>('/certificates')
return response.data
}
export async function uploadCertificate(name: string, certFile: File, keyFile: File): Promise<Certificate> {
const formData = new FormData()
formData.append('name', name)
formData.append('certificate_file', certFile)
formData.append('key_file', keyFile)
const response = await client.post<Certificate>('/certificates', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
return response.data
}
export async function deleteCertificate(id: number): Promise<void> {
await client.delete(`/certificates/${id}`)
}

View File

@@ -23,6 +23,7 @@ export interface ProxyHost {
locations: Location[];
advanced_config?: string;
enabled: boolean;
certificate_id?: number | null;
created_at: string;
updated_at: string;
}