From b31036147de7c8668e564880013ef896c623fbb8 Mon Sep 17 00:00:00 2001 From: GigaFyde Date: Wed, 26 Feb 2020 13:46:10 +0100 Subject: [PATCH] A huge amount more spelling corrections --- client/src/neko/messages.ts | 8 ++--- server/internal/session/manager.go | 4 +-- server/internal/session/session.go | 8 ++--- server/internal/types/config/webrtc.go | 4 +-- server/internal/types/message/messages.go | 4 +-- server/internal/types/session.go | 8 ++--- server/internal/types/webrtc.go | 2 +- server/internal/types/webscoket.go | 2 +- server/internal/webrtc/peer.go | 2 +- server/internal/websocket/admin.go | 44 +++++++++++------------ server/internal/websocket/chat.go | 12 +++---- server/internal/websocket/control.go | 12 +++---- server/internal/websocket/handler.go | 4 +-- server/internal/websocket/screen.go | 4 +-- server/internal/websocket/session.go | 12 +++---- server/internal/websocket/signal.go | 2 +- server/internal/websocket/websocket.go | 4 +-- server/neko.go | 2 +- 18 files changed, 69 insertions(+), 69 deletions(-) diff --git a/client/src/neko/messages.ts b/client/src/neko/messages.ts index fdb81ee..92f0fdf 100644 --- a/client/src/neko/messages.ts +++ b/client/src/neko/messages.ts @@ -16,8 +16,8 @@ export type WebSocketMessages = | SignalProvideMessage | SignalAnswerMessage | MemberListMessage - | MembeConnectMessage - | MembeDisconnectMessage + | MemberConnectMessage + | MemberDisconnectMessage | ControlMessage | ScreenResolutionMessage | ScreenConfigurationsMessage @@ -85,13 +85,13 @@ export interface MemberListPayload { } // member/connected -export interface MembeConnectMessage extends WebSocketMessage, MemberPayload { +export interface MemberConnectMessage extends WebSocketMessage, MemberPayload { event: typeof EVENT.MEMBER.CONNECTED } export type MemberPayload = Member // member/disconnected -export interface MembeDisconnectMessage extends WebSocketMessage, MemberPayload { +export interface MemberDisconnectMessage extends WebSocketMessage, MemberPayload { event: typeof EVENT.MEMBER.DISCONNECTED } export interface MemberDisconnectPayload { diff --git a/server/internal/session/manager.go b/server/internal/session/manager.go index 5a2548e..1806a88 100644 --- a/server/internal/session/manager.go +++ b/server/internal/session/manager.go @@ -27,7 +27,7 @@ type SessionManager struct { emmiter events.EventEmmiter } -func (manager *SessionManager) New(id string, admin bool, socket types.WebScoket) types.Session { +func (manager *SessionManager) New(id string, admin bool, socket types.WebSocket) types.Session { session := &Session{ id: id, admin: admin, @@ -112,7 +112,7 @@ func (manager *SessionManager) Clear() error { return nil } -func (manager *SessionManager) Brodcast(v interface{}, exclude interface{}) error { +func (manager *SessionManager) Broadcast(v interface{}, exclude interface{}) error { for id, session := range manager.members { if !session.connected { continue diff --git a/server/internal/session/session.go b/server/internal/session/session.go index e65cbc0..78f225e 100644 --- a/server/internal/session/session.go +++ b/server/internal/session/session.go @@ -17,7 +17,7 @@ type Session struct { muted bool connected bool manager *SessionManager - socket types.WebScoket + socket types.WebSocket peer types.Peer mu sync.Mutex } @@ -67,7 +67,7 @@ func (session *Session) SetName(name string) error { return nil } -func (session *Session) SetSocket(socket types.WebScoket) error { +func (session *Session) SetSocket(socket types.WebSocket) error { session.socket = socket return nil } @@ -113,11 +113,11 @@ func (session *Session) Write(v interface{}) error { return session.socket.Send(v) } -func (session *Session) SignalAnwser(sdp string) error { +func (session *Session) SignalAnswer(sdp string) error { if session.peer == nil { return nil } - return session.peer.SignalAnwser(sdp) + return session.peer.SignalAnswer(sdp) } func (session *Session) destroy() error { diff --git a/server/internal/types/config/webrtc.go b/server/internal/types/config/webrtc.go index b2d1a35..3499c02 100644 --- a/server/internal/types/config/webrtc.go +++ b/server/internal/types/config/webrtc.go @@ -32,8 +32,8 @@ func (WebRTC) Init(cmd *cobra.Command) error { return err } - cmd.PersistentFlags().String("aduio", "", "audio codec parameters to use for streaming (unused)") - if err := viper.BindPFlag("aparams", cmd.PersistentFlags().Lookup("aduio")); err != nil { + cmd.PersistentFlags().String("audio", "", "audio codec parameters to use for streaming (unused)") + if err := viper.BindPFlag("aparams", cmd.PersistentFlags().Lookup("audio")); err != nil { return err } diff --git a/server/internal/types/message/messages.go b/server/internal/types/message/messages.go index d19040b..580a177 100644 --- a/server/internal/types/message/messages.go +++ b/server/internal/types/message/messages.go @@ -55,7 +55,7 @@ type ControlTarget struct { Target string `json:"target"` } -type ChatRecieve struct { +type ChatReceive struct { Event string `json:"event"` Content string `json:"content"` } @@ -66,7 +66,7 @@ type ChatSend struct { Content string `json:"content"` } -type EmoteRecieve struct { +type EmoteReceive struct { Event string `json:"event"` Emote string `json:"emote"` } diff --git a/server/internal/types/session.go b/server/internal/types/session.go index fbf34db..819badc 100644 --- a/server/internal/types/session.go +++ b/server/internal/types/session.go @@ -17,17 +17,17 @@ type Session interface { SetMuted(muted bool) SetName(name string) error SetConnected(connected bool) error - SetSocket(socket WebScoket) error + SetSocket(socket WebSocket) error SetPeer(peer Peer) error Address() *string Kick(message string) error Write(v interface{}) error Send(v interface{}) error - SignalAnwser(sdp string) error + SignalAnswer(sdp string) error } type SessionManager interface { - New(id string, admin bool, socket WebScoket) Session + New(id string, admin bool, socket WebSocket) Session HasHost() bool IsHost(id string) bool SetHost(id string) error @@ -38,7 +38,7 @@ type SessionManager interface { Members() []*Member Destroy(id string) error Clear() error - Brodcast(v interface{}, exclude interface{}) error + Broadcast(v interface{}, exclude interface{}) error OnHost(listener func(id string)) OnHostCleared(listener func(id string)) OnDestroy(listener func(id string)) diff --git a/server/internal/types/webrtc.go b/server/internal/types/webrtc.go index a507635..7b342b0 100644 --- a/server/internal/types/webrtc.go +++ b/server/internal/types/webrtc.go @@ -13,7 +13,7 @@ type WebRTCManager interface { } type Peer interface { - SignalAnwser(sdp string) error + SignalAnswer(sdp string) error WriteData(v interface{}) error Destroy() error } diff --git a/server/internal/types/webscoket.go b/server/internal/types/webscoket.go index 801d752..cbfc738 100644 --- a/server/internal/types/webscoket.go +++ b/server/internal/types/webscoket.go @@ -2,7 +2,7 @@ package types import "net/http" -type WebScoket interface { +type WebSocket interface { Address() *string Send(v interface{}) error Destroy() error diff --git a/server/internal/webrtc/peer.go b/server/internal/webrtc/peer.go index 47a74d2..3b75e29 100644 --- a/server/internal/webrtc/peer.go +++ b/server/internal/webrtc/peer.go @@ -13,7 +13,7 @@ type Peer struct { mu sync.Mutex } -func (peer *Peer) SignalAnwser(sdp string) error { +func (peer *Peer) SignalAnswer(sdp string) error { return peer.connection.SetRemoteDescription(webrtc.SessionDescription{SDP: sdp, Type: webrtc.SDPTypeAnswer}) } diff --git a/server/internal/websocket/admin.go b/server/internal/websocket/admin.go index 35a74c5..c63ee0b 100644 --- a/server/internal/websocket/admin.go +++ b/server/internal/websocket/admin.go @@ -21,12 +21,12 @@ func (h *MessageHandler) adminLock(id string, session types.Session) error { h.locked = true - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Admin{ Event: event.ADMIN_LOCK, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_LOCK) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_LOCK) return err } @@ -46,12 +46,12 @@ func (h *MessageHandler) adminUnlock(id string, session types.Session) error { h.locked = false - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Admin{ Event: event.ADMIN_UNLOCK, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_UNLOCK) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNLOCK) return err } @@ -69,22 +69,22 @@ func (h *MessageHandler) adminControl(id string, session types.Session) error { h.sessions.SetHost(id) if ok { - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_CONTROL, ID: id, Target: host.ID(), }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_CONTROL) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_CONTROL) return err } } else { - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Admin{ Event: event.ADMIN_CONTROL, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_CONTROL) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_CONTROL) return err } } @@ -103,22 +103,22 @@ func (h *MessageHandler) adminRelease(id string, session types.Session) error { h.sessions.ClearHost() if ok { - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_RELEASE, ID: id, Target: host.ID(), }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_RELEASE) return err } } else { - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Admin{ Event: event.ADMIN_RELEASE, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_RELEASE) return err } } @@ -141,13 +141,13 @@ func (h *MessageHandler) adminGive(id string, session types.Session, payload *me h.sessions.SetHost(payload.ID) // let everyone know - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.CONTROL_GIVE, ID: id, Target: payload.ID, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_LOCKED) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_LOCKED) return err } @@ -173,13 +173,13 @@ func (h *MessageHandler) adminMute(id string, session types.Session, payload *me target.SetMuted(true) - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_MUTE, Target: target.ID(), ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_UNMUTE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNMUTE) return err } @@ -200,13 +200,13 @@ func (h *MessageHandler) adminUnmute(id string, session types.Session, payload * target.SetMuted(false) - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_UNMUTE, Target: target.ID(), ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_UNMUTE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNMUTE) return err } @@ -234,13 +234,13 @@ func (h *MessageHandler) adminKick(id string, session types.Session, payload *me return err } - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_KICK, Target: target.ID(), ID: id, }, []string{payload.ID}); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_KICK) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_KICK) return err } @@ -284,13 +284,13 @@ func (h *MessageHandler) adminBan(id string, session types.Session, payload *mes return err } - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.AdminTarget{ Event: event.ADMIN_BAN, Target: target.ID(), ID: id, }, []string{payload.ID}); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.ADMIN_BAN) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_BAN) return err } diff --git a/server/internal/websocket/chat.go b/server/internal/websocket/chat.go index 78dd38d..8f68b5d 100644 --- a/server/internal/websocket/chat.go +++ b/server/internal/websocket/chat.go @@ -6,35 +6,35 @@ import ( "n.eko.moe/neko/internal/types/message" ) -func (h *MessageHandler) chat(id string, session types.Session, payload *message.ChatRecieve) error { +func (h *MessageHandler) chat(id string, session types.Session, payload *message.ChatReceive) error { if session.Muted() { return nil } - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.ChatSend{ Event: event.CHAT_MESSAGE, Content: payload.Content, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) return err } return nil } -func (h *MessageHandler) chatEmote(id string, session types.Session, payload *message.EmoteRecieve) error { +func (h *MessageHandler) chatEmote(id string, session types.Session, payload *message.EmoteReceive) error { if session.Muted() { return nil } - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.EmoteSend{ Event: event.CHAT_EMOTE, Emote: payload.Emote, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) return err } return nil diff --git a/server/internal/websocket/control.go b/server/internal/websocket/control.go index 44f3dcc..f20598c 100644 --- a/server/internal/websocket/control.go +++ b/server/internal/websocket/control.go @@ -20,12 +20,12 @@ func (h *MessageHandler) controlRelease(id string, session types.Session) error h.sessions.ClearHost() // tell everyone - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Control{ Event: event.CONTROL_RELEASE, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) return err } @@ -39,12 +39,12 @@ func (h *MessageHandler) controlRequest(id string, session types.Session) error h.sessions.SetHost(id) // let everyone know - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Control{ Event: event.CONTROL_LOCKED, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_LOCKED) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_LOCKED) return err } @@ -93,13 +93,13 @@ func (h *MessageHandler) controlGive(id string, session types.Session, payload * h.sessions.SetHost(payload.ID) // let everyone know - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.ControlTarget{ Event: event.CONTROL_GIVE, ID: id, Target: payload.ID, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_LOCKED) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_LOCKED) return err } diff --git a/server/internal/websocket/handler.go b/server/internal/websocket/handler.go index 73f8135..1895ade 100644 --- a/server/internal/websocket/handler.go +++ b/server/internal/websocket/handler.go @@ -84,13 +84,13 @@ func (h *MessageHandler) Message(id string, raw []byte) error { // Chat Events case event.CHAT_MESSAGE: - payload := &message.ChatRecieve{} + payload := &message.ChatReceive{} return errors.Wrapf( utils.Unmarshal(payload, raw, func() error { return h.chat(id, session, payload) }), "%s failed", header.Event) case event.CHAT_EMOTE: - payload := &message.EmoteRecieve{} + payload := &message.EmoteReceive{} return errors.Wrapf( utils.Unmarshal(payload, raw, func() error { return h.chatEmote(id, session, payload) diff --git a/server/internal/websocket/screen.go b/server/internal/websocket/screen.go index b178dcf..b9f4a62 100644 --- a/server/internal/websocket/screen.go +++ b/server/internal/websocket/screen.go @@ -18,7 +18,7 @@ func (h *MessageHandler) screenSet(id string, session types.Session, payload *me return err } - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.ScreenResolution{ Event: event.SCREEN_RESOLUTION, ID: id, @@ -26,7 +26,7 @@ func (h *MessageHandler) screenSet(id string, session types.Session, payload *me Height: payload.Height, Rate: payload.Rate, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.SCREEN_RESOLUTION) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.SCREEN_RESOLUTION) return err } diff --git a/server/internal/websocket/session.go b/server/internal/websocket/session.go index 8790757..2201ce5 100644 --- a/server/internal/websocket/session.go +++ b/server/internal/websocket/session.go @@ -50,12 +50,12 @@ func (h *MessageHandler) SessionConnected(id string, session types.Session) erro } // let everyone know there is a new session - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.Member{ Event: event.MEMBER_CONNECTED, Member: session.Member(), }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) return err } @@ -66,21 +66,21 @@ func (h *MessageHandler) SessionDestroyed(id string) error { // clear host if exists if h.sessions.IsHost(id) { h.sessions.ClearHost() - if err := h.sessions.Brodcast(message.Control{ + if err := h.sessions.Broadcast(message.Control{ Event: event.CONTROL_RELEASE, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.CONTROL_RELEASE) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) } } // let everyone know session disconnected - if err := h.sessions.Brodcast( + if err := h.sessions.Broadcast( message.MemberDisconnected{ Event: event.MEMBER_DISCONNECTED, ID: id, }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("brodcasting event %s has failed", event.MEMBER_DISCONNECTED) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.MEMBER_DISCONNECTED) return err } diff --git a/server/internal/websocket/signal.go b/server/internal/websocket/signal.go index e5b0dc1..1d96c2b 100644 --- a/server/internal/websocket/signal.go +++ b/server/internal/websocket/signal.go @@ -28,7 +28,7 @@ func (h *MessageHandler) signalAnswer(id string, session types.Session, payload return err } - if err := session.SignalAnwser(payload.SDP); err != nil { + if err := session.SignalAnswer(payload.SDP); err != nil { return err } diff --git a/server/internal/websocket/websocket.go b/server/internal/websocket/websocket.go index ba12a65..414d0f3 100644 --- a/server/internal/websocket/websocket.go +++ b/server/internal/websocket/websocket.go @@ -125,7 +125,7 @@ func (ws *WebSocketHandler) Upgrade(w http.ResponseWriter, r *http.Request) erro id, admin, err := ws.authenticate(r) if err != nil { - ws.logger.Warn().Err(err).Msg("authenticatetion failed") + ws.logger.Warn().Err(err).Msg("authentication failed") if err = connection.WriteJSON(message.Disconnect{ Event: event.SYSTEM_DISCONNECT, @@ -243,7 +243,7 @@ func (ws *WebSocketHandler) handle(connection *websocket.Conn, id string) { Str("session", id). Str("address", connection.RemoteAddr().String()). Str("raw", string(raw)). - Msg("recieved message from client") + Msg("received message from client") if err := ws.handler.Message(id, raw); err != nil { ws.logger.Error().Err(err).Msg("message handler has failed") } diff --git a/server/neko.go b/server/neko.go index 024e752..c7c5642 100644 --- a/server/neko.go +++ b/server/neko.go @@ -83,7 +83,7 @@ func (i *Version) String() string { func (i *Version) Details() string { return fmt.Sprintf( "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", - fmt.Sprintf("Verison %s.%s.%s", i.Major, i.Minor, i.Patch), + fmt.Sprintf("Version %s.%s.%s", i.Major, i.Minor, i.Patch), fmt.Sprintf("GitCommit %s", i.GitCommit), fmt.Sprintf("GitBranch %s", i.GitBranch), fmt.Sprintf("BuildDate %s", i.BuildDate),