Update a couple permissions things, no longer allow anonymous users.
This commit is contained in:
@@ -196,6 +196,9 @@ func (client *Client) PushConn(g *hall.Hall, id string, up conn.Up, tracks []con
|
||||
g.WallOps("Write to disk: " + err.Error())
|
||||
return err
|
||||
}
|
||||
if down == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
client.down[up.Id()] = down
|
||||
return nil
|
||||
@@ -699,7 +702,7 @@ func newDiskConn(client *Client, up conn.Up, remoteTracks []conn.UpTrack) (*disk
|
||||
}
|
||||
|
||||
if len(tracks) == 0 {
|
||||
return nil, errors.New("no usable tracks found")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
down := &diskConn{
|
||||
|
||||
@@ -8,6 +8,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.stormux.org/storm/skald/conn"
|
||||
"git.stormux.org/storm/skald/hall"
|
||||
)
|
||||
|
||||
func TestSanitise(t *testing.T) {
|
||||
@@ -195,6 +198,32 @@ func TestMixFrameReturnsNilForSilence(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDiskConnIgnoresConnectionWithoutRecordableTracks(t *testing.T) {
|
||||
down, err := newDiskConn(&Client{}, &fakeUp{id: "up1"}, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if down != nil {
|
||||
t.Fatalf("expected no disk connection for no tracks, got %#v", down)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushConnDoesNotStoreConnectionWithoutRecordableTracks(t *testing.T) {
|
||||
g := &hall.Hall{}
|
||||
client := &Client{
|
||||
hall: g,
|
||||
recorder: &recorder{},
|
||||
down: make(map[string]*diskConn),
|
||||
}
|
||||
err := client.PushConn(g, "up1", &fakeUp{id: "up1"}, nil, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(client.down) != 0 {
|
||||
t.Fatalf("stored %d down connections, expected 0", len(client.down))
|
||||
}
|
||||
}
|
||||
|
||||
func TestRecorderCreatesPlayableOgg(t *testing.T) {
|
||||
if _, err := exec.LookPath("ffmpeg"); err != nil {
|
||||
t.Skip("ffmpeg not installed")
|
||||
@@ -275,3 +304,13 @@ func pcmFrame(sample int16) []byte {
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
type fakeUp struct {
|
||||
id string
|
||||
}
|
||||
|
||||
func (u *fakeUp) AddLocal(conn.Down) error { return nil }
|
||||
func (u *fakeUp) DelLocal(conn.Down) bool { return true }
|
||||
func (u *fakeUp) Id() string { return u.id }
|
||||
func (u *fakeUp) Label() string { return "audio" }
|
||||
func (u *fakeUp) User() (string, string) { return "user-id", "Username" }
|
||||
|
||||
Reference in New Issue
Block a user