Skip to content

Commit

Permalink
feat: ✨ BingAI Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
adams549659584 committed May 3, 2023
0 parents commit b807e7b
Show file tree
Hide file tree
Showing 19 changed files with 1,223 additions and 0 deletions.
119 changes: 119 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build Go-Proxy-BingAI
on:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

linuxamd64build:
name: build amd64 version
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
- name: build linux amd64 version
run: |
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
- name: package
run: tar -zcvf go-proxy-bingai-linux-amd64.tar.gz go-proxy-bingai
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-linux-amd64.tar.gz
asset_name: go-proxy-bingai-linux-amd64.tar.gz
asset_content_type: application/gzip

linuxarm64build:
name: build arm64 version
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
- name: build linux arm64 version
run: |
go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go
- name: package
run: tar -zcvf go-proxy-bingai-linux-arm64.tar.gz go-proxy-bingai
- name: upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: go-proxy-bingai-linux-arm64.tar.gz
asset_name: go-proxy-bingai-linux-arm64.tar.gz
asset_content_type: application/gzip

docker-build:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v3

- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
docker.io/${{ github.repository }}:${{ github.ref_name }}
docker.io/${{ github.repository }}:latest
cache-from: type=registry,ref=${{ github.repository }}:cache
cache-to: type=registry,ref=${{ github.repository }}:cache,mode=max
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
}
]
}
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# go-proxy-bing

一个用 GO 写的微软 Bing AI 的代理服务。 使用微软原始页面简单定制,基本兼容微软 Bing AI 所有功能。

- 电脑端已登录状态

![电脑已登录](./docs/img/1.png)

- 电脑端未登录状态

![电脑未登录](./docs/img/2.png)

- 手机端已登录状态

![手机已登录](./docs/img/3.png)

- 手机端未登录状态

![手机未登录](./docs/img/4.png)

### 演示站点:

> 甲骨文小鸡仔,轻虐
- https://bing.vcanbb.top

### 获取cookies

- 访问 https://www.bing.com/https://cn.bing.com/ ,登录

- F12 或 Ctrl + Shift + I 打开控制台

- 拿到 Cookie 后,在网站设置用户Cookie弹窗填入即可。

![获取Cookie](./docs/img/5.png)

### 部署

> 需 https 域名
- docker 部署 , 参考 [Dockerfile](./docker/Dockerfile)[docker-compose.yml](./docker/docker-compose.yml)
11 changes: 11 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:alpine AS builder
WORKDIR /app
COPY . .
RUN go build -ldflags="-s -w" -tags netgo -trimpath -o go-proxy-bingai main.go

FROM alpine
WORKDIR /app
COPY --from=builder /app/go-proxy-bingai .

EXPOSE 8080
CMD ["/app/go-proxy-bingai"]
33 changes: 33 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3'

services:
go-proxy-bingai:
# 镜像名称
image: adams549659584/go-proxy-bingai
# 容器名称
container_name: go-proxy-bingai
# 自启动
restart: unless-stopped
ports:
- 8080:8080

# go-proxy-bingai:
# # 镜像名称
# image: adams549659584/go-proxy-bingai
# # 容器名称
# container_name: go-proxy-bingai
# build:
# context: ../
# dockerfile: docker/Dockerfile
# # 自启动
# restart: unless-stopped
# # 加入指定网络
# networks:
# - MyNetwork
# ports:
# - 8888:8080

# networks:
# MyNetwork:
# external: true

Binary file added docs/img/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module adams549659584/go-proxy-bingai

go 1.20

require github.com/andybalholm/brotli v1.0.5
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
Loading

0 comments on commit b807e7b

Please sign in to comment.