mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-03 11:50:56 +00:00
Merge pull request #204 from riking/compile-fix
Remove relative imports, update main for ratelimiting
This commit is contained in:
commit
50f597b769
3 changed files with 8 additions and 7 deletions
|
@ -6,7 +6,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"../../server"
|
"github.com/FrankerFaceZ/FrankerFaceZ/socketserver/server"
|
||||||
|
"github.com/FrankerFaceZ/FrankerFaceZ/socketserver/server/rate"
|
||||||
"github.com/abiosoft/ishell"
|
"github.com/abiosoft/ishell"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
@ -33,7 +34,7 @@ func commandLineConsole() {
|
||||||
Command: "message",
|
Command: "message",
|
||||||
Arguments: args[0],
|
Arguments: args[0],
|
||||||
}
|
}
|
||||||
server.PublishToAll(msg)
|
server.PublishToAll(msg, rate.Unlimited())
|
||||||
return "Message sent.", nil
|
return "Message sent.", nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -52,9 +53,9 @@ func commandLineConsole() {
|
||||||
|
|
||||||
var count int
|
var count int
|
||||||
if target == "_ALL" {
|
if target == "_ALL" {
|
||||||
count = server.PublishToAll(msg)
|
count = server.PublishToAll(msg, rate.Unlimited())
|
||||||
} else {
|
} else {
|
||||||
count = server.PublishToChannel(target, msg)
|
count = server.PublishToChannel(target, msg, rate.Unlimited())
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("Published to %d clients", count), nil
|
return fmt.Sprintf("Published to %d clients", count), nil
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package main // import "bitbucket.org/stendec/frankerfacez/socketserver/cmd/ffzsocketserver"
|
package main // import "github.com/FrankerFaceZ/FrankerFaceZ/socketserver/cmd/ffzsocketserver"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -9,7 +9,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"../../server"
|
"github.com/FrankerFaceZ/FrankerFaceZ/socketserver/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
import _ "net/http/pprof"
|
import _ "net/http/pprof"
|
||||||
|
|
|
@ -139,7 +139,7 @@ func (backend *backendInfo) SendRemoteCommand(remoteCommand, data string, auth A
|
||||||
|
|
||||||
if resp.StatusCode == 401 {
|
if resp.StatusCode == 401 {
|
||||||
return "", ErrAuthorizationNeeded
|
return "", ErrAuthorizationNeeded
|
||||||
} else if resp.StatusCode != 200 {
|
} else if resp.StatusCode < 200 || resp.StatusCode > 299 { // any non-2xx
|
||||||
if resp.Header.Get("Content-Type") == "application/json" {
|
if resp.Header.Get("Content-Type") == "application/json" {
|
||||||
var err2 ErrForwardedFromBackend
|
var err2 ErrForwardedFromBackend
|
||||||
err := json.Unmarshal(respBytes, &err2.JSONError)
|
err := json.Unmarshal(respBytes, &err2.JSONError)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue