fix: 移除启动界面的前端仓库地址

This commit is contained in:
dujiao-next committed 2026-07-29 13:12:31 +08:00
1 parent a3450c063f
commit 1f38205747
2 files changed
+45 -17

No files matched your search

+20 -17
View File
@@ -4,6 +4,7 @@ import (
"errors"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"
@@ -211,23 +212,25 @@ func printUpdateStateRecoveryHint() {
}
func printStartupBanner() {
fmt.Println(ansiBrightMag + "╔══════════════════════════════════════════════════════════════════════╗" + ansiReset)
fmt.Println(ansiBrightMag + "║ 🚀 Dujiao-Next API 启动中 ║" + ansiReset)
fmt.Println(ansiBrightMag + "╚══════════════════════════════════════════════════════════════════════╝" + ansiReset)
fmt.Println(ansiCyan + "██████╗ ██╗ ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗███████╗██╗ ██╗████████╗" + ansiReset)
fmt.Println(ansiCyan + "██╔══██╗██║ ██║ ██║██╔══██╗██╔═══██╗ ████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝" + ansiReset)
fmt.Println(ansiCyan + "██║ ██║██║ ██║ ██║███████║██║ ██║ ██╔██╗ ██║█████╗ ╚███╔╝ ██║ " + ansiReset)
fmt.Println(ansiCyan + "██║ ██║██║ ██║██ ██║██╔══██║██║ ██║ ██║╚██╗██║██╔══╝ ██╔██╗ ██║ " + ansiReset)
fmt.Println(ansiCyan + "██████╔╝╚██████╔╝╚█████╔╝██║ ██║╚██████╔╝ ██║ ╚████║███████╗██╔╝ ██╗ ██║ " + ansiReset)
fmt.Println(ansiCyan + "╚═════╝ ╚═════╝ ╚════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝ " + ansiReset)
fmt.Println(ansiGreen + ansiBold + "Open Source Repositories" + ansiReset)
fmt.Println(ansiBlue + "• Root: https://github.com/dujiao-next" + ansiReset)
fmt.Println(ansiBlue + "• API: https://github.com/dujiao-next/dujiao-next" + ansiReset)
fmt.Println(ansiBlue + "• User: https://github.com/dujiao-next/user" + ansiReset)
fmt.Println(ansiBlue + "• Admin: https://github.com/dujiao-next/admin" + ansiReset)
fmt.Println(ansiBlue + "• Official:https://github.com/dujiao-next/document" + ansiReset)
fmt.Println(ansiGreen + "Version: " + version.Version + ansiReset)
fmt.Println(ansiDim + "--------------------------------------------------------------" + ansiReset)
writeStartupBanner(os.Stdout)
}
func writeStartupBanner(w io.Writer) {
fmt.Fprintln(w, ansiBrightMag+"╔══════════════════════════════════════════════════════════════════════╗"+ansiReset)
fmt.Fprintln(w, ansiBrightMag+"║ 🚀 Dujiao-Next API 启动中 ║"+ansiReset)
fmt.Fprintln(w, ansiBrightMag+"╚══════════════════════════════════════════════════════════════════════╝"+ansiReset)
fmt.Fprintln(w, ansiCyan+"██████╗ ██╗ ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗███████╗██╗ ██╗████████╗"+ansiReset)
fmt.Fprintln(w, ansiCyan+"██╔══██╗██║ ██║ ██║██╔══██╗██╔═══██╗ ████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝"+ansiReset)
fmt.Fprintln(w, ansiCyan+"██║ ██║██║ ██║ ██║███████║██║ ██║ ██╔██╗ ██║█████╗ ╚███╔╝ ██║ "+ansiReset)
fmt.Fprintln(w, ansiCyan+"██║ ██║██║ ██║██ ██║██╔══██║██║ ██║ ██║╚██╗██║██╔══╝ ██╔██╗ ██║ "+ansiReset)
fmt.Fprintln(w, ansiCyan+"██████╔╝╚██████╔╝╚█████╔╝██║ ██║╚██████╔╝ ██║ ╚████║███████╗██╔╝ ██╗ ██║ "+ansiReset)
fmt.Fprintln(w, ansiCyan+"╚═════╝ ╚═════╝ ╚════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝ "+ansiReset)
fmt.Fprintln(w, ansiGreen+ansiBold+"Open Source Repositories"+ansiReset)
fmt.Fprintln(w, ansiBlue+"• Root: https://github.com/dujiao-next"+ansiReset)
fmt.Fprintln(w, ansiBlue+"• API: https://github.com/dujiao-next/dujiao-next"+ansiReset)
fmt.Fprintln(w, ansiBlue+"• Official:https://dujiao-next.com"+ansiReset)
fmt.Fprintln(w, ansiGreen+"Version: "+version.Version+ansiReset)
fmt.Fprintln(w, ansiDim+"--------------------------------------------------------------"+ansiReset)
}
func isWeakSecret(secret string) bool {
+25
View File
@@ -2,11 +2,36 @@ package main
import (
"reflect"
"strings"
"testing"
"github.com/dujiao-next/internal/config"
)
func TestWriteStartupBannerOmitsRetiredFrontendRepositories(t *testing.T) {
var output strings.Builder
writeStartupBanner(&output)
banner := output.String()
for _, removed := range []string{
"• User: https://github.com/dujiao-next/user",
"• Admin: https://github.com/dujiao-next/admin",
} {
if strings.Contains(banner, removed) {
t.Errorf("startup banner still contains retired repository: %s", removed)
}
}
for _, retained := range []string{
"• Root: https://github.com/dujiao-next",
"• API: https://github.com/dujiao-next/dujiao-next",
"• Official:https://dujiao-next.com",
} {
if !strings.Contains(banner, retained) {
t.Errorf("startup banner is missing retained repository: %s", retained)
}
}
}
func TestWeakRuntimeSecretNamesCoversEveryRootSecret(t *testing.T) {
cfg := &config.Config{
App: config.AppConfig{SecretKey: "change-me-32-byte-secret-key!!"},