2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:47:20 +08:00

feat: 为部分设置补全描述,close #762

This commit is contained in:
2025-10-11 01:27:24 +08:00
parent 4708196ba2
commit 2f2ac9da87
3 changed files with 150 additions and 15 deletions

View File

@@ -77,7 +77,7 @@ func MustLogin(t *gotext.Locale, conf *koanf.Koanf, session *sessions.Manager, u
safeClientHash := cast.ToString(sess.Get("safe_client"))
if safeClientHash != clientHash || safeClientHash == "" {
sess.Forget("user_id") // 清除 user_id否则会来回跳转
Abort(w, http.StatusUnauthorized, t.Get("client ip/ua changed, please login again"))
Abort(w, http.StatusUnauthorized, t.Get("client ip changed, please login again"))
return
}
}

View File

@@ -41,6 +41,9 @@ const { data: model } = useRequest(setting.list, {
})
const handleSave = () => {
if (model.value.entrance.trim() === '') {
model.value.entrance = '/'
}
useRequest(setting.update(model.value)).onSuccess(() => {
window.$message.success($gettext('Saved successfully'))
if (model.value.locale !== themeStore.locale) {

View File

@@ -9,7 +9,22 @@ const model = defineModel<any>('model', { type: Object, required: true })
<template>
<n-space vertical>
<n-form>
<n-form-item :label="$gettext('Login Timeout')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Login Timeout') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Set the maximum lifetime (in minutes) of the login state, after which you need to log in again'
)
}}
</n-tooltip>
</template>
<n-input-number
v-model:value="model.lifetime"
:placeholder="$gettext('120')"
@@ -22,39 +37,156 @@ const model = defineModel<any>('model', { type: Object, required: true })
</template>
</n-input-number>
</n-form-item>
<n-form-item :label="$gettext('Access Entrance')">
<n-input v-model:value="model.entrance" :placeholder="$gettext('/admin')" />
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Access Entrance') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Set the access entrance of the panel (e.g. /mypanel) to prevent some malicious access. Leave blank to disable (not recommended)'
)
}}
</n-tooltip>
</template>
<n-input v-model:value="model.entrance" />
</n-form-item>
<n-form-item :label="$gettext('Request IP Header')">
<n-input
v-model:value="model.ip_header"
:placeholder="$gettext('Customize the IP used by panel (useful when using CDN)')"
/>
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Request IP Header') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Set the header that carries the real IP of the client, useful when using CDN or reverse proxy. Leave blank to use the client IP directly'
)
}}
</n-tooltip>
</template>
<n-input v-model:value="model.ip_header" :placeholder="$gettext('X-Real-IP')" />
</n-form-item>
<n-form-item :label="$gettext('Bind Domain')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Bind Domain') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Restrict panel access to the specified domain names. Leave blank to allow access from any domain'
)
}}
</n-tooltip>
</template>
<n-dynamic-input
v-model:value="model.bind_domain"
placeholder="example.com"
show-sort-button
/>
</n-form-item>
<n-form-item :label="$gettext('Bind IP')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Bind IP') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Restrict panel access to the specified IP addresses. Leave blank to allow access from any IP'
)
}}
</n-tooltip>
</template>
<n-dynamic-input v-model:value="model.bind_ip" placeholder="127.0.0.1" show-sort-button />
</n-form-item>
<n-form-item :label="$gettext('Bind UA')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Bind UA') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Restrict panel access to the specified User-Agent strings. Leave blank to allow access from any User-Agent'
)
}}
</n-tooltip>
</template>
<n-dynamic-input
v-model:value="model.bind_ua"
placeholder="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36"
show-sort-button
/>
</n-form-item>
<n-form-item :label="$gettext('Offline Mode')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Offline Mode') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'When enabled, the panel will not attempt to connect to external services for updates or other features. This may limit some functionalities'
)
}}
</n-tooltip>
</template>
<n-switch v-model:value="model.offline_mode" />
</n-form-item>
<n-form-item :label="$gettext('Auto Update')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Auto Update') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'When enabled, the panel will automatically check for and install updates when they are available. It is recommended to keep this enabled to ensure you have the latest features and security patches'
)
}}
</n-tooltip>
</template>
<n-switch v-model:value="model.auto_update" />
</n-form-item>
<n-form-item :label="$gettext('Panel HTTPS')">
<n-form-item>
<template #label>
<n-tooltip>
<template #trigger>
<div class="flex items-center">
{{ $gettext('Panel HTTPS') }}
<the-icon :size="16" icon="mdi:help-circle-outline" class="ml-1" />
</div>
</template>
{{
$gettext(
'Enable HTTPS for the panel to ensure secure communication. You need to provide a valid SSL certificate and private key'
)
}}
</n-tooltip>
</template>
<n-switch v-model:value="model.https" />
</n-form-item>
<n-form-item v-if="model.https" :label="$gettext('Certificate')">