5 Commits

Author SHA1 Message Date
Jose Luis Montañes Ojados
356b492629 Fix Poke timeout, input CommandLow handling, and add Poke Popup
All checks were successful
Build and Release / build-linux (push) Successful in 35s
Build and Release / build-windows (push) Successful in 2m35s
Build and Release / release (push) Has been skipped
2026-01-17 15:57:34 +01:00
Jose Luis Montañes Ojados
99f26c4485 fix: restore author credits in about view 2026-01-17 03:27:18 +01:00
Jose Luis Montañes Ojados
9ed1d4f60e ci: automate release notes generation using git log
All checks were successful
Build and Release / build-linux (push) Successful in 33s
Build and Release / build-windows (push) Successful in 1m54s
Build and Release / release (push) Successful in 8s
2026-01-17 03:15:53 +01:00
Jose Luis Montañes Ojados
a639558ce4 docs: update README with new binary naming and release instructions
All checks were successful
Build and Release / build-linux (push) Successful in 34s
Build and Release / build-windows (push) Successful in 1m52s
Build and Release / release (push) Successful in 4s
2026-01-17 03:10:02 +01:00
Jose Luis Montañes Ojados
3dc4942942 ci: rename binaries to ts3-tui and improve artifact naming 2026-01-17 03:09:31 +01:00
7 changed files with 178 additions and 45 deletions

View File

@@ -38,20 +38,21 @@ jobs:
run: | run: |
export CGO_ENABLED=1 export CGO_ENABLED=1
mkdir -p dist mkdir -p dist
# More descriptive name: ts3-tui
go build -o dist/ts3-tui.exe ./cmd/tui go build -o dist/ts3-tui.exe ./cmd/tui
# Copy DLLs # Copy DLLs
cp /mingw64/bin/libogg-0.dll dist/ cp /mingw64/bin/libogg-0.dll dist/
cp /mingw64/bin/libopus-0.dll dist/ cp /mingw64/bin/libopus-0.dll dist/
cp /mingw64/bin/libopusfile-0.dll dist/ cp /mingw64/bin/libopusfile-0.dll dist/
cp /mingw64/bin/libportaudio-2.dll dist/ || true cp /mingw64/bin/libportaudio-2.dll dist/ || true
# Create ZIP # Create ZIP with architecture name
cd dist && zip -r ../tui_windows_x86_64.zip . * cd dist && zip -r ../ts3-tui-windows-x86_64.zip . *
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: tui-windows-zip name: ts3-tui-windows-zip
path: tui_windows_x86_64.zip path: ts3-tui-windows-x86_64.zip
build-linux: build-linux:
runs-on: linux-x86_64 runs-on: linux-x86_64
@@ -78,12 +79,13 @@ jobs:
export CGO_ENABLED=1 export CGO_ENABLED=1
export ARCH=$(uname -m) export ARCH=$(uname -m)
mkdir -p dist mkdir -p dist
go build -o dist/tui_linux_${ARCH} ./cmd/tui # More descriptive name: ts3-tui-linux-ARCH
go build -o dist/ts3-tui-linux-${ARCH} ./cmd/tui
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: tui-linux-binaries name: ts3-tui-linux-binaries
path: dist/* path: dist/*
release: release:
@@ -91,14 +93,25 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Changelog
run: |
# Get commits since the last tag (or since the beginning)
git log --oneline $(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)..HEAD > changelog.txt
- name: Download Artifacts - name: Download Artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
body_path: changelog.txt
files: | files: |
tui-windows-zip/tui_windows_x86_64.zip ts3-tui-windows-zip/ts3-tui-windows-x86_64.zip
tui-linux-binaries/* ts3-tui-linux-binaries/*
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -104,6 +104,11 @@ type Model struct {
isMuted bool // Mic muted isMuted bool // Mic muted
isPTT bool // Push-to-talk active isPTT bool // Push-to-talk active
// Popup State
showPokePopup bool
pokePopupSender string
pokePopupMessage string
// Program reference for sending messages from event handlers // Program reference for sending messages from event handlers
program *tea.Program program *tea.Program
showLog bool showLog bool
@@ -398,12 +403,19 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, nil return m, nil
case pokeMsg: case pokeMsg:
// Append to chat as well
m.chatMessages = append(m.chatMessages, ChatMessage{ m.chatMessages = append(m.chatMessages, ChatMessage{
Time: time.Now(), Time: time.Now(),
Sender: "POKE", Sender: "POKE",
Content: fmt.Sprintf("[%s]: %s", msg.senderName, msg.message), Content: fmt.Sprintf("[%s]: %s", msg.senderName, msg.message),
}) })
m.addLog("Received poke from %s: %s", msg.senderName, msg.message) m.addLog("Received poke from %s: %s", msg.senderName, msg.message)
// Trigger Popup
m.showPokePopup = true
m.pokePopupSender = msg.senderName
m.pokePopupMessage = msg.message
return m, nil return m, nil
case chatMsg: case chatMsg:
@@ -545,8 +557,18 @@ func (m *Model) updateChannelList(channels []*ts3client.Channel) {
} }
func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) { func (m *Model) handleKeyPress(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
key := msg.String()
// Global Key Handling for Popup
if m.showPokePopup {
if key == "esc" || key == "enter" || key == "q" {
m.showPokePopup = false
}
return m, nil
}
// 1. Absolute Globals (Always active) // 1. Absolute Globals (Always active)
switch msg.String() { switch key {
case "ctrl+c": case "ctrl+c":
if m.client != nil { if m.client != nil {
m.client.Disconnect() m.client.Disconnect()
@@ -836,6 +858,32 @@ func (m *Model) handleInputKeys(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
// View renders the UI // View renders the UI
func (m *Model) View() string { func (m *Model) View() string {
if m.showPokePopup {
boxStyle := lipgloss.NewStyle().
Border(lipgloss.DoubleBorder()).
BorderForeground(lipgloss.Color("196")). // Red for Poke
Padding(1, 2).
Width(50).
Align(lipgloss.Center)
titleStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("226")).MarginBottom(1)
senderStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("208")).Bold(true)
msgStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("255")).Italic(true)
helpStyle := lipgloss.NewStyle().Faint(true).MarginTop(2)
content := lipgloss.JoinVertical(lipgloss.Center,
titleStyle.Render("YOU WERE POKED!"),
"",
fmt.Sprintf("From: %s", senderStyle.Render(m.pokePopupSender)),
"",
msgStyle.Render(fmt.Sprintf("%q", m.pokePopupMessage)),
"",
helpStyle.Render("(Press Esc/Enter to close)"),
)
return lipgloss.Place(m.width, m.height, lipgloss.Center, lipgloss.Center, boxStyle.Render(content))
}
if m.focus == FocusAbout { if m.focus == FocusAbout {
return m.renderAboutView() return m.renderAboutView()
} }
@@ -1246,7 +1294,8 @@ func (m *Model) renderAboutView() string {
titleStyle.Render("TS3 TUI CLIENT"), titleStyle.Render("TS3 TUI CLIENT"),
lipgloss.NewStyle().Foreground(lipgloss.Color("250")).Render("Una terminal potente para tus comunidades."), lipgloss.NewStyle().Foreground(lipgloss.Color("250")).Render("Una terminal potente para tus comunidades."),
"", "",
lipgloss.NewStyle().Bold(true).Render("Hecho en Antigravity"), lipgloss.NewStyle().Bold(true).Render("Realizado por JosLeDeta"),
lipgloss.NewStyle().Italic(true).Faint(true).Render("Hecho en Antigravity"),
"", "",
lipgloss.NewStyle().Bold(true).Render("Con la ayuda de:"), lipgloss.NewStyle().Bold(true).Render("Con la ayuda de:"),
lipgloss.NewStyle().Foreground(lipgloss.Color("212")).Render("- Gemini 3 Pro"), lipgloss.NewStyle().Foreground(lipgloss.Color("212")).Render("- Gemini 3 Pro"),

View File

@@ -36,6 +36,7 @@ type Client struct {
PingPacketID uint16 // Type 0x04 PingPacketID uint16 // Type 0x04
PongPacketID uint16 // Type 0x05 PongPacketID uint16 // Type 0x05
AckPacketID uint16 // Type 0x06 AckPacketID uint16 // Type 0x06
AckLowPacketID uint16 // Type 0x07
// Ping RTT tracking // Ping RTT tracking
PingSentTimes map[uint16]time.Time // Map PingPacketID -> Time sent PingSentTimes map[uint16]time.Time // Map PingPacketID -> Time sent
@@ -48,10 +49,14 @@ type Client struct {
ServerName string ServerName string
// Fragment reassembly (packet queue like ts3j) // Fragment reassembly (packet queue like ts3j)
CommandQueue map[uint16]*protocol.Packet // Packets waiting for reassembly CommandQueue map[uint16]*protocol.Packet // Packets waiting for reassembly (Type 0x02)
ExpectedCommandPID uint16 // Next expected packet ID ExpectedCommandPID uint16 // Next expected packet ID (Type 0x02)
FragmentState bool // Toggle: true = collecting, false = ready FragmentState bool // Toggle: true = collecting, false = ready
CommandLowQueue map[uint16]*protocol.Packet // Packets waiting for reassembly (Type 0x03)
ExpectedCommandLowPID uint16 // Next expected packet ID (Type 0x03)
FragmentStateLow bool // Toggle: true = collecting, false = ready
// Server Data // Server Data
Channels map[uint64]*Channel Channels map[uint64]*Channel
@@ -71,11 +76,14 @@ func NewClient(nickname string) *Client {
return &Client{ return &Client{
Nickname: nickname, Nickname: nickname,
PacketIDCounterC2S: 1, PacketIDCounterC2S: 1,
AckLowPacketID: 1,
VoicePacketID: 1, VoicePacketID: 1,
Channels: make(map[uint64]*Channel), Channels: make(map[uint64]*Channel),
VoiceDecoders: make(map[uint16]*opus.Decoder), VoiceDecoders: make(map[uint16]*opus.Decoder),
CommandQueue: make(map[uint16]*protocol.Packet), CommandQueue: make(map[uint16]*protocol.Packet),
ExpectedCommandPID: 0, ExpectedCommandPID: 0,
CommandLowQueue: make(map[uint16]*protocol.Packet),
ExpectedCommandLowPID: 0,
PingSentTimes: make(map[uint16]time.Time), PingSentTimes: make(map[uint16]time.Time),
PingRTT: 0, PingRTT: 0,
PingDeviation: 0, PingDeviation: 0,

View File

@@ -35,6 +35,21 @@ func sanitizeForLog(s string) string {
} }
func (c *Client) handleCommand(pkt *protocol.Packet) error { func (c *Client) handleCommand(pkt *protocol.Packet) error {
// Select the correct queue and counters based on PacketType
var queue map[uint16]*protocol.Packet
var expectedPID *uint16
var fragmentState *bool
if pkt.Header.PacketType() == protocol.PacketTypeCommandLow {
queue = c.CommandLowQueue
expectedPID = &c.ExpectedCommandLowPID
fragmentState = &c.FragmentStateLow
} else {
queue = c.CommandQueue
expectedPID = &c.ExpectedCommandPID
fragmentState = &c.FragmentState
}
// Check if Encrypted // Check if Encrypted
// PacketTypeCommand is usually encrypted. // PacketTypeCommand is usually encrypted.
// Flag check? The flag is in the Header (e.g. Unencrypted flag). // Flag check? The flag is in the Header (e.g. Unencrypted flag).
@@ -100,14 +115,14 @@ func (c *Client) handleCommand(pkt *protocol.Packet) error {
// Queue-based fragment reassembly (like ts3j) // Queue-based fragment reassembly (like ts3j)
// Store packet in queue // Store packet in queue
c.CommandQueue[pkt.Header.PacketID] = &protocol.Packet{ queue[pkt.Header.PacketID] = &protocol.Packet{
Header: pkt.Header, Header: pkt.Header,
Data: append([]byte{}, data...), // Clone data (already decrypted) Data: append([]byte{}, data...), // Clone data (already decrypted)
} }
// Try to process packets in order // Try to process packets in order
for { for {
nextPkt, ok := c.CommandQueue[c.ExpectedCommandPID] nextPkt, ok := queue[*expectedPID]
if !ok { if !ok {
// Missing packet, wait for it // Missing packet, wait for it
break break
@@ -117,16 +132,16 @@ func (c *Client) handleCommand(pkt *protocol.Packet) error {
if isFragmented { if isFragmented {
// Toggle fragment state // Toggle fragment state
c.FragmentState = !c.FragmentState *fragmentState = !*fragmentState
if c.FragmentState { if *fragmentState {
// Starting a new fragment sequence // Starting a new fragment sequence
// Don't process yet, wait for more // Don't process yet, wait for more
c.ExpectedCommandPID++ *expectedPID++
continue continue
} else { } else {
// Ending fragment sequence - reassemble all // Ending fragment sequence - reassemble all
reassembled, compressed := c.reassembleFragments() reassembled, compressed := c.reassembleFragmentsCustom(queue, *expectedPID)
if reassembled == nil { if reassembled == nil {
log.Printf("Fragment reassembly failed") log.Printf("Fragment reassembly failed")
break break
@@ -144,9 +159,9 @@ func (c *Client) handleCommand(pkt *protocol.Packet) error {
} }
} }
} }
} else if c.FragmentState { } else if *fragmentState {
// Middle fragment - keep collecting // Middle fragment - keep collecting
c.ExpectedCommandPID++ *expectedPID++
continue continue
} else { } else {
// Non-fragmented packet - process normally // Non-fragmented packet - process normally
@@ -165,10 +180,11 @@ func (c *Client) handleCommand(pkt *protocol.Packet) error {
} }
// Remove processed packet from queue // Remove processed packet from queue
delete(c.CommandQueue, c.ExpectedCommandPID) delete(queue, *expectedPID)
c.ExpectedCommandPID++ *expectedPID++
// Process the command // Process the command
// Fix: processCommand should probably handle execution
if err := c.processCommand(data, nextPkt); err != nil { if err := c.processCommand(data, nextPkt); err != nil {
log.Printf("Error processing command: %v", err) log.Printf("Error processing command: %v", err)
} }
@@ -177,16 +193,17 @@ func (c *Client) handleCommand(pkt *protocol.Packet) error {
return nil return nil
} }
// reassembleFragments collects all buffered fragments in order and returns reassembled data // reassembleFragmentsCustom collects all buffered fragments in order from the given queue
func (c *Client) reassembleFragments() ([]byte, bool) { // ending at currentPID.
func (c *Client) reassembleFragmentsCustom(queue map[uint16]*protocol.Packet, currentPID uint16) ([]byte, bool) {
var result []byte var result []byte
compressed := false compressed := false
// Find the start of the fragment sequence (scan backwards from current) // Find the start of the fragment sequence (scan backwards from current)
startPID := c.ExpectedCommandPID startPID := currentPID
for { for {
prevPID := startPID - 1 prevPID := startPID - 1
pkt, ok := c.CommandQueue[prevPID] pkt, ok := queue[prevPID]
if !ok { if !ok {
break break
} }
@@ -198,9 +215,9 @@ func (c *Client) reassembleFragments() ([]byte, bool) {
startPID = prevPID startPID = prevPID
} }
// Now collect from startPID to ExpectedCommandPID (inclusive) // Now collect from startPID to currentPID (inclusive)
for pid := startPID; pid <= c.ExpectedCommandPID; pid++ { for pid := startPID; pid <= currentPID; pid++ {
pkt, ok := c.CommandQueue[pid] pkt, ok := queue[pid]
if !ok { if !ok {
log.Printf("Missing fragment PID=%d during reassembly", pid) log.Printf("Missing fragment PID=%d during reassembly", pid)
return nil, false return nil, false
@@ -212,11 +229,11 @@ func (c *Client) reassembleFragments() ([]byte, bool) {
} }
result = append(result, pkt.Data...) result = append(result, pkt.Data...)
delete(c.CommandQueue, pid) delete(queue, pid)
} }
log.Printf("Reassembled fragments PID %d-%d, total %d bytes, compressed=%v", log.Printf("Reassembled fragments PID %d-%d, total %d bytes, compressed=%v",
startPID, c.ExpectedCommandPID, len(result), compressed) startPID, currentPID, len(result), compressed)
return result, compressed return result, compressed
} }

View File

@@ -55,6 +55,46 @@ func (c *Client) handlePacket(pkt *protocol.Packet) error {
c.Conn.SendPacket(ack) c.Conn.SendPacket(ack)
return c.handleCommand(pkt)
case protocol.PacketTypeCommandLow:
// Send ACK Low
ackData := make([]byte, 2)
binary.BigEndian.PutUint16(ackData, pkt.Header.PacketID)
ack := protocol.NewPacket(protocol.PacketTypeAckLow, ackData)
// Spec/ts3j: AckLow has its own counter
c.AckLowPacketID++
ack.Header.PacketID = c.AckLowPacketID
ack.Header.ClientID = c.ClientID
// ACKs usually don't have NewProtocol flag set in Header byte
ack.Header.Type &= ^uint8(protocol.PacketFlagNewProtocol)
// ACKs for Command packets after handshake must be encrypted
key := protocol.HandshakeKey
nonce := protocol.HandshakeNonce
if c.Handshake != nil && c.Handshake.Step >= 6 && len(c.Handshake.SharedIV) > 0 {
crypto := &protocol.CryptoState{
SharedIV: c.Handshake.SharedIV,
SharedMac: c.Handshake.SharedMac,
GenerationID: 0,
}
key, nonce = crypto.GenerateKeyNonce(&ack.Header, true) // Client->Server=true
}
// Meta for Client->Server: PID(2) + CID(2) + PT(1) = 5 bytes
meta := make([]byte, 5)
binary.BigEndian.PutUint16(meta[0:2], ack.Header.PacketID)
binary.BigEndian.PutUint16(meta[2:4], ack.Header.ClientID)
meta[4] = ack.Header.Type
encData, mac, _ := protocol.EncryptEAX(key, nonce, meta, ack.Data)
ack.Data = encData
copy(ack.Header.MAC[:], mac)
// log.Printf("Sending ACK Low for server CommandLow PID=%d", pkt.Header.PacketID)
c.Conn.SendPacket(ack)
return c.handleCommand(pkt) return c.handleCommand(pkt)
case protocol.PacketTypeVoice: case protocol.PacketTypeVoice:
c.handleVoice(pkt) c.handleVoice(pkt)

View File

@@ -76,7 +76,13 @@ For the best experience when working on Linux features from Windows, use the **W
## 🤖 Gitea Actions (CI/CD) ## 🤖 Gitea Actions (CI/CD)
El archivo `.gitea/workflows/build-windows.yml` automatiza la compilación en cada push. El archivo `.gitea/workflows/build.yml` automatiza la compilación y la creación de Releases.
1. **Builds automáticas**: Cada `push` a `master` genera artefactos descargables.
2. **Releases automáticas**: Al subir un tag (`git tag v*`), se crea una Release con:
- `ts3-tui-windows-x86_64.zip` (Portable: exe + dlls).
- `ts3-tui-linux-x86_64` (Para PC/WSL2).
- `ts3-tui-linux-aarch64` (Para ARM/Raspberry Pi).
### Cómo usar tu propio Windows como Runner ### Cómo usar tu propio Windows como Runner
@@ -110,7 +116,7 @@ Si tu runner principal es ARM (como una Raspberry Pi) y quieres compilar para tu
- Igual que en Windows, usa `./act_runner register` con el token de tu Gitea. - Igual que en Windows, usa `./act_runner register` con el token de tu Gitea.
- En **labels**, pon algo como `linux-x86_64:host`. - En **labels**, pon algo como `linux-x86_64:host`.
4. **Actualiza el workflow**: 4. **Actualiza el workflow**:
- En `.gitea/workflows/build-linux.yml`, cambia `runs-on: ubuntu-latest` por `runs-on: linux-x86_64`. - En `.gitea/workflows/build.yml`, cambia `runs-on: ubuntu-latest` por `runs-on: linux-x86_64` en el job `build-linux`.
> [!NOTE] > [!NOTE]
> Al usar el label `:host`, el runner usará las herramientas instaladas en tu Linux de WSL2 sin necesidad de Docker, lo que lo hace mucho más rápido. > Al usar el label `:host`, el runner usará las herramientas instaladas en tu Linux de WSL2 sin necesidad de Docker, lo que lo hace mucho más rápido.

View File

@@ -4,4 +4,4 @@ $env:PKG_CONFIG_PATH = "D:\esto_al_path\msys64\mingw64\lib\pkgconfig"
Write-Host "Starting TeamSpeak Client (Windows Native)..." -ForegroundColor Cyan Write-Host "Starting TeamSpeak Client (Windows Native)..." -ForegroundColor Cyan
# go run ./cmd/client/main.go --server localhost:9987 # go run ./cmd/client/main.go --server localhost:9987
# go run ./cmd/example --server localhost:9987 # go run ./cmd/example --server localhost:9987
go run ./cmd/tui --server ts.vlazaro.es:9987 --nickname Adam --debug go run ./cmd/tui --server 127.0.0.1:9987 --nickname Adam --debug