2022-10-28 17:04:57 +08:00
|
|
|
import http from '@/api';
|
2022-11-10 17:44:38 +08:00
|
|
|
import { ReqPage, ResPage } from '../interface';
|
2022-12-13 17:20:13 +08:00
|
|
|
import { Website } from '../interface/Website';
|
2022-11-19 17:16:02 +08:00
|
|
|
import { File } from '../interface/file';
|
2022-10-28 17:04:57 +08:00
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const SearchWebsites = (req: Website.WebSiteSearch) => {
|
|
|
|
return http.post<ResPage<Website.Website>>(`/websites/search`, req);
|
2022-11-02 15:19:14 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateWebsite = (req: Website.WebSiteCreateReq) => {
|
2022-10-28 17:04:57 +08:00
|
|
|
return http.post<any>(`/websites`, req);
|
|
|
|
};
|
2022-11-02 15:19:14 +08:00
|
|
|
|
2022-12-26 16:09:21 +08:00
|
|
|
export const OpWebsite = (req: Website.WebSiteOp) => {
|
|
|
|
return http.post<any>(`/websites/operate`, req);
|
|
|
|
};
|
|
|
|
|
2022-12-23 11:08:28 +08:00
|
|
|
export const BackupWebsite = (req: Website.BackupReq) => {
|
|
|
|
return http.post(`/websites/backup`, req);
|
2022-11-29 17:39:10 +08:00
|
|
|
};
|
2022-12-13 17:20:13 +08:00
|
|
|
|
|
|
|
export const RecoverWebsite = (req: Website.WebSiteRecover) => {
|
2022-11-30 10:34:44 +08:00
|
|
|
return http.post(`/websites/recover`, req);
|
|
|
|
};
|
2022-12-13 17:20:13 +08:00
|
|
|
|
|
|
|
export const RecoverWebsiteByUpload = (req: Website.WebsiteRecoverByUpload) => {
|
2022-12-01 16:21:49 +08:00
|
|
|
return http.post(`/websites/recover/byupload`, req);
|
|
|
|
};
|
2022-11-29 17:39:10 +08:00
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateWebsite = (req: Website.WebSiteUpdateReq) => {
|
2022-11-08 17:21:13 +08:00
|
|
|
return http.post<any>(`/websites/update`, req);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const GetWebsite = (id: number) => {
|
2022-12-26 11:42:37 +08:00
|
|
|
return http.get<Website.WebsiteDTO>(`/websites/${id}`);
|
2022-11-08 17:21:13 +08:00
|
|
|
};
|
|
|
|
|
2022-11-30 15:47:11 +08:00
|
|
|
export const GetWebsiteOptions = () => {
|
|
|
|
return http.get<Array<string>>(`/websites/options`);
|
|
|
|
};
|
|
|
|
|
2022-11-19 17:16:02 +08:00
|
|
|
export const GetWebsiteNginx = (id: number) => {
|
|
|
|
return http.get<File.File>(`/websites/${id}/nginx`);
|
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const DeleteWebsite = (req: Website.WebSiteDel) => {
|
2022-11-02 15:19:14 +08:00
|
|
|
return http.post<any>(`/websites/del`, req);
|
|
|
|
};
|
2022-11-02 18:18:20 +08:00
|
|
|
|
|
|
|
export const ListGroups = () => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.get<Website.Group[]>(`/websites/groups`);
|
2022-11-02 18:18:20 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateGroup = (req: Website.GroupOp) => {
|
2022-11-02 18:18:20 +08:00
|
|
|
return http.post<any>(`/websites/groups`, req);
|
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateGroup = (req: Website.GroupOp) => {
|
2022-12-23 11:08:28 +08:00
|
|
|
return http.post<any>(`/websites/groups/update`, req);
|
2022-11-02 18:18:20 +08:00
|
|
|
};
|
|
|
|
|
2022-12-23 11:08:28 +08:00
|
|
|
export const DeleteGroup = (req: Website.DelReq) => {
|
|
|
|
return http.post<any>(`/websites/groups/del`, req);
|
2022-11-02 18:18:20 +08:00
|
|
|
};
|
2022-11-03 17:06:48 +08:00
|
|
|
|
|
|
|
export const ListDomains = (id: number) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.get<Website.Domain[]>(`/websites/domains/${id}`);
|
2022-11-03 17:06:48 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const DeleteDomain = (req: Website.DomainDelete) => {
|
|
|
|
return http.post<any>(`/websites/domains/del/`, req);
|
2022-11-03 17:06:48 +08:00
|
|
|
};
|
2022-11-03 18:02:07 +08:00
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateDomain = (req: Website.DomainCreate) => {
|
2022-11-03 18:02:07 +08:00
|
|
|
return http.post<any>(`/websites/domains`, req);
|
|
|
|
};
|
2022-11-07 16:19:05 +08:00
|
|
|
|
2022-12-13 18:54:46 +08:00
|
|
|
export const GetNginxConfig = (req: Website.NginxScopeReq) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.post<Website.NginxScopeConfig>(`/websites/config`, req);
|
2022-11-07 16:19:05 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateNginxConfig = (req: Website.NginxConfigReq) => {
|
2022-11-07 16:19:05 +08:00
|
|
|
return http.post<any>(`/websites/config/update`, req);
|
|
|
|
};
|
2022-11-10 17:44:38 +08:00
|
|
|
|
|
|
|
export const SearchDnsAccount = (req: ReqPage) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.post<ResPage<Website.DnsAccount>>(`/websites/dns/search`, req);
|
2022-11-10 17:44:38 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateDnsAccount = (req: Website.DnsAccountCreate) => {
|
2022-11-16 10:31:35 +08:00
|
|
|
return http.post<any>(`/websites/dns`, req);
|
2022-11-10 17:44:38 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateDnsAccount = (req: Website.DnsAccountUpdate) => {
|
2022-11-10 17:44:38 +08:00
|
|
|
return http.post<any>(`/websites/dns/update`, req);
|
|
|
|
};
|
|
|
|
|
2022-12-22 10:34:02 +08:00
|
|
|
export const DeleteDnsAccount = (req: Website.DelReq) => {
|
|
|
|
return http.post<any>(`/websites/dns/del`, req);
|
2022-11-10 17:44:38 +08:00
|
|
|
};
|
2022-11-11 17:41:39 +08:00
|
|
|
|
|
|
|
export const SearchAcmeAccount = (req: ReqPage) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.post<ResPage<Website.AcmeAccount>>(`/websites/acme/search`, req);
|
2022-11-11 17:41:39 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateAcmeAccount = (req: Website.AcmeAccountCreate) => {
|
|
|
|
return http.post<Website.AcmeAccount>(`/websites/acme`, req);
|
2022-11-11 17:41:39 +08:00
|
|
|
};
|
|
|
|
|
2022-12-22 10:30:32 +08:00
|
|
|
export const DeleteAcmeAccount = (req: Website.DelReq) => {
|
|
|
|
return http.post<any>(`/websites/acme/del`, req);
|
2022-11-11 17:41:39 +08:00
|
|
|
};
|
2022-11-16 10:31:35 +08:00
|
|
|
|
|
|
|
export const SearchSSL = (req: ReqPage) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.post<ResPage<Website.SSL>>(`/websites/ssl/search`, req);
|
2022-11-16 10:31:35 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const ListSSL = (req: Website.SSLReq) => {
|
|
|
|
return http.post<Website.SSL[]>(`/websites/ssl/search`, req);
|
2022-11-20 18:32:56 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const CreateSSL = (req: Website.SSLCreate) => {
|
|
|
|
return http.post<Website.SSLCreate>(`/websites/ssl`, req);
|
2022-11-16 10:31:35 +08:00
|
|
|
};
|
|
|
|
|
2022-12-23 11:08:28 +08:00
|
|
|
export const DeleteSSL = (req: Website.DelReq) => {
|
|
|
|
return http.post<any>(`/websites/ssl/del`, req);
|
2022-11-16 10:31:35 +08:00
|
|
|
};
|
|
|
|
|
2022-11-17 17:39:33 +08:00
|
|
|
export const GetWebsiteSSL = (websiteId: number) => {
|
2022-12-29 14:55:20 +08:00
|
|
|
return http.get<Website.SSL>(`/websites/ssl/website/${websiteId}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const GetSSL = (id: number) => {
|
|
|
|
return http.get<Website.SSL>(`/websites/ssl/${id}`);
|
2022-11-17 17:39:33 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const ApplySSL = (req: Website.SSLApply) => {
|
|
|
|
return http.post<Website.SSLApply>(`/websites/ssl/apply`, req);
|
2022-11-16 10:31:35 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const RenewSSL = (req: Website.SSLRenew) => {
|
2022-11-17 17:39:33 +08:00
|
|
|
return http.post<any>(`/websites/ssl/renew`, req);
|
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const GetDnsResolve = (req: Website.DNSResolveReq) => {
|
|
|
|
return http.post<Website.DNSResolve[]>(`/websites/ssl/resolve`, req);
|
2022-11-16 10:31:35 +08:00
|
|
|
};
|
2022-11-20 18:32:56 +08:00
|
|
|
|
|
|
|
export const GetHTTPSConfig = (id: number) => {
|
2022-12-13 17:20:13 +08:00
|
|
|
return http.get<Website.HTTPSConfig>(`/websites/${id}/https`);
|
2022-11-20 18:32:56 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateHTTPSConfig = (req: Website.HTTPSReq) => {
|
|
|
|
return http.post<Website.HTTPSConfig>(`/websites/${req.websiteId}/https`, req);
|
2022-11-20 18:32:56 +08:00
|
|
|
};
|
2022-12-04 17:45:54 +08:00
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const PreCheck = (req: Website.CheckReq) => {
|
|
|
|
return http.post<Website.CheckRes[]>(`/websites/check`, req);
|
2022-12-04 17:45:54 +08:00
|
|
|
};
|
2022-12-06 11:42:11 +08:00
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const GetWafConfig = (req: Website.WafReq) => {
|
|
|
|
return http.post<Website.WafRes>(`/websites/waf/config`, req);
|
2022-12-06 11:42:11 +08:00
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const UpdateWafEnable = (req: Website.WafUpdate) => {
|
2022-12-06 11:42:11 +08:00
|
|
|
return http.post<any>(`/websites/waf/update`, req);
|
|
|
|
};
|
2022-12-28 11:37:04 +08:00
|
|
|
|
|
|
|
export const UpdateNginxFile = (req: Website.NginxUpdate) => {
|
|
|
|
return http.post<any>(`/websites/nginx/update`, req);
|
|
|
|
};
|