implement setting page (#12)

This commit is contained in:
UUBulb
2024-11-23 21:59:48 +08:00
committed by GitHub
parent 34b7a67ab0
commit b474400649
21 changed files with 941 additions and 36 deletions

View File

@@ -75,6 +75,12 @@ export interface GithubComNaibaNezhaModelCommonResponseArrayModelUser {
success: boolean;
}
export interface GithubComNaibaNezhaModelCommonResponseArrayModelWAF {
data: ModelWAF[];
error: string;
success: boolean;
}
export interface GithubComNaibaNezhaModelCommonResponseArrayString {
data: string[];
error: string;
@@ -105,14 +111,14 @@ export interface GithubComNaibaNezhaModelCommonResponseModelLoginResponse {
success: boolean;
}
export interface GithubComNaibaNezhaModelCommonResponseModelServiceResponse {
data: ModelServiceResponse;
export interface GithubComNaibaNezhaModelCommonResponseModelProfile {
data: ModelProfile;
error: string;
success: boolean;
}
export interface GithubComNaibaNezhaModelCommonResponseModelUser {
data: ModelUser;
export interface GithubComNaibaNezhaModelCommonResponseModelServiceResponse {
data: ModelServiceResponse;
error: string;
success: boolean;
}
@@ -408,6 +414,15 @@ export interface ModelNotificationGroupResponseItem {
notifications: number[];
}
export interface ModelProfile {
created_at: string;
id: number;
login_ip: string;
password: string;
updated_at: string;
username: string;
}
export interface ModelRule {
/** 覆盖范围 RuleCoverAll/IgnoreAll */
cover: number;
@@ -583,7 +598,11 @@ export interface ModelSettingForm {
install_host?: string;
/** IP变更提醒的通知组 */
ip_change_notification_group_id: number;
/** @minLength 2 */
language: string;
/** 真实IP */
real_ip_header?: string;
/** @minLength 1 */
site_name: string;
}
@@ -621,3 +640,10 @@ export interface ModelUserForm {
password: string;
username: string;
}
export interface ModelWAF {
count: number;
ip: number[];
last_block_reason: number;
last_block_timestamp: number;
}

View File

@@ -1,7 +1,7 @@
import { ModelUser } from "@/types";
import { ModelProfile } from "@/types";
export interface AuthContextProps {
profile: ModelUser | undefined;
profile: ModelProfile | undefined;
login: (username: string, password: string) => void;
logout: () => void;
}

View File

@@ -11,3 +11,4 @@ export * from './alert-rule';
export * from './notificationStore';
export * from './notificationContext';
export * from './fm';
export * from './settings';

View File

@@ -1,6 +1,6 @@
import { ModelUser } from "@/types";
import { ModelProfile } from "@/types";
export interface MainStore {
profile: ModelUser | undefined;
setProfile: (profile: ModelUser | undefined) => void;
profile: ModelProfile | undefined;
setProfile: (profile: ModelProfile | undefined) => void;
}

16
src/types/settings.ts Normal file
View File

@@ -0,0 +1,16 @@
export const settingCoverageTypes: Record<number, string> = {
1: "All excludes specific servers",
2: "Only specific servers",
}
export const nezhaLang: Record<string, string> = {
"zh_CN": "简体中文(中国大陆)",
"zh_TW": "正體中文(台灣)",
"en_US": "English",
}
export const wafBlockReasons: Record<number, string> = {
1: "Login failed",
2: "Brute-force attacking token",
3: "Brute-force attacking Agent secret",
}