0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-09-04 02:06:54 +02:00
Commit graph

500 commits

Author SHA1 Message Date
Thibaut CHARLES
ec30d143cd User registration return M_USER_IN_USE when username is already taken (#372)
When registering a new user using POST `/_matrix/client/r0/register`, the server was returning a 500 error when user name was already taken.

I added a check in `completeRegistration` to verify if the username is available before inserting it, and return a 400 `M_USER_IN_USE` error if there is a conflict, as [defined in matrix-doc](https://matrix.org/speculator/spec/HEAD/client_server/unstable.html#post-matrix-client-r0-register)

Signed-off-by: Thibaut CHARLES cromfr@gmail.com
2017-12-19 09:49:42 +00:00
Erik Johnston
b835e585c4
Add transaction ID to events if sending device (#368) 2017-12-15 15:42:55 +00:00
Erik Johnston
de6529d766
Ensure we only process one event at a time (#376) 2017-12-15 15:22:06 +00:00
Erik Johnston
4bb862864c Remove unused webhook 2017-12-15 14:10:28 +00:00
Richard van der Hoff
58e228fc3a s/VerifyEventSignatures/VerifyAllEventSignatures/
gomatrixserverlib API has been updated
2017-12-12 10:26:25 +00:00
Richard van der Hoff
e2f88f3889 gb vendor update github.com/matrix-org/gomatrixserverlib 2017-12-12 10:26:25 +00:00
Richard van der Hoff
d118eced54
Use the right linter versions (#370)
Prefer the gometalinter and linters that we build to anything else kicking
around on our PATH
2017-12-12 10:25:38 +00:00
Richard van der Hoff
568c6f7c66
Use latest versions of go (#369) 2017-12-12 10:25:24 +00:00
Richard van der Hoff
c3cb6f8767 Update gometalinter, and disable gas (#371)
* Update gometalinter

* Disable gas linter

According to the gas github page:

> Gas is still in alpha and accepting feedback from early adopters. We do not
> consider it production ready at this time.

Generally it seems to shout about a lot of things which aren't very errory,
like executing subprocesses with anything other than a hardcoded commandline,
and creating directories with anything other than 700 perms.
2017-12-08 19:13:17 +00:00
Erik Johnston
16f593f786 Fix some linting errors 2017-12-06 13:55:51 +00:00
Erik Johnston
75aa316a6a
Write and read transaction id from sync DB (#367) 2017-12-06 09:37:18 +00:00
Erik Johnston
578d8cf492
Add CORS headers to all responses including errors (#364) 2017-12-06 09:36:50 +00:00
Andrew Morgan
bc3dd821f9 Implemented ReCaptcha registration method (#343)
Signed-off-by: Andrew (anoa) <anoa@openmailbox.org>
2017-12-05 16:16:14 +00:00
Erik Johnston
8da05cc413
Add some basic docs about opentracing (#366) 2017-12-05 14:55:27 +00:00
Erik Johnston
ff78a99604 Disable the maligned lint (#365)
We don't really care about ensuring our structs are small, and sometimes
its clearer to group struct fields together.
2017-12-05 11:37:34 +00:00
Erik Johnston
7d38e82f25
Pass client transaction IDs along the kafka streams (#362) 2017-12-04 18:07:52 +00:00
Erik Johnston
7236090989
Add config option to disable registration (#360) 2017-12-04 17:07:45 +00:00
Andrew Morgan
791a5ee7f4 Squash username to all lowercase letters upon registration (#361)
* Squash username to all lowercase letters upon registration

Signed-off-by: Andrew Morgan (https://amorgan.xyz) <andrew@amorgan.xyz>
2017-12-04 09:40:36 +00:00
Erik Johnston
cc12fc930a Fix typo 2017-11-29 09:48:55 +00:00
Erik Johnston
330628ed29
Refactor BuildEvents to split out AddPrevEventsToEvent (#359)
This is so that we can add prev events to the builder explicitly,
without having to actually build the event.
2017-11-29 09:48:09 +00:00
Andrew Morgan
a4460dd6ee Set up proper registration flow (#354)
* Refactor registration to align with the spec
* We now keep track of sessions and their completed registration stages.
* We only complete registration if the client has completed a full flow.
* New Derived section in config for data derived from config options.
* New config options for captcha.
* Send params back to client for each registration stage.

Signed-off-by: Andrew Morgan (https://amorgan.xyz) <andrew@amorgan.xyz>
2017-11-29 09:43:03 +00:00
Erik Johnston
b7a3b92a9f
Implement /make_join and /send_join (#316) 2017-11-29 09:38:56 +00:00
Richard van der Hoff
3c543bba54
run commit hook on what we're committing (#356)
(rather than what's in our WC)
2017-11-27 12:19:04 +00:00
Richard van der Hoff
fc92fdbe0a
Add OPTIONS handlers everywhere (#355)
Everything gets pre-flighted now, because of the Authorization header, so we
need to support OPTIONS everywhere.
2017-11-27 12:18:48 +00:00
Richard van der Hoff
0786318a04
Bump gomatrixserverlib (#353)
* Bump gomatrixserverlib

Mostly because I want to use Erik's go-faster jsoning.

* Update KeyDB for new KeyFetcher API

we now need to implement FetcherName.

* Attempt to fix integ tests

CanonicalJSON doesn't like the empty string, apparently, and anyway
canonicalising it is pointless.

* More integ test fix
2017-11-27 12:05:14 +00:00
Erik Johnston
9e352e7311
Implement query to get state and auth chain (#352)
* Implement query to get state and auth chain

* Add routing for queryStateAndAuthChain

* Comments

* Fix fetching wrong set of events

* Add tests

* Shuffle and comment
2017-11-27 10:20:00 +00:00
Erik Johnston
9476a266bd
Add database.naffka to example config (#350)
* Add database.naffka to example config

* Update dendrite-config.yaml

* Add naffka creation to INSTALL
2017-11-22 15:46:49 +00:00
Erik Johnston
0d72e34acf
Fix panic if upload name wasn't supplied (#351) 2017-11-22 15:45:03 +00:00
Erik Johnston
f42f44391f
Fix /sync when we have no events (#341)
* Fix /sync when we have no events

We used a since token of 0 to mean that no token was given. However, naffka
streams start at 0. This causes clients to get stuck spinning forever until an
event is sent.

This changes it so that we pass around pointers instead, with nil meaning a
since token wasn't given.

* Comment

* Fix unit tests

* Comments

* Fix typo
2017-11-22 09:51:12 +00:00
Erik Johnston
d44dc2d5e6
Code Style: Prefer WithFields over Infof (#349)
* Code Style: Prefer WithFields over Infof

* Update CODE_STYLE.md
2017-11-22 09:35:25 +00:00
Erik Johnston
e5f5bb5961
Update version of kafka (#347)
* Update version of kafka

* Update path

* Fix setting config option
2017-11-21 12:13:01 +00:00
Ross Schulman
ea53558cca Implement room_alias federation end point (#338)
* Add room alias query endpoint

* Try to fix indentation problems

* Fix linting errors and use of httpReq.FormValue

Signed-off-by: Ross Schulman <ross@rbs.io>

* Run gofmt

* Check for empty alias parameter and fix route URL

Signed-off-by: Ross Schulman <ross@rbs.io>

* Fix some linting errors

Signed-off-by: Ross Schulman <ross@rbs.io>

* Delete extra copy of directory route
2017-11-20 14:33:49 +00:00
Erik Johnston
19a716e7da
Fix create filter API (#342) 2017-11-18 15:06:51 +00:00
Michael Telatynski
bb8dcb09a1 use voip turnServers struct from gomatrix for dedup and consistency (#344)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-11-17 10:27:28 +00:00
Erik Johnston
8599a36fa6
Use a Postgres database rather than Memory for Naffka (#337)
* Update naffka dep

* User Postgres database rather than Memory for Naffka
2017-11-16 17:35:28 +00:00
Erik Johnston
bdc44c4bde Log errors when there is an error validating token (#340) 2017-11-16 15:46:52 +00:00
Erik Johnston
4b280943dc Fix SQL 2017-11-16 15:28:15 +00:00
Erik Johnston
561315e1d6
Add gofmt linter (#339)
* Check that gofmt has been run

* gofmt files

* Tabs and spaces
2017-11-16 10:12:02 +00:00
Richard van der Hoff
4124ce2ac0
Store keys rather than json in the keydatabase (#330)
* bump gomatrixserverlib

(changes to KeyFetcher and KeyDatabase interfaces)

* Store keys rather than json in the keydatabase

Rather than storing the raw JSON returned from a /keys/v1/query call in the
table, store the key itself.

This makes keydb.Database implement the updated KeyDatabase interface.
2017-11-15 17:46:16 +00:00
Erik Johnston
7f85422471
Move /state request handling out of RequestPool (#333)
We should probably move the handling out from the syncapi, but that
requires the clientapi to stream the current state which it currently
doesn't. This at least stops the sync and state handling being done in
one file.
2017-11-15 15:42:39 +00:00
Richard van der Hoff
db32692f2e
Just run the linter in the commit hook (#334)
The pre-commit hook took 45 seconds to run on my machine, which was more than
enough time for me to get distracted by a swordfight in the corridor.

Let's just run the linters (which still take 6 seconds). It's not the place of
a commit hook to run every test we can think of - that is what CI is for.
2017-11-15 11:14:21 +00:00
Erik Johnston
139fae988e Fix linting errors in go1.9.1 (#336)
Fix linting errors in go1.9.1
2017-11-15 11:13:09 +00:00
Erik Johnston
ff8b229192 Remove vendor/bin from PATH in script (#335)
We should no longer be building anything into vendor/bin in the scripts,
so adding it to the path can lead to all sorts of confusion if old
binaries are there.
2017-11-15 11:12:21 +00:00
Richard van der Hoff
8fff0e887c Update gometalinter config (#331)
* Update gometalinter config

gometalinter now uses `maligned` instead of `aligncheck`
(https://github.com/alecthomas/gometalinter/pull/367), so we need to update our
config accordingly.

* Update gometalinter

* Disable gotype linter

gotype does not seem to play nicely with the gb vendor directory. In
particular, it wants each of our dependencies to be built and installed (see
https://github.com/golang/go/issues/10969), but (empirically) it will not
accept them being installed in `pkg` but insists on them being in `vendor/pkg`.

This presents a problem because `gb build` builds the packages into `pkg`
(which doesn't seem entirely unreasonable since `.` comes before `vendor` in
`$GOPATH`). `go install github.com/x/y` does install in `vendor/pkg` but
requires us to know the name of each package.

The general conclusion of https://github.com/alecthomas/gometalinter/issues/91
seems to have been that the easiest thing to do is to disable `gotype` for now.

* Fix `unparam` lint

* Fix goshadow lint
2017-11-15 10:25:48 +00:00
Erik Johnston
dc782ec399
Split travis into multiple jobs (#322)
The motivation for this is to make it easier to see whether a travis failure is due to linting, unit tests or integration test failures, without having to look in the logs.

It also means that each job is independent, so if e.g. the linting fails then the unit tests will still be run.
2017-11-14 14:58:27 +00:00
Paul Tötterman
bad701c703 Add device display names (#319) 2017-11-14 09:59:02 +00:00
Andrew Morgan
8720570bb0 Check for existing filter before inserting a new one (#318)
Signed-off-by: Andrew (anoa) <anoa@openmailbox.org>
2017-11-14 09:56:23 +00:00
Richard van der Hoff
bf855a7e5c
Factor out keyring initialisation (#329)
Take the keyring init from the client-api-server and the monolith out to a
shared file
2017-11-13 18:39:09 +00:00
Michael Telatynski
90396b5620 implement voip/turnServer API endpoint (#323)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-11-09 09:58:45 +00:00
Andrew Morgan
b7cfc2e057 Federation: Implement Query Profile API (#317)
* Federation: Implement Query Profile API

Implements the server portion of: `GET
/_matrix/federation/v1/query/profile?user_id=...&field=...`

Closes #278

Signed-off-by: Andrew (anoa) <anoa@openmailbox.org>

* Properly export profile-related structs and fix wording

Signed-off-by: Andrew (anoa) <anoa@openmailbox.org>

* Check provided user's domain matches our own.
2017-11-05 14:03:54 -04:00