Add configuration files, database migrations, and authentication implementation scaffolding

This commit is contained in:
Sebastian Unterschütz
2026-04-30 19:08:07 +02:00
commit 331d60581e
83 changed files with 222264 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
package parser
import (
"regexp"
"strings"
"time"
)
type LogEvent struct {
Timestamp time.Time
Type string // 'CHAT', 'JOIN', 'LEAVE', 'ADMIN', 'GENERIC'
Content string
Raw string
}
// Reforger-specific regex patterns
var (
// Example: 12:30:01.122 SCRIPT : [RJSSupport][Chat] [Global] Zauberklöte: hi, leute...
chatRegex = regexp.MustCompile(`^(\d{2}:\d{2}:\d{2}\.\d{3})\s+SCRIPT\s+:\s+\[.*?\]\[Chat\]\s+\[.*?\]\s+(.*?):\s+(.*)$`)
// Example: 09:37:50.865 DEFAULT : BattlEye Server: 'Player #0 Mike1Delta (92.209.175.19:6679) connected'
joinRegex = regexp.MustCompile(`^(\d{2}:\d{2}:\d{2}\.\d{3})\s+DEFAULT\s+:\s+BattlEye Server:\s+'Player #\d+\s+(.*?)\s+\(.*?\) connected'$`)
// Example: 09:38:53.842 DEFAULT : BattlEye Server: 'Player #0 Mike1Delta disconnected'
leaveRegex = regexp.MustCompile(`^(\d{2}:\d{2}:\d{2}\.\d{3})\s+DEFAULT\s+:\s+BattlEye Server:\s+'Player #\d+\s+(.*?) disconnected'$`)
)
func ParseLine(line string) *LogEvent {
line = strings.TrimSpace(line)
if line == "" {
return nil
}
event := &LogEvent{
Raw: line,
Type: "GENERIC",
}
// Try Chat
if matches := chatRegex.FindStringSubmatch(line); matches != nil {
event.Type = "CHAT"
event.Content = matches[2] + ": " + matches[3]
return event
}
// Try Join
if matches := joinRegex.FindStringSubmatch(line); matches != nil {
event.Type = "JOIN"
event.Content = matches[2] + " connected to server"
return event
}
// Try Leave
if matches := leaveRegex.FindStringSubmatch(line); matches != nil {
event.Type = "LEAVE"
event.Content = matches[2] + " left the server"
return event
}
return event
}