From bf43adffe5658a0c8565371267ba91e2d92f5ea8 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sat, 8 Mar 2025 18:42:55 +0800 Subject: [PATCH] update setting api (#123) --- src/components/install-commands.tsx | 17 +++++------------ src/types/api.ts | 10 ---------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/components/install-commands.tsx b/src/components/install-commands.tsx index a634e6f..4b9a432 100644 --- a/src/components/install-commands.tsx +++ b/src/components/install-commands.tsx @@ -88,22 +88,15 @@ export const InstallCommandsMenu = forwardRef((p const generateCommand = ( type: number, - { agent_secret_key, install_host, tls }: ModelSetting, - { agent_secret, role }: ModelProfile, + { install_host, tls }: ModelSetting, + { agent_secret }: ModelProfile, ) => { if (!install_host) throw new Error(i18next.t("Results.InstallHostRequired")) - // 如果 agent_secret 为空且 role 为 0 ,则使用 agent_secret_key,否则如果 agent_secret 为空则报错 - if (!agent_secret && role === 0) { - agent_secret = agent_secret_key - } else if (!agent_secret) { - throw new Error(i18next.t("Results.AgentSecretRequired")) - } + if (!agent_secret) throw new Error(i18next.t("Results.AgentSecretRequired")) - agent_secret_key = agent_secret - - const env = `NZ_SERVER=${install_host} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret_key}` - const env_win = `$env:NZ_SERVER=\"${install_host}\";$env:NZ_TLS=\"${tls || false}\";$env:NZ_CLIENT_SECRET=\"${agent_secret_key}\";` + const env = `NZ_SERVER=${install_host} NZ_TLS=${tls || false} NZ_CLIENT_SECRET=${agent_secret}` + const env_win = `$env:NZ_SERVER=\"${install_host}\";$env:NZ_TLS=\"${tls || false}\";$env:NZ_CLIENT_SECRET=\"${agent_secret}\";` switch (type) { case OSTypes.Linux: diff --git a/src/types/api.ts b/src/types/api.ts index 1d79661..0120212 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -631,32 +631,22 @@ export interface ModelServiceResponseItem { export interface ModelSetting { admin_template: string - agent_secret_key: string - avg_ping_count: number /** 覆盖范围(0:提醒未被 IgnoredIPNotification 包含的所有服务器; 1:仅提醒被 IgnoredIPNotification 包含的服务器;) */ cover: number custom_code: string custom_code_dashboard: string - /** debug模式开关 */ - debug: boolean dns_servers: string /** IP变更提醒 */ enable_ip_change_notification: boolean /** 通知信息IP不打码 */ enable_plain_ip_in_notification: boolean - /** 强制要求认证 */ - force_auth: boolean /** 特定服务器IP(多个服务器用逗号分隔) */ ignored_ip_notification: string - /** [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内) */ ignored_ip_notification_server_ids: Record install_host: string ip_change_notification_group_id: number /** 系统语言,默认 zh_CN */ language: string - /** 时区,默认为 Asia/Shanghai */ - location: string - /** oauth2 供应商列表,无需配置,自动生成 */ oauth2_providers: string[] /** 真实IP */ real_ip_header: string