Merge pull request 'v2.4.2' (#4) from v2.4.2 into master
Reviewed-on: http://192.168.123.5/jinnrry/PMail_Github/pulls/4
This commit is contained in:
commit
e95930cc1a
8
.github/workflows/docker_build.yml
vendored
8
.github/workflows/docker_build.yml
vendored
@ -39,7 +39,10 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
|
|
||||||
- name: Build FE
|
- name: Build FE
|
||||||
run: make build_fe
|
run: |
|
||||||
|
echo "$(git show -s --format=%H)"
|
||||||
|
echo "GITHASH=$(git show -s --format=%H)" >> ${GITHUB_ENV}
|
||||||
|
make build_fe
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v2.1.0
|
uses: docker/login-action@v2.1.0
|
||||||
@ -51,6 +54,9 @@ jobs:
|
|||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
|
build-args: |
|
||||||
|
VERSION=${{ env.VERSION }}
|
||||||
|
GITHASH=${{ env.GITHASH }}
|
||||||
context: .
|
context: .
|
||||||
file: ./DockerfileGithubAction
|
file: ./DockerfileGithubAction
|
||||||
platforms: |
|
platforms: |
|
||||||
|
|||||||
8
.github/workflows/docker_build_pre.yml
vendored
8
.github/workflows/docker_build_pre.yml
vendored
@ -39,7 +39,9 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
|
|
||||||
- name: Build FE
|
- name: Build FE
|
||||||
run: make build_fe
|
run: |
|
||||||
|
echo "GITHASH=$(git show -s --format=%H)" >> ${GITHUB_ENV}
|
||||||
|
make build_fe
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v2.1.0
|
uses: docker/login-action@v2.1.0
|
||||||
@ -51,7 +53,9 @@ jobs:
|
|||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
build-args: VERSION=${{ env.VERSION }}
|
build-args: |
|
||||||
|
VERSION=${{ env.VERSION }}
|
||||||
|
GITHASH=${{ env.GITHASH }}
|
||||||
context: .
|
context: .
|
||||||
file: ./DockerfileGithubAction
|
file: ./DockerfileGithubAction
|
||||||
platforms: |
|
platforms: |
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
FROM golang:alpine as serverbuild
|
FROM golang:alpine as serverbuild
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
|
ARG GITHASH
|
||||||
WORKDIR /work
|
WORKDIR /work
|
||||||
|
|
||||||
COPY server .
|
COPY server .
|
||||||
|
|
||||||
RUN apk update && apk add git
|
RUN apk update && apk add git
|
||||||
RUN go build -ldflags "-s -w -X 'main.version=${VERSION}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=$(git show -s --format=%H)' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
|
RUN go build -ldflags "-s -w -X 'main.version=${VERSION}' -X 'main.goVersion=$(go version)' -X 'main.gitHash=${GITHASH}' -X 'main.buildTime=$(TZ=UTC-8 date +%Y-%m-%d" "%H:%M:%S)'" -o pmail main.go
|
||||||
RUN cd /work/hooks/telegram_push && go build -ldflags "-s -w" -o output/telegram_push telegram_push.go
|
RUN cd /work/hooks/telegram_push && go build -ldflags "-s -w" -o output/telegram_push telegram_push.go
|
||||||
RUN cd /work/hooks/web_push && go build -ldflags "-s -w" -o output/web_push web_push.go
|
RUN cd /work/hooks/web_push && go build -ldflags "-s -w" -o output/web_push web_push.go
|
||||||
RUN cd /work/hooks/wechat_push && go build -ldflags "-s -w" -o output/wechat_push wechat_push.go
|
RUN cd /work/hooks/wechat_push && go build -ldflags "-s -w" -o output/wechat_push wechat_push.go
|
||||||
|
|||||||
@ -50,8 +50,8 @@ func main() {
|
|||||||
// 日志消息输出可以是任意的io.writer类型
|
// 日志消息输出可以是任意的io.writer类型
|
||||||
log.SetOutput(os.Stdout)
|
log.SetOutput(os.Stdout)
|
||||||
|
|
||||||
var cst, _ = time.LoadLocation("Asia/Shanghai")
|
var cstZone = time.FixedZone("CST", 8*3600)
|
||||||
time.Local = cst
|
time.Local = cstZone
|
||||||
|
|
||||||
config.Init()
|
config.Init()
|
||||||
|
|
||||||
@ -75,15 +75,16 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if version == "" {
|
if version == "" {
|
||||||
version = time.Now().Format("2006-01-02 15:04:05")
|
version = "TestVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infoln("***************************************************")
|
log.Infoln("*******************************************************************")
|
||||||
log.Infof("***\tServer Start Success Version:%s\n", version)
|
log.Infof("***\tServer Start Success \n")
|
||||||
|
log.Infof("***\tServer Version: %s \n", version)
|
||||||
log.Infof("***\tGit Commit Hash: %s ", gitHash)
|
log.Infof("***\tGit Commit Hash: %s ", gitHash)
|
||||||
log.Infof("***\tBuild TimeStamp: %s ", buildTime)
|
log.Infof("***\tBuild Date: %s ", buildTime)
|
||||||
log.Infof("***\tBuild GoLang Version: %s ", goVersion)
|
log.Infof("***\tBuild GoLang Version: %s ", goVersion)
|
||||||
log.Infoln("***************************************************")
|
log.Infoln("*******************************************************************")
|
||||||
|
|
||||||
// 定时任务启动
|
// 定时任务启动
|
||||||
go cron_server.Start()
|
go cron_server.Start()
|
||||||
|
|||||||
@ -64,6 +64,24 @@ func (s *Session) Data(r io.Reader) error {
|
|||||||
// 判断是收信还是转发,只要是登陆了,都当成转发处理
|
// 判断是收信还是转发,只要是登陆了,都当成转发处理
|
||||||
//account, domain := email.From.GetDomainAccount()
|
//account, domain := email.From.GetDomainAccount()
|
||||||
if s.Ctx.UserID > 0 {
|
if s.Ctx.UserID > 0 {
|
||||||
|
|
||||||
|
log.WithContext(ctx).Debugf("开始执行插件SendBefore!")
|
||||||
|
as2 := async.New(ctx)
|
||||||
|
for _, hook := range hooks.HookList {
|
||||||
|
if hook == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
as2.WaitProcess(func(hk any) {
|
||||||
|
hk.(framework.EmailHook).SendBefore(ctx, email)
|
||||||
|
}, hook)
|
||||||
|
}
|
||||||
|
as2.Wait()
|
||||||
|
log.WithContext(ctx).Debugf("开始执行插件SendBefore!End")
|
||||||
|
|
||||||
|
if email == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// 转发
|
// 转发
|
||||||
err := saveEmail(ctx, email, 1, true, true)
|
err := saveEmail(ctx, email, 1, true, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -86,10 +104,7 @@ func (s *Session) Data(r io.Reader) error {
|
|||||||
|
|
||||||
SPFStatus = spfCheck(s.RemoteAddress.String(), email.Sender, email.Sender.EmailAddress)
|
SPFStatus = spfCheck(s.RemoteAddress.String(), email.Sender, email.Sender.EmailAddress)
|
||||||
|
|
||||||
saveEmail(ctx, email, 0, SPFStatus, dkimStatus)
|
|
||||||
|
|
||||||
log.WithContext(ctx).Debugf("开始执行插件ReceiveParseAfter!")
|
log.WithContext(ctx).Debugf("开始执行插件ReceiveParseAfter!")
|
||||||
|
|
||||||
as2 := async.New(ctx)
|
as2 := async.New(ctx)
|
||||||
for _, hook := range hooks.HookList {
|
for _, hook := range hooks.HookList {
|
||||||
if hook == nil {
|
if hook == nil {
|
||||||
@ -102,6 +117,12 @@ func (s *Session) Data(r io.Reader) error {
|
|||||||
as2.Wait()
|
as2.Wait()
|
||||||
log.WithContext(ctx).Debugf("开始执行插件ReceiveParseAfter!End")
|
log.WithContext(ctx).Debugf("开始执行插件ReceiveParseAfter!End")
|
||||||
|
|
||||||
|
if email == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
saveEmail(ctx, email, 0, SPFStatus, dkimStatus)
|
||||||
|
|
||||||
log.WithContext(ctx).Debugf("开始执行邮件规则!")
|
log.WithContext(ctx).Debugf("开始执行邮件规则!")
|
||||||
// 执行邮件规则
|
// 执行邮件规则
|
||||||
rs := rule.GetAllRules(ctx)
|
rs := rule.GetAllRules(ctx)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user