mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 04:30:06 +00:00
feat: separate real ip header of frontend/agent (#130)
* feat: separate real ip header of frontend/agent * test(ci): test * Revert "test(ci): test" This reverts commit 7d2f16ed24e5f95f6101dc3ac67816ece2dc5ade. * chore: auto-fix linting and formatting issues
This commit is contained in:
@@ -3,12 +3,12 @@ import { initReactI18next } from "react-i18next"
|
|||||||
|
|
||||||
import deTranslation from "../locales/de/translation.json"
|
import deTranslation from "../locales/de/translation.json"
|
||||||
import enTranslation from "../locales/en/translation.json"
|
import enTranslation from "../locales/en/translation.json"
|
||||||
|
import esTranslation from "../locales/es/translation.json"
|
||||||
import itTranslation from "../locales/it/translation.json"
|
import itTranslation from "../locales/it/translation.json"
|
||||||
import ruTranslation from "../locales/ru/translation.json"
|
import ruTranslation from "../locales/ru/translation.json"
|
||||||
|
import taTranslation from "../locales/ta/translation.json"
|
||||||
import zhCNTranslation from "../locales/zh-CN/translation.json"
|
import zhCNTranslation from "../locales/zh-CN/translation.json"
|
||||||
import zhTWTranslation from "../locales/zh-TW/translation.json"
|
import zhTWTranslation from "../locales/zh-TW/translation.json"
|
||||||
import esTranslation from "../locales/es/translation.json"
|
|
||||||
import taTranslation from "../locales/ta/translation.json"
|
|
||||||
|
|
||||||
const resources = {
|
const resources = {
|
||||||
"zh-CN": {
|
"zh-CN": {
|
||||||
|
|||||||
@@ -87,7 +87,8 @@
|
|||||||
"BruteForceAttackingToken": "Brute Force Angriffs Token",
|
"BruteForceAttackingToken": "Brute Force Angriffs Token",
|
||||||
"BruteForceAttackingAgentSecret": "Brute Force Angriff Agent Geheimnis",
|
"BruteForceAttackingAgentSecret": "Brute Force Angriff Agent Geheimnis",
|
||||||
"CustomCodesDashboard": "Benutzerdefinierter Coder für das Dashboard",
|
"CustomCodesDashboard": "Benutzerdefinierter Coder für das Dashboard",
|
||||||
"RealIPHeader": "Echter IP-Anfrage-Header",
|
"WebRealIPHeader": "Echter IP-Anfrage-Header des Frontend",
|
||||||
|
"AgentRealIPHeader": "Echter IP-Anfrage-Header des Agent",
|
||||||
"UseDirectConnectingIP": "Direkte IP-Verbindung verwenden",
|
"UseDirectConnectingIP": "Direkte IP-Verbindung verwenden",
|
||||||
"IPChangeNotification": "IP Änderung Benachrichtigung",
|
"IPChangeNotification": "IP Änderung Benachrichtigung",
|
||||||
"EditTask": "Task bearbeiten",
|
"EditTask": "Task bearbeiten",
|
||||||
|
|||||||
@@ -139,7 +139,8 @@
|
|||||||
"CustomCodes": "Custom Codes (Style and Script)",
|
"CustomCodes": "Custom Codes (Style and Script)",
|
||||||
"CustomCodesDashboard": "Custom Codes for Dashboard",
|
"CustomCodesDashboard": "Custom Codes for Dashboard",
|
||||||
"CustomPublicDNSNameserversforDDNS": "Custom Public DNS Nameservers for DDNS",
|
"CustomPublicDNSNameserversforDDNS": "Custom Public DNS Nameservers for DDNS",
|
||||||
"RealIPHeader": "Real IP request header",
|
"WebRealIPHeader": "Frontend real IP request header",
|
||||||
|
"AgentRealIPHeader": "Agent real IP request header",
|
||||||
"UseDirectConnectingIP": "Use direct connection IP",
|
"UseDirectConnectingIP": "Use direct connection IP",
|
||||||
"IPChangeNotification": "IP Change Notification",
|
"IPChangeNotification": "IP Change Notification",
|
||||||
"FullIPNotification": "Show Full IP Address in Notification Messages",
|
"FullIPNotification": "Show Full IP Address in Notification Messages",
|
||||||
|
|||||||
@@ -162,7 +162,8 @@
|
|||||||
"CustomCodes": "Códigos personalizados (Style y Script)",
|
"CustomCodes": "Códigos personalizados (Style y Script)",
|
||||||
"CustomCodesDashboard": "Códigos personalizados para el Dashboard",
|
"CustomCodesDashboard": "Códigos personalizados para el Dashboard",
|
||||||
"CustomPublicDNSNameserversforDDNS": "Servidores de nombres DNS públicos personalizados para DDNS",
|
"CustomPublicDNSNameserversforDDNS": "Servidores de nombres DNS públicos personalizados para DDNS",
|
||||||
"RealIPHeader": "Encabezado de solicitud de IP real",
|
"WebRealIPHeader": "Encabezado de solicitud de IP real del frontend",
|
||||||
|
"AgentRealIPHeader": "Encabezado de solicitud de IP real del Agent",
|
||||||
"UseDirectConnectingIP": "Usar IP de conexión directa",
|
"UseDirectConnectingIP": "Usar IP de conexión directa",
|
||||||
"CreateNotifier": "Crear notificador",
|
"CreateNotifier": "Crear notificador",
|
||||||
"LastBlockReason": "Última razón de bloqueo",
|
"LastBlockReason": "Última razón de bloqueo",
|
||||||
|
|||||||
@@ -144,7 +144,8 @@
|
|||||||
"DashboardOriginalHost": "Indirizzo di ancoraggio dell'agente [nome dominio/IP:porta]",
|
"DashboardOriginalHost": "Indirizzo di ancoraggio dell'agente [nome dominio/IP:porta]",
|
||||||
"ConfigTLS": "Usa TLS per connettere Agent",
|
"ConfigTLS": "Usa TLS per connettere Agent",
|
||||||
"CustomPublicDNSNameserversforDDNS": "Server dei nomi DNS pubblici personalizzati per DDNS",
|
"CustomPublicDNSNameserversforDDNS": "Server dei nomi DNS pubblici personalizzati per DDNS",
|
||||||
"RealIPHeader": "Intestazione della richiesta IP reale",
|
"WebRealIPHeader": "Intestazione della richiesta IP reale del frontend",
|
||||||
|
"AgentRealIPHeader": "Intestazione della richiesta IP reale dell’agente",
|
||||||
"UseDirectConnectingIP": "Utilizzare l'IP di connessione diretta",
|
"UseDirectConnectingIP": "Utilizzare l'IP di connessione diretta",
|
||||||
"IPChangeNotification": "Notifica di modifica IP",
|
"IPChangeNotification": "Notifica di modifica IP",
|
||||||
"FullIPNotification": "Mostra l'indirizzo IP completo nei messaggi di notifica",
|
"FullIPNotification": "Mostra l'indirizzo IP completo nei messaggi di notifica",
|
||||||
|
|||||||
@@ -122,7 +122,8 @@
|
|||||||
"BruteForceAttackingAgentSecret": "Секрет агента для защиты от брутфорса",
|
"BruteForceAttackingAgentSecret": "Секрет агента для защиты от брутфорса",
|
||||||
"CustomCodesDashboard": "Пользовательский код для панели управления",
|
"CustomCodesDashboard": "Пользовательский код для панели управления",
|
||||||
"CustomPublicDNSNameserversforDDNS": "Пользовательские публичные DNS-серверы для DDNS",
|
"CustomPublicDNSNameserversforDDNS": "Пользовательские публичные DNS-серверы для DDNS",
|
||||||
"RealIPHeader": "Заголовок запроса с реальным IP",
|
"WebRealIPHeader": "Заголовок запроса с реальным IP от frontend",
|
||||||
|
"AgentRealIPHeader": "Заголовок запроса с реальным IP от агента",
|
||||||
"FullIPNotification": "Показывать полный IP-адрес в уведомлениях",
|
"FullIPNotification": "Показывать полный IP-адрес в уведомлениях",
|
||||||
"EditService": "Редактировать сервис",
|
"EditService": "Редактировать сервис",
|
||||||
"CreateService": "Создать сервис",
|
"CreateService": "Создать сервис",
|
||||||
|
|||||||
@@ -143,7 +143,8 @@
|
|||||||
"CustomCodes": "தனிப்பயன் குறியீடுகள் (நடை மற்றும் ச்கிரிப்ட்)",
|
"CustomCodes": "தனிப்பயன் குறியீடுகள் (நடை மற்றும் ச்கிரிப்ட்)",
|
||||||
"CustomCodesDashboard": "டாச்போர்டுக்கான தனிப்பயன் குறியீடுகள்",
|
"CustomCodesDashboard": "டாச்போர்டுக்கான தனிப்பயன் குறியீடுகள்",
|
||||||
"CustomPublicDNSNameserversforDDNS": "டி.டி.என்.எச்சிற்கான தனிப்பயன் பொது டி.என்.எச் பெயர்செர்வர்ச்",
|
"CustomPublicDNSNameserversforDDNS": "டி.டி.என்.எச்சிற்கான தனிப்பயன் பொது டி.என்.எச் பெயர்செர்வர்ச்",
|
||||||
"RealIPHeader": "உண்மையான ஐபி கோரிக்கை தலைப்பு",
|
"WebRealIPHeader": "முன்நிலை உண்மையான ஐபி கோரிக்கை தலைப்பு",
|
||||||
|
"AgentRealIPHeader": "ஏஜெண்ட் உண்மையான ஐபி கோரிக்கை தலைப்பு",
|
||||||
"UseDirectConnectingIP": "நேரடி இணைப்பு ஐபி பயன்படுத்தவும்",
|
"UseDirectConnectingIP": "நேரடி இணைப்பு ஐபி பயன்படுத்தவும்",
|
||||||
"IPChangeNotification": "ஐபி மாற்ற அறிவிப்பு",
|
"IPChangeNotification": "ஐபி மாற்ற அறிவிப்பு",
|
||||||
"FullIPNotification": "அறிவிப்பு செய்திகளில் முழு ஐபி முகவரியைக் காட்டுங்கள்",
|
"FullIPNotification": "அறிவிப்பு செய்திகளில் முழு ஐபி முகவரியைக் காட்டுங்கள்",
|
||||||
|
|||||||
@@ -146,7 +146,8 @@
|
|||||||
"DashboardOriginalHost": "Agent对接地址【域名/IP:端口】",
|
"DashboardOriginalHost": "Agent对接地址【域名/IP:端口】",
|
||||||
"ConfigTLS": "Agent 使用 TLS 连接",
|
"ConfigTLS": "Agent 使用 TLS 连接",
|
||||||
"CustomPublicDNSNameserversforDDNS": "DDNS 的自定义公共 DNS 名称服务器",
|
"CustomPublicDNSNameserversforDDNS": "DDNS 的自定义公共 DNS 名称服务器",
|
||||||
"RealIPHeader": "真实IP请求头",
|
"WebRealIPHeader": "前端真实IP请求头",
|
||||||
|
"AgentRealIPHeader": "Agent真实IP请求头",
|
||||||
"UseDirectConnectingIP": "使用直连 IP",
|
"UseDirectConnectingIP": "使用直连 IP",
|
||||||
"IPChangeNotification": "IP变更通知",
|
"IPChangeNotification": "IP变更通知",
|
||||||
"FullIPNotification": "在通知消息中显示完整的 IP 地址",
|
"FullIPNotification": "在通知消息中显示完整的 IP 地址",
|
||||||
|
|||||||
@@ -146,7 +146,8 @@
|
|||||||
"DashboardOriginalHost": "Agent對接位址【網域名稱/IP:連接埠】",
|
"DashboardOriginalHost": "Agent對接位址【網域名稱/IP:連接埠】",
|
||||||
"ConfigTLS": "Agent 使用 TLS 連線",
|
"ConfigTLS": "Agent 使用 TLS 連線",
|
||||||
"CustomPublicDNSNameserversforDDNS": "DDNS 的自訂公共 DNS 名稱伺服器",
|
"CustomPublicDNSNameserversforDDNS": "DDNS 的自訂公共 DNS 名稱伺服器",
|
||||||
"RealIPHeader": "真實IP請求頭",
|
"WebRealIPHeader": "前端真實IP請求頭",
|
||||||
|
"AgentRealIPHeader": "Agent真實IP請求頭",
|
||||||
"UseDirectConnectingIP": "使用直連 IP",
|
"UseDirectConnectingIP": "使用直連 IP",
|
||||||
"IPChangeNotification": "IP變更通知",
|
"IPChangeNotification": "IP變更通知",
|
||||||
"FullIPNotification": "在通知訊息中顯示完整的 IP 位址",
|
"FullIPNotification": "在通知訊息中顯示完整的 IP 位址",
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ const settingFormSchema = z.object({
|
|||||||
install_host: asOptionalField(z.string()),
|
install_host: asOptionalField(z.string()),
|
||||||
custom_code: asOptionalField(z.string()),
|
custom_code: asOptionalField(z.string()),
|
||||||
custom_code_dashboard: asOptionalField(z.string()),
|
custom_code_dashboard: asOptionalField(z.string()),
|
||||||
real_ip_header: asOptionalField(z.string()),
|
web_real_ip_header: asOptionalField(z.string()),
|
||||||
|
agent_real_ip_header: asOptionalField(z.string()),
|
||||||
|
|
||||||
tls: asOptionalField(z.boolean()),
|
tls: asOptionalField(z.boolean()),
|
||||||
enable_ip_change_notification: asOptionalField(z.boolean()),
|
enable_ip_change_notification: asOptionalField(z.boolean()),
|
||||||
@@ -315,10 +316,10 @@ export default function SettingsPage() {
|
|||||||
/>
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="real_ip_header"
|
name="web_real_ip_header"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("RealIPHeader")}</FormLabel>
|
<FormLabel>{t("WebRealIPHeader")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Input
|
<Input
|
||||||
@@ -334,12 +335,51 @@ export default function SettingsPage() {
|
|||||||
if (checked) {
|
if (checked) {
|
||||||
field.disabled = true
|
field.disabled = true
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"real_ip_header",
|
"web_real_ip_header",
|
||||||
"NZ::Use-Peer-IP",
|
"NZ::Use-Peer-IP",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
field.disabled = false
|
field.disabled = false
|
||||||
form.setValue("real_ip_header", "")
|
form.setValue("web_real_ip_header", "")
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<FormLabel className="font-normal ml-2">
|
||||||
|
{t("UseDirectConnectingIP")}
|
||||||
|
</FormLabel>
|
||||||
|
</div>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="agent_real_ip_header"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>{t("AgentRealIPHeader")}</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<Input
|
||||||
|
disabled={field.value == "NZ::Use-Peer-IP"}
|
||||||
|
className="w-1/2"
|
||||||
|
placeholder="CF-Connecting-IP"
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
checked={field.value == "NZ::Use-Peer-IP"}
|
||||||
|
className="ml-2"
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
if (checked) {
|
||||||
|
field.disabled = true
|
||||||
|
form.setValue(
|
||||||
|
"agent_real_ip_header",
|
||||||
|
"NZ::Use-Peer-IP",
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
field.disabled = false
|
||||||
|
form.setValue("agent_real_ip_header", "")
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -648,8 +648,10 @@ export interface ModelSetting {
|
|||||||
/** 系统语言,默认 zh_CN */
|
/** 系统语言,默认 zh_CN */
|
||||||
language: string
|
language: string
|
||||||
oauth2_providers: string[]
|
oauth2_providers: string[]
|
||||||
/** 真实IP */
|
/** 前端真实IP */
|
||||||
real_ip_header: string
|
web_real_ip_header: string
|
||||||
|
/** Agent真实IP */
|
||||||
|
agent_real_ip_header: string
|
||||||
site_name: string
|
site_name: string
|
||||||
/** 用于前端判断生成的安装命令是否启用 TLS */
|
/** 用于前端判断生成的安装命令是否启用 TLS */
|
||||||
tls: boolean
|
tls: boolean
|
||||||
@@ -669,8 +671,10 @@ export interface ModelSettingForm {
|
|||||||
ip_change_notification_group_id: number
|
ip_change_notification_group_id: number
|
||||||
/** @minLength 2 */
|
/** @minLength 2 */
|
||||||
language: string
|
language: string
|
||||||
/** 真实IP */
|
/** 前端真实IP */
|
||||||
real_ip_header?: string
|
web_real_ip_header?: string
|
||||||
|
/** Agent真实IP */
|
||||||
|
agent_real_ip_header?: string
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
site_name: string
|
site_name: string
|
||||||
tls?: boolean
|
tls?: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user