feat: refactor auth and xpack integration

This commit is contained in:
ssongliu
2026-05-21 12:32:52 +08:00
committed by zhengkunwang223
parent 69906046e8
commit a917ca00a1
175 changed files with 5676 additions and 3734 deletions
+10 -4
View File
@@ -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);
};
+34 -7
View File
@@ -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);
};
-6
View File
@@ -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`);
};
+10 -28
View File
@@ -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`);