diff --git a/socketserver/internal/server/backend.go b/socketserver/internal/server/backend.go index 6af4d068..42adb5ff 100644 --- a/socketserver/internal/server/backend.go +++ b/socketserver/internal/server/backend.go @@ -99,7 +99,7 @@ func HBackendPublishRequest(w http.ResponseWriter, r *http.Request) { case MsgTargetTypeChat: count = PublishToChat(channel, cm) case MsgTargetTypeMultichat: - // TODO + count = PublishToMultiple(strings.Split(channel, ","), cm) case MsgTargetTypeGlobal: count = PublishToAll(cm) case MsgTargetTypeInvalid: @@ -119,15 +119,15 @@ func (bfe BackendForwardedError) Error() string { var AuthorizationNeededError = errors.New("Must authenticate Twitch username to use this command") -func RequestRemoteDataCached(remoteCommand, data string, auth AuthInfo) (string, error) { +func SendRemoteCommandCached(remoteCommand, data string, auth AuthInfo) (string, error) { cached, ok := responseCache.Get(getCacheKey(remoteCommand, data)) if ok { return cached.(string), nil } - return RequestRemoteData(remoteCommand, data, auth) + return SendRemoteCommand(remoteCommand, data, auth) } -func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr string, err error) { +func SendRemoteCommand(remoteCommand, data string, auth AuthInfo) (responseStr string, err error) { destUrl := fmt.Sprintf("%s/cmd/%s", backendUrl, remoteCommand) var authKey string if auth.UsernameValidated { diff --git a/socketserver/internal/server/commands.go b/socketserver/internal/server/commands.go index 6b9ea72a..00adc88a 100644 --- a/socketserver/internal/server/commands.go +++ b/socketserver/internal/server/commands.go @@ -376,7 +376,7 @@ func HandleBunchedRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg Cl PendingBunchedRequests[br] = &BunchSubscriberList{Members: []BunchSubscriber{{Client: client, MessageID: msg.MessageID}}} go func(request BunchedRequest) { - resp, err := RequestRemoteDataCached(string(request.Command), request.Param, AuthInfo{}) + resp, err := SendRemoteCommandCached(string(request.Command), request.Param, AuthInfo{}) var msg ClientMessage if err == nil { @@ -417,7 +417,7 @@ func HandleRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg ClientMes const AuthorizationFailedErrorString = "Failed to verify your Twitch username." func doRemoteCommand(conn *websocket.Conn, msg ClientMessage, client *ClientInfo) { - resp, err := RequestRemoteDataCached(string(msg.Command), msg.origArguments, client.AuthInfo) + resp, err := SendRemoteCommandCached(string(msg.Command), msg.origArguments, client.AuthInfo) if err == AuthorizationNeededError { client.StartAuthorization(func(_ *ClientInfo, success bool) {