fix(auth): point account-store and token-store directly to ~/.config/hose-use

This commit is contained in:
gitea committed 2026-09-18 11:22:41 +08:00
1 parent c72f07f582
commit 8c444efc85
3 files changed
+14 -19

No files matched your search

+2 -2
View File
@@ -8,9 +8,9 @@ Core 层负责基础设施:企业配置管理、认证 Token 获取与缓存
src/core/
├── auth/ # 登录认证协议与凭证存储(纯凭据层)
│ ├── login.ts # 登录四矩阵(RSA账密登录、短信验证码、F12/cURL凭证导入、浏览器同步)
│ ├── account-store.ts # 多账号持久化存储 (~/.cache/ekb-mcp/accounts.json)
│ ├── account-store.ts # 多账号持久化存储 (~/.config/hose-use/accounts.json)
│ ├── tools.ts # MCP Auth Tools 注册与调度
│ ├── token-store.ts # 动态 Token 缓存(兼容 ~/.config/hose-use/tokens.json 与历史路径)
│ ├── token-store.ts # 动态 Token 缓存 (~/.config/hose-use/tokens.json)
│ └── types.ts
├── http/ # 统一 HTTP 客户端装配与网络传输(语义化客户端)
│ ├── factory.ts # Ky 底层客户端工厂(超时、重试、错误钩子)
+11 -5
View File
@@ -1,12 +1,12 @@
import { readFileSync, writeFileSync, mkdirSync } from "fs";
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import { join, dirname } from "path";
import { homedir } from "os";
import { z } from "zod";
const ACCOUNT_CACHE_PATH = join(
export const ACCOUNT_CACHE_PATH = join(
homedir(),
".cache",
"ekb-mcp",
".config",
"hose-use",
"accounts.json"
);
@@ -38,7 +38,13 @@ export type AccountEntry = z.infer<typeof AccountEntrySchema>;
export type AccountStore = z.infer<typeof AccountStoreSchema>;
function ensureDir(path: string): void {
mkdirSync(dirname(path), { recursive: true });
const dir = dirname(path);
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true, mode: 0o700 });
}
try {
chmodSync(dir, 0o700);
} catch {}
}
export function loadAccountStore(): AccountStore {
+1 -12
View File
@@ -10,20 +10,9 @@ export const PRIMARY_TOKEN_CACHE_PATH = join(
"tokens.json"
);
export const LEGACY_TOKEN_CACHE_PATH = join(
homedir(),
".cache",
"ekb-mcp",
"tokens.json"
);
export const TOKEN_CACHE_PATH = PRIMARY_TOKEN_CACHE_PATH;
function resolveTokenCachePath(): string {
if (existsSync(PRIMARY_TOKEN_CACHE_PATH)) {
return PRIMARY_TOKEN_CACHE_PATH;
}
if (existsSync(LEGACY_TOKEN_CACHE_PATH)) {
return LEGACY_TOKEN_CACHE_PATH;
}
return PRIMARY_TOKEN_CACHE_PATH;
}