From 93407cf7cff05fa99709ba5055bce329524cef32 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Fri, 29 Aug 2014 19:53:33 +0100 Subject: Bugfixes on presence pushes on user joining: * No need to inform clients of status of remote users; as that will arrive in due course anyway. We don't -have- the state currently, so we'd only send an unknown message * Remember to bump the presence serial for the event source, so the notifiers will wake up and report it --- tests/handlers/test_presence.py | 128 ++++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 57 deletions(-) (limited to 'tests/handlers') diff --git a/tests/handlers/test_presence.py b/tests/handlers/test_presence.py index fcd7a784cd..0a176bdd44 100644 --- a/tests/handlers/test_presence.py +++ b/tests/handlers/test_presence.py @@ -514,13 +514,6 @@ class PresencePushTestCase(unittest.TestCase): ) hs.handlers = JustPresenceHandlers(hs) - def update(*args,**kwargs): - # print "mock_update_client: Args=%s, kwargs=%s" %(args, kwargs,) - return defer.succeed(None) - - self.mock_update_client = Mock() - self.mock_update_client.side_effect = update - self.datastore = hs.get_datastore() def get_received_txn_response(*args): @@ -528,7 +521,7 @@ class PresencePushTestCase(unittest.TestCase): self.datastore.get_received_txn_response = get_received_txn_response self.handler = hs.get_handlers().presence_handler - self.handler.push_update_to_clients = self.mock_update_client + self.event_source = hs.get_event_sources().sources["presence"] # Mock the RoomMemberHandler hs.handlers.room_member_handler = Mock(spec=[ @@ -622,16 +615,23 @@ class PresencePushTestCase(unittest.TestCase): apple_set.add(self.u_banana) apple_set.add(self.u_clementine) + self.assertEquals(self.event_source.get_current_key(), 0) + yield self.handler.set_state(self.u_apple, self.u_apple, {"state": ONLINE}) - self.mock_update_client.assert_has_calls([ - call(users_to_push=set([self.u_apple, self.u_banana, self.u_clementine]), - room_ids=["a-room"], - observed_user=self.u_apple, - statuscache=ANY), # self-reflection - ], any_order=True) - self.mock_update_client.reset_mock() + self.assertEquals(self.event_source.get_current_key(), 1) + self.assertEquals( + self.event_source.get_new_events_for_user(self.u_apple, 0, None)[0], + [ + {"type": "m.presence", + "content": { + "user_id": "@apple:test", + "state": ONLINE, + "mtime_age": 0, + }}, + ], + ) presence = yield self.handler.get_presence_list( observer_user=self.u_apple, accepted=True) @@ -657,31 +657,24 @@ class PresencePushTestCase(unittest.TestCase): "state": OFFLINE}, ], presence) - self.mock_update_client.assert_has_calls([ - call(users_to_push=set([self.u_banana]), - room_ids=[], - observed_user=self.u_banana, - statuscache=ANY), # self-reflection - ]) # and no others... + self.assertEquals(self.event_source.get_current_key(), 2) + self.assertEquals( + self.event_source.get_new_events_for_user( + self.u_banana, 1, None + )[0], + [ + {"type": "m.presence", + "content": { + "user_id": "@banana:test", + "state": ONLINE, + "mtime_age": 2000 + }}, + ] + ) @defer.inlineCallbacks def test_push_remote(self): put_json = self.mock_http_client.put_json -# put_json.expect_call_and_return( -# call("remote", -# path=ANY, # Can't guarantee which txn ID will be which -# data=_expect_edu("remote", "m.presence", -# content={ -# "push": [ -# {"user_id": "@apple:test", -# "state": "online", -# "mtime_age": 0}, -# ], -# } -# ) -# ), -# defer.succeed((200, "OK")) -# ) put_json.expect_call_and_return( call("farm", path=ANY, # Can't guarantee which txn ID will be which @@ -724,6 +717,8 @@ class PresencePushTestCase(unittest.TestCase): self.room_members = [self.u_banana, self.u_potato] + self.assertEquals(self.event_source.get_current_key(), 0) + yield self.mock_federation_resource.trigger("PUT", "/matrix/federation/v1/send/1000000/", _make_edu_json("elsewhere", "m.presence", @@ -737,12 +732,20 @@ class PresencePushTestCase(unittest.TestCase): ) ) - self.mock_update_client.assert_has_calls([ - call(users_to_push=set([self.u_apple]), - room_ids=["a-room"], - observed_user=self.u_potato, - statuscache=ANY), - ], any_order=True) + self.assertEquals(self.event_source.get_current_key(), 1) + self.assertEquals( + self.event_source.get_new_events_for_user( + self.u_apple, 0, None + )[0], + [ + {"type": "m.presence", + "content": { + "user_id": "@potato:remote", + "state": ONLINE, + "mtime_age": 1000, + }} + ] + ) self.clock.advance_time(2) @@ -754,24 +757,35 @@ class PresencePushTestCase(unittest.TestCase): def test_join_room_local(self): self.room_members = [self.u_apple, self.u_banana] - yield self.distributor.fire("user_joined_room", self.u_elderberry, + self.assertEquals(self.event_source.get_current_key(), 0) + + # TODO(paul): Gut-wrenching + self.handler._user_cachemap[self.u_clementine] = UserPresenceCache() + self.handler._user_cachemap[self.u_clementine].update( + { + "state": PresenceState.ONLINE, + "mtime": self.clock.time_msec(), + }, self.u_clementine + ) + + yield self.distributor.fire("user_joined_room", self.u_clementine, "a-room" ) - self.mock_update_client.assert_has_calls([ - call(room_ids=["a-room"], - observed_user=self.u_elderberry, - users_to_push=set(), - statuscache=ANY), - call(users_to_push=set([self.u_elderberry]), - observed_user=self.u_apple, - room_ids=[], - statuscache=ANY), - call(users_to_push=set([self.u_elderberry]), - observed_user=self.u_banana, - room_ids=[], - statuscache=ANY), - ], any_order=True) + self.assertEquals(self.event_source.get_current_key(), 1) + self.assertEquals( + self.event_source.get_new_events_for_user( + self.u_apple, 0, None + )[0], + [ + {"type": "m.presence", + "content": { + "user_id": "@clementine:test", + "state": ONLINE, + "mtime_age": 0, + }} + ] + ) @defer.inlineCallbacks def test_join_room_remote(self): -- cgit 1.4.1 From 8fe912d95c96a2e3faff9f480c04060fa7cd0c0d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sun, 31 Aug 2014 14:51:37 +0100 Subject: change the world: make the default matrix API URL prefix /_matrix rather than /matrix to make it easier for existing websites to mount a HS in their namespace without collisions. perl -pi -e 's#/matrix#/_matrix#g' ./cmdclient/console.py ./docs/client-server/howto.rst ./docs/client-server/specification.rst ./docs/client-server/swagger_matrix/directory ./docs/client-server/swagger_matrix/events ./docs/client-server/swagger_matrix/login ./docs/client-server/swagger_matrix/presence ./docs/client-server/swagger_matrix/profile ./docs/client-server/swagger_matrix/registration ./docs/client-server/swagger_matrix/rooms ./docs/server-server/specification.rst ./graph/graph.py ./jsfiddles/create_room_send_msg/demo.js ./jsfiddles/event_stream/demo.js ./jsfiddles/example_app/demo.js ./jsfiddles/register_login/demo.js ./jsfiddles/room_memberships/demo.js ./synapse/api/urls.py ./tests/federation/test_federation.py ./tests/handlers/test_presence.py ./tests/handlers/test_typing.py ./tests/rest/test_events.py ./tests/rest/test_presence.py ./tests/rest/test_profile.py ./tests/rest/test_rooms.py ./webclient/components/fileUpload/file-upload-service.js ./webclient/components/matrix/matrix-service.js --- cmdclient/console.py | 12 +++++------ docs/client-server/howto.rst | 22 ++++++++++---------- docs/client-server/specification.rst | 4 ++-- docs/client-server/swagger_matrix/directory | 2 +- docs/client-server/swagger_matrix/events | 2 +- docs/client-server/swagger_matrix/login | 2 +- docs/client-server/swagger_matrix/presence | 2 +- docs/client-server/swagger_matrix/profile | 2 +- docs/client-server/swagger_matrix/registration | 2 +- docs/client-server/swagger_matrix/rooms | 2 +- docs/server-server/specification.rst | 2 +- graph/graph.py | 2 +- jsfiddles/create_room_send_msg/demo.js | 8 ++++---- jsfiddles/event_stream/demo.js | 8 ++++---- jsfiddles/example_app/demo.js | 18 ++++++++-------- jsfiddles/register_login/demo.js | 8 ++++---- jsfiddles/room_memberships/demo.js | 10 ++++----- synapse/api/urls.py | 8 ++++---- tests/federation/test_federation.py | 18 ++++++++-------- tests/handlers/test_presence.py | 24 +++++++++++----------- tests/handlers/test_typing.py | 6 +++--- tests/rest/test_events.py | 2 +- tests/rest/test_presence.py | 2 +- tests/rest/test_profile.py | 2 +- tests/rest/test_rooms.py | 2 +- .../components/fileUpload/file-upload-service.js | 2 +- webclient/components/matrix/matrix-service.js | 12 +++++------ 27 files changed, 93 insertions(+), 93 deletions(-) (limited to 'tests/handlers') diff --git a/cmdclient/console.py b/cmdclient/console.py index 7bda4000fc..7678b5e352 100755 --- a/cmdclient/console.py +++ b/cmdclient/console.py @@ -60,7 +60,7 @@ class SynapseCmd(cmd.Cmd): "complete_usernames": "on", "send_delivery_receipts": "on" } - self.path_prefix = "/matrix/client/api/v1" + self.path_prefix = "/_matrix/client/api/v1" self.event_stream_token = "END" self.prompt = ">>> " @@ -252,7 +252,7 @@ class SynapseCmd(cmd.Cmd): @defer.inlineCallbacks def _do_emailrequest(self, args): - url = self._identityServerUrl()+"/matrix/identity/api/v1/validate/email/requestToken" + url = self._identityServerUrl()+"/_matrix/identity/api/v1/validate/email/requestToken" json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False, headers={'Content-Type': ['application/x-www-form-urlencoded']}) @@ -274,7 +274,7 @@ class SynapseCmd(cmd.Cmd): @defer.inlineCallbacks def _do_emailvalidate(self, args): - url = self._identityServerUrl()+"/matrix/identity/api/v1/validate/email/submitToken" + url = self._identityServerUrl()+"/_matrix/identity/api/v1/validate/email/submitToken" json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False, headers={'Content-Type': ['application/x-www-form-urlencoded']}) @@ -294,7 +294,7 @@ class SynapseCmd(cmd.Cmd): @defer.inlineCallbacks def _do_3pidbind(self, args): - url = self._identityServerUrl()+"/matrix/identity/api/v1/3pid/bind" + url = self._identityServerUrl()+"/_matrix/identity/api/v1/3pid/bind" json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False, headers={'Content-Type': ['application/x-www-form-urlencoded']}) @@ -360,14 +360,14 @@ class SynapseCmd(cmd.Cmd): def _do_invite(self, roomid, userstring): if (not userstring.startswith('@') and self._is_on("complete_usernames")): - url = self._identityServerUrl()+"/matrix/identity/api/v1/lookup" + url = self._identityServerUrl()+"/_matrix/identity/api/v1/lookup" json_res = yield self.http_client.do_request("GET", url, qparams={'medium':'email','address':userstring}) mxid = None if 'mxid' in json_res and 'signatures' in json_res: - url = self._identityServerUrl()+"/matrix/identity/api/v1/pubkey/ed25519" + url = self._identityServerUrl()+"/_matrix/identity/api/v1/pubkey/ed25519" pubKey = None pubKeyObj = yield self.http_client.do_request("GET", url) diff --git a/docs/client-server/howto.rst b/docs/client-server/howto.rst index 9ef4cb5f78..3660c73d36 100644 --- a/docs/client-server/howto.rst +++ b/docs/client-server/howto.rst @@ -30,7 +30,7 @@ Registration The aim of registration is to get a user ID and access token which you will need when accessing other APIs:: - curl -XPOST -d '{"user_id":"example", "password":"wordpass"}' "http://localhost:8080/matrix/client/api/v1/register" + curl -XPOST -d '{"user_id":"example", "password":"wordpass"}' "http://localhost:8080/_matrix/client/api/v1/register" { "access_token": "QGV4YW1wbGU6bG9jYWxob3N0.AqdSzFmFYrLrTmteXc", @@ -51,13 +51,13 @@ Login ----- The aim when logging in is to get an access token for your existing user ID:: - curl -XGET "http://localhost:8080/matrix/client/api/v1/login" + curl -XGET "http://localhost:8080/_matrix/client/api/v1/login" { "type": "m.login.password" } - curl -XPOST -d '{"type":"m.login.password", "user":"example", "password":"wordpass"}' "http://localhost:8080/matrix/client/api/v1/login" + curl -XPOST -d '{"type":"m.login.password", "user":"example", "password":"wordpass"}' "http://localhost:8080/_matrix/client/api/v1/login" { "access_token": "QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd", @@ -87,7 +87,7 @@ Creating a room If you want to send a message to someone, you have to be in a room with them. To create a room:: - curl -XPOST -d '{"room_alias_name":"tutorial"}' "http://localhost:8080/matrix/client/api/v1/rooms?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" + curl -XPOST -d '{"room_alias_name":"tutorial"}' "http://localhost:8080/_matrix/client/api/v1/rooms?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" { "room_alias": "#tutorial:localhost", @@ -105,7 +105,7 @@ Sending messages ---------------- You can now send messages to this room:: - curl -XPUT -d '{"msgtype":"m.text", "body":"hello"}' "http://localhost:8080/matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/messages/%40example%3Alocalhost/msgid1?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" + curl -XPUT -d '{"msgtype":"m.text", "body":"hello"}' "http://localhost:8080/_matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/messages/%40example%3Alocalhost/msgid1?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" NB: There are no limitations to the types of messages which can be exchanged. The only requirement is that ``"msgtype"`` is specified. @@ -127,7 +127,7 @@ Inviting a user to a room ------------------------- You can directly invite a user to a room like so:: - curl -XPUT -d '{"membership":"invite"}' "http://localhost:8080/matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/members/%40myfriend%3Alocalhost/state?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" + curl -XPUT -d '{"membership":"invite"}' "http://localhost:8080/_matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/members/%40myfriend%3Alocalhost/state?access_token=QGV4YW1wbGU6bG9jYWxob3N0.vRDLTgxefmKWQEtgGd" This informs ``@myfriend:localhost`` of the room ID ``!CvcvRuDYDzTOzfKKgh:localhost`` and allows them to join the room. @@ -137,7 +137,7 @@ Joining a room via an invite If you receive an invite, you can join the room by changing the membership to join:: - curl -XPUT -d '{"membership":"join"}' "http://localhost:8080/matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/members/%40myfriend%3Alocalhost/state?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" + curl -XPUT -d '{"membership":"join"}' "http://localhost:8080/_matrix/client/api/v1/rooms/%21CvcvRuDYDzTOzfKKgh:localhost/members/%40myfriend%3Alocalhost/state?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" NB: Only the person invited (``@myfriend:localhost``) can change the membership state to ``"join"``. @@ -147,7 +147,7 @@ Joining a room via an alias Alternatively, if you know the room alias for this room and the room config allows it, you can directly join a room via the alias:: - curl -XPUT -d '{}' "http://localhost:8080/matrix/client/api/v1/join/%23tutorial%3Alocalhost?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" + curl -XPUT -d '{}' "http://localhost:8080/_matrix/client/api/v1/join/%23tutorial%3Alocalhost?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" { "room_id": "!CvcvRuDYDzTOzfKKgh:localhost" @@ -173,7 +173,7 @@ Getting all state If the client doesn't know any information on the rooms the user is invited/joined on, they can get all the user's state for all rooms:: - curl -XGET "http://localhost:8080/matrix/client/api/v1/im/sync?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" + curl -XGET "http://localhost:8080/_matrix/client/api/v1/im/sync?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK" [ { @@ -236,7 +236,7 @@ all of the messages and feedback for these rooms. This can be a LOT of data. You may just want the most recent message for each room. This can be achieved by applying pagination stream parameters to this request:: - curl -XGET "http://localhost:8080/matrix/client/api/v1/im/sync?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK&from=END&to=START&limit=1" + curl -XGET "http://localhost:8080/_matrix/client/api/v1/im/sync?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK&from=END&to=START&limit=1" [ { @@ -271,7 +271,7 @@ Getting live state Once you know which rooms the client has previously interacted with, you need to listen for incoming events. This can be done like so:: - curl -XGET "http://localhost:8080/matrix/client/api/v1/events?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK&from=END" + curl -XGET "http://localhost:8080/_matrix/client/api/v1/events?access_token=QG15ZnJpZW5kOmxvY2FsaG9zdA...XKuGdVsovHmwMyDDvK&from=END" { "chunk": [], diff --git a/docs/client-server/specification.rst b/docs/client-server/specification.rst index 4c1a3d4456..ee8bb5c420 100644 --- a/docs/client-server/specification.rst +++ b/docs/client-server/specification.rst @@ -306,11 +306,11 @@ POST requests MUST be submitted as application/json. All paths MUST be namespaced by the version of the API being used. This should be: -/matrix/client/api/v1 +/_matrix/client/api/v1 All REST paths in this section MUST be prefixed with this. E.g. REST Path: /rooms/$room_id - Absolute Path: /matrix/client/api/v1/rooms/$room_id + Absolute Path: /_matrix/client/api/v1/rooms/$room_id Registration ============ diff --git a/docs/client-server/swagger_matrix/directory b/docs/client-server/swagger_matrix/directory index 3f3bef9c11..98109a0fbc 100644 --- a/docs/client-server/swagger_matrix/directory +++ b/docs/client-server/swagger_matrix/directory @@ -1,7 +1,7 @@ { "apiVersion": "1.0.0", "swaggerVersion": "1.2", - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "resourcePath": "/directory", "produces": [ "application/json" diff --git a/docs/client-server/swagger_matrix/events b/docs/client-server/swagger_matrix/events index ca69d34db5..d22c68cc78 100644 --- a/docs/client-server/swagger_matrix/events +++ b/docs/client-server/swagger_matrix/events @@ -1,7 +1,7 @@ { "apiVersion": "1.0.0", "swaggerVersion": "1.2", - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "resourcePath": "/events", "produces": [ "application/json" diff --git a/docs/client-server/swagger_matrix/login b/docs/client-server/swagger_matrix/login index 4410d3c887..8cc598b3c1 100644 --- a/docs/client-server/swagger_matrix/login +++ b/docs/client-server/swagger_matrix/login @@ -40,7 +40,7 @@ "path": "/login" } ], - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "consumes": [ "application/json" ], diff --git a/docs/client-server/swagger_matrix/presence b/docs/client-server/swagger_matrix/presence index 1b4c7323aa..d52ce2164a 100644 --- a/docs/client-server/swagger_matrix/presence +++ b/docs/client-server/swagger_matrix/presence @@ -1,7 +1,7 @@ { "apiVersion": "1.0.0", "swaggerVersion": "1.2", - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "resourcePath": "/presence", "produces": [ "application/json" diff --git a/docs/client-server/swagger_matrix/profile b/docs/client-server/swagger_matrix/profile index 1ebde62e20..188259fa3d 100644 --- a/docs/client-server/swagger_matrix/profile +++ b/docs/client-server/swagger_matrix/profile @@ -1,7 +1,7 @@ { "apiVersion": "1.0.0", "swaggerVersion": "1.2", - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "resourcePath": "/profile", "produces": [ "application/json" diff --git a/docs/client-server/swagger_matrix/registration b/docs/client-server/swagger_matrix/registration index ccd542d11e..2048aec1d2 100644 --- a/docs/client-server/swagger_matrix/registration +++ b/docs/client-server/swagger_matrix/registration @@ -37,7 +37,7 @@ "path": "/register" } ], - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "consumes": [ "application/json" ], diff --git a/docs/client-server/swagger_matrix/rooms b/docs/client-server/swagger_matrix/rooms index 1c32d135aa..7d3341f097 100644 --- a/docs/client-server/swagger_matrix/rooms +++ b/docs/client-server/swagger_matrix/rooms @@ -1,7 +1,7 @@ { "apiVersion": "1.0.0", "swaggerVersion": "1.2", - "basePath": "http://localhost:8080/matrix/client/api/v1", + "basePath": "http://localhost:8080/_matrix/client/api/v1", "resourcePath": "/rooms", "produces": [ "application/json" diff --git a/docs/server-server/specification.rst b/docs/server-server/specification.rst index a9ab9bff66..17cffafdd4 100644 --- a/docs/server-server/specification.rst +++ b/docs/server-server/specification.rst @@ -155,7 +155,7 @@ Protocol URLs All these URLs are namespaced within a prefix of - /matrix/federation/v1/... + /_matrix/federation/v1/... For active pushing of messages representing live activity "as it happens": diff --git a/graph/graph.py b/graph/graph.py index 220f5eb1d5..ac06d979e1 100644 --- a/graph/graph.py +++ b/graph/graph.py @@ -120,7 +120,7 @@ def make_graph(pdus, room, filename_prefix): def get_pdus(host, room): transaction = json.loads( urllib2.urlopen( - "http://%s/matrix/federation/v1/context/%s/" % (host, room) + "http://%s/_matrix/federation/v1/context/%s/" % (host, room) ).read() ) diff --git a/jsfiddles/create_room_send_msg/demo.js b/jsfiddles/create_room_send_msg/demo.js index db2ae2d606..61044da743 100644 --- a/jsfiddles/create_room_send_msg/demo.js +++ b/jsfiddles/create_room_send_msg/demo.js @@ -10,7 +10,7 @@ $('.login').live('click', function() { var user = $("#userLogin").val(); var password = $("#passwordLogin").val(); $.ajax({ - url: "http://localhost:8080/matrix/client/api/v1/login", + url: "http://localhost:8080/_matrix/client/api/v1/login", type: "POST", contentType: "application/json; charset=utf-8", data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), @@ -25,7 +25,7 @@ $('.login').live('click', function() { }); var getCurrentRoomList = function() { - var url = "http://localhost:8080/matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1"; + var url = "http://localhost:8080/_matrix/client/api/v1/initialSync?access_token=" + accountInfo.access_token + "&limit=1"; $.getJSON(url, function(data) { var rooms = data.rooms; for (var i=0; i=0; --i) { @@ -193,7 +193,7 @@ var getMessages = function(roomId) { var getMemberList = function(roomId) { $("#members").empty(); memberInfo = []; - var url = "http://localhost:8080/matrix/client/api/v1/rooms/" + + var url = "http://localhost:8080/_matrix/client/api/v1/rooms/" + encodeURIComponent(roomId) + "/members?access_token=" + accountInfo.access_token; $.getJSON(url, function(data) { for (var i=0; i