mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-01 16:00:07 +00:00
feat: refactor auth and xpack integration
This commit is contained in:
committed by
zhengkunwang223
parent
69906046e8
commit
a917ca00a1
@@ -92,6 +92,11 @@ class RequestHttp {
|
||||
window.location.reload();
|
||||
return Promise.reject(data);
|
||||
}
|
||||
if (data.code == ResultEnum.ERRXPACKEE) {
|
||||
globalStore.isXpackEELicensed = false;
|
||||
router.push({ name: 'XpackEELicenseRequired' });
|
||||
return Promise.reject(data);
|
||||
}
|
||||
if (data.code == ResultEnum.NodeUnBind) {
|
||||
changeToLocal();
|
||||
window.location.reload();
|
||||
|
||||
@@ -47,6 +47,44 @@ export namespace AI {
|
||||
migMode: string;
|
||||
processes: Process[];
|
||||
}
|
||||
export interface MonitorGPUSearch {
|
||||
productName: string;
|
||||
startTime: Date;
|
||||
endTime: Date;
|
||||
}
|
||||
export interface MonitorGPUOptions {
|
||||
gpuType: string;
|
||||
options: Array<string>;
|
||||
chartHide: Array<ChartHide>;
|
||||
}
|
||||
export interface ChartHide {
|
||||
productName: string;
|
||||
process: boolean;
|
||||
gpu: boolean;
|
||||
memory: boolean;
|
||||
power: boolean;
|
||||
temperature: boolean;
|
||||
speed: boolean;
|
||||
}
|
||||
export interface MonitorGPUData {
|
||||
date: Array<Date>;
|
||||
gpuValue: Array<number>;
|
||||
temperatureValue: Array<number>;
|
||||
powerTotal: Array<number>;
|
||||
powerUsed: Array<number>;
|
||||
powerPercent: Array<number>;
|
||||
memoryTotal: Array<number>;
|
||||
memoryUsed: Array<number>;
|
||||
memoryPercent: Array<number>;
|
||||
speedValue: Array<number>;
|
||||
gpuProcesses: Array<Array<GPUProcess>>;
|
||||
}
|
||||
export interface GPUProcess {
|
||||
pid: string;
|
||||
type: string;
|
||||
processName: string;
|
||||
usedMemory: string;
|
||||
}
|
||||
export interface Process {
|
||||
pid: string;
|
||||
type: string;
|
||||
|
||||
@@ -48,15 +48,46 @@ export namespace Login {
|
||||
export interface AuthInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
sessionTimeout: number;
|
||||
expirationDays: number;
|
||||
expirationTime: string;
|
||||
mfaStatus: string;
|
||||
mfaInterval: number;
|
||||
role: string;
|
||||
permissions: string[];
|
||||
nodeScopes: number[];
|
||||
nodeRoles: Array<{ nodeId: number; nodeName: string; roleId: number; roleName: string }>;
|
||||
|
||||
apiInterfaceStatus: string;
|
||||
apiKey: string;
|
||||
ipWhiteList: string;
|
||||
apiKeyValidityTime: number;
|
||||
}
|
||||
export interface AuthInfoUpdate {
|
||||
id: number;
|
||||
name: string;
|
||||
password: string;
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
retryPassword: string;
|
||||
sessionTimeout: number;
|
||||
expirationDays: number;
|
||||
expirationTime: string;
|
||||
}
|
||||
export interface MFARequest {
|
||||
title: string;
|
||||
interval: number;
|
||||
}
|
||||
export interface MFAInfo {
|
||||
secret: string;
|
||||
qrImage: string;
|
||||
}
|
||||
export interface MFABind {
|
||||
secret: string;
|
||||
code: string;
|
||||
interval: string;
|
||||
}
|
||||
export interface ApiConfig {
|
||||
apiInterfaceStatus: string;
|
||||
apiKey: string;
|
||||
ipWhiteList: string;
|
||||
apiKeyValidityTime: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,45 +160,6 @@ export namespace Host {
|
||||
endTime: Date;
|
||||
}
|
||||
|
||||
export interface MonitorGPUSearch {
|
||||
productName: string;
|
||||
startTime: Date;
|
||||
endTime: Date;
|
||||
}
|
||||
export interface MonitorGPUOptions {
|
||||
gpuType: string;
|
||||
options: Array<string>;
|
||||
chartHide: Array<ChartHide>;
|
||||
}
|
||||
export interface ChartHide {
|
||||
productName: string;
|
||||
process: boolean;
|
||||
gpu: boolean;
|
||||
memory: boolean;
|
||||
power: boolean;
|
||||
temperature: boolean;
|
||||
speed: boolean;
|
||||
}
|
||||
export interface MonitorGPUData {
|
||||
date: Array<Date>;
|
||||
gpuValue: Array<number>;
|
||||
temperatureValue: Array<number>;
|
||||
powerTotal: Array<number>;
|
||||
powerUsed: Array<number>;
|
||||
powerPercent: Array<number>;
|
||||
memoryTotal: Array<number>;
|
||||
memoryUsed: Array<number>;
|
||||
memoryPercent: Array<number>;
|
||||
speedValue: Array<number>;
|
||||
gpuProcesses: Array<Array<GPUProcess>>;
|
||||
}
|
||||
export interface GPUProcess {
|
||||
pid: string;
|
||||
type: string;
|
||||
processName: string;
|
||||
usedMemory: string;
|
||||
}
|
||||
|
||||
export interface SSHInfo {
|
||||
autoStart: boolean;
|
||||
isActive: boolean;
|
||||
|
||||
@@ -1,32 +1,44 @@
|
||||
import { DateTimeFormats } from '@intlify/core-base';
|
||||
|
||||
export namespace Setting {
|
||||
export interface SettingInfo {
|
||||
userName: string;
|
||||
password: string;
|
||||
email: string;
|
||||
systemIP: string;
|
||||
systemVersion: string;
|
||||
upgradeBackupCopies: string;
|
||||
export interface AgentSettingInfo {
|
||||
dockerSockPath: string;
|
||||
developerMode: string;
|
||||
systemVersion: string;
|
||||
systemIP: string;
|
||||
|
||||
sessionTimeout: number;
|
||||
localTime: string;
|
||||
timeZone: string;
|
||||
ntpSite: string;
|
||||
|
||||
defaultNetwork: string;
|
||||
defaultIO: string;
|
||||
lastCleanTime: string;
|
||||
lastCleanSize: string;
|
||||
lastCleanData: string;
|
||||
|
||||
monitorStatus: string;
|
||||
monitorInterval: string;
|
||||
monitorStoreDays: string;
|
||||
|
||||
appStoreVersion: string;
|
||||
appStoreLastModified: string;
|
||||
appStoreSyncStatus: string;
|
||||
|
||||
fileRecycleBin: string;
|
||||
}
|
||||
export interface SettingInfo {
|
||||
systemVersion: string;
|
||||
upgradeBackupCopies: string;
|
||||
developerMode: string;
|
||||
|
||||
sessionTimeout: number;
|
||||
|
||||
panelName: string;
|
||||
edition: string;
|
||||
theme: string;
|
||||
menuTabs: string;
|
||||
language: string;
|
||||
docSource: string;
|
||||
defaultIO: string;
|
||||
defaultNetwork: string;
|
||||
lastCleanTime: string;
|
||||
lastCleanSize: string;
|
||||
lastCleanData: string;
|
||||
|
||||
serverPort: number;
|
||||
ipv6: string;
|
||||
@@ -39,16 +51,7 @@ export namespace Setting {
|
||||
securityEntrance: string;
|
||||
dashboardMemoVisible: string;
|
||||
dashboardSimpleNodeVisible: string;
|
||||
expirationDays: number;
|
||||
expirationTime: string;
|
||||
complexityVerification: string;
|
||||
mfaStatus: string;
|
||||
mfaSecret: string;
|
||||
mfaInterval: string;
|
||||
|
||||
monitorStatus: string;
|
||||
monitorInterval: number;
|
||||
monitorStoreDays: number;
|
||||
|
||||
messageType: string;
|
||||
emailVars: string;
|
||||
@@ -64,11 +67,31 @@ export namespace Setting {
|
||||
proxyUser: string;
|
||||
proxyPasswd: string;
|
||||
proxyPasswdKeep: string;
|
||||
}
|
||||
export interface SettingBaseInfo {
|
||||
systemVersion: string;
|
||||
developerMode: string;
|
||||
upgradeBackupCopies: string;
|
||||
|
||||
apiInterfaceStatus: string;
|
||||
apiKey: string;
|
||||
ipWhiteList: string;
|
||||
apiKeyValidityTime: number;
|
||||
port: string;
|
||||
ipv6: string;
|
||||
bindAddress: string;
|
||||
panelName: string;
|
||||
edition: string;
|
||||
theme: string;
|
||||
menuTabs: string;
|
||||
language: string;
|
||||
hideMenu: string;
|
||||
docSource: string;
|
||||
|
||||
serverPort: string;
|
||||
securityEntrance: string;
|
||||
complexityVerification: string;
|
||||
noAuthSetting: string;
|
||||
proxyType: string;
|
||||
|
||||
dashboardMemoVisible: string;
|
||||
dashboardSimpleNodeVisible: string;
|
||||
}
|
||||
export interface TerminalInfo {
|
||||
lineHeight: string;
|
||||
@@ -113,12 +136,6 @@ export namespace Setting {
|
||||
proxyPasswdKeep: string;
|
||||
withDockerRestart: boolean;
|
||||
}
|
||||
export interface ApiConfig {
|
||||
apiInterfaceStatus: string;
|
||||
apiKey: string;
|
||||
ipWhiteList: string;
|
||||
apiKeyValidityTime: number;
|
||||
}
|
||||
export interface SSLUpdate {
|
||||
ssl: string;
|
||||
domain: string;
|
||||
@@ -142,19 +159,6 @@ export namespace Setting {
|
||||
export interface PortUpdate {
|
||||
serverPort: number;
|
||||
}
|
||||
export interface MFARequest {
|
||||
title: string;
|
||||
interval: number;
|
||||
}
|
||||
export interface MFAInfo {
|
||||
secret: string;
|
||||
qrImage: string;
|
||||
}
|
||||
export interface MFABind {
|
||||
secret: string;
|
||||
code: string;
|
||||
interval: string;
|
||||
}
|
||||
export interface PasskeyRegisterRequest {
|
||||
name: string;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ export const closeOllamaModel = (name: string) => {
|
||||
return http.post(`/ai/ollama/close`, { name: name });
|
||||
};
|
||||
|
||||
export const loadGPUInfo = () => {
|
||||
return http.get<any>(`/ai/gpu/load`);
|
||||
};
|
||||
|
||||
export const bindDomain = (req: AI.BindDomain) => {
|
||||
return http.post(`/ai/domain/bind`, req);
|
||||
};
|
||||
@@ -42,6 +38,16 @@ export const updateBindDomain = (req: AI.BindDomain) => {
|
||||
return http.post(`/ai/domain/update`, req);
|
||||
};
|
||||
|
||||
export const loadGPUInfo = () => {
|
||||
return http.get<any>(`/ai/gpu/load`);
|
||||
};
|
||||
export const getGPUOptions = () => {
|
||||
return http.get<AI.MonitorGPUOptions>(`/ai/gpu/options`);
|
||||
};
|
||||
export const loadGPUMonitor = (param: AI.MonitorGPUSearch) => {
|
||||
return http.post<AI.MonitorGPUData>(`/ai/gpu/monitor/search`, param);
|
||||
};
|
||||
|
||||
export const pageMcpServer = (req: AI.McpServerSearch) => {
|
||||
return http.post<ResPage<AI.McpServer>>(`/ai/mcp/search`, req);
|
||||
};
|
||||
|
||||
@@ -35,17 +35,44 @@ export const getWelcomePage = () => {
|
||||
return http.get<string>('/core/auth/welcome');
|
||||
};
|
||||
|
||||
export const getAuthInfo = () => {
|
||||
return http.get<Login.AuthInfo>('/core/xpackee/users/info');
|
||||
export const getUserInfo = () => {
|
||||
return http.get<Login.AuthInfo>('/core/auth/current');
|
||||
};
|
||||
export const updateAuthInfo = (params: Login.AuthInfoUpdate) => {
|
||||
export const loadMFA = (params: Login.MFARequest) => {
|
||||
return http.post<Login.MFAInfo>(`/core/auth/mfa`, params);
|
||||
};
|
||||
export const bindMFA = (params: Login.MFABind) => {
|
||||
return http.post(`/core/auth/mfa/bind`, params);
|
||||
};
|
||||
export const generateApiKey = () => {
|
||||
return http.post<string>(`/core/auth/api/generate`);
|
||||
};
|
||||
export const updateApiConfig = (param: Login.ApiConfig) => {
|
||||
return http.post(`/core/auth/api/update`, param);
|
||||
};
|
||||
|
||||
export const passkeyRegisterBegin = (param: { name: string }) => {
|
||||
return http.post<Login.PasskeyBeginResponse>(`/core/auth/passkey/register/begin`, param);
|
||||
};
|
||||
export const passkeyRegisterFinish = (param: Record<string, any>, sessionId: string) => {
|
||||
return http.post(`/core/auth/passkey/register/finish`, param, undefined, { 'Passkey-Session': sessionId });
|
||||
};
|
||||
export const passkeyList = () => {
|
||||
return http.get<Array<{ id: string; name: string; createdAt: string; lastUsedAt: string }>>(
|
||||
`/core/auth/passkey/list`,
|
||||
);
|
||||
};
|
||||
export const passkeyDelete = (id: string) => {
|
||||
return http.post(`/core/auth/passkey/del`, { id });
|
||||
};
|
||||
|
||||
export const updateUserInfo = (params: Login.AuthInfoUpdate) => {
|
||||
let request = deepCopy(params) as Login.AuthInfoUpdate;
|
||||
if (request.oldPassword) {
|
||||
request.oldPassword = Base64.encode(request.oldPassword);
|
||||
}
|
||||
if (request.newPassword) {
|
||||
request.newPassword = Base64.encode(request.newPassword);
|
||||
if (request.password) {
|
||||
request.password = Base64.encode(request.password);
|
||||
}
|
||||
request.retryPassword = '';
|
||||
return http.post<any>('/core/xpackee/users/info/update', request);
|
||||
return http.post<any>('/core/auth/current/update', request);
|
||||
};
|
||||
|
||||
@@ -65,12 +65,6 @@ export const operateFilterChain = (name: string, op: string) => {
|
||||
export const loadMonitor = (param: Host.MonitorSearch) => {
|
||||
return http.post<Array<Host.MonitorData>>(`/hosts/monitor/search`, param);
|
||||
};
|
||||
export const getGPUOptions = () => {
|
||||
return http.get<Host.MonitorGPUOptions>(`/hosts/monitor/gpuoptions`);
|
||||
};
|
||||
export const loadGPUMonitor = (param: Host.MonitorGPUSearch) => {
|
||||
return http.post<Host.MonitorGPUData>(`/hosts/monitor/gpu/search`, param);
|
||||
};
|
||||
export const getNetworkOptions = () => {
|
||||
return http.get<Array<string>>(`/hosts/monitor/netoptions`);
|
||||
};
|
||||
|
||||
@@ -81,8 +81,13 @@ export const loadDaemonJsonPath = () => {
|
||||
export const updateAgentSetting = (param: Setting.SettingUpdate) => {
|
||||
return http.post(`/settings/update`, param);
|
||||
};
|
||||
export const getAgentSettingInfo = () => {
|
||||
return http.post<Setting.SettingInfo>(`/settings/search`);
|
||||
export const getAgentSettingInfo = (currentNode?: string) => {
|
||||
return http.post<Setting.AgentSettingInfo>(
|
||||
`/settings/search`,
|
||||
{},
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const getAgentTerminalAIInfo = () => {
|
||||
return http.post<Setting.TerminalAIInfo>(`/settings/terminal/ai/search`);
|
||||
@@ -113,6 +118,9 @@ export const updateCommonDescription = (param: Setting.CommonDescription) => {
|
||||
export const getSettingInfo = () => {
|
||||
return http.post<Setting.SettingInfo>(`/core/settings/search`);
|
||||
};
|
||||
export const getSettingBaseInfo = () => {
|
||||
return http.post<Setting.SettingBaseInfo>(`/core/settings/search/base`);
|
||||
};
|
||||
export const getSettingBy = (key: string) => {
|
||||
return http.post<string>(`/core/settings/by`, { key: key });
|
||||
};
|
||||
@@ -164,24 +172,6 @@ export const downloadSSL = () => {
|
||||
export const handleExpired = (param: Setting.PasswordUpdate) => {
|
||||
return http.post(`/core/settings/expired/handle`, param);
|
||||
};
|
||||
export const loadMFA = (param: Setting.MFARequest) => {
|
||||
return http.post<Setting.MFAInfo>(`/core/settings/mfa`, param);
|
||||
};
|
||||
export const bindMFA = (param: Setting.MFABind) => {
|
||||
return http.post(`/core/settings/mfa/bind`, param);
|
||||
};
|
||||
export const passkeyRegisterBegin = (param: Setting.PasskeyRegisterRequest) => {
|
||||
return http.post<Setting.PasskeyBeginResponse>(`/core/settings/passkey/register/begin`, param);
|
||||
};
|
||||
export const passkeyRegisterFinish = (param: Record<string, any>, sessionId: string) => {
|
||||
return http.post(`/core/settings/passkey/register/finish`, param, undefined, { 'Passkey-Session': sessionId });
|
||||
};
|
||||
export const passkeyList = () => {
|
||||
return http.get<Array<Setting.PasskeyInfo>>(`/core/settings/passkey/list`);
|
||||
};
|
||||
export const passkeyDelete = (id: string) => {
|
||||
return http.delete(`/core/settings/passkey/${id}`);
|
||||
};
|
||||
export const getAppStoreConfig = (node?: string) => {
|
||||
const params = node ? `?operateNode=${node}` : '';
|
||||
return http.get<App.AppStoreConfig>(`/core/settings/apps/store/config${params}`);
|
||||
@@ -233,14 +223,6 @@ export const upgrade = (version: string) => {
|
||||
return http.post(`/core/settings/upgrade`, { version: version });
|
||||
};
|
||||
|
||||
// api config
|
||||
export const generateApiKey = () => {
|
||||
return http.post<string>(`/core/settings/api/config/generate/key`);
|
||||
};
|
||||
export const updateApiConfig = (param: Setting.ApiConfig) => {
|
||||
return http.post(`/core/settings/api/config/update`, param);
|
||||
};
|
||||
|
||||
// memo
|
||||
export const getMemo = () => {
|
||||
return http.get<string>(`/core/settings/memo`);
|
||||
|
||||
Reference in New Issue
Block a user