Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build desktop

package event

import (
Expand Down
67 changes: 67 additions & 0 deletions internal/event/wails_broadcaster_http.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//go:build !desktop

package event

import (
"context"
"sync"

"github.com/Bowl42/maxx/internal/domain"
)

// WailsBroadcaster wraps an existing Broadcaster
// In HTTP mode, this simply delegates to the inner broadcaster without Wails event emission
type WailsBroadcaster struct {
inner Broadcaster
ctx context.Context
mu sync.RWMutex
}

// NewWailsBroadcaster creates a new WailsBroadcaster wrapping the given broadcaster
func NewWailsBroadcaster(inner Broadcaster) *WailsBroadcaster {
return &WailsBroadcaster{
inner: inner,
}
}

// SetContext is a no-op in HTTP mode (kept for API compatibility)
func (w *WailsBroadcaster) SetContext(ctx context.Context) {
w.mu.Lock()
defer w.mu.Unlock()
w.ctx = ctx
}

// BroadcastProxyRequest broadcasts a proxy request update
func (w *WailsBroadcaster) BroadcastProxyRequest(req *domain.ProxyRequest) {
if w.inner != nil {
w.inner.BroadcastProxyRequest(req)
}
}

// BroadcastProxyUpstreamAttempt broadcasts a proxy upstream attempt update
func (w *WailsBroadcaster) BroadcastProxyUpstreamAttempt(attempt *domain.ProxyUpstreamAttempt) {
if w.inner != nil {
w.inner.BroadcastProxyUpstreamAttempt(attempt)
}
}

// BroadcastLog broadcasts a log message
func (w *WailsBroadcaster) BroadcastLog(message string) {
if w.inner != nil {
w.inner.BroadcastLog(message)
}
}

// BroadcastStats broadcasts stats update
func (w *WailsBroadcaster) BroadcastStats(stats interface{}) {
if w.inner != nil {
w.inner.BroadcastStats(stats)
}
}

// BroadcastMessage broadcasts a custom message
func (w *WailsBroadcaster) BroadcastMessage(messageType string, data interface{}) {
if w.inner != nil {
w.inner.BroadcastMessage(messageType, data)
}
}
1 change: 1 addition & 0 deletions wails.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://wails.io/schemas/config.v2.json",
"name": "maxx",
"outputfilename": "maxx",
"tags": "desktop",
"frontend:install": "pnpm install",
"frontend:build": "pnpm build",
"frontend:dev:watcher": "pnpm dev",
Expand Down
11 changes: 11 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"postcss": "^8.5.6",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-resizable-panels": "^2.1.7",
"react-router-dom": "^7.11.0",
"recharts": "^3.6.0",
"shadcn": "^3.6.3",
Expand Down
Loading