fix(build): make build-web works; gofmt all Go files
This commit is contained in:
@@ -18,7 +18,7 @@ docs:
|
||||
|
||||
# Build the web frontend
|
||||
build-web:
|
||||
cd web && [ -s ~/.nvm/nvm.sh ] && . ~/.nvm/nvm.sh && npm run build || (cd web && npm run build)
|
||||
cd web && ([ -s ~/.nvm/nvm.sh ] && . ~/.nvm/nvm.sh && npm run build || npm run build)
|
||||
|
||||
# Run the server locally (dev mode)
|
||||
run: build-server
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ import (
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/giphy"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/invite"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/message"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/moderation"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/middleware"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/moderation"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/permissions"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/push"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/reaction"
|
||||
@@ -250,7 +250,7 @@ func main() {
|
||||
r.Use(middleware.RateLimit(2, 5))
|
||||
r.Post("/", inviteHandler.Join)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// File serving (public, for viewing uploaded files)
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ import (
|
||||
|
||||
// APIClient wraps HTTP calls to the dumpster server.
|
||||
type APIClient struct {
|
||||
BaseURL string
|
||||
HTTP *http.Client
|
||||
BaseURL string
|
||||
HTTP *http.Client
|
||||
SessionToken string
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -3,18 +3,18 @@ package main
|
||||
import "github.com/charmbracelet/bubbles/key"
|
||||
|
||||
type keyMap struct {
|
||||
Up key.Binding
|
||||
Down key.Binding
|
||||
Top key.Binding
|
||||
Bottom key.Binding
|
||||
Tab key.Binding
|
||||
ShiftTab key.Binding
|
||||
FocusInput key.Binding
|
||||
Unfocus key.Binding
|
||||
Quit key.Binding
|
||||
Help key.Binding
|
||||
Send key.Binding
|
||||
MemberToggle key.Binding
|
||||
Up key.Binding
|
||||
Down key.Binding
|
||||
Top key.Binding
|
||||
Bottom key.Binding
|
||||
Tab key.Binding
|
||||
ShiftTab key.Binding
|
||||
FocusInput key.Binding
|
||||
Unfocus key.Binding
|
||||
Quit key.Binding
|
||||
Help key.Binding
|
||||
Send key.Binding
|
||||
MemberToggle key.Binding
|
||||
ChannelPicker key.Binding
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -53,8 +53,8 @@ var (
|
||||
BorderForeground(aqua)
|
||||
|
||||
UnfocusedBorder = lipgloss.NewStyle().
|
||||
Border(lipgloss.NormalBorder(), false, false, true, false).
|
||||
BorderForeground(bgT)
|
||||
Border(lipgloss.NormalBorder(), false, false, true, false).
|
||||
BorderForeground(bgT)
|
||||
|
||||
// Server list
|
||||
ServerActive = lipgloss.NewStyle().
|
||||
|
||||
+6
-6
@@ -4,12 +4,12 @@ package main
|
||||
|
||||
// VoiceState holds the current voice connection state.
|
||||
type VoiceState struct {
|
||||
Connected bool
|
||||
RoomName string
|
||||
LiveKitURL string
|
||||
Token string
|
||||
Muted bool
|
||||
Deafened bool
|
||||
Connected bool
|
||||
RoomName string
|
||||
LiveKitURL string
|
||||
Token string
|
||||
Muted bool
|
||||
Deafened bool
|
||||
Participants []VoiceParticipant
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -17,8 +17,8 @@ import (
|
||||
|
||||
// Handler handles direct-message conversations.
|
||||
type Handler struct {
|
||||
db *sql.DB
|
||||
hub *gateway.Hub
|
||||
db *sql.DB
|
||||
hub *gateway.Hub
|
||||
logger *slog.Logger
|
||||
}
|
||||
|
||||
@@ -256,14 +256,14 @@ func (h *Handler) buildResponse(ctx context.Context, convID string) (conversatio
|
||||
}
|
||||
|
||||
type messageResponse struct {
|
||||
ID string `json:"id"`
|
||||
ConversationID string `json:"conversation_id"`
|
||||
AuthorID string `json:"author_id"`
|
||||
AuthorName string `json:"author_username"`
|
||||
DisplayName *string `json:"author_display_name"`
|
||||
Content string `json:"content"`
|
||||
EditedAt *string `json:"edited_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
ID string `json:"id"`
|
||||
ConversationID string `json:"conversation_id"`
|
||||
AuthorID string `json:"author_id"`
|
||||
AuthorName string `json:"author_username"`
|
||||
DisplayName *string `json:"author_display_name"`
|
||||
Content string `json:"content"`
|
||||
EditedAt *string `json:"edited_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// ListMessages lists messages in a conversation.
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/embed"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/gateway"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/moderation"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/middleware"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/moderation"
|
||||
"git.dustin.coffee/hobokenchicken/dumpsterChat/internal/push"
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
@@ -136,8 +136,8 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(http.StatusTooManyRequests)
|
||||
json.NewEncoder(w).Encode(map[string]interface{}{
|
||||
"error": "slowmode",
|
||||
"retry_after": retryAfter,
|
||||
"error": "slowmode",
|
||||
"retry_after": retryAfter,
|
||||
"retry_after_ms": retryAfter * 1000,
|
||||
})
|
||||
return
|
||||
|
||||
@@ -2,28 +2,28 @@ package permissions
|
||||
|
||||
// Permission bitflags.
|
||||
const (
|
||||
VIEW_CHANNEL int64 = 1 << 0
|
||||
SEND_MESSAGES int64 = 1 << 1
|
||||
MANAGE_MESSAGES int64 = 1 << 2
|
||||
KICK_MEMBERS int64 = 1 << 3
|
||||
BAN_MEMBERS int64 = 1 << 4
|
||||
MANAGE_SERVER int64 = 1 << 5
|
||||
MANAGE_CHANNELS int64 = 1 << 6
|
||||
ADMINISTRATOR int64 = 1 << 7
|
||||
CONNECT_VOICE int64 = 1 << 8
|
||||
SPEAK_VOICE int64 = 1 << 9
|
||||
SHARE_SCREEN int64 = 1 << 10
|
||||
MUTE_MEMBERS int64 = 1 << 11
|
||||
VIEW_CHANNEL int64 = 1 << 0
|
||||
SEND_MESSAGES int64 = 1 << 1
|
||||
MANAGE_MESSAGES int64 = 1 << 2
|
||||
KICK_MEMBERS int64 = 1 << 3
|
||||
BAN_MEMBERS int64 = 1 << 4
|
||||
MANAGE_SERVER int64 = 1 << 5
|
||||
MANAGE_CHANNELS int64 = 1 << 6
|
||||
ADMINISTRATOR int64 = 1 << 7
|
||||
CONNECT_VOICE int64 = 1 << 8
|
||||
SPEAK_VOICE int64 = 1 << 9
|
||||
SHARE_SCREEN int64 = 1 << 10
|
||||
MUTE_MEMBERS int64 = 1 << 11
|
||||
CREATE_INSTANT_INVITE int64 = 1 << 12
|
||||
CHANGE_NICKNAME int64 = 1 << 13
|
||||
MANAGE_NICKNAMES int64 = 1 << 14
|
||||
MANAGE_ROLES int64 = 1 << 15
|
||||
MANAGE_WEBHOOKS int64 = 1 << 16
|
||||
EMBED_LINKS int64 = 1 << 17
|
||||
ATTACH_FILES int64 = 1 << 18
|
||||
ADD_REACTIONS int64 = 1 << 19
|
||||
USE_EXTERNAL_EMOJIS int64 = 1 << 20
|
||||
MENTION_EVERYONE int64 = 1 << 21
|
||||
CHANGE_NICKNAME int64 = 1 << 13
|
||||
MANAGE_NICKNAMES int64 = 1 << 14
|
||||
MANAGE_ROLES int64 = 1 << 15
|
||||
MANAGE_WEBHOOKS int64 = 1 << 16
|
||||
EMBED_LINKS int64 = 1 << 17
|
||||
ATTACH_FILES int64 = 1 << 18
|
||||
ADD_REACTIONS int64 = 1 << 19
|
||||
USE_EXTERNAL_EMOJIS int64 = 1 << 20
|
||||
MENTION_EVERYONE int64 = 1 << 21
|
||||
)
|
||||
|
||||
// DefaultEveryonePermissions is granted to the @everyone role when a server is created.
|
||||
|
||||
@@ -183,8 +183,6 @@ func (h *Handler) SendPush(ctx context.Context, userID string, payload map[strin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// SendChannelNotification sends a push notification to all server members (except the author)
|
||||
// when a new message is posted in a channel.
|
||||
func (h *Handler) SendChannelNotification(ctx context.Context, channelID, authorID, channelName, content string) {
|
||||
@@ -254,6 +252,7 @@ func (h *Handler) SendChannelNotification(ctx context.Context, channelID, author
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateVAPIDKeys generates a new VAPID key pair.
|
||||
func GenerateVAPIDKeys() (publicKey, privateKey string, err error) {
|
||||
privateKeyBytes := make([]byte, 32)
|
||||
|
||||
@@ -148,9 +148,9 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
|
||||
h.hub.BroadcastToServer(serverID, gateway.Event{
|
||||
Type: gateway.EventReactionAdd,
|
||||
Data: map[string]interface{}{
|
||||
"reaction": reaction,
|
||||
"channel_id": channelID,
|
||||
"message_id": messageID,
|
||||
"reaction": reaction,
|
||||
"channel_id": channelID,
|
||||
"message_id": messageID,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
lksdk "github.com/livekit/server-sdk-go/v2"
|
||||
"github.com/livekit/protocol/auth"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
lksdk "github.com/livekit/server-sdk-go/v2"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
apiKey string
|
||||
apiSecret string
|
||||
url string
|
||||
apiKey string
|
||||
apiSecret string
|
||||
url string
|
||||
roomClient *lksdk.RoomServiceClient
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ func (c *Client) CreateRoom(name string) (*livekit.Room, error) {
|
||||
}
|
||||
|
||||
room, err := c.roomClient.CreateRoom(context.Background(), &livekit.CreateRoomRequest{
|
||||
Name: name,
|
||||
EmptyTimeout: 300, // 5 minutes before auto-delete when empty
|
||||
Name: name,
|
||||
EmptyTimeout: 300, // 5 minutes before auto-delete when empty
|
||||
MaxParticipants: 20,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user