4 Commits
Author SHA1 Message Date
zimonianhua 476e42b919 fix(channel): 增加HTTP客户端超时时间并改进SOCKS5代理处理
Publish Docker image (amd64) / Push Docker image to multiple registries (push) Has been cancelled
Publish Docker image (arm64) / Push Docker image to multiple registries (push) Has been cancelled
Linux Release / release (push) Has been cancelled
macOS Release / release (push) Has been cancelled
Windows Release / release (push) Has been cancelled
- 将Telegram和微信企业号通道的HTTP客户端超时统一延长至30秒,避免因网络延迟导致请求失败
- 修复SOCKS5代理连接未正确处理上下文取消的问题,现在支持带认证的SOCKS5代理
- 当无法获取默认HTTP传输时,提供完整的传输配置而非空结构
2026-02-11 11:25:42 +08:00
zimonianhua f395e4c951 build: 将 Docker 镜像源从 justsong 更改为 zimonianhua
更新 docker-compose.yml 和 GitHub Actions 工作流文件中的镜像名称,以使用新的镜像仓库源。
2026-02-11 10:16:21 +08:00
zimonianhua 52b9439a14 build: 升级 Node.js 版本至 18 并启用 corepack
- 将 Docker 基础镜像从 node:16 升级至 node:18。
- 在 Dockerfile 中启用 corepack 并准备指定版本的 yarn。
- 更新所有 GitHub Actions 工作流中的 node-version 为 18。
2026-02-11 10:09:40 +08:00
zimonianhua 3044db38bb ci: 改进版本信息获取以支持无标签提交
修改所有 GitHub Actions 工作流,在检出代码时获取完整历史记录和标签,并将 `git describe` 命令统一添加 `--always` 参数,确保在无标签的提交上也能生成有效的版本信息。
2026-02-11 09:58:46 +08:00
10 changed files with 70 additions and 28 deletions
+5 -2
View File
@@ -19,10 +19,13 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Save version info
run: |
git describe --tags > VERSION
git describe --tags --always > VERSION
- name: Log in to Docker Hub
uses: docker/login-action@v2
@@ -42,7 +45,7 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
justsong/message-pusher
zimonianhua/message-pusher
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
+5 -2
View File
@@ -19,10 +19,13 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Save version info
run: |
git describe --tags > VERSION
git describe --tags --always > VERSION
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
@@ -48,7 +51,7 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
justsong/message-pusher
zimonianhua/message-pusher
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
+4 -4
View File
@@ -16,14 +16,14 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build Frontend
env:
CI: ""
run: |
cd web
npm install
REACT_APP_VERSION=$(git describe --tags) npm run build
REACT_APP_VERSION=$(git describe --tags --always) npm run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
@@ -32,12 +32,12 @@ jobs:
- name: Build Backend (amd64)
run: |
go mod download
go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags)' -extldflags '-static'" -o message-pusher
go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags --always)' -extldflags '-static'" -o message-pusher
- name: Build Backend (arm64)
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags)' -extldflags '-static'" -o message-pusher-arm64
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags --always)' -extldflags '-static'" -o message-pusher-arm64
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
+3 -3
View File
@@ -16,14 +16,14 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build Frontend
env:
CI: ""
run: |
cd web
npm install
REACT_APP_VERSION=$(git describe --tags) npm run build
REACT_APP_VERSION=$(git describe --tags --always) npm run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
@@ -32,7 +32,7 @@ jobs:
- name: Build Backend
run: |
go mod download
go build -ldflags "-X 'message-pusher/common.Version=$(git describe --tags)'" -o message-pusher-macos
go build -ldflags "-X 'message-pusher/common.Version=$(git describe --tags --always)'" -o message-pusher-macos
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
+3 -3
View File
@@ -19,14 +19,14 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build Frontend
env:
CI: ""
run: |
cd web
npm install
REACT_APP_VERSION=$(git describe --tags) npm run build
REACT_APP_VERSION=$(git describe --tags --always) npm run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
@@ -35,7 +35,7 @@ jobs:
- name: Build Backend
run: |
go mod download
go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags)'" -o message-pusher.exe
go build -ldflags "-s -w -X 'message-pusher/common.Version=$(git describe --tags --always)'" -o message-pusher.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
+2 -1
View File
@@ -1,8 +1,9 @@
FROM node:16 as builder
FROM node:18 AS builder
WORKDIR /build
COPY ./web .
COPY ./VERSION .
RUN corepack enable && corepack prepare yarn@1.22.22 --activate
RUN yarn install
RUN REACT_APP_VERSION=$(cat VERSION) yarn build
+40 -5
View File
@@ -26,7 +26,17 @@ func newHTTPClient(proxyAddress string, timeout time.Duration) (*http.Client, er
func newHTTPTransport(proxyAddress string) (*http.Transport, error) {
base, ok := http.DefaultTransport.(*http.Transport)
if !ok {
return &http.Transport{}, nil
return &http.Transport{
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
}, nil
}
transport := base.Clone()
proxyAddress = strings.TrimSpace(proxyAddress)
@@ -46,15 +56,40 @@ func newHTTPTransport(proxyAddress string) (*http.Transport, error) {
transport.Proxy = http.ProxyURL(u)
return transport, nil
case "socks5", "socks5h":
normalized := *u
normalized.Scheme = "socks5"
dialer, err := proxy.FromURL(&normalized, proxy.Direct)
var auth *proxy.Auth
if u.User != nil {
auth = &proxy.Auth{
User: u.User.Username(),
Password: "",
}
if password, ok := u.User.Password(); ok {
auth.Password = password
}
}
dialer, err := proxy.SOCKS5("tcp", u.Host, auth, &net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 30 * time.Second,
})
if err != nil {
return nil, err
}
transport.Proxy = nil
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
return dialer.Dial(network, addr)
type dialResult struct {
conn net.Conn
err error
}
ch := make(chan dialResult, 1)
go func() {
conn, err := dialer.Dial(network, addr)
ch <- dialResult{conn: conn, err: err}
}()
select {
case <-ctx.Done():
return nil, ctx.Err()
case r := <-ch:
return r.conn, r.err
}
}
return transport, nil
default:
+1 -1
View File
@@ -25,7 +25,7 @@ type telegramMessageResponse struct {
func SendTelegramMessage(message *model.Message, user *model.User, channel_ *model.Channel) error {
// https://core.telegram.org/bots/api#sendmessage
client, err := newHTTPClient(channel_.URL, 10*time.Second)
client, err := newHTTPClient(channel_.URL, 30*time.Second)
if err != nil {
return err
}
+2 -2
View File
@@ -49,7 +49,7 @@ func (i *WeChatCorpAccountTokenStoreItem) Token() string {
func (i *WeChatCorpAccountTokenStoreItem) Refresh() {
// https://work.weixin.qq.com/api/doc/90000/90135/91039
client, err := newHTTPClient(i.Proxy, 5*time.Second)
client, err := newHTTPClient(i.Proxy, 30*time.Second)
if err != nil {
common.SysError("failed to create http client: " + err.Error())
return
@@ -159,7 +159,7 @@ func SendWeChatCorpMessage(message *model.Message, user *model.User, channel_ *m
Proxy: proxyAddress,
}
accessToken := TokenStoreGetToken(tokenItem.Key())
client, err := newHTTPClient(proxyAddress, 10*time.Second)
client, err := newHTTPClient(proxyAddress, 30*time.Second)
if err != nil {
return err
}
+1 -1
View File
@@ -2,7 +2,7 @@ version: "3"
services:
message-pusher:
image: justsong/message-pusher
image: zimonianhua/message-pusher
restart: unless-stopped
ports:
- 3000:3000