feat: Implement system configuration page for site settings and proxy management, and add team registration functionality.
This commit is contained in:
@@ -375,26 +375,26 @@ func runTeamRegProcess(config TeamRegConfig) {
|
||||
addTeamRegLog("[系统] 进程正常完成")
|
||||
}
|
||||
|
||||
// 查找输出文件
|
||||
outputFile := findLatestOutputFile(workDir)
|
||||
if outputFile != "" {
|
||||
teamRegState.mu.Lock()
|
||||
teamRegState.OutputFile = outputFile
|
||||
teamRegState.mu.Unlock()
|
||||
addTeamRegLog(fmt.Sprintf("[系统] 输出文件: %s", filepath.Base(outputFile)))
|
||||
// 查找输出文件
|
||||
outputFile := findLatestOutputFile(workDir)
|
||||
if outputFile != "" {
|
||||
teamRegState.mu.Lock()
|
||||
teamRegState.OutputFile = outputFile
|
||||
teamRegState.mu.Unlock()
|
||||
addTeamRegLog(fmt.Sprintf("[系统] 输出文件: %s", filepath.Base(outputFile)))
|
||||
|
||||
// 自动导入
|
||||
if config.AutoImport {
|
||||
addTeamRegLog("[系统] 自动导入账号到数据库...")
|
||||
tryAutoImport(outputFile, config)
|
||||
}
|
||||
// 自动导入
|
||||
if config.AutoImport {
|
||||
addTeamRegLog("[系统] 自动导入账号到数据库...")
|
||||
tryAutoImport(outputFile, config)
|
||||
}
|
||||
|
||||
// 发送回车退出程序(如果还在运行)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
signalTeamRegExit()
|
||||
}
|
||||
|
||||
// 发送回车退出程序(如果还在运行)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
signalTeamRegExit()
|
||||
}
|
||||
|
||||
// readOutput 读取进程输出
|
||||
func readOutput(reader io.Reader, workDir string, config TeamRegConfig) {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
@@ -405,26 +405,26 @@ func readOutput(reader io.Reader, workDir string, config TeamRegConfig) {
|
||||
if trimmed != "" {
|
||||
addTeamRegLog(trimmed)
|
||||
|
||||
// 检测输出文件名(例如:结果已保存到: accounts-2-20260201-071558.json)
|
||||
if strings.Contains(trimmed, "结果已保存到") || strings.Contains(trimmed, "accounts-") && strings.Contains(trimmed, ".json") {
|
||||
// 尝试提取文件名
|
||||
if idx := strings.Index(trimmed, "accounts-"); idx >= 0 {
|
||||
endIdx := strings.Index(trimmed[idx:], ".json")
|
||||
if endIdx > 0 {
|
||||
fileName := trimmed[idx : idx+endIdx+5] // 包含 .json
|
||||
// 构建完整路径
|
||||
fullPath := filepath.Join(workDir, fileName)
|
||||
teamRegState.mu.Lock()
|
||||
teamRegState.OutputFile = fullPath
|
||||
teamRegState.mu.Unlock()
|
||||
if config.AutoImport {
|
||||
go tryAutoImport(fullPath, config)
|
||||
}
|
||||
// 发送回车提示退出(有些程序会在完成后等待回车)
|
||||
signalTeamRegExit()
|
||||
// 检测输出文件名(例如:结果已保存到: accounts-2-20260201-071558.json)
|
||||
if strings.Contains(trimmed, "结果已保存到") || strings.Contains(trimmed, "accounts-") && strings.Contains(trimmed, ".json") {
|
||||
// 尝试提取文件名
|
||||
if idx := strings.Index(trimmed, "accounts-"); idx >= 0 {
|
||||
endIdx := strings.Index(trimmed[idx:], ".json")
|
||||
if endIdx > 0 {
|
||||
fileName := trimmed[idx : idx+endIdx+5] // 包含 .json
|
||||
// 构建完整路径
|
||||
fullPath := filepath.Join(workDir, fileName)
|
||||
teamRegState.mu.Lock()
|
||||
teamRegState.OutputFile = fullPath
|
||||
teamRegState.mu.Unlock()
|
||||
if config.AutoImport {
|
||||
go tryAutoImport(fullPath, config)
|
||||
}
|
||||
// 发送回车提示退出(有些程序会在完成后等待回车)
|
||||
signalTeamRegExit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检测 403 错误
|
||||
if strings.Contains(trimmed, "403") {
|
||||
@@ -573,6 +573,21 @@ func addTeamRegLog(log string) {
|
||||
logger.Info(fmt.Sprintf("[TeamReg] %s", cleanLog), "", "team-reg")
|
||||
}
|
||||
|
||||
// HandleTeamRegClearLogs POST /api/team-reg/clear-logs - 清除日志
|
||||
func HandleTeamRegClearLogs(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
Error(w, http.StatusMethodNotAllowed, "仅支持 POST")
|
||||
return
|
||||
}
|
||||
|
||||
teamRegState.mu.Lock()
|
||||
teamRegState.Logs = make([]string, 0)
|
||||
teamRegState.mu.Unlock()
|
||||
|
||||
logger.Info("[TeamReg] 日志已清除", "", "team-reg")
|
||||
Success(w, map[string]string{"message": "日志已清除"})
|
||||
}
|
||||
|
||||
// findTeamRegExecutable 查找 team-reg 可执行文件
|
||||
func findTeamRegExecutable() string {
|
||||
// 可能的文件名
|
||||
|
||||
Reference in New Issue
Block a user