1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 19:43:49 +08:00

Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
Ink33 2021-03-27 16:53:22 +08:00
commit a499ad0c43
No known key found for this signature in database
GPG Key ID: 5D8B1D036EFB0D2E
5 changed files with 95 additions and 41 deletions

View File

@ -1,35 +1,30 @@
name: release
on:
release:
types: [created]
push:
tags:
- 'v*'
jobs:
releases-matrix:
name: Release Go Binary
goreleaser:
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:
- uses: actions/checkout@v2
- name: Set RELEASE_VERSION env
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- uses: pcrbot/go-release-action@master
env:
CGO_ENABLED: 0
-
name: Checkout
uses: actions/checkout@v2.3.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
build_flags: -trimpath
ldflags: -w -s
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
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
View 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

View File

@ -28,6 +28,9 @@ import (
var Version = "unknown"
func init() {
if Version != "unknown" {
return
}
info, ok := debug.ReadBuildInfo()
if ok {
Version = info.Main.Version

View File

@ -173,7 +173,7 @@ type JSONConfig struct {
UseSSOAddress bool `json:"use_sso_address"`
Debug bool `json:"debug"`
LogLevel string `json:"log_level"`
WebUI *GoCQWebUI `json:"web_ui"`
// WebUI *GoCQWebUI `json:"web_ui"`
}
// CQHTTPAPIConfig HTTPAPI对应的Config结构体
@ -221,6 +221,7 @@ type GoCQReverseWebSocketConfig struct {
ReverseReconnectInterval uint16 `json:"reverse_reconnect_interval"`
}
/*
// GoCQWebUI WebUI对应Config结构体
type GoCQWebUI struct {
Enabled bool `json:"enabled"`
@ -228,6 +229,7 @@ type GoCQWebUI struct {
WebUIPort uint64 `json:"web_ui_port"`
WebInput bool `json:"web_input"`
}
*/
// DefaultConfig 返回一份默认配置对应结构体
func DefaultConfig() *JSONConfig {
@ -273,12 +275,6 @@ func DefaultConfig() *JSONConfig {
ReverseReconnectInterval: 3000,
},
},
WebUI: &GoCQWebUI{
Enabled: true,
Host: "127.0.0.1",
WebInput: false,
WebUIPort: 9999,
},
}
}

View File

@ -180,9 +180,11 @@ func main() {
log.Warnf("已开启Debug模式.")
log.Debugf("开发交流群: 192548878")
server.Debug = true
/*
if conf.WebUI == nil || !conf.WebUI.Enabled {
log.Warnf("警告: 在Debug模式下未启用WebUi服务, 将无法进行性能分析.")
}
*/
}
log.Info("用户交流群: 721829413")
if !global.PathExists("device.json") {
@ -311,7 +313,7 @@ func main() {
global.Proxy = conf.ProxyRewrite
// b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUI.Host, conf.WebUI.WebUIPort), cli)
// 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 err := commonLogin(); err != nil {
log.Fatalf("登录时发生致命错误: %v", err)
@ -442,7 +444,7 @@ func OldPasswordDecrypt(encryptedPassword string, key []byte) string {
func checkUpdate() {
log.Infof("正在检查更新.")
if coolq.Version == "unknown" {
if coolq.Version == "(devel)" {
log.Warnf("检查更新失败: 使用的 Actions 测试版或自编译版本.")
return
}