CherryHQ / CherryHQ/cherry-studio-app

[Bug]: user-agent的内容使得请求被cf拦截

Open
#369 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.8k
Forks
278
Avg merge
5h 10m
Merged PRs (30d)
385

Description

### 问题检查清单

- [x] 我明白 issue 是用于反馈和解决问题的,而不是用于在评论区抱怨的,并会尽可能提供详细信息以帮助解决问题。
- [x] 我的问题不在 [常见问题 FAQ](https://github.com/CherryHQ/cherry-studio-app/issues) 中。
- [x] 我已经查看了**置顶问题**,并搜索了现有的 [Open Issues](https://github.com/CherryHQ/cherry-studio-app/issues)、[Closed Issues](https://github.com/CherryHQ/cherry-studio-app/issues?q=is%3Aissue%20state%3Aclosed) 和 [Discussions](https://github.com/CherryHQ/cherry-studio-app/discussions),没有发现类似的问题或讨论。
- [x] 我已经填写了简短、清晰的标题,以便开发者在浏览问题列表时可以快速识别问题的大致内容。而不是"一个建议"、"卡住了"等。
- [x] 我已确认正在使用最新版本的 Cherry Studio。

### 平台

Android

### 设备型号

redmi torbo 3

### 系统版本

android 16

### 应用版本

v0.1.7

### Bug 描述

配置部分api网站(newapi网站)时,由于api网站使用cf且配置较为严格,由于存在user-agent的内容使得请求被拦截。

![Image](https://github.com/user-attachments/assets/03548bc1-c982-4dff-95d2-d2cfcd2873be)
![Image](https://github.com/user-attachments/assets/27c62204-36d3-46d5-9bce-17c8c98afa5a)

建议修改user-agent的内容为改为中性标识("Cherry-Studio/1.0")或者改为通用浏览器 UA("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.0"

### 复现步骤

![Image](https://github.com/user-attachments/assets/03548bc1-c982-4dff-95d2-d2cfcd2873be)
![Image](https://github.com/user-attachments/assets/27c62204-36d3-46d5-9bce-17c8c98afa5a)

### 预期行为

希望可以正常使用功能

### 相关日志输出

```shell

```

### 补充信息

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by locating where the Android app constructs request headers and sets the current User-Agent, then reproduce the request against the Cloudflare-protected newapi configuration. Done means the configured API request is no longer blocked for this case and the behavior is verified on the reported Android setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
mobile, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.