better-staridc-MNBT
1import { apiGn } from '@/shared/api/http'
2
3// ============ PHP 版本 ============
4/** 获取 PHP 版本列表 (gn=set_init, section=php) */
5export function getPhpList() {
6 return apiGn('set_init', { section: 'php' }, { silent: true })
7}
8/** 切换 PHP 版本 (gn=phpxg, php=版本号) */
9export function setPhpVersion(php) {
10 return apiGn('phpxg', { php })
11}
12
13// ============ 域名 ============
14/** 获取域名绑定列表 (gn=listurl) */
15export function getDomainList() {
16 return apiGn('listurl', {}, { silent: true })
17}
18/** 获取域名解析列表 (gn=hqzmlls) */
19export function getDomainDnsList() {
20 return apiGn('hqzmlls', {}, { silent: true })
21}
22
23// ============ 密码访问 ============
24/** 获取密码访问目录列表 (gn=pass_list) */
25export function getPassList() {
26 return apiGn('pass_list', {}, { silent: true })
27}
28/** 添加密码访问目录 (gn=tjmmfw, name, mbml, user, pass) */
29export function addPassDir(name, mbml, user, pass) {
30 return apiGn('tjmmfw', { name, mbml, user, pass })
31}
32/** 删除密码访问目录 (gn=scmmfw, mb=目录名) */
33export function delPassDir(mb) {
34 return apiGn('scmmfw', { mb })
35}
36
37// ============ 默认文档 ============
38/** 获取默认文档 (gn=set_init, section=mrwd) */
39export function getDefaultDoc() {
40 return apiGn('set_init', { section: 'mrwd' }, { silent: true })
41}
42/** 修改默认文档 (gn=xgmrwd, ml=文档内容) */
43export function setDefaultDoc(ml) {
44 return apiGn('xgmrwd', { ml })
45}
46
47// ============ 运行目录 ============
48/** 获取运行目录 (gn=set_init, section=yxml) */
49export function getRunDir() {
50 return apiGn('set_init', { section: 'yxml' }, { silent: true })
51}
52/** 设置运行目录 (gn=setyxml, wb=目录路径) */
53export function setRunDir(wb) {
54 return apiGn('setyxml', { wb })
55}
56
57// ============ 伪静态 ============
58/** 获取伪静态规则模板列表 (gn=set_init, section=wjt) */
59export function getRewriteTemplates() {
60 return apiGn('set_init', { section: 'wjt' }, { silent: true })
61}
62/** 获取伪静态规则内容 (gn=hqjt, xz=规则名; xz='0.当前' 读取当前站点规则) */
63export function getRewrite(xz = '0.当前') {
64 return apiGn('hqjt', { xz }, { silent: true })
65}
66/** 设置伪静态规则 (gn=setwjt, wb=规则内容) */
67export function setRewrite(wb) {
68 return apiGn('setwjt', { wb })
69}
70
71// ============ SSL ============
72/** 获取 SSL 配置 (gn=getssl) */
73export function getSsl() {
74 return apiGn('getssl', {}, { silent: true })
75}
76/** 设置 SSL 证书 (gn=setssl, key=密钥, pem=证书PEM) */
77export function setSsl(key, pem) {
78 return apiGn('setssl', { key, pem })
79}
80/** 关闭 SSL (gn=clossl) */
81export function closeSsl() {
82 return apiGn('clossl')
83}
84/** 申请/续签 Let's Encrypt SSL (gn=sqssl, list=域名数组, type=false申请/true续签) */
85export function applySsl(list, type = false) {
86 return apiGn('sqssl', { list, type: type ? 'true' : 'false' })
87}
88/** 强制 HTTPS (gn=httpsqz, qk=开关) */
89export function forceHttps(enabled) {
90 return apiGn('httpsqz', { qk: enabled ? 'true' : 'false' })
91}
92
93// ============ 防盗链 ============
94/** 获取防盗链配置 (gn=getfdl) */
95export function getHotlink() {
96 return apiGn('getfdl', {}, { silent: true })
97}
98/** 设置防盗链 (gn=fdlkg, fix=后缀, domains=域名, status=开关, return_rule, http_status) */
99export function setHotlink(fix, domains, status, return_rule = '', http_status = '') {
100 return apiGn('fdlkg', { fix, domains, status, return_rule, http_status })
101}
102
103// ============ Gzip ============
104/** 设置 Gzip (gn=setgzip) */
105export function setGzip() {
106 return apiGn('setgzip')
107}
108
109// ============ 缓存 ============
110/** 设置缓存规则 (gn=cache, suffix=后缀, time_out=缓存时间) */
111export function setCache(suffix, time_out) {
112 return apiGn('cache', { suffix, time_out })
113}
114
115// ============ 修改密码 ============
116/** 修改 FTP/SQL 密码 (gn=xgpass, ftp=FTP密码, sql=SQL密码) */
117export function changePassword(ftp = '', sql = '') {
118 return apiGn('xgpass', { ftp, sql })
119}
120
121// ============ SQL 权限 ============
122/** 设置数据库权限 (gn=databaseaq1) */
123export function setSqlAuth() {
124 return apiGn('databaseaq1')
125}
126
127// ============ 邮箱绑定 ============
128/** 绑定邮箱 (gn=mailbd, mail=邮箱地址) */
129export function bindEmail(mail) {
130 return apiGn('mailbd', { mail })
131}