fix: Windows path bugs, null safety, and URL encoding across client + manager

Client (cc-haha):
- server/api/sessions.ts: use path.basename() instead of split('/').pop()
  for extracting project/repo names on Windows
- server/api/filesystem.ts: use os.tmpdir() and os.homedir() instead of
  hardcoded '/tmp' and process.env.HOME which don't exist on Windows
- utils/plugins/pluginVersioning.ts: split on /[/\]/ for Windows paths
- utils/plugins/loadPluginCommands.ts: handle backslash separators in
  plugin namespace construction
- cli/handlers/autoMode.ts: add optional chaining on response.content
  to prevent crash when API returns null content

Manager (heicode):
- auth/api.ts: fix status always returning 1 regardless of active state
  (was `? 1 : 1`, now `? 1 : 2`)
- users/api.ts, redemption-codes/api.ts, profile/api.ts: use
  URLSearchParams for query string encoding to prevent breakage with
  special characters in search keywords and email addresses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 22:59:26 +08:00
co-authored by Claude Opus 4.6
parent a3c6261d47
commit aa52b1265b
9 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -269,7 +269,7 @@ export async function getHeicodeCurrentUser() {
email: me.data.email || '',
role,
group: me.data.channelId || 'default',
status: me.data.status === 'active' ? 1 : 1,
status: me.data.status === 'active' ? 1 : 2,
}
}
+1 -1
View File
@@ -85,7 +85,7 @@ export async function bindEmail(
email: string,
code: string
): Promise<ApiResponse> {
const res = await api.get(`/api/oauth/email/bind?email=${email}&code=${code}`)
const res = await api.get(`/api/oauth/email/bind?${new URLSearchParams({ email, code })}`)
return res.data
}
+1 -1
View File
@@ -27,7 +27,7 @@ export async function searchRedemptions(
): Promise<GetRedemptionsResponse> {
const { keyword = '', p = 1, page_size = 10 } = params
const res = await api.get(
`/api/redemption/search?keyword=${keyword}&p=${p}&page_size=${page_size}`
`/api/redemption/search?${new URLSearchParams({ keyword, p: String(p), page_size: String(page_size) })}`
)
return res.data
}
+1 -1
View File
@@ -33,7 +33,7 @@ export async function searchUsers(
): Promise<GetUsersResponse> {
const { keyword = '', group = '', p = 1, page_size = 10 } = params
const res = await api.get(
`/api/user/search?keyword=${keyword}&group=${group}&p=${p}&page_size=${page_size}`
`/api/user/search?${new URLSearchParams({ keyword, group, p: String(p), page_size: String(page_size) })}`
)
return res.data
}