feat: build licensed desktop image processor

This commit is contained in:
2026-08-26 07:26:35 +08:00
parent 6ff3d71921
commit 1f31424015
32 changed files with 6515 additions and 2 deletions
+15
View File
@@ -0,0 +1,15 @@
const DESKTOP_CLIENT_ID = 'genuine-qingquwang'
const VISIBLE_ASCII = /^[\x20-\x7E]+$/
export function buildDesktopRequestHeaders(version: string): Record<string, string> {
const clientHeader = `${DESKTOP_CLIENT_ID}/${version}`
// Fetch 请求头必须是 ByteString,禁止中文等非 ASCII 字符在发请求前触发异常。
if (!VISIBLE_ASCII.test(clientHeader)) {
throw new Error('桌面客户端版本标识必须使用 ASCII 字符')
}
return {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Desktop-Client': clientHeader,
}
}