| 160 | } |
| 161 | |
| 162 | export async function loadFingerprint(sessionBase, type = 'desktop') { |
| 163 | const fpFile = path.join(sessionBase, `session_fingerprint_${type}.json`) |
| 164 | |
| 165 | if (!fs.existsSync(fpFile)) { |
| 166 | return null |
| 167 | } |
| 168 | |
| 169 | try { |
| 170 | const content = await fs.promises.readFile(fpFile, 'utf8') |
| 171 | return JSON.parse(content) |
| 172 | } catch (error) { |
| 173 | log('WARN', `从以下位置加载指纹失败: ${fpFile}`) |
| 174 | log('WARN', `错误: ${error.message}`) |
| 175 | return null |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | export function getUserAgent(fingerprint) { |
| 180 | if (!fingerprint) return null |