1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-28 05:28:30 +00:00

Handle multichat in single-publish

This commit is contained in:
Kane York 2015-11-08 22:01:32 -08:00
parent 4f3473e8d9
commit a4ecc790b9
2 changed files with 6 additions and 6 deletions

View file

@ -99,7 +99,7 @@ func HBackendPublishRequest(w http.ResponseWriter, r *http.Request) {
case MsgTargetTypeChat: case MsgTargetTypeChat:
count = PublishToChat(channel, cm) count = PublishToChat(channel, cm)
case MsgTargetTypeMultichat: case MsgTargetTypeMultichat:
// TODO count = PublishToMultiple(strings.Split(channel, ","), cm)
case MsgTargetTypeGlobal: case MsgTargetTypeGlobal:
count = PublishToAll(cm) count = PublishToAll(cm)
case MsgTargetTypeInvalid: case MsgTargetTypeInvalid:
@ -119,15 +119,15 @@ func (bfe BackendForwardedError) Error() string {
var AuthorizationNeededError = errors.New("Must authenticate Twitch username to use this command") 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)) cached, ok := responseCache.Get(getCacheKey(remoteCommand, data))
if ok { if ok {
return cached.(string), nil 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) destUrl := fmt.Sprintf("%s/cmd/%s", backendUrl, remoteCommand)
var authKey string var authKey string
if auth.UsernameValidated { if auth.UsernameValidated {

View file

@ -376,7 +376,7 @@ func HandleBunchedRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg Cl
PendingBunchedRequests[br] = &BunchSubscriberList{Members: []BunchSubscriber{{Client: client, MessageID: msg.MessageID}}} PendingBunchedRequests[br] = &BunchSubscriberList{Members: []BunchSubscriber{{Client: client, MessageID: msg.MessageID}}}
go func(request BunchedRequest) { 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 var msg ClientMessage
if err == nil { if err == nil {
@ -417,7 +417,7 @@ func HandleRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg ClientMes
const AuthorizationFailedErrorString = "Failed to verify your Twitch username." const AuthorizationFailedErrorString = "Failed to verify your Twitch username."
func doRemoteCommand(conn *websocket.Conn, msg ClientMessage, client *ClientInfo) { 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 { if err == AuthorizationNeededError {
client.StartAuthorization(func(_ *ClientInfo, success bool) { client.StartAuthorization(func(_ *ClientInfo, success bool) {