fix: missing notification group input in settings (#24)

* fix: missing notification group input in settings

* change script name

* license

* update settings api

* improve: cell width

* feat: site name
This commit is contained in:
UUBulb
2024-12-04 20:03:16 +08:00
committed by GitHub
parent 36472035e1
commit 58efdde19e
13 changed files with 639 additions and 371 deletions

201
LICENSE Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2024 nezhahq
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,10 +1,10 @@
import { ModelSettingForm, ModelConfig } from "@/types" import { ModelSettingForm, ModelSettingResponse } from "@/types"
import { fetcher, FetcherMethod } from "./api" import { fetcher, FetcherMethod } from "./api"
export const updateSettings = async (data: ModelSettingForm): Promise<void> => { export const updateSettings = async (data: ModelSettingForm): Promise<void> => {
return fetcher<void>(FetcherMethod.PATCH, `/api/v1/setting`, data); return fetcher<void>(FetcherMethod.PATCH, `/api/v1/setting`, data);
} }
export const getSettings = async (): Promise<ModelConfig> => { export const getSettings = async (): Promise<ModelSettingResponse> => {
return fetcher<ModelConfig>(FetcherMethod.GET, '/api/v1/setting', null); return fetcher<ModelSettingResponse>(FetcherMethod.GET, '/api/v1/setting', null);
} }

View File

@@ -13,7 +13,7 @@ import { NzNavigationMenuLink } from "./xui/navigation-menu";
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "./ui/dropdown-menu"; import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "./ui/dropdown-menu";
import { LogOut, Settings, User2 } from "lucide-react"; import { LogOut, Settings, User2 } from "lucide-react";
import { useAuth } from "@/hooks/useAuth"; import { useAuth } from "@/hooks/useAuth";
import { Link, useLocation } from "react-router-dom"; import { Link, useLocation, useNavigate } from "react-router-dom";
import { useMediaQuery } from "@/hooks/useMediaQuery"; import { useMediaQuery } from "@/hooks/useMediaQuery";
import { import {
Drawer, Drawer,
@@ -53,6 +53,8 @@ export default function Header() {
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const [dropdownOpen, setDropdownOpen] = useState(false); const [dropdownOpen, setDropdownOpen] = useState(false);
const navigate = useNavigate();
return ( return (
isDesktop ? ( isDesktop ? (
<header className="h-16 flex items-center border-b-2 px-4 overflow-x-auto"> <header className="h-16 flex items-center border-b-2 px-4 overflow-x-auto">
@@ -121,17 +123,27 @@ export default function Header() {
<DropdownMenuLabel>{profile.username}</DropdownMenuLabel> <DropdownMenuLabel>{profile.username}</DropdownMenuLabel>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuGroup> <DropdownMenuGroup>
<DropdownMenuItem onClick={() => { setDropdownOpen(false) }}> <DropdownMenuItem onClick={() => {
<Link to="/dashboard/profile" className="flex items-center gap-2 w-full"> setDropdownOpen(false)
navigate("/dashboard/profile")
}}
className="cursor-pointer"
>
<div className="flex items-center gap-2 w-full">
<User2 /> <User2 />
{t('Profile')} {t('Profile')}
</Link> </div>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem onClick={() => { setDropdownOpen(false) }}> <DropdownMenuItem onClick={() => {
<Link to="/dashboard/settings" className="flex items-center gap-2 w-full"> setDropdownOpen(false)
navigate("/dashboard/settings")
}}
className="cursor-pointer"
>
<div className="flex items-center gap-2 w-full">
<Settings /> <Settings />
{t('Settings')} {t('Settings')}
</Link> </div>
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuGroup> </DropdownMenuGroup>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
@@ -199,19 +211,27 @@ export default function Header() {
<DropdownMenuLabel>{profile.username}</DropdownMenuLabel> <DropdownMenuLabel>{profile.username}</DropdownMenuLabel>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuGroup> <DropdownMenuGroup>
<DropdownMenuItem onClick={() => { setDropdownOpen(false) }}> <DropdownMenuItem onClick={() => {
<Link to="/dashboard/profile" className="flex items-center gap-2 w-full"> setDropdownOpen(false)
navigate("/dashboard/profile")
}}
className="cursor-pointer"
>
<div className="flex items-center gap-2 w-full">
<User2 /> <User2 />
{t('Profile')} {t('Profile')}
<DropdownMenuShortcut>P</DropdownMenuShortcut> </div>
</Link>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem onClick={() => { setDropdownOpen(false) }}> <DropdownMenuItem onClick={() => {
<Link to="/dashboard/settings" className="flex items-center gap-2 w-full"> setDropdownOpen(false)
navigate("/dashboard/settings")
}}
className="cursor-pointer"
>
<div className="flex items-center gap-2 w-full">
<Settings /> <Settings />
{t('Settings')} {t('Settings')}
<DropdownMenuShortcut>S</DropdownMenuShortcut> </div>
</Link>
</DropdownMenuItem> </DropdownMenuItem>
</DropdownMenuGroup> </DropdownMenuGroup>
<DropdownMenuSeparator /> <DropdownMenuSeparator />

View File

@@ -7,7 +7,7 @@ import {
import { Button, ButtonProps } from "@/components/ui/button" import { Button, ButtonProps } from "@/components/ui/button"
import { forwardRef, useState } from "react" import { forwardRef, useState } from "react"
import useSettings from "@/hooks/useSetting" import useSettings from "@/hooks/useSetting"
import { ModelConfig } from "@/types" import { ModelSettingResponse } from "@/types"
import { Check, Clipboard } from "lucide-react" import { Check, Clipboard } from "lucide-react"
import { toast } from "sonner" import { toast } from "sonner"
import { copyToClipboard } from "@/lib/utils" import { copyToClipboard } from "@/lib/utils"
@@ -62,7 +62,7 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
); );
}) })
const generateCommand = (type: number, { agent_secret_key, install_host, tls }: ModelConfig) => { const generateCommand = (type: number, { agent_secret_key, install_host, tls }: ModelSettingResponse) => {
if (!install_host) if (!install_host)
throw new Error(i18next.t("Results.InstallHostRequired")); throw new Error(i18next.t("Results.InstallHostRequired"));
@@ -72,7 +72,7 @@ const generateCommand = (type: number, { agent_secret_key, install_host, tls }:
switch (type) { switch (type) {
case OSTypes.Linux: case OSTypes.Linux:
case OSTypes.macOS: { case OSTypes.macOS: {
return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o nezha.sh && chmod +x nezha.sh && env ${env} ./nezha.sh` return `curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.sh -o agent.sh && chmod +x agent.sh && env ${env} ./agent.sh`
} }
case OSTypes.Windows: { case OSTypes.Windows: {
return `${env} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12;set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1` return `${env} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12;set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/nezhahq/scripts/main/agent/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1`

View File

@@ -1,9 +1,9 @@
import { swrFetcher } from "@/api/api"; import { swrFetcher } from "@/api/api";
import { ModelConfig } from "@/types"; import { ModelSettingResponse } from "@/types";
import useSWR from "swr"; import useSWR from "swr";
export default function useSetting() { export default function useSetting() {
const { data } = useSWR<ModelConfig>( const { data } = useSWR<ModelSettingResponse>(
"/api/v1/setting", "/api/v1/setting",
swrFetcher swrFetcher
); );

View File

@@ -127,6 +127,7 @@
"WAF": "Web application firewall", "WAF": "Web application firewall",
"SiteName": "Site name", "SiteName": "Site name",
"DashboardOriginalHost": "Agent docking address [domain name/IP:port]", "DashboardOriginalHost": "Agent docking address [domain name/IP:port]",
"ConfigTLS": "Use TLS to connect Agent",
"LoginFailed": "Login failed", "LoginFailed": "Login failed",
"BruteForceAttackingToken": "Brute Force Attacking Token", "BruteForceAttackingToken": "Brute Force Attacking Token",
"BruteForceAttackingAgentSecret": "Brute Force Attacking Agent Secret", "BruteForceAttackingAgentSecret": "Brute Force Attacking Agent Secret",

View File

@@ -140,6 +140,7 @@
"CustomCodes": "Codice personalizzato (stili e script)", "CustomCodes": "Codice personalizzato (stili e script)",
"CustomCodesDashboard": "Codice personalizzato per dashboard", "CustomCodesDashboard": "Codice personalizzato per dashboard",
"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",
"CustomPublicDNSNameserversforDDNS": "Server dei nomi DNS pubblici personalizzati per DDNS", "CustomPublicDNSNameserversforDDNS": "Server dei nomi DNS pubblici personalizzati per DDNS",
"RealIPHeader": "Intestazione della richiesta IP reale", "RealIPHeader": "Intestazione della richiesta IP reale",
"UseDirectConnectingIP": "Utilizzare l'IP di connessione diretta", "UseDirectConnectingIP": "Utilizzare l'IP di connessione diretta",

View File

@@ -140,6 +140,7 @@
"CustomCodes": "自定义代码(样式和脚本)", "CustomCodes": "自定义代码(样式和脚本)",
"CustomCodesDashboard": "仪表板的自定义代码", "CustomCodesDashboard": "仪表板的自定义代码",
"DashboardOriginalHost": "Agent对接地址【域名/IP:端口】", "DashboardOriginalHost": "Agent对接地址【域名/IP:端口】",
"ConfigTLS": "Agent 使用 TLS 连接",
"CustomPublicDNSNameserversforDDNS": "DDNS 的自定义公共 DNS 名称服务器", "CustomPublicDNSNameserversforDDNS": "DDNS 的自定义公共 DNS 名称服务器",
"RealIPHeader": "真实IP请求头", "RealIPHeader": "真实IP请求头",
"UseDirectConnectingIP": "使用直连 IP", "UseDirectConnectingIP": "使用直连 IP",

View File

@@ -140,6 +140,7 @@
"CustomCodes": "自訂程式碼(樣式和腳本)", "CustomCodes": "自訂程式碼(樣式和腳本)",
"CustomCodesDashboard": "儀表板的自訂程式碼", "CustomCodesDashboard": "儀表板的自訂程式碼",
"DashboardOriginalHost": "Agent對接位址【網域名稱/IP:連接埠】", "DashboardOriginalHost": "Agent對接位址【網域名稱/IP:連接埠】",
"ConfigTLS": "Agent 使用 TLS 連線",
"CustomPublicDNSNameserversforDDNS": "DDNS 的自訂公共 DNS 名稱伺服器", "CustomPublicDNSNameserversforDDNS": "DDNS 的自訂公共 DNS 名稱伺服器",
"RealIPHeader": "真實IP請求頭", "RealIPHeader": "真實IP請求頭",
"UseDirectConnectingIP": "使用直連 IP", "UseDirectConnectingIP": "使用直連 IP",

View File

@@ -86,8 +86,10 @@ export default function AlertRulePage() {
}, },
{ {
header: t("Rules"), header: t("Rules"),
accessorKey: "rules", cell: ({ row }) => {
accessorFn: (row) => JSON.stringify(row.rules), const s = row.original;
return <div className="max-w-48 whitespace-normal break-words">{JSON.stringify(s.rules)}</div>;
},
}, },
{ {
header: t("TasksToTriggerOnAlert"), header: t("TasksToTriggerOnAlert"),

View File

@@ -1,4 +1,5 @@
import { Outlet } from "react-router-dom"; import { Outlet } from "react-router-dom";
import { useEffect } from "react";
import { Card } from "@/components/ui/card"; import { Card } from "@/components/ui/card";
import { ThemeProvider } from "@/components/theme-provider"; import { ThemeProvider } from "@/components/theme-provider";
@@ -6,9 +7,16 @@ import Header from "@/components/header";
import { Toaster } from "@/components/ui/sonner"; import { Toaster } from "@/components/ui/sonner";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import useSetting from "@/hooks/useSetting";
export default function Root() { export default function Root() {
const { t } = useTranslation(); const { t } = useTranslation();
const settings = useSetting();
useEffect(() => {
document.title = settings?.site_name || "哪吒监控 Nezha Monitoring";
}, [settings]);
return ( return (
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme"> <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
<Card className="text-sm max-w-7xl mx-auto mt-5 min-h-[90%] flex flex-col justify-between"> <Card className="text-sm max-w-7xl mx-auto mt-5 min-h-[90%] flex flex-col justify-between">
@@ -17,7 +25,7 @@ export default function Root() {
<Outlet /> <Outlet />
</div> </div>
<footer className="mx-5 pb-5 text-foreground/60 font-thin text-center"> <footer className="mx-5 pb-5 text-foreground/60 font-thin text-center">
&copy; 2019-2024 {t('nezha')} &copy; 2019-2024 {t('nezha')} {settings?.version}
</footer> </footer>
</Card> </Card>
<Toaster /> <Toaster />

View File

@@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
import { ModelConfig, settingCoverageTypes, nezhaLang } from "@/types"; import { ModelSettingResponse, settingCoverageTypes, nezhaLang } from "@/types";
import { SettingsTab } from "@/components/settings-tab"; import { SettingsTab } from "@/components/settings-tab";
import { z } from "zod"; import { z } from "zod";
import { asOptionalField } from "@/lib/utils"; import { asOptionalField } from "@/lib/utils";
@@ -43,13 +43,14 @@ const settingFormSchema = z.object({
custom_code_dashboard: asOptionalField(z.string()), custom_code_dashboard: asOptionalField(z.string()),
real_ip_header: asOptionalField(z.string()), real_ip_header: asOptionalField(z.string()),
tls: asOptionalField(z.boolean()),
enable_ip_change_notification: asOptionalField(z.boolean()), enable_ip_change_notification: asOptionalField(z.boolean()),
enable_plain_ip_in_notification: asOptionalField(z.boolean()), enable_plain_ip_in_notification: asOptionalField(z.boolean()),
}); });
export default function SettingsPage() { export default function SettingsPage() {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
const [config, setConfig] = useState<ModelConfig>(); const [config, setConfig] = useState<ModelSettingResponse>();
const [error, setError] = useState<Error>(); const [error, setError] = useState<Error>();
useEffect(() => { useEffect(() => {
@@ -196,6 +197,23 @@ export default function SettingsPage() {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="tls"
render={({ field }) => (
<FormItem className="flex items-center space-x-2">
<FormControl>
<div className="flex items-center gap-2">
<Checkbox checked={field.value} onCheckedChange={field.onChange} />
<Label className="text-sm">
{t("ConfigTLS")}
</Label>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField <FormField
control={form.control} control={form.control}
name="custom_nameservers" name="custom_nameservers"
@@ -280,6 +298,19 @@ export default function SettingsPage() {
</FormItem> </FormItem>
)} )}
/> />
<FormField
control={form.control}
name="ip_change_notification_group_id"
render={({ field }) => (
<FormItem>
<FormLabel>{t("NotifierGroupID")}</FormLabel>
<FormControl>
<Input placeholder="0" type="number" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField <FormField
control={form.control} control={form.control}
name="enable_ip_change_notification" name="enable_ip_change_notification"

View File

@@ -10,261 +10,229 @@
*/ */
export interface GithubComNezhahqNezhaModelCommonResponseAny { export interface GithubComNezhahqNezhaModelCommonResponseAny {
data?: any; data: any;
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelAlertRule { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelAlertRule {
data?: ModelAlertRule[]; data: ModelAlertRule[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelCron { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelCron {
data?: ModelCron[]; data: ModelCron[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelDDNSProfile { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelDDNSProfile {
data?: ModelDDNSProfile[]; data: ModelDDNSProfile[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNAT { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNAT {
data?: ModelNAT[]; data: ModelNAT[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotification { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotification {
data?: ModelNotification[]; data: ModelNotification[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotificationGroupResponseItem { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotificationGroupResponseItem {
data?: ModelNotificationGroupResponseItem[]; data: ModelNotificationGroupResponseItem[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServer { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServer {
data?: ModelServer[]; data: ModelServer[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServerGroupResponseItem { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServerGroupResponseItem {
data?: ModelServerGroupResponseItem[]; data: ModelServerGroupResponseItem[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServiceInfos { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServiceInfos {
data?: ModelServiceInfos[]; data: ModelServiceInfos[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelUser { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelUser {
data?: ModelUser[]; data: ModelUser[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelWAFApiMock { export interface GithubComNezhahqNezhaModelCommonResponseArrayModelWAFApiMock {
data?: ModelWAFApiMock[]; data: ModelWAFApiMock[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayString { export interface GithubComNezhahqNezhaModelCommonResponseArrayString {
data?: string[]; data: string[];
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseArrayUint64 { export interface GithubComNezhahqNezhaModelCommonResponseArrayUint64 {
data?: number[]; data: number[];
error?: string; error: string;
success?: boolean; success: boolean;
}
export interface GithubComNezhahqNezhaModelCommonResponseModelConfig {
data?: ModelConfig;
error?: string;
success?: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseModelForceUpdateResponse { export interface GithubComNezhahqNezhaModelCommonResponseModelForceUpdateResponse {
data?: ModelForceUpdateResponse; data: ModelForceUpdateResponse;
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseModelLoginResponse { export interface GithubComNezhahqNezhaModelCommonResponseModelLoginResponse {
data?: ModelLoginResponse; data: ModelLoginResponse;
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseModelProfile { export interface GithubComNezhahqNezhaModelCommonResponseModelProfile {
data?: ModelProfile; data: ModelProfile;
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseModelServiceResponse { export interface GithubComNezhahqNezhaModelCommonResponseModelServiceResponse {
data?: ModelServiceResponse; data: ModelServiceResponse;
error?: string; error: string;
success?: boolean; success: boolean;
}
export interface GithubComNezhahqNezhaModelCommonResponseModelSettingResponse {
data: ModelSettingResponse;
error: string;
success: boolean;
} }
export interface GithubComNezhahqNezhaModelCommonResponseUint64 { export interface GithubComNezhahqNezhaModelCommonResponseUint64 {
data?: number; data: number;
error?: string; error: string;
success?: boolean; success: boolean;
} }
export interface ModelAlertRule { export interface ModelAlertRule {
created_at?: string; created_at: string;
enable?: boolean; enable: boolean;
/** 失败时执行的触发任务id */ /** 失败时执行的触发任务id */
fail_trigger_tasks?: number[]; fail_trigger_tasks: number[];
id?: number; id: number;
name?: string; name: string;
/** 该报警规则所在的通知组 */ /** 该报警规则所在的通知组 */
notification_group_id?: number; notification_group_id: number;
/** 恢复时执行的触发任务id */ /** 恢复时执行的触发任务id */
recover_trigger_tasks?: number[]; recover_trigger_tasks: number[];
rules?: ModelRule[]; rules: ModelRule[];
/** 触发模式: 0-始终触发(默认) 1-单次触发 */ /** 触发模式: 0-始终触发(默认) 1-单次触发 */
trigger_mode?: number; trigger_mode: number;
updated_at?: string; updated_at: string;
} }
export interface ModelAlertRuleForm { export interface ModelAlertRuleForm {
enable?: boolean; enable?: boolean;
/** 失败时触发的任务id */ /** 失败时触发的任务id */
fail_trigger_tasks?: number[]; fail_trigger_tasks: number[];
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
notification_group_id?: number; notification_group_id: number;
/** 恢复时触发的任务id */ /** 恢复时触发的任务id */
recover_trigger_tasks?: number[]; recover_trigger_tasks: number[];
rules?: ModelRule[]; rules: ModelRule[];
/** @default 0 */ /** @default 0 */
trigger_mode?: number; trigger_mode: number;
}
export interface ModelConfig {
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;
/** 特定服务器IP多个服务器用逗号分隔 */
ignored_ip_notification?: string;
/** [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内 */
ignored_ip_notification_server_ids?: Record<string, boolean>;
install_host?: string;
ip_change_notification_group_id?: number;
jwt_secret_key?: string;
/** 系统语言,默认 zh_CN */
language?: string;
listen_port?: number;
/** 时区,默认为 Asia/Shanghai */
location?: string;
/** 真实IP */
real_ip_header?: string;
site_name?: string;
tls?: boolean;
} }
export interface ModelCreateFMResponse { export interface ModelCreateFMResponse {
session_id?: string; session_id: string;
} }
export interface ModelCreateTerminalResponse { export interface ModelCreateTerminalResponse {
server_id?: number; server_id: number;
server_name?: string; server_name: string;
session_id?: string; session_id: string;
} }
export interface ModelCron { export interface ModelCron {
command?: string; command: string;
/** 计划任务覆盖范围 (0:仅覆盖特定服务器 1:仅忽略特定服务器 2:由触发该计划任务的服务器执行) */ /** 计划任务覆盖范围 (0:仅覆盖特定服务器 1:仅忽略特定服务器 2:由触发该计划任务的服务器执行) */
cover?: number; cover: number;
created_at?: string; created_at: string;
cron_job_id?: number; cron_job_id: number;
id?: number; id: number;
/** 最后一次执行时间 */ /** 最后一次执行时间 */
last_executed_at?: string; last_executed_at: string;
/** 最后一次执行结果 */ /** 最后一次执行结果 */
last_result?: boolean; last_result: boolean;
name?: string; name: string;
/** 指定通知方式的分组 */ /** 指定通知方式的分组 */
notification_group_id?: number; notification_group_id: number;
/** 推送成功的通知 */ /** 推送成功的通知 */
push_successful?: boolean; push_successful: boolean;
/** 分钟 小时 天 月 星期 */ /** 分钟 小时 天 月 星期 */
scheduler?: string; scheduler: string;
servers?: number[]; servers: number[];
/** 0:计划任务 1:触发任务 */ /** 0:计划任务 1:触发任务 */
task_type?: number; task_type: number;
updated_at?: string; updated_at: string;
} }
export interface ModelCronForm { export interface ModelCronForm {
command?: string; command?: string;
/** @default 0 */ /** @default 0 */
cover?: number; cover: number;
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
notification_group_id?: number; notification_group_id: number;
push_successful?: boolean; push_successful?: boolean;
scheduler?: string; scheduler: string;
servers?: number[]; servers: number[];
/** /**
* 0:计划任务 1:触发任务 * 0:计划任务 1:触发任务
* @default 0 * @default 0
*/ */
task_type?: number; task_type: number;
} }
export interface ModelCycleTransferStats { export interface ModelCycleTransferStats {
from?: string; from: string;
max?: number; max: number;
min?: number; min: number;
name?: string; name: string;
next_update?: Record<string, string>; next_update: Record<string, string>;
server_name?: Record<string, string>; server_name: Record<string, string>;
to?: string; to: string;
transfer?: Record<string, number>; transfer: Record<string, number>;
} }
export interface ModelDDNSForm { export interface ModelDDNSForm {
access_id?: string; access_id?: string;
access_secret?: string; access_secret?: string;
domains?: string[]; domains: string[];
enable_ipv4?: boolean; enable_ipv4?: boolean;
enable_ipv6?: boolean; enable_ipv6?: boolean;
/** @default 3 */ /** @default 3 */
max_retries?: number; max_retries: number;
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
provider?: string; provider: string;
webhook_headers?: string; webhook_headers?: string;
/** @default 1 */ /** @default 1 */
webhook_method?: number; webhook_method?: number;
@@ -275,22 +243,22 @@ export interface ModelDDNSForm {
} }
export interface ModelDDNSProfile { export interface ModelDDNSProfile {
access_id?: string; access_id: string;
access_secret?: string; access_secret: string;
created_at?: string; created_at: string;
domains?: string[]; domains: string[];
enable_ipv4?: boolean; enable_ipv4: boolean;
enable_ipv6?: boolean; enable_ipv6: boolean;
id?: number; id: number;
max_retries?: number; max_retries: number;
name?: string; name: string;
provider?: string; provider: string;
updated_at?: string; updated_at: string;
webhook_headers?: string; webhook_headers: string;
webhook_method?: number; webhook_method: number;
webhook_request_body?: string; webhook_request_body: string;
webhook_request_type?: number; webhook_request_type: number;
webhook_url?: string; webhook_url: string;
} }
export interface ModelForceUpdateResponse { export interface ModelForceUpdateResponse {
@@ -300,138 +268,138 @@ export interface ModelForceUpdateResponse {
} }
export interface ModelGeoIP { export interface ModelGeoIP {
country_code?: string; country_code: string;
ip?: ModelIP; ip: ModelIP;
} }
export interface ModelHost { export interface ModelHost {
arch?: string; arch: string;
boot_time?: number; boot_time: number;
cpu?: string[]; cpu: string[];
disk_total?: number; disk_total: number;
gpu?: string[]; gpu: string[];
mem_total?: number; mem_total: number;
platform?: string; platform: string;
platform_version?: string; platform_version: string;
swap_total?: number; swap_total: number;
version?: string; version: string;
virtualization?: string; virtualization: string;
} }
export interface ModelHostState { export interface ModelHostState {
cpu?: number; cpu: number;
disk_used?: number; disk_used: number;
gpu?: number[]; gpu: number[];
load_1?: number; load_1: number;
load_15?: number; load_15: number;
load_5?: number; load_5: number;
mem_used?: number; mem_used: number;
net_in_speed?: number; net_in_speed: number;
net_in_transfer?: number; net_in_transfer: number;
net_out_speed?: number; net_out_speed: number;
net_out_transfer?: number; net_out_transfer: number;
process_count?: number; process_count: number;
swap_used?: number; swap_used: number;
tcp_conn_count?: number; tcp_conn_count: number;
temperatures?: ModelSensorTemperature[]; temperatures: ModelSensorTemperature[];
udp_conn_count?: number; udp_conn_count: number;
uptime?: number; uptime: number;
} }
export interface ModelIP { export interface ModelIP {
ipv4_addr?: string; ipv4_addr: string;
ipv6_addr?: string; ipv6_addr: string;
} }
export interface ModelLoginRequest { export interface ModelLoginRequest {
password?: string; password: string;
username?: string; username: string;
} }
export interface ModelLoginResponse { export interface ModelLoginResponse {
expire?: string; expire: string;
token?: string; token: string;
} }
export interface ModelNAT { export interface ModelNAT {
created_at?: string; created_at: string;
domain?: string; domain: string;
host?: string; host: string;
id?: number; id: number;
name?: string; name: string;
server_id?: number; server_id: number;
updated_at?: string; updated_at: string;
} }
export interface ModelNATForm { export interface ModelNATForm {
domain?: string; domain: string;
host?: string; host: string;
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
server_id?: number; server_id: number;
} }
export interface ModelNotification { export interface ModelNotification {
created_at?: string; created_at: string;
id?: number; id: number;
name?: string; name: string;
request_body?: string; request_body: string;
request_header?: string; request_header: string;
request_method?: number; request_method: number;
request_type?: number; request_type: number;
updated_at?: string; updated_at: string;
url?: string; url: string;
verify_tls?: boolean; verify_tls: boolean;
} }
export interface ModelNotificationForm { export interface ModelNotificationForm {
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
request_body?: string; request_body: string;
request_header?: string; request_header: string;
request_method?: number; request_method: number;
request_type?: number; request_type: number;
skip_check?: boolean; skip_check?: boolean;
url?: string; url: string;
verify_tls?: boolean; verify_tls?: boolean;
} }
export interface ModelNotificationGroup { export interface ModelNotificationGroup {
created_at?: string; created_at: string;
id?: number; id: number;
name?: string; name: string;
updated_at?: string; updated_at: string;
} }
export interface ModelNotificationGroupForm { export interface ModelNotificationGroupForm {
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
notifications?: number[]; notifications: number[];
} }
export interface ModelNotificationGroupResponseItem { export interface ModelNotificationGroupResponseItem {
group?: ModelNotificationGroup; group: ModelNotificationGroup;
notifications?: number[]; notifications: number[];
} }
export interface ModelProfile { export interface ModelProfile {
created_at?: string; created_at: string;
id?: number; id: number;
login_ip?: string; login_ip: string;
password?: string; password: string;
updated_at?: string; updated_at: string;
username?: string; username: string;
} }
export interface ModelProfileForm { export interface ModelProfileForm {
new_password?: string; new_password: string;
new_username?: string; new_username: string;
original_password?: string; original_password: string;
} }
export interface ModelRule { export interface ModelRule {
/** 覆盖范围 RuleCoverAll/IgnoreAll */ /** 覆盖范围 RuleCoverAll/IgnoreAll */
cover?: number; cover: number;
/** 流量统计周期 */ /** 流量统计周期 */
cycle_interval?: number; cycle_interval?: number;
/** 流量统计的开始时间 */ /** 流量统计的开始时间 */
@@ -454,7 +422,7 @@ export interface ModelRule {
* net_all_speed、transfer_in、transfer_out、transfer_all、offline * net_all_speed、transfer_in、transfer_out、transfer_all、offline
* transfer_in_cycle、transfer_out_cycle、transfer_all_cycle * transfer_in_cycle、transfer_out_cycle、transfer_all_cycle
*/ */
type?: string; type: string;
} }
export interface ModelSensorTemperature { export interface ModelSensorTemperature {
@@ -463,27 +431,27 @@ export interface ModelSensorTemperature {
} }
export interface ModelServer { export interface ModelServer {
created_at?: string; created_at: string;
/** DDNS配置 */ /** DDNS配置 */
ddns_profiles?: number[]; ddns_profiles?: number[];
/** 展示排序,越大越靠前 */ /** 展示排序,越大越靠前 */
display_index?: number; display_index: number;
/** 启用DDNS */ /** 启用DDNS */
enable_ddns?: boolean; enable_ddns: boolean;
geoip?: ModelGeoIP; geoip: ModelGeoIP;
/** 对游客隐藏 */ /** 对游客隐藏 */
hide_for_guest?: boolean; hide_for_guest: boolean;
host?: ModelHost; host: ModelHost;
id?: number; id: number;
last_active?: string; last_active: string;
name?: string; name: string;
/** 管理员可见备注 */ /** 管理员可见备注 */
note?: string; note: string;
/** 公开备注 */ /** 公开备注 */
public_note?: string; public_note: string;
state?: ModelHostState; state: ModelHostState;
updated_at?: string; updated_at: string;
uuid?: string; uuid: string;
} }
export interface ModelServerForm { export interface ModelServerForm {
@@ -493,12 +461,12 @@ export interface ModelServerForm {
* 展示排序,越大越靠前 * 展示排序,越大越靠前
* @default 0 * @default 0
*/ */
display_index?: number; display_index: number;
/** 启用DDNS */ /** 启用DDNS */
enable_ddns?: boolean; enable_ddns?: boolean;
/** 对游客隐藏 */ /** 对游客隐藏 */
hide_for_guest?: boolean; hide_for_guest?: boolean;
name?: string; name: string;
/** 管理员可见备注 */ /** 管理员可见备注 */
note?: string; note?: string;
/** 公开备注 */ /** 公开备注 */
@@ -506,95 +474,95 @@ export interface ModelServerForm {
} }
export interface ModelServerGroup { export interface ModelServerGroup {
created_at?: string; created_at: string;
id?: number; id: number;
name?: string; name: string;
updated_at?: string; updated_at: string;
} }
export interface ModelServerGroupForm { export interface ModelServerGroupForm {
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
servers?: number[]; servers: number[];
} }
export interface ModelServerGroupResponseItem { export interface ModelServerGroupResponseItem {
group?: ModelServerGroup; group: ModelServerGroup;
servers?: number[]; servers: number[];
} }
export interface ModelService { export interface ModelService {
cover?: number; cover: number;
created_at?: string; created_at: string;
duration?: number; duration: number;
enable_show_in_service?: boolean; enable_show_in_service: boolean;
enable_trigger_task?: boolean; enable_trigger_task: boolean;
/** 失败时执行的触发任务id */ /** 失败时执行的触发任务id */
fail_trigger_tasks?: number[]; fail_trigger_tasks: number[];
id?: number; id: number;
latency_notify?: boolean; latency_notify: boolean;
max_latency?: number; max_latency: number;
min_latency?: number; min_latency: number;
name?: string; name: string;
/** 当前服务监控所属的通知组 ID */ /** 当前服务监控所属的通知组 ID */
notification_group_id?: number; notification_group_id: number;
notify?: boolean; notify: boolean;
/** 恢复时执行的触发任务id */ /** 恢复时执行的触发任务id */
recover_trigger_tasks?: number[]; recover_trigger_tasks: number[];
skip_servers?: Record<string, boolean>; skip_servers: Record<string, boolean>;
target?: string; target: string;
type?: number; type: number;
updated_at?: string; updated_at: string;
} }
export interface ModelServiceForm { export interface ModelServiceForm {
cover?: number; cover: number;
duration?: number; duration: number;
enable_show_in_service?: boolean; enable_show_in_service?: boolean;
enable_trigger_task?: boolean; enable_trigger_task?: boolean;
fail_trigger_tasks?: number[]; fail_trigger_tasks: number[];
latency_notify?: boolean; latency_notify?: boolean;
/** @default 0 */ /** @default 0 */
max_latency?: number; max_latency: number;
/** @default 0 */ /** @default 0 */
min_latency?: number; min_latency: number;
/** @minLength 1 */ /** @minLength 1 */
name?: string; name: string;
notification_group_id?: number; notification_group_id: number;
notify?: boolean; notify?: boolean;
recover_trigger_tasks?: number[]; recover_trigger_tasks: number[];
skip_servers?: Record<string, boolean>; skip_servers: Record<string, boolean>;
target?: string; target: string;
type?: number; type: number;
} }
export interface ModelServiceInfos { export interface ModelServiceInfos {
avg_delay?: number[]; avg_delay: number[];
created_at?: number[]; created_at: number[];
monitor_id?: number; monitor_id: number;
monitor_name?: string; monitor_name: string;
server_id?: number; server_id: number;
server_name?: string; server_name: string;
} }
export interface ModelServiceResponse { export interface ModelServiceResponse {
cycle_transfer_stats?: Record<string, ModelCycleTransferStats>; cycle_transfer_stats: Record<string, ModelCycleTransferStats>;
services?: Record<string, ModelServiceResponseItem>; services: Record<string, ModelServiceResponseItem>;
} }
export interface ModelServiceResponseItem { export interface ModelServiceResponseItem {
current_down?: number; current_down: number;
current_up?: number; current_up: number;
delay?: number[]; delay: number[];
down?: number[]; down: number[];
service?: ModelService; service: ModelService;
total_down?: number; total_down: number;
total_up?: number; total_up: number;
up?: number[]; up: number[];
} }
export interface ModelSettingForm { export interface ModelSettingForm {
cover?: number; cover: number;
custom_code?: string; custom_code?: string;
custom_code_dashboard?: string; custom_code_dashboard?: string;
custom_nameservers?: string; custom_nameservers?: string;
@@ -603,54 +571,88 @@ export interface ModelSettingForm {
ignored_ip_notification?: string; ignored_ip_notification?: string;
install_host?: string; install_host?: string;
/** IP变更提醒的通知组 */ /** IP变更提醒的通知组 */
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; real_ip_header?: string;
/** @minLength 1 */ /** @minLength 1 */
site_name?: string; site_name: string;
tls?: boolean;
}
export interface ModelSettingResponse {
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;
/** 特定服务器IP多个服务器用逗号分隔 */
ignored_ip_notification: string;
/** [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内 */
ignored_ip_notification_server_ids: Record<string, boolean>;
install_host: string;
ip_change_notification_group_id: number;
jwt_secret_key: string;
/** 系统语言,默认 zh_CN */
language: string;
listen_port: number;
/** 时区,默认为 Asia/Shanghai */
location: string;
/** 真实IP */
real_ip_header: string;
site_name: string;
tls: boolean;
version: string;
} }
export interface ModelStreamServer { export interface ModelStreamServer {
country_code?: string; country_code: string;
/** 展示排序,越大越靠前 */ /** 展示排序,越大越靠前 */
display_index?: number; display_index: number;
host?: ModelHost; host: ModelHost;
id?: number; id: number;
last_active?: string; last_active: string;
name?: string; name: string;
/** 公开备注,只第一个数据包有值 */ /** 公开备注,只第一个数据包有值 */
public_note?: string; public_note: string;
state?: ModelHostState; state: ModelHostState;
} }
export interface ModelStreamServerData { export interface ModelStreamServerData {
now?: number; now: number;
servers?: ModelStreamServer[]; servers: ModelStreamServer[];
} }
export interface ModelTerminalForm { export interface ModelTerminalForm {
protocol?: string; protocol: string;
server_id?: number; server_id: number;
} }
export interface ModelUser { export interface ModelUser {
created_at?: string; created_at: string;
id?: number; id: number;
password?: string; password: string;
updated_at?: string; updated_at: string;
username?: string; username: string;
} }
export interface ModelUserForm { export interface ModelUserForm {
password?: string; password: string;
username?: string; username: string;
} }
export interface ModelWAFApiMock { export interface ModelWAFApiMock {
count?: number; count: number;
ip?: string; ip: string;
last_block_reason?: number; last_block_reason: number;
last_block_timestamp?: number; last_block_timestamp: number;
} }