Skip to content

Commit

Permalink
docs: 增加cf搭建反代教程
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Nov 29, 2024
1 parent 74df179 commit 3c8d02c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,37 @@ pnpm install --filter=steam-plugin

- QQ 群: [741577559](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=IvPaOVo_p-6n--FaLm1v39ML9EZaBRCm&authKey=YPs0p%2FRh8MGPQrWZgn99fk4kGB5PtRAoOYIUqK71FBsBYCDdekxCEHFFHnznpYA1&noverify=0&group_code=741577559)

## 使用cloudflare搭建反代 (连接不上steam情况下的备选)

### 1. 来自[@MapleLeaf2007](https://github.com/MapleLeaf2007) 的图文教程

[点我前往 地址: https://mapleleaf.icu/2024/11/29/CloudFlareReverseProxy/](https://mapleleaf.icu/2024/11/29/CloudFlareReverseProxy/)

### 2. 简易版

1. 需要`cloudflare账号`, 以及在`cf托管的域名`
2. 打开[Workers 和 Pages](https://dash.cloudflare.com/1e36e2833bb5f40af76d604e0894cb93/workers-and-pages), 点击`创建`, 然后点击`创建 Worker`
3. 名字随意, 可参考`api-steam` 然后点击`部署` 再点击`编辑代码`
4. 复制以下代码到编辑器, `覆盖`原内容, 然后点击`部署`, 出现`版本已保存`即可
```js
export default {
async fetch(request) {
const url = new URL(request.url)
url.hostname = "api.steampowered.com"
const newRequest = new Request(url, request)
return await fetch(newRequest)
}
}
```
5. 依次点击`左上角第3步填写的名字`, `设置`, `域和路由`右边的`添加`, `自定义域`, 然后填入你想设置的二级或多级域名, 比如`api.steam.example.com`, 然后点`添加域`
6. 测试(可选): 浏览器访问`https://api.steam.example.com/ISteamWebAPIUtil/GetServerInfo/v1/`, `api.steam.example.com`替换成第5步设置的域名, 如果能看到`servertime`字段, 说明配置成功
7. 对你的Bot发送`#steam设置api反代https://api.steam.example.com`, 域名替换成第5步设置的域名
8. store反代重复步骤2-6,把api换成store即可

### 注意事项

1. cloudflare的workers免费账户的请求数量限制10w次(总共)

## 贡献者

> 🌟 星光闪烁,你们的智慧如同璀璨的夜空。感谢所有为 **steam-plugin** 做出贡献的人!
Expand Down

0 comments on commit 3c8d02c

Please sign in to comment.