feat: 管理员新增个性化配置支持任意 IP 输入
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9bec3208f8
commit
574757f903
10
admin.html
10
admin.html
@ -650,11 +650,13 @@
|
||||
<el-form-item label="IP 地址">
|
||||
<el-input
|
||||
v-model="ipRuleDialog.form.ip"
|
||||
placeholder="自动识别当前 IP"
|
||||
disabled
|
||||
:placeholder="isAdmin && ipRuleDialog.mode === 'create' ? '请输入 IP 地址' : '自动识别当前 IP'"
|
||||
:disabled="!(isAdmin && ipRuleDialog.mode === 'create')"
|
||||
></el-input>
|
||||
<div class="small-text" style="margin-top:4px;">
|
||||
{{ ipRuleDialog.mode === 'create' ? '自动填充当前 IP,不可修改' : 'IP 地址不可修改' }}
|
||||
{{ isAdmin && ipRuleDialog.mode === 'create'
|
||||
? '管理员可填写任意有效 IP'
|
||||
: (ipRuleDialog.mode === 'create' ? '自动填充当前 IP,不可修改' : 'IP 地址不可修改') }}
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
@ -1048,7 +1050,7 @@
|
||||
submitIpRuleDialog: async function () {
|
||||
var form = this.ipRuleDialog.form;
|
||||
var ip = (form.ip || "").trim();
|
||||
if (!this.isAdmin || this.ipRuleDialog.mode === "create") {
|
||||
if (!this.isAdmin) {
|
||||
ip = (this.clientIp || "").trim();
|
||||
form.blocked = false;
|
||||
}
|
||||
|
||||
@ -687,8 +687,7 @@ async function handleIpRules(
|
||||
}
|
||||
|
||||
const rule = parseIpRuleBody(body);
|
||||
const isCreate = body.mode === "create";
|
||||
if (!isAdminClient(clientReq) || isCreate) {
|
||||
if (!isAdminClient(clientReq)) {
|
||||
rule.ip = resolveAdminClientIp(clientReq);
|
||||
}
|
||||
if (!canManageIpRule(clientReq, rule.ip)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user