mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-18 04:13:10 -06:00
Update whitelist, gomatrixserverlib, tweaks to roomserver
This commit is contained in:
parent
47c1ef2b49
commit
85316c5247
2
go.mod
2
go.mod
|
|
@ -11,7 +11,7 @@ require (
|
||||||
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200310180544-7f3fad43b51c
|
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200310180544-7f3fad43b51c
|
||||||
github.com/matrix-org/go-sqlite3-js v0.0.0-20200304164012-aa524245b658
|
github.com/matrix-org/go-sqlite3-js v0.0.0-20200304164012-aa524245b658
|
||||||
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26
|
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317114945-9a368ea4620d
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317140257-ddc7feaaf2fd
|
||||||
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1
|
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1
|
||||||
github.com/matrix-org/util v0.0.0-20190711121626-527ce5ddefc7
|
github.com/matrix-org/util v0.0.0-20190711121626-527ce5ddefc7
|
||||||
github.com/mattn/go-sqlite3 v2.0.2+incompatible
|
github.com/mattn/go-sqlite3 v2.0.2+incompatible
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -266,6 +266,8 @@ github.com/matrix-org/gomatrixserverlib v0.0.0-20200317103236-134415251e65 h1:ll
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317103236-134415251e65/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317103236-134415251e65/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317114945-9a368ea4620d h1:0GYO2Jye1TNVzsn02IF5tqV80psDi0KIWC4+glH6+/Q=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317114945-9a368ea4620d h1:0GYO2Jye1TNVzsn02IF5tqV80psDi0KIWC4+glH6+/Q=
|
||||||
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317114945-9a368ea4620d/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317114945-9a368ea4620d/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
|
||||||
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317140257-ddc7feaaf2fd h1:n95A8YyiCZ8Nu2beqw4akCaPIRrZr/nesHYDZV8WkXI=
|
||||||
|
github.com/matrix-org/gomatrixserverlib v0.0.0-20200317140257-ddc7feaaf2fd/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
|
||||||
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1 h1:osLoFdOy+ChQqVUn2PeTDETFftVkl4w9t/OW18g3lnk=
|
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1 h1:osLoFdOy+ChQqVUn2PeTDETFftVkl4w9t/OW18g3lnk=
|
||||||
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1/go.mod h1:cXoYQIENbdWIQHt1SyCo6Bl3C3raHwJ0wgVrXHSqf+A=
|
github.com/matrix-org/naffka v0.0.0-20200127221512-0716baaabaf1/go.mod h1:cXoYQIENbdWIQHt1SyCo6Bl3C3raHwJ0wgVrXHSqf+A=
|
||||||
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5 h1:W7l5CP4V7wPyPb4tYE11dbmeAOwtFQBTW0rf4OonOS8=
|
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5 h1:W7l5CP4V7wPyPb4tYE11dbmeAOwtFQBTW0rf4OonOS8=
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ func (d *Database) StoreEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Here we should aim to have two different code paths for new rooms
|
||||||
|
// vs existing ones.
|
||||||
|
|
||||||
// Get the default room version. If the client doesn't supply a room_version
|
// Get the default room version. If the client doesn't supply a room_version
|
||||||
// then we will use our configured default to create the room.
|
// then we will use our configured default to create the room.
|
||||||
// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom
|
// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom
|
||||||
|
|
@ -135,24 +138,26 @@ func (d *Database) StoreEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractRoomVersionFromCreateEvent(event gomatrixserverlib.Event) (
|
func extractRoomVersionFromCreateEvent(event gomatrixserverlib.Event) (
|
||||||
roomVersion gomatrixserverlib.RoomVersion, err error,
|
gomatrixserverlib.RoomVersion, error,
|
||||||
) {
|
) {
|
||||||
|
var err error
|
||||||
|
var roomVersion gomatrixserverlib.RoomVersion
|
||||||
// Look for m.room.create events.
|
// Look for m.room.create events.
|
||||||
if event.Type() != gomatrixserverlib.MRoomCreate {
|
if event.Type() != gomatrixserverlib.MRoomCreate {
|
||||||
return
|
return gomatrixserverlib.RoomVersion(""), nil
|
||||||
}
|
}
|
||||||
roomVersion = roomserverVersion.DefaultRoomVersion()
|
roomVersion = roomserverVersion.DefaultRoomVersion()
|
||||||
var createContent gomatrixserverlib.CreateContent
|
var createContent gomatrixserverlib.CreateContent
|
||||||
// The m.room.create event contains an optional "room_version" key in
|
// The m.room.create event contains an optional "room_version" key in
|
||||||
// the event content, so we need to unmarshal that first.
|
// the event content, so we need to unmarshal that first.
|
||||||
if err = json.Unmarshal(event.Content(), &createContent); err != nil {
|
if err = json.Unmarshal(event.Content(), &createContent); err != nil {
|
||||||
return
|
return gomatrixserverlib.RoomVersion(""), err
|
||||||
}
|
}
|
||||||
// A room version was specified in the event content?
|
// A room version was specified in the event content?
|
||||||
if createContent.RoomVersion != nil {
|
if createContent.RoomVersion != nil {
|
||||||
roomVersion = *createContent.RoomVersion
|
roomVersion = *createContent.RoomVersion
|
||||||
}
|
}
|
||||||
return
|
return roomVersion, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) assignRoomNID(
|
func (d *Database) assignRoomNID(
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ func Open(dataSourceName string) (*Database, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreEvent implements input.EventDatabase
|
// StoreEvent implements input.EventDatabase
|
||||||
|
// nolint:gocyclo
|
||||||
func (d *Database) StoreEvent(
|
func (d *Database) StoreEvent(
|
||||||
ctx context.Context, event gomatrixserverlib.Event,
|
ctx context.Context, event gomatrixserverlib.Event,
|
||||||
txnAndSessionID *api.TransactionID, authEventNIDs []types.EventNID,
|
txnAndSessionID *api.TransactionID, authEventNIDs []types.EventNID,
|
||||||
|
|
@ -93,6 +94,9 @@ func (d *Database) StoreEvent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Here we should aim to have two different code paths for new rooms
|
||||||
|
// vs existing ones.
|
||||||
|
|
||||||
// Get the default room version. If the client doesn't supply a room_version
|
// Get the default room version. If the client doesn't supply a room_version
|
||||||
// then we will use our configured default to create the room.
|
// then we will use our configured default to create the room.
|
||||||
// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom
|
// https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-createroom
|
||||||
|
|
@ -164,24 +168,26 @@ func (d *Database) StoreEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractRoomVersionFromCreateEvent(event gomatrixserverlib.Event) (
|
func extractRoomVersionFromCreateEvent(event gomatrixserverlib.Event) (
|
||||||
roomVersion gomatrixserverlib.RoomVersion, err error,
|
gomatrixserverlib.RoomVersion, error,
|
||||||
) {
|
) {
|
||||||
|
var err error
|
||||||
|
var roomVersion gomatrixserverlib.RoomVersion
|
||||||
// Look for m.room.create events.
|
// Look for m.room.create events.
|
||||||
if event.Type() != gomatrixserverlib.MRoomCreate {
|
if event.Type() != gomatrixserverlib.MRoomCreate {
|
||||||
return
|
return gomatrixserverlib.RoomVersion(""), nil
|
||||||
}
|
}
|
||||||
roomVersion = roomserverVersion.DefaultRoomVersion()
|
roomVersion = roomserverVersion.DefaultRoomVersion()
|
||||||
var createContent gomatrixserverlib.CreateContent
|
var createContent gomatrixserverlib.CreateContent
|
||||||
// The m.room.create event contains an optional "room_version" key in
|
// The m.room.create event contains an optional "room_version" key in
|
||||||
// the event content, so we need to unmarshal that first.
|
// the event content, so we need to unmarshal that first.
|
||||||
if err = json.Unmarshal(event.Content(), &createContent); err != nil {
|
if err = json.Unmarshal(event.Content(), &createContent); err != nil {
|
||||||
return
|
return gomatrixserverlib.RoomVersion(""), err
|
||||||
}
|
}
|
||||||
// A room version was specified in the event content?
|
// A room version was specified in the event content?
|
||||||
if createContent.RoomVersion != nil {
|
if createContent.RoomVersion != nil {
|
||||||
roomVersion = *createContent.RoomVersion
|
roomVersion = *createContent.RoomVersion
|
||||||
}
|
}
|
||||||
return
|
return roomVersion, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Database) assignRoomNID(
|
func (d *Database) assignRoomNID(
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,6 @@ Newly banned rooms appear in the leave section of incremental sync
|
||||||
Newly banned rooms appear in the leave section of incremental sync
|
Newly banned rooms appear in the leave section of incremental sync
|
||||||
local user can join room with version 1
|
local user can join room with version 1
|
||||||
User can invite local user to room with version 1
|
User can invite local user to room with version 1
|
||||||
local user can join room with version 2
|
|
||||||
User can invite local user to room with version 2
|
|
||||||
local user can join room with version 3
|
|
||||||
User can invite local user to room with version 3
|
|
||||||
local user can join room with version 4
|
|
||||||
User can invite local user to room with version 4
|
|
||||||
Should reject keys claiming to belong to a different user
|
Should reject keys claiming to belong to a different user
|
||||||
Can add account data
|
Can add account data
|
||||||
Can add account data to room
|
Can add account data to room
|
||||||
|
|
@ -198,10 +192,6 @@ Local non-members don't see posted message events
|
||||||
Remote room members also see posted message events
|
Remote room members also see posted message events
|
||||||
Lazy loading parameters in the filter are strictly boolean
|
Lazy loading parameters in the filter are strictly boolean
|
||||||
remote user can join room with version 1
|
remote user can join room with version 1
|
||||||
remote user can join room with version 2
|
|
||||||
remote user can join room with version 3
|
|
||||||
remote user can join room with version 4
|
|
||||||
remote user can join room with version 5
|
|
||||||
Inbound federation can query room alias directory
|
Inbound federation can query room alias directory
|
||||||
Outbound federation can query v2 /send_join
|
Outbound federation can query v2 /send_join
|
||||||
Inbound federation can receive v2 /send_join
|
Inbound federation can receive v2 /send_join
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue