Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Check the hostname tag file

lotk1e5a699f2f92
diff --git a/core/api/contact/v1/contact.go b/core/api/contact/v1/contact.go
index 4117c0ad..9f8df412 100644
--- a/core/api/contact/v1/contact.go
+++ b/core/api/contact/v1/contact.go
@@ -299,7 +299,6 @@ type EditContactsRes struct {
api_v1.StandardRes
}
-// 新获取联系人列表 contact/list_ndp 邮箱不去重 Active 默认-1
type ListContactsNDPReq struct {
g.Meta `path:"/contact/list_ndp" method:"get" tags:"Contact" summary:"List all contacts"`
Authorization string `json:"authorization" dc:"Authorization" in:"header"`
@@ -307,7 +306,7 @@ type ListContactsNDPReq struct {
PageSize int `json:"page_size" v:"required|min:1" dc:"Page Size"`
GroupId int `json:"group_id" dc:"Group ID(Optional)"`
Keyword string `json:"keyword" dc:"Search Email"`
- Active int `json:"active" v:"required|in:0,1,-1" dc:"Active(1:Subscribed 0:Unsubscribed -1:all)" default:"-1"` // 原来的status (避免和联系人确认状态混淆)
+ Active int `json:"active" v:"required|in:0,1,-1" dc:"Active(1:Subscribed 0:Unsubscribed -1:all)" default:"-1"`
}
type ListContactsNDPRes struct {
@@ -318,7 +317,6 @@ type ListContactsNDPRes struct {
} `json:"data"`
}
-// 新编辑联系人 contact/edit_ndp
type EditContactsNDPReq struct {
g.Meta `path:"/contact/edit_ndp" method:"post" tags:"Contact" summary:"Edit contact"`
Authorization string `json:"authorization" dc:"Authorization" in:"header"`
@@ -332,7 +330,6 @@ type EditContactsNDPRes struct {
api_v1.StandardRes
}
-// 新删除联系人 contact/delete_ndp
type DeleteContactsNDPReq struct {
g.Meta `path:"/contact/delete_ndp" method:"post" tags:"Contact" summary:"Delete contacts"`
Authorization string `json:"authorization" dc:"Authorization" in:"header"`
diff --git a/core/internal/service/settings/billionmail_hostname.go b/core/internal/service/settings/billionmail_hostname.go
index db155c0f..3032a697 100644
--- a/core/internal/service/settings/billionmail_hostname.go
+++ b/core/internal/service/settings/billionmail_hostname.go
@@ -4,39 +4,22 @@ import (
v1 "billionmail-core/api/domains/v1"
"billionmail-core/internal/service/domains"
"billionmail-core/internal/service/public"
- "context"
- "github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/os/gfile"
"os"
"strings"
)
// Check whether the A record of BILLIONMAIL_HOSTNAME is consistent with the local public network IP and write or delete the tag file
func CheckHostname() {
- ctx := context.Background()
- g.Log().Warning(ctx, "billionmail_hostname start 111111111")
hostname := public.MustGetDockerEnv("BILLIONMAIL_HOSTNAME", "")
flagFile := public.AbsPath("../core/data/billionmail_hostname.txt")
-
- // ----------------------------------------------------------------------
- if gfile.Exists(flagFile) {
- content := gfile.GetContents(flagFile)
- g.Log().Warning(ctx, "flagFile content 111111111: ", content)
- } else {
- g.Log().Warning(ctx, "flagFile not exists 111111111")
- }
- // ----------------------------------------------------------------------
-
if hostname == "" || hostname == "mail.example.com" {
_ = os.Remove(flagFile)
- g.Log().Warning(ctx, "No hostname 111111111")
return
}
serverIP, err := public.GetServerIP()
if err != nil {
- g.Log().Warning(ctx, "No serverIP 111111111")
return
}
@@ -52,7 +35,6 @@ func CheckHostname() {
}
Valid := domains.ValidateARecord(record)
- g.Log().Warning(ctx, "Valid 111111111", Valid)
if Valid {
_ = os.WriteFile(flagFile, []byte(hostname), 0644)
}
diff --git a/core/internal/service/timers/timers.go b/core/internal/service/timers/timers.go
index b1064c0f..12b8d264 100644
--- a/core/internal/service/timers/timers.go
+++ b/core/internal/service/timers/timers.go
@@ -143,9 +143,7 @@ func Start(ctx context.Context) (err error) {
// fail2ban access logs detection
gtimer.AddOnce(800*time.Millisecond, fail2ban.NewAccessLogDetection().Start)
- //gtimer.AddOnce(500*time.Millisecond, func() {
- gtimer.Add(1*time.Minute, func() {
- g.Log().Warning(ctx, "billionmail_hostname start 0000000")
+ gtimer.AddOnce(500*time.Millisecond, func() {
settings.CheckHostname()
})
gtimer.Add(24*time.Hour, func() {