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) => {
|
2023-03-09 17:50:47 +08:00
|
|
|
return http.post<ResPage<Website.WebsiteDTO>>(`/websites/search`, req);
|
2022-11-02 15:19:14 +08:00
|
|
|
};
|
|
|
|
|
2023-01-03 16:56:36 +08:00
|
|
|
export const ListWebsites = () => {
|
|
|
|
return http.get<Website.WebsiteDTO>(`/websites/list`);
|
|
|
|
};
|
|
|
|
|
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-30 17:39:17 +08:00
|
|
|
export const OpWebsiteLog = (req: Website.WebSiteOpLog) => {
|
|
|
|
return http.post<Website.WebSiteLog>(`/websites/log`, req);
|
|
|
|
};
|
|
|
|
|
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`);
|
|
|
|
};
|
|
|
|
|
2023-04-04 18:54:04 +08:00
|
|
|
export const GetWebsiteConfig = (id: number, type: string) => {
|
|
|
|
return http.get<File.File>(`/websites/${id}/config/${type}`);
|
2022-11-19 17:16:02 +08:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
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) => {
|
2023-04-12 23:00:30 +08:00
|
|
|
return http.post<Website.SSLCreate>(`/websites/ssl`, req, 60000);
|
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);
|
|
|
|
};
|
|
|
|
|
2023-03-21 14:42:50 +08:00
|
|
|
export const UpdateSSL = (req: Website.SSLUpdate) => {
|
|
|
|
return http.post<any>(`/websites/ssl/update`, req);
|
|
|
|
};
|
|
|
|
|
2022-12-13 17:20:13 +08:00
|
|
|
export const GetDnsResolve = (req: Website.DNSResolveReq) => {
|
2023-04-12 23:00:30 +08:00
|
|
|
return http.post<Website.DNSResolve[]>(`/websites/ssl/resolve`, req, 60000);
|
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);
|
|
|
|
};
|
2023-01-03 16:56:36 +08:00
|
|
|
|
|
|
|
export const ChangeDefaultServer = (req: Website.DefaultServerUpdate) => {
|
|
|
|
return http.post<any>(`/websites/default/server`, req);
|
|
|
|
};
|
2023-04-06 00:09:58 +08:00
|
|
|
|
|
|
|
export const GetPHPConfig = (id: number) => {
|
|
|
|
return http.get<Website.PHPConfig>(`/websites/php/config/${id}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const UpdatePHPConfig = (req: Website.PHPConfigUpdate) => {
|
|
|
|
return http.post<any>(`/websites/php/config/`, req);
|
|
|
|
};
|
2023-04-12 14:48:30 +08:00
|
|
|
|
|
|
|
export const UpdatePHPFile = (req: Website.PHPUpdate) => {
|
|
|
|
return http.post<any>(`/websites/php/update`, req);
|
|
|
|
};
|
2023-04-14 16:01:06 +08:00
|
|
|
|
|
|
|
export const GetRewriteConfig = (req: Website.RewriteReq) => {
|
|
|
|
return http.post<Website.RewriteRes>(`/websites/rewrite`, req);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const UpdateRewriteConfig = (req: Website.RewriteUpdate) => {
|
|
|
|
return http.post<any>(`/websites/rewrite/update`, req);
|
|
|
|
};
|
2023-04-17 16:54:34 +08:00
|
|
|
|
|
|
|
export const UpdateWebsiteDir = (req: Website.DirUpdate) => {
|
|
|
|
return http.post<any>(`/websites/dir/update`, req);
|
|
|
|
};
|
2023-04-18 18:46:58 +08:00
|
|
|
|
|
|
|
export const UpdateWebsiteDirPermission = (req: Website.DirPermissionUpdate) => {
|
|
|
|
return http.post<any>(`/websites/dir/permission`, req);
|
|
|
|
};
|