0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-09-19 17:38:56 +02:00
Commit graph

37 commits

Author SHA1 Message Date
Kegsay
b6ea1bc67a
Support sqlite in addition to postgres (#869)
* Move current work into single branch

* Initial massaging of clientapi etc (not working yet)

* Interfaces for accounts/devices databases

* Duplicate postgres package for sqlite3 (no changes made to it yet)

* Some keydb, accountdb, devicedb, common partition fixes, some more syncapi tweaking

* Fix accounts DB, device DB

* Update naffka dependency for SQLite

* Naffka SQLite

* Update naffka to latest master

* SQLite support for federationsender

* Mostly not-bad support for SQLite in syncapi (although there are problems where lots of events get classed incorrectly as backward extremities, probably because of IN/ANY clauses that are badly supported)

* Update Dockerfile -> Go 1.13.7, add build-base (as gcc and friends are needed for SQLite)

* Implement GET endpoints for account_data in clientapi

* Nuke filtering for now...

* Revert "Implement GET endpoints for account_data in clientapi"

This reverts commit 4d80dff458.

* Implement GET endpoints for account_data in clientapi (#861)

* Implement GET endpoints for account_data in clientapi

* Fix accountDB parameter

* Remove fmt.Println

* Fix insertAccountData SQLite query

* Fix accountDB storage interfaces

* Add empty push rules into account data on account creation (#862)

* Put SaveAccountData into the right function this time

* Not sure if roomserver is better or worse now

* sqlite work

* Allow empty last sent ID for the first event

* sqlite: room creation works

* Support sending messages

* Nuke fmt.println

* Move QueryVariadic etc into common, other device fixes

* Fix some linter issues

* Fix bugs

* Fix some linting errors

* Fix errcheck lint errors

* Make naffka use postgres as fallback, fix couple of compile errors

* What on earth happened to the /rooms/{roomID}/send/{eventType} routing

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-02-13 17:27:33 +00:00
Kiril Vladimiroff
d5dbe546e4
Always defer *sql.Rows.Close and consult with Err (#844)
* Always defer *sql.Rows.Close and consult with Err

database/sql.Rows.Next() makes sure to call Close only after exhausting
result rows which would NOT happen when returning early from a bad Scan.
Close being idempotent makes it a great candidate to get always deferred
regardless of what happens later on the result set.

This change also makes sure call Err() after exhausting Next() and
propagate non-nil results from it as the documentation advises.

Closes #764

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

* Override named result parameters in last returns

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

* Do the same over new changes that got merged

Signed-off-by: Kiril Vladimiroff <kiril@vladimiroff.org>

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-02-11 14:12:21 +00:00
S7evinK
3dfafd4824
Implement missing device management features (#835)
* Implement missing device management features

Signed-off-by: Till Faelligen <tfaelligen@gmail.com>

* Add a little more documentation

* Undo changes

* Use non-anonymous struct to decode devices list

* Update sytest-whitelist

* Update sytest-whitelist

* Update sytest-blacklist

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-02-11 12:13:38 +00:00
Behouba Manassé
9937c05bea
Pass cfg by reference around the codebase (#819)
* Pass cfg by reference around the codebase

* Merge branch 'master' into pass-cfg-by-ref

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-02-11 11:18:12 +00:00
Neil Alexander
c20109a573
Implement room version capabilities in CS API (#866)
* Add wiring for querying the roomserver for the default room version

* Try to implement /capabilities for room versions

* Update copyright notices

* Update sytests, add /capabilities endpoint into CS API

* Update sytest-whitelist

* Add GetDefaultRoomVersion

* Fix cases where state package was shadowed

* Fix version formatting

* Update Dockerfile to Go 1.13.6

* oh yes types I remember

* And fix the default too
2020-02-05 18:06:39 +00:00
Prateek Sachan
4113599f61
Handle kind=guest query parameter on /register (#860)
* Handle kind=guest query parameter on /register

* Reorganized imports

* Pass device_id as nil

* Added tests to systest-whitelist
2020-01-30 11:25:57 +00:00
Neil Alexander
68ee11d96c
Add empty push rules into account data on account creation (#862) 2020-01-30 11:20:44 +00:00
Neil Alexander
6885c10083
Implement GET endpoints for account_data in clientapi (#861)
* Implement GET endpoints for account_data in clientapi

* Fix accountDB parameter

* Remove fmt.Println
2020-01-29 17:53:05 +00:00
Neil Alexander
ac96fd565b Identifier key login
Merge commit '56318dcca400b5ada4dfa4f8fac922522fc88128'
2020-01-20 11:37:23 +00:00
Neil Alexander
3bd023e74d
Federation fixes (#845)
* Update gomatrixserverlib to p2p commit 92c0338, other tweaks

* Update gomatrixserverlib to p2p commit e5dcc65

* Rewrite getAuthChain

* Update gomatrixserverlib in go.mod/go.sum

* Correct a couple of package refs for updated gmsl/gomatrix

* Update gomatrixserverlib ref in go.mod/go.sum

* Update getAuthChain comments following @babolivier review
2020-01-10 12:11:44 +00:00
Serra Allgood
56318dcca4 Fix login using identifier key
Not a full fix, it only really supports logging in with
the localpart of an mxid.

Signed-off-by: Serra Allgood <serra@allgood.dev>
2019-11-27 14:09:06 -08:00
Alex Chen
e959927d0a selectAccountDataByType shouldn't error when no rows (#804)
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-10-07 13:15:58 +01:00
Alex Chen
e239fb10f3
Add missing servers field in /directory/room/:alias response (#732) 2019-10-02 00:09:47 +08:00
Behouba Manassé
49fd47c863 selectAccountDataByType return ClientEvent pointer instead of slice of ClientEvent (#798)
This pull request is an attempt to fix #773.

Signed-off-by: Kouame Behouba Manassé behouba@gmail.com
2019-09-30 17:25:04 +01:00
Alex Chen
43308d2f3f
Associate transactions with session IDs instead of device IDs (#789) 2019-08-24 00:55:40 +08:00
Alex Chen
0ed2dd0b15
Fix data race in clientapi/routing/register.go (#787) 2019-08-16 12:05:00 +08:00
Alex Chen
d63d2a50cd
Replace event content types with ones in gomatrixserverlib (#785)
The types that are not in gomatrixserverlib are not replaced.

This also updates the gomatrixserverlib dependency.
2019-08-16 01:45:11 +08:00
Parminder Singh
d21a2fb152 Add auth fallback endpoint (#405)
Also adds support for the recaptcha auth type.
2019-08-15 01:34:49 +08:00
Alex Chen
aa0d22bf50
Implement client single event retrieval (#693) 2019-08-09 17:45:54 +08:00
Alex Chen
94ea325c93
Fix permission and 404 response for alias deletion - #654 (#706) 2019-08-07 11:00:58 +08:00
Alex Chen
324ca22b35
Implement profile retrieval over federation (#726) 2019-08-07 00:02:12 +08:00
Alex Chen
66bf615360
Fix transaction IDs in transaction cache have global scope (#772) 2019-08-06 23:33:53 +08:00
Alex Chen
f8d2860765 Replace membership and visibility values with constants (#774)
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-08-06 15:07:36 +01:00
Sumukha Pk
d283676b9a Implements room tagging. (#694) 2019-08-02 19:17:51 +08:00
Alex Chen
604685c503 Implement room creation content (#754)
Fixes #660.

Signed-off-by: Alex Chen minecnly@gmail.com
2019-07-24 17:15:36 +01:00
Thibaut CHARLES
b729a10366 Store & retrieve filters as structs rather than []byte (#436)
Manipulate filters as gomatrix.Filter structures, instead of their []byte JSON representation.
This lays ground work for using filters in dendrite for /sync requests.
2019-07-25 00:08:51 +08:00
Andrew Morgan
78032b3f4c
Correctly create new device when device_id is passed to /login (#753)
Fixes https://github.com/matrix-org/dendrite/issues/401

Currently when passing a `device_id` parameter to `/login`, which is [supposed](https://matrix.org/docs/spec/client_server/unstable#post-matrix-client-r0-login) to return a device with that ID set, it instead just generates a random `device_id` and hands that back to you.

The code was already there to do this correctly, it looks like it had just been broken during some change. Hopefully sytest will prevent this from becoming broken again.
2019-07-22 15:05:38 +01:00
Andrew Morgan
504d23f468 Remove unnecessary http method checks (#747)
Closes #523

There were a lot of unnecessary checks for HTTP methods of requests. gorilla/mux makes sure that these methods will only be called if certain HTTP methods are used, thus there's no reason to have these extra checks.
2019-07-18 15:40:10 +08:00
Andrew Morgan
bff60953f3 Prevent duplicate entries in the completed registration flows (#741) 2019-07-17 11:55:25 +08:00
Andrew Morgan
e2251199a4
Lots of small typo fixes (#737) 2019-07-12 16:43:01 +01:00
Alex Chen
f8463063ac
Fix #661 appservice can't set aliases in its own namespace (#731)
Fixes #661.
2019-07-12 21:36:17 +08:00
Andrew Morgan
7edf197ecc
Fix response to /rooms/{roomId}/join v2 (#734)
Continuation of #684 but merged-forward.

Also did a little code cleanup and added a new, passing test to the testfile.
2019-07-12 14:29:30 +01:00
Alex Chen
86e65bb22d Add back missing returns for httputil.LogThenError calls (#730)
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-07-09 17:33:52 +01:00
Anant Prakash
c725176878 Fix http responses in validateRecaptcha (#431)
fixes #421
2019-07-09 14:21:33 +01:00
Andrew Morgan
33a1392541
Encode URLs properly (#728)
We were escaping the URL before performing any pattern matching on it.
This meant that if you sent data that URLdecoded to a "/", it would count as
a "/" in the URL, potentially causing a 404. This was causing some flaky tests
with some randomly-generated query parameters.

Now, we keep URLs encoded while doing the pattern matching, and only afterwards
do we URL decode each query parameter individually before passing them to their
respective handler functions.

github.com/gorilla/mux was also updated to v1.7.3 to fix a bug with URL encoding and subrouters.
2019-07-03 16:38:50 +01:00
Andrew Morgan
bc382bba46
Fix pipeline, emoji and syntax (#713)
Fixes #697

Switched to golangci-lint, fixes issues with buildkite and does some linting fixes to appease the new linters.
2019-06-19 14:05:03 +01:00
ruben
74827428bd use go module for dependencies (#594) 2019-05-21 21:56:55 +01:00