1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-03 00:18:31 +00:00

Reformat and add global message subscriptions

This commit is contained in:
Kane York 2015-10-26 10:06:45 -07:00
parent df7d607556
commit 8918b9ac3a
11 changed files with 182 additions and 158 deletions

View file

@ -1,21 +1,21 @@
package server
import (
"golang.org/x/crypto/nacl/box"
"net/http"
"time"
"fmt"
"net/url"
"github.com/pmylund/go-cache"
"strconv"
"io/ioutil"
"encoding/json"
"sync"
"log"
"os"
"crypto/rand"
"encoding/base64"
"encoding/json"
"fmt"
"github.com/pmylund/go-cache"
"golang.org/x/crypto/nacl/box"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"sync"
"time"
)
var backendHttpClient http.Client
@ -35,7 +35,7 @@ func SetupBackend(config *Config) {
if responseCache != nil {
responseCache.Flush()
}
responseCache = cache.New(60 * time.Second, 120 * time.Second)
responseCache = cache.New(60*time.Second, 120*time.Second)
getBacklogUrl = fmt.Sprintf("%s/backlog", backendUrl)
@ -64,7 +64,7 @@ func getCacheKey(remoteCommand, data string) string {
return fmt.Sprintf("%s/%s", remoteCommand, data)
}
func HandlePublishRequest(w http.ResponseWriter, r *http.Request) {
func HBackendPublishRequest(w http.ResponseWriter, r *http.Request) {
formData, err := UnsealRequest(r.Form)
if err != nil {
w.WriteHeader(403)
@ -109,7 +109,7 @@ func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr s
formData := url.Values{
"clientData": []string{data},
authKey: []string{auth.TwitchUsername},
authKey: []string{auth.TwitchUsername},
}
sealedForm, err := SealRequest(formData)
@ -144,7 +144,7 @@ func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr s
func FetchBacklogData(chatSubs, channelSubs []string) ([]ClientMessage, error) {
formData := url.Values{
"chatSubs": chatSubs,
"chatSubs": chatSubs,
"channelSubs": channelSubs,
}