mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-06 03:53:50 +08:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
a499ad0c43
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
@ -1,35 +1,30 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [created]
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
releases-matrix:
|
goreleaser:
|
||||||
name: Release Go Binary
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64, darwin/arm64
|
|
||||||
goos: [linux, windows, darwin]
|
|
||||||
goarch: ["386", amd64, arm, arm64]
|
|
||||||
exclude:
|
|
||||||
- goos: darwin
|
|
||||||
goarch: arm
|
|
||||||
- goos: darwin
|
|
||||||
goarch: "386"
|
|
||||||
- goos: windows
|
|
||||||
goarch: arm64
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
-
|
||||||
- name: Set RELEASE_VERSION env
|
name: Checkout
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
uses: actions/checkout@v2.3.4
|
||||||
- uses: pcrbot/go-release-action@master
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: 0
|
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
fetch-depth: 0
|
||||||
goos: ${{ matrix.goos }}
|
|
||||||
goarch: ${{ matrix.goarch }}
|
-
|
||||||
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
|
name: Set up Go
|
||||||
build_flags: -trimpath
|
uses: actions/setup-go@v2
|
||||||
ldflags: -w -s
|
with:
|
||||||
|
go-version: '1.16.2'
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v2
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release --rm-dist
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
58
.goreleaser.yml
Normal file
58
.goreleaser.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
env:
|
||||||
|
- GO111MODULE=on
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GO111MODULE=on
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
goarch:
|
||||||
|
- 386
|
||||||
|
- amd64
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
ignore:
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm
|
||||||
|
- goos: darwin
|
||||||
|
goarch: 386
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
|
flags:
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X github.com/Mrs4s/go-cqhttp/coolq.Version=v{{.Version}}
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: '{{ .ProjectName }}_checksums.txt'
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^docs:'
|
||||||
|
- '^test:'
|
||||||
|
- fix typo
|
||||||
|
- Merge pull request
|
||||||
|
- Merge branch
|
||||||
|
- Merge remote-tracking
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
|
||||||
|
nfpms:
|
||||||
|
- license: AGPL 3.0
|
||||||
|
homepage: https://go-cqhttp.org
|
||||||
|
file_name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
|
||||||
|
formats:
|
||||||
|
- deb
|
||||||
|
- rpm
|
@ -28,6 +28,9 @@ import (
|
|||||||
var Version = "unknown"
|
var Version = "unknown"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
if Version != "unknown" {
|
||||||
|
return
|
||||||
|
}
|
||||||
info, ok := debug.ReadBuildInfo()
|
info, ok := debug.ReadBuildInfo()
|
||||||
if ok {
|
if ok {
|
||||||
Version = info.Main.Version
|
Version = info.Main.Version
|
||||||
|
@ -173,7 +173,7 @@ type JSONConfig struct {
|
|||||||
UseSSOAddress bool `json:"use_sso_address"`
|
UseSSOAddress bool `json:"use_sso_address"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
LogLevel string `json:"log_level"`
|
LogLevel string `json:"log_level"`
|
||||||
WebUI *GoCQWebUI `json:"web_ui"`
|
// WebUI *GoCQWebUI `json:"web_ui"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CQHTTPAPIConfig HTTPAPI对应的Config结构体
|
// CQHTTPAPIConfig HTTPAPI对应的Config结构体
|
||||||
@ -221,6 +221,7 @@ type GoCQReverseWebSocketConfig struct {
|
|||||||
ReverseReconnectInterval uint16 `json:"reverse_reconnect_interval"`
|
ReverseReconnectInterval uint16 `json:"reverse_reconnect_interval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// GoCQWebUI WebUI对应Config结构体
|
// GoCQWebUI WebUI对应Config结构体
|
||||||
type GoCQWebUI struct {
|
type GoCQWebUI struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
@ -228,6 +229,7 @@ type GoCQWebUI struct {
|
|||||||
WebUIPort uint64 `json:"web_ui_port"`
|
WebUIPort uint64 `json:"web_ui_port"`
|
||||||
WebInput bool `json:"web_input"`
|
WebInput bool `json:"web_input"`
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// DefaultConfig 返回一份默认配置对应结构体
|
// DefaultConfig 返回一份默认配置对应结构体
|
||||||
func DefaultConfig() *JSONConfig {
|
func DefaultConfig() *JSONConfig {
|
||||||
@ -273,12 +275,6 @@ func DefaultConfig() *JSONConfig {
|
|||||||
ReverseReconnectInterval: 3000,
|
ReverseReconnectInterval: 3000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
WebUI: &GoCQWebUI{
|
|
||||||
Enabled: true,
|
|
||||||
Host: "127.0.0.1",
|
|
||||||
WebInput: false,
|
|
||||||
WebUIPort: 9999,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
main.go
12
main.go
@ -180,9 +180,11 @@ func main() {
|
|||||||
log.Warnf("已开启Debug模式.")
|
log.Warnf("已开启Debug模式.")
|
||||||
log.Debugf("开发交流群: 192548878")
|
log.Debugf("开发交流群: 192548878")
|
||||||
server.Debug = true
|
server.Debug = true
|
||||||
if conf.WebUI == nil || !conf.WebUI.Enabled {
|
/*
|
||||||
log.Warnf("警告: 在Debug模式下未启用WebUi服务, 将无法进行性能分析.")
|
if conf.WebUI == nil || !conf.WebUI.Enabled {
|
||||||
}
|
log.Warnf("警告: 在Debug模式下未启用WebUi服务, 将无法进行性能分析.")
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
log.Info("用户交流群: 721829413")
|
log.Info("用户交流群: 721829413")
|
||||||
if !global.PathExists("device.json") {
|
if !global.PathExists("device.json") {
|
||||||
@ -311,7 +313,7 @@ func main() {
|
|||||||
global.Proxy = conf.ProxyRewrite
|
global.Proxy = conf.ProxyRewrite
|
||||||
// b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUI.Host, conf.WebUI.WebUIPort), cli)
|
// b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUI.Host, conf.WebUI.WebUIPort), cli)
|
||||||
// c := server.Console
|
// c := server.Console
|
||||||
isQRCodeLogin := conf.Uin == 0 || len(conf.Password) == 0
|
isQRCodeLogin := (conf.Uin == 0 || len(conf.Password) == 0) && len(conf.PasswordEncrypted) == 0
|
||||||
if !isQRCodeLogin {
|
if !isQRCodeLogin {
|
||||||
if err := commonLogin(); err != nil {
|
if err := commonLogin(); err != nil {
|
||||||
log.Fatalf("登录时发生致命错误: %v", err)
|
log.Fatalf("登录时发生致命错误: %v", err)
|
||||||
@ -442,7 +444,7 @@ func OldPasswordDecrypt(encryptedPassword string, key []byte) string {
|
|||||||
|
|
||||||
func checkUpdate() {
|
func checkUpdate() {
|
||||||
log.Infof("正在检查更新.")
|
log.Infof("正在检查更新.")
|
||||||
if coolq.Version == "unknown" {
|
if coolq.Version == "(devel)" {
|
||||||
log.Warnf("检查更新失败: 使用的 Actions 测试版或自编译版本.")
|
log.Warnf("检查更新失败: 使用的 Actions 测试版或自编译版本.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user