Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
206c90451c | ||
|
|
5efa9a08ab |
No files matched your search
@@ -143,11 +143,11 @@ go build -trimpath -o ../bin/scert-admin ./cmd/scert-admin
|
||||
项目配备统一的打包脚本 `deploy/package.mjs`,产物严格遵循 **`项目名+版本+架构`** 的命名规范:
|
||||
|
||||
```bash
|
||||
# 打包 Linux amd64 归档包 (生成 Scert_v1.52.1_linux_amd64.tar.gz)
|
||||
node deploy/package.mjs --target=linux_amd64 --version=v1.52.1
|
||||
# 打包 Linux amd64 归档包 (生成 Scert_v1.52.2_linux_amd64.tar.gz)
|
||||
node deploy/package.mjs --target=linux_amd64 --version=v1.52.2
|
||||
|
||||
# 打包 Windows amd64 压缩包 (生成 Scert_v1.52.1_windows_amd64.zip)
|
||||
node deploy/package.mjs --target=windows_amd64 --version=v1.52.1
|
||||
# 打包 Windows amd64 压缩包 (生成 Scert_v1.52.2_windows_amd64.zip)
|
||||
node deploy/package.mjs --target=windows_amd64 --version=v1.52.2
|
||||
```
|
||||
|
||||
发布包内包含:
|
||||
@@ -157,7 +157,7 @@ node deploy/package.mjs --target=windows_amd64 --version=v1.52.1
|
||||
- `systemd/` 与 `nginx/` 配置示例模板
|
||||
- `SHA256SUMS` 完整性校验文件
|
||||
|
||||
推送版本标签(例如 `git tag v1.52.1 && git push Scert v1.52.1`)后,GitHub 与 Gitea 会自动触发 Actions 矩阵编译,生成各架构的发布包并自动挂载至 Release 资产清单中。
|
||||
推送版本标签(例如 `git tag v1.52.2 && git push Scert v1.52.2`)后,GitHub 与 Gitea 会自动触发 Actions 矩阵编译,生成各架构的发布包并自动挂载至 Release 资产清单中。
|
||||
|
||||
---
|
||||
|
||||
@@ -167,8 +167,8 @@ node deploy/package.mjs --target=windows_amd64 --version=v1.52.1
|
||||
|
||||
1. 从 Release 页面下载对应架构的发布包并解压:
|
||||
```bash
|
||||
tar -zxvf Scert_v1.52.1_linux_amd64.tar.gz
|
||||
cd Scert_v1.52.1_linux_amd64
|
||||
tar -zxvf Scert_v1.52.2_linux_amd64.tar.gz
|
||||
cd Scert_v1.52.2_linux_amd64
|
||||
```
|
||||
|
||||
2. 执行安装脚本:
|
||||
@@ -188,7 +188,7 @@ node deploy/package.mjs --target=windows_amd64 --version=v1.52.1
|
||||
|
||||
### Windows
|
||||
|
||||
1. 解压 `Scert_v1.52.1_windows_amd64.zip`。
|
||||
1. 解压 `Scert_v1.52.2_windows_amd64.zip`。
|
||||
2. 以管理员权限启动 PowerShell 并执行:
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\install-windows.ps1 -SourceDirectory .
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package buildinfo
|
||||
|
||||
const Version = "1.52.1"
|
||||
const Version = "1.52.2"
|
||||
@@ -309,7 +309,7 @@ func TestSmailSystemSenderUsesSameEnvelopeAndHeader(t *testing.T) {
|
||||
t.Fatal("邮件头没有使用固定系统通知身份,或泄�旧管�员�件地�")
|
||||
}
|
||||
if security && strings.Contains(message, "receiver@example.com") {
|
||||
t.Fatal("验证码不得发送给普通通知收件人")
|
||||
t.Fatal("验è¯�ç �ä¸�å¾—å�‘é€�给普通通知收件äº?)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func TestSmailSystemNotificationUsesSMTPOnly(t *testing.T) {
|
||||
server.mu.Lock()
|
||||
defer server.mu.Unlock()
|
||||
if len(server.messages) != 1 {
|
||||
t.Fatalf("SMTP 系统通知数量错误:%d", len(server.messages))
|
||||
t.Fatalf("SMTP 系统通知数�错误�d", len(server.messages))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +449,38 @@ func TestBuildSMTPMessageIncludesStyledHTMLAlternative(t *testing.T) {
|
||||
"<p style=\"color:red\">HTML 通知</p>",
|
||||
} {
|
||||
if !strings.Contains(message, value) {
|
||||
t.Fatalf("SMTP multipart 邮件缺少 %q:%s", value, message)
|
||||
t.Fatalf("SMTP multipart 邮件缺少 %q�s", value, message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendTestMailImmediateFailureOnAuthError(t *testing.T) {
|
||||
server := newSMTPTestServer(t, false, true)
|
||||
server.rejectAuth = true
|
||||
host, port := server.address()
|
||||
cfg := smtpTestConfig(host, port, "starttls")
|
||||
cfg.RetryCount = 3
|
||||
cfg.RetryIntervalsSecs = []int{30, 120, 600}
|
||||
service := New(cfg, credentialReaderStub{values: map[string]string{
|
||||
"username": "user",
|
||||
"password": "wrong-password",
|
||||
}})
|
||||
service.smtpTLSConfig = server.clientTLSConfig
|
||||
|
||||
start := time.Now()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
err := service.SendTestMail(ctx, "target@example.com")
|
||||
elapsed := time.Since(start)
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("expected error on rejected auth, got nil")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "认�失败") && !strings.Contains(err.Error(), "Authentication credentials invalid") {
|
||||
t.Fatalf("expected auth failure error, got: %v", err)
|
||||
}
|
||||
if elapsed > 2*time.Second {
|
||||
t.Fatalf("SendTestMail took %v, expected immediate return without retry backoff sleep", elapsed)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package notification
|
||||
package notification
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,6 +9,18 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// sendSMTPDirect 单次直接发送测试邮件,避免在交互测试时进入多轮重试退避导致超时掩盖真实错误
|
||||
func (s *Service) sendSMTPDirect(ctx context.Context, payload mailPayload) error {
|
||||
if strings.TrimSpace(s.config.SMTPHost) == "" {
|
||||
return errors.New("SMTP 主机不能为空")
|
||||
}
|
||||
credentials, err := s.loadSMTPCredentials(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return s.sendSMTPOnce(ctx, payload, credentials)
|
||||
}
|
||||
|
||||
// SendTestMail 发送测试邮件,验证发信通道配置与网络连通性。
|
||||
func (s *Service) SendTestMail(ctx context.Context, targetRecipient string) error {
|
||||
if s == nil || (!s.config.HTTPEnabled && !s.config.SMTPEnabled) {
|
||||
@@ -76,7 +88,7 @@ func (s *Service) SendTestMail(ctx context.Context, targetRecipient string) erro
|
||||
if !s.config.SMTPEnabled {
|
||||
return errors.New("Smail 系统通知账号必须启用 SMTP 通道")
|
||||
}
|
||||
if err := s.sendSMTPWithRetry(ctx, payload); err != nil {
|
||||
if err := s.sendSMTPDirect(ctx, payload); err != nil {
|
||||
return fmt.Errorf("SMTP 测试邮件发送失败:%w", err)
|
||||
}
|
||||
return nil
|
||||
@@ -87,10 +99,10 @@ func (s *Service) SendTestMail(ctx context.Context, targetRecipient string) erro
|
||||
}
|
||||
}
|
||||
if s.config.SMTPEnabled {
|
||||
if err := s.sendSMTPWithRetry(ctx, payload); err != nil {
|
||||
if err := s.sendSMTPDirect(ctx, payload); err != nil {
|
||||
return fmt.Errorf("SMTP 测试邮件发送失败:%w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("测试邮件发送失败,请检查通道设置及网络连通性")
|
||||
}
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "scert-frontend",
|
||||
"version": "1.52.1",
|
||||
"version": "1.52.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "scert-frontend",
|
||||
"version": "1.52.1",
|
||||
"version": "1.52.2",
|
||||
"dependencies": {
|
||||
"vue": "3.5.41"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "scert-frontend",
|
||||
"private": true,
|
||||
"version": "1.52.1",
|
||||
"version": "1.52.2",
|
||||
"type": "module",
|
||||
"packageManager": "npm@11.17.0",
|
||||
"engines": {
|
||||
|
||||
@@ -85,7 +85,7 @@ defineEmits(["select", "settings"]);
|
||||
<div v-if="currentUser" class="navigation-account-card" aria-label="当前登录账号">
|
||||
<div class="navigation-account-header">
|
||||
<span class="navigation-account-label">当前账号</span>
|
||||
<span class="navigation-version-label">版本 {{ version ? (version.startsWith("v") || version.startsWith("V") ? version : "V" + version) : "V1.52.1" }}</span>
|
||||
<span class="navigation-version-label">版本 {{ version ? (version.startsWith("v") || version.startsWith("V") ? version : "V" + version) : "V1.52.2" }}</span>
|
||||
</div>
|
||||
<div class="navigation-account-row">
|
||||
<strong class="navigation-account-name" :title="currentUser.account">{{ currentUser.account || "未命名账号" }}</strong>
|
||||
|
||||
@@ -60,7 +60,7 @@ test("系统设置导航仅对当前已确认的超级管理员显示", async ()
|
||||
const html = await renderComponent("../Dashboard/DashboardNavigation.vue", {
|
||||
activeSection: "overview", sections: [],
|
||||
currentUser: role ? { account: "测试", role } : null,
|
||||
version: "1.52.1",
|
||||
version: "1.52.2",
|
||||
roleLabels: workspaceRoleLabels,
|
||||
loggingOut: false, error: "", logout() {},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user