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
This commit is contained in:
Matthew Hodgson 2014-08-31 14:51:37 +01:00
parent 820ef6e9d8
commit 8fe912d95c
27 changed files with 93 additions and 93 deletions

View File

@ -60,7 +60,7 @@ class SynapseCmd(cmd.Cmd):
"complete_usernames": "on", "complete_usernames": "on",
"send_delivery_receipts": "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.event_stream_token = "END"
self.prompt = ">>> " self.prompt = ">>> "
@ -252,7 +252,7 @@ class SynapseCmd(cmd.Cmd):
@defer.inlineCallbacks @defer.inlineCallbacks
def _do_emailrequest(self, args): 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, json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False,
headers={'Content-Type': ['application/x-www-form-urlencoded']}) headers={'Content-Type': ['application/x-www-form-urlencoded']})
@ -274,7 +274,7 @@ class SynapseCmd(cmd.Cmd):
@defer.inlineCallbacks @defer.inlineCallbacks
def _do_emailvalidate(self, args): 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, json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False,
headers={'Content-Type': ['application/x-www-form-urlencoded']}) headers={'Content-Type': ['application/x-www-form-urlencoded']})
@ -294,7 +294,7 @@ class SynapseCmd(cmd.Cmd):
@defer.inlineCallbacks @defer.inlineCallbacks
def _do_3pidbind(self, args): 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, json_res = yield self.http_client.do_request("POST", url, data=urllib.urlencode(args), jsonreq=False,
headers={'Content-Type': ['application/x-www-form-urlencoded']}) headers={'Content-Type': ['application/x-www-form-urlencoded']})
@ -360,14 +360,14 @@ class SynapseCmd(cmd.Cmd):
def _do_invite(self, roomid, userstring): def _do_invite(self, roomid, userstring):
if (not userstring.startswith('@') and if (not userstring.startswith('@') and
self._is_on("complete_usernames")): 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}) json_res = yield self.http_client.do_request("GET", url, qparams={'medium':'email','address':userstring})
mxid = None mxid = None
if 'mxid' in json_res and 'signatures' in json_res: 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 pubKey = None
pubKeyObj = yield self.http_client.do_request("GET", url) pubKeyObj = yield self.http_client.do_request("GET", url)

View File

@ -30,7 +30,7 @@ Registration
The aim of registration is to get a user ID and access token which you will need The aim of registration is to get a user ID and access token which you will need
when accessing other APIs:: 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", "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:: 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" "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", "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 If you want to send a message to someone, you have to be in a room with them. To
create a room:: 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", "room_alias": "#tutorial:localhost",
@ -105,7 +105,7 @@ Sending messages
---------------- ----------------
You can now send messages to this room:: 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. NB: There are no limitations to the types of messages which can be exchanged.
The only requirement is that ``"msgtype"`` is specified. 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:: 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 This informs ``@myfriend:localhost`` of the room ID
``!CvcvRuDYDzTOzfKKgh:localhost`` and allows them to join the room. ``!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 If you receive an invite, you can join the room by changing the membership to
join:: 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 NB: Only the person invited (``@myfriend:localhost``) can change the membership
state to ``"join"``. 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 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:: 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" "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 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:: 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 may just want the most recent message for each room. This can be achieved by
applying pagination stream parameters to this request:: 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 Once you know which rooms the client has previously interacted with, you need to
listen for incoming events. This can be done like so:: 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": [], "chunk": [],

View File

@ -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 All paths MUST be namespaced by the version of the API being used. This should
be: be:
/matrix/client/api/v1 /_matrix/client/api/v1
All REST paths in this section MUST be prefixed with this. E.g. All REST paths in this section MUST be prefixed with this. E.g.
REST Path: /rooms/$room_id REST Path: /rooms/$room_id
Absolute Path: /matrix/client/api/v1/rooms/$room_id Absolute Path: /_matrix/client/api/v1/rooms/$room_id
Registration Registration
============ ============

View File

@ -1,7 +1,7 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"resourcePath": "/directory", "resourcePath": "/directory",
"produces": [ "produces": [
"application/json" "application/json"

View File

@ -1,7 +1,7 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"resourcePath": "/events", "resourcePath": "/events",
"produces": [ "produces": [
"application/json" "application/json"

View File

@ -40,7 +40,7 @@
"path": "/login" "path": "/login"
} }
], ],
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],

View File

@ -1,7 +1,7 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"resourcePath": "/presence", "resourcePath": "/presence",
"produces": [ "produces": [
"application/json" "application/json"

View File

@ -1,7 +1,7 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"resourcePath": "/profile", "resourcePath": "/profile",
"produces": [ "produces": [
"application/json" "application/json"

View File

@ -37,7 +37,7 @@
"path": "/register" "path": "/register"
} }
], ],
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],

View File

@ -1,7 +1,7 @@
{ {
"apiVersion": "1.0.0", "apiVersion": "1.0.0",
"swaggerVersion": "1.2", "swaggerVersion": "1.2",
"basePath": "http://localhost:8080/matrix/client/api/v1", "basePath": "http://localhost:8080/_matrix/client/api/v1",
"resourcePath": "/rooms", "resourcePath": "/rooms",
"produces": [ "produces": [
"application/json" "application/json"

View File

@ -155,7 +155,7 @@ Protocol URLs
All these URLs are namespaced within a prefix of 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": For active pushing of messages representing live activity "as it happens":

View File

@ -120,7 +120,7 @@ def make_graph(pdus, room, filename_prefix):
def get_pdus(host, room): def get_pdus(host, room):
transaction = json.loads( transaction = json.loads(
urllib2.urlopen( urllib2.urlopen(
"http://%s/matrix/federation/v1/context/%s/" % (host, room) "http://%s/_matrix/federation/v1/context/%s/" % (host, room)
).read() ).read()
) )

View File

@ -10,7 +10,7 @@ $('.login').live('click', function() {
var user = $("#userLogin").val(); var user = $("#userLogin").val();
var password = $("#passwordLogin").val(); var password = $("#passwordLogin").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/login", url: "http://localhost:8080/_matrix/client/api/v1/login",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
@ -25,7 +25,7 @@ $('.login').live('click', function() {
}); });
var getCurrentRoomList = 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) { $.getJSON(url, function(data) {
var rooms = data.rooms; var rooms = data.rooms;
for (var i=0; i<rooms.length; ++i) { for (var i=0; i<rooms.length; ++i) {
@ -44,7 +44,7 @@ $('.createRoom').live('click', function() {
data.room_alias_name = roomAlias; data.room_alias_name = roomAlias;
} }
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token, url: "http://localhost:8080/_matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token,
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify(data), data: JSON.stringify(data),
@ -79,7 +79,7 @@ $('.sendMessage').live('click', function() {
return; return;
} }
var url = "http://localhost:8080/matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomid", encodeURIComponent(roomId)); url = url.replace("$roomid", encodeURIComponent(roomId));

View File

@ -7,7 +7,7 @@ var eventStreamInfo = {
var roomInfo = []; var roomInfo = [];
var longpollEventStream = function() { var longpollEventStream = function() {
var url = "http://localhost:8080/matrix/client/api/v1/events?access_token=$token&from=$from"; var url = "http://localhost:8080/_matrix/client/api/v1/events?access_token=$token&from=$from";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$from", eventStreamInfo.from); url = url.replace("$from", eventStreamInfo.from);
@ -48,7 +48,7 @@ $('.login').live('click', function() {
var user = $("#userLogin").val(); var user = $("#userLogin").val();
var password = $("#passwordLogin").val(); var password = $("#passwordLogin").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/login", url: "http://localhost:8080/_matrix/client/api/v1/login",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
@ -65,7 +65,7 @@ $('.login').live('click', function() {
var getCurrentRoomList = function() { var getCurrentRoomList = function() {
$("#roomId").val(""); $("#roomId").val("");
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) { $.getJSON(url, function(data) {
var rooms = data.rooms; var rooms = data.rooms;
for (var i=0; i<rooms.length; ++i) { for (var i=0; i<rooms.length; ++i) {
@ -98,7 +98,7 @@ var sendMessage = function(roomId) {
return; return;
} }
var url = "http://localhost:8080/matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomid", encodeURIComponent(roomId)); url = url.replace("$roomid", encodeURIComponent(roomId));

View File

@ -10,7 +10,7 @@ var viewingRoomId;
// ************** Event Streaming ************** // ************** Event Streaming **************
var longpollEventStream = function() { var longpollEventStream = function() {
var url = "http://localhost:8080/matrix/client/api/v1/events?access_token=$token&from=$from"; var url = "http://localhost:8080/_matrix/client/api/v1/events?access_token=$token&from=$from";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$from", eventStreamInfo.from); url = url.replace("$from", eventStreamInfo.from);
@ -89,7 +89,7 @@ $('.login').live('click', function() {
var user = $("#userLogin").val(); var user = $("#userLogin").val();
var password = $("#passwordLogin").val(); var password = $("#passwordLogin").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/login", url: "http://localhost:8080/_matrix/client/api/v1/login",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
@ -107,7 +107,7 @@ $('.register').live('click', function() {
var user = $("#userReg").val(); var user = $("#userReg").val();
var password = $("#passwordReg").val(); var password = $("#passwordReg").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/register", url: "http://localhost:8080/_matrix/client/api/v1/register",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user_id: user, password: password }), data: JSON.stringify({ user_id: user, password: password }),
@ -134,7 +134,7 @@ $('.createRoom').live('click', function() {
data.room_alias_name = roomAlias; data.room_alias_name = roomAlias;
} }
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token, url: "http://localhost:8080/_matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token,
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify(data), data: JSON.stringify(data),
@ -155,7 +155,7 @@ $('.createRoom').live('click', function() {
// ************** Getting current state ************** // ************** Getting current state **************
var getCurrentRoomList = 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) { $.getJSON(url, function(data) {
var rooms = data.rooms; var rooms = data.rooms;
for (var i=0; i<rooms.length; ++i) { for (var i=0; i<rooms.length; ++i) {
@ -181,7 +181,7 @@ var loadRoomContent = function(roomId) {
var getMessages = function(roomId) { var getMessages = function(roomId) {
$("#messages").empty(); $("#messages").empty();
var url = "http://localhost:8080/matrix/client/api/v1/rooms/" + var url = "http://localhost:8080/_matrix/client/api/v1/rooms/" +
encodeURIComponent(roomId) + "/messages?access_token=" + accountInfo.access_token + "&from=END&dir=b&limit=10"; encodeURIComponent(roomId) + "/messages?access_token=" + accountInfo.access_token + "&from=END&dir=b&limit=10";
$.getJSON(url, function(data) { $.getJSON(url, function(data) {
for (var i=data.chunk.length-1; i>=0; --i) { for (var i=data.chunk.length-1; i>=0; --i) {
@ -193,7 +193,7 @@ var getMessages = function(roomId) {
var getMemberList = function(roomId) { var getMemberList = function(roomId) {
$("#members").empty(); $("#members").empty();
memberInfo = []; 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; encodeURIComponent(roomId) + "/members?access_token=" + accountInfo.access_token;
$.getJSON(url, function(data) { $.getJSON(url, function(data) {
for (var i=0; i<data.chunk.length; ++i) { for (var i=0; i<data.chunk.length; ++i) {
@ -216,7 +216,7 @@ $('.sendMessage').live('click', function() {
var sendMessage = function(roomId, body) { var sendMessage = function(roomId, body) {
var msgId = $.now(); var msgId = $.now();
var url = "http://localhost:8080/matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/rooms/$roomid/send/m.room.message?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomid", encodeURIComponent(roomId)); url = url.replace("$roomid", encodeURIComponent(roomId));
@ -262,7 +262,7 @@ var setRooms = function(roomList) {
var membership = $(this).find('td:eq(1)').text(); var membership = $(this).find('td:eq(1)').text();
if (membership !== "join") { if (membership !== "join") {
console.log("Joining room " + roomId); console.log("Joining room " + roomId);
var url = "http://localhost:8080/matrix/client/api/v1/rooms/$roomid/join?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/rooms/$roomid/join?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomid", encodeURIComponent(roomId)); url = url.replace("$roomid", encodeURIComponent(roomId));
$.ajax({ $.ajax({

View File

@ -11,7 +11,7 @@ $('.register').live('click', function() {
var user = $("#user").val(); var user = $("#user").val();
var password = $("#password").val(); var password = $("#password").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/register", url: "http://localhost:8080/_matrix/client/api/v1/register",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user_id: user, password: password }), data: JSON.stringify({ user_id: user, password: password }),
@ -27,7 +27,7 @@ $('.register').live('click', function() {
var login = function(user, password) { var login = function(user, password) {
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/login", url: "http://localhost:8080/_matrix/client/api/v1/login",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
@ -44,7 +44,7 @@ var login = function(user, password) {
$('.login').live('click', function() { $('.login').live('click', function() {
var user = $("#userLogin").val(); var user = $("#userLogin").val();
var password = $("#passwordLogin").val(); var password = $("#passwordLogin").val();
$.getJSON("http://localhost:8080/matrix/client/api/v1/login", function(data) { $.getJSON("http://localhost:8080/_matrix/client/api/v1/login", function(data) {
if (data.flows[0].type !== "m.login.password") { if (data.flows[0].type !== "m.login.password") {
alert("I don't know how to login with this type: " + data.type); alert("I don't know how to login with this type: " + data.type);
return; return;
@ -60,7 +60,7 @@ $('.logout').live('click', function() {
}); });
$('.testToken').live('click', function() { $('.testToken').live('click', 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) { $.getJSON(url, function(data) {
$("#imSyncText").text(JSON.stringify(data, undefined, 2)); $("#imSyncText").text(JSON.stringify(data, undefined, 2));
}).fail(function(err) { }).fail(function(err) {

View File

@ -18,7 +18,7 @@ $('.login').live('click', function() {
var user = $("#userLogin").val(); var user = $("#userLogin").val();
var password = $("#passwordLogin").val(); var password = $("#passwordLogin").val();
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/login", url: "http://localhost:8080/_matrix/client/api/v1/login",
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ user: user, password: password, type: "m.login.password" }), data: JSON.stringify({ user: user, password: password, type: "m.login.password" }),
@ -39,7 +39,7 @@ var getCurrentRoomList = function() {
// solution but that is out of scope of this fiddle. // solution but that is out of scope of this fiddle.
$("#rooms").find("tr:gt(0)").remove(); $("#rooms").find("tr:gt(0)").remove();
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) { $.getJSON(url, function(data) {
var rooms = data.rooms; var rooms = data.rooms;
for (var i=0; i<rooms.length; ++i) { for (var i=0; i<rooms.length; ++i) {
@ -53,7 +53,7 @@ var getCurrentRoomList = function() {
$('.createRoom').live('click', function() { $('.createRoom').live('click', function() {
var data = {}; var data = {};
$.ajax({ $.ajax({
url: "http://localhost:8080/matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token, url: "http://localhost:8080/_matrix/client/api/v1/createRoom?access_token="+accountInfo.access_token,
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify(data), data: JSON.stringify(data),
@ -87,7 +87,7 @@ $('.changeMembership').live('click', function() {
return; return;
} }
var url = "http://localhost:8080/matrix/client/api/v1/rooms/$roomid/$membership?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/rooms/$roomid/$membership?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomid", encodeURIComponent(roomId)); url = url.replace("$roomid", encodeURIComponent(roomId));
url = url.replace("$membership", membership); url = url.replace("$membership", membership);
@ -117,7 +117,7 @@ $('.changeMembership').live('click', function() {
$('.joinAlias').live('click', function() { $('.joinAlias').live('click', function() {
var roomAlias = $("#roomAlias").val(); var roomAlias = $("#roomAlias").val();
var url = "http://localhost:8080/matrix/client/api/v1/join/$roomalias?access_token=$token"; var url = "http://localhost:8080/_matrix/client/api/v1/join/$roomalias?access_token=$token";
url = url.replace("$token", accountInfo.access_token); url = url.replace("$token", accountInfo.access_token);
url = url.replace("$roomalias", encodeURIComponent(roomAlias)); url = url.replace("$roomalias", encodeURIComponent(roomAlias));
$.ajax({ $.ajax({

View File

@ -15,7 +15,7 @@
"""Contains the URL paths to prefix various aspects of the server with. """ """Contains the URL paths to prefix various aspects of the server with. """
CLIENT_PREFIX = "/matrix/client/api/v1" CLIENT_PREFIX = "/_matrix/client/api/v1"
FEDERATION_PREFIX = "/matrix/federation/v1" FEDERATION_PREFIX = "/_matrix/federation/v1"
WEB_CLIENT_PREFIX = "/matrix/client" WEB_CLIENT_PREFIX = "/_matrix/client"
CONTENT_REPO_PREFIX = "/matrix/content" CONTENT_REPO_PREFIX = "/_matrix/content"

View File

@ -87,7 +87,7 @@ class FederationTestCase(unittest.TestCase):
# Empty context initially # Empty context initially
(code, response) = yield self.mock_resource.trigger("GET", (code, response) = yield self.mock_resource.trigger("GET",
"/matrix/federation/v1/state/my-context/", None) "/_matrix/federation/v1/state/my-context/", None)
self.assertEquals(200, code) self.assertEquals(200, code)
self.assertFalse(response["pdus"]) self.assertFalse(response["pdus"])
@ -112,7 +112,7 @@ class FederationTestCase(unittest.TestCase):
) )
(code, response) = yield self.mock_resource.trigger("GET", (code, response) = yield self.mock_resource.trigger("GET",
"/matrix/federation/v1/state/my-context/", None) "/_matrix/federation/v1/state/my-context/", None)
self.assertEquals(200, code) self.assertEquals(200, code)
self.assertEquals(1, len(response["pdus"])) self.assertEquals(1, len(response["pdus"]))
@ -123,7 +123,7 @@ class FederationTestCase(unittest.TestCase):
) )
(code, response) = yield self.mock_resource.trigger("GET", (code, response) = yield self.mock_resource.trigger("GET",
"/matrix/federation/v1/pdu/red/abc123def456/", None) "/_matrix/federation/v1/pdu/red/abc123def456/", None)
self.assertEquals(404, code) self.assertEquals(404, code)
# Now insert such a PDU # Now insert such a PDU
@ -142,7 +142,7 @@ class FederationTestCase(unittest.TestCase):
) )
(code, response) = yield self.mock_resource.trigger("GET", (code, response) = yield self.mock_resource.trigger("GET",
"/matrix/federation/v1/pdu/red/abc123def456/", None) "/_matrix/federation/v1/pdu/red/abc123def456/", None)
self.assertEquals(200, code) self.assertEquals(200, code)
self.assertEquals(1, len(response["pdus"])) self.assertEquals(1, len(response["pdus"]))
self.assertEquals("m.text", response["pdus"][0]["pdu_type"]) self.assertEquals("m.text", response["pdus"][0]["pdu_type"])
@ -168,7 +168,7 @@ class FederationTestCase(unittest.TestCase):
self.mock_http_client.put_json.assert_called_with( self.mock_http_client.put_json.assert_called_with(
"remote", "remote",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data={ data={
"ts": 1000000, "ts": 1000000,
"origin": "test", "origin": "test",
@ -203,7 +203,7 @@ class FederationTestCase(unittest.TestCase):
# MockClock ensures we can guess these timestamps # MockClock ensures we can guess these timestamps
self.mock_http_client.put_json.assert_called_with( self.mock_http_client.put_json.assert_called_with(
"remote", "remote",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data={ data={
"origin": "test", "origin": "test",
"ts": 1000000, "ts": 1000000,
@ -226,7 +226,7 @@ class FederationTestCase(unittest.TestCase):
self.federation.register_edu_handler("m.test", recv_observer) self.federation.register_edu_handler("m.test", recv_observer)
yield self.mock_resource.trigger("PUT", yield self.mock_resource.trigger("PUT",
"/matrix/federation/v1/send/1001000/", "/_matrix/federation/v1/send/1001000/",
"""{ """{
"origin": "remote", "origin": "remote",
"ts": 1001000, "ts": 1001000,
@ -261,7 +261,7 @@ class FederationTestCase(unittest.TestCase):
self.mock_http_client.get_json.assert_called_with( self.mock_http_client.get_json.assert_called_with(
destination="remote", destination="remote",
path="/matrix/federation/v1/query/a-question", path="/_matrix/federation/v1/query/a-question",
args={"one": "1", "two": "2"} args={"one": "1", "two": "2"}
) )
@ -273,7 +273,7 @@ class FederationTestCase(unittest.TestCase):
self.federation.register_query_handler("a-question", recv_handler) self.federation.register_query_handler("a-question", recv_handler)
code, response = yield self.mock_resource.trigger("GET", code, response = yield self.mock_resource.trigger("GET",
"/matrix/federation/v1/query/a-question?three=3&four=4", None) "/_matrix/federation/v1/query/a-question?three=3&four=4", None)
self.assertEquals(200, code) self.assertEquals(200, code)
self.assertEquals({"another": "response"}, response) self.assertEquals({"another": "response"}, response)

View File

@ -314,7 +314,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("elsewhere", call("elsewhere",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("elsewhere", "m.presence_invite", data=_expect_edu("elsewhere", "m.presence_invite",
content={ content={
"observer_user": "@apple:test", "observer_user": "@apple:test",
@ -340,7 +340,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("elsewhere", call("elsewhere",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("elsewhere", "m.presence_accept", data=_expect_edu("elsewhere", "m.presence_accept",
content={ content={
"observer_user": "@cabbage:elsewhere", "observer_user": "@cabbage:elsewhere",
@ -352,7 +352,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
) )
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("elsewhere", "m.presence_invite", _make_edu_json("elsewhere", "m.presence_invite",
content={ content={
"observer_user": "@cabbage:elsewhere", "observer_user": "@cabbage:elsewhere",
@ -371,7 +371,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("elsewhere", call("elsewhere",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("elsewhere", "m.presence_deny", data=_expect_edu("elsewhere", "m.presence_deny",
content={ content={
"observer_user": "@cabbage:elsewhere", "observer_user": "@cabbage:elsewhere",
@ -383,7 +383,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
) )
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("elsewhere", "m.presence_invite", _make_edu_json("elsewhere", "m.presence_invite",
content={ content={
"observer_user": "@cabbage:elsewhere", "observer_user": "@cabbage:elsewhere",
@ -397,7 +397,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
@defer.inlineCallbacks @defer.inlineCallbacks
def test_accepted_remote(self): def test_accepted_remote(self):
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("elsewhere", "m.presence_accept", _make_edu_json("elsewhere", "m.presence_accept",
content={ content={
"observer_user": "@apple:test", "observer_user": "@apple:test",
@ -415,7 +415,7 @@ class PresenceInvitesTestCase(unittest.TestCase):
@defer.inlineCallbacks @defer.inlineCallbacks
def test_denied_remote(self): def test_denied_remote(self):
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("elsewhere", "m.presence_deny", _make_edu_json("elsewhere", "m.presence_deny",
content={ content={
"observer_user": "@apple:test", "observer_user": "@apple:test",
@ -720,7 +720,7 @@ class PresencePushTestCase(unittest.TestCase):
self.assertEquals(self.event_source.get_current_key(), 0) self.assertEquals(self.event_source.get_current_key(), 0)
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("elsewhere", "m.presence", _make_edu_json("elsewhere", "m.presence",
content={ content={
"push": [ "push": [
@ -836,7 +836,7 @@ class PresencePushTestCase(unittest.TestCase):
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("remote", call("remote",
path="/matrix/federation/v1/send/1000002/", path="/_matrix/federation/v1/send/1000002/",
data=_expect_edu("remote", "m.presence", data=_expect_edu("remote", "m.presence",
content={ content={
"push": [ "push": [
@ -1130,7 +1130,7 @@ class PresencePollingTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("remote", call("remote",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("remote", "m.presence", data=_expect_edu("remote", "m.presence",
content={ content={
"push": [ "push": [
@ -1145,7 +1145,7 @@ class PresencePollingTestCase(unittest.TestCase):
) )
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("remote", "m.presence", _make_edu_json("remote", "m.presence",
content={ content={
"poll": [ "@banana:test" ], "poll": [ "@banana:test" ],
@ -1159,7 +1159,7 @@ class PresencePollingTestCase(unittest.TestCase):
self.assertTrue(self.u_banana in self.handler._remote_sendmap) self.assertTrue(self.u_banana in self.handler._remote_sendmap)
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000001/", "/_matrix/federation/v1/send/1000001/",
_make_edu_json("remote", "m.presence", _make_edu_json("remote", "m.presence",
content={ content={
"unpoll": [ "@banana:test" ], "unpoll": [ "@banana:test" ],

View File

@ -166,7 +166,7 @@ class TypingNotificationsTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("farm", call("farm",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("farm", "m.typing", data=_expect_edu("farm", "m.typing",
content={ content={
"room_id": self.room_id, "room_id": self.room_id,
@ -192,7 +192,7 @@ class TypingNotificationsTestCase(unittest.TestCase):
self.room_members = [self.u_apple, self.u_onion] self.room_members = [self.u_apple, self.u_onion]
yield self.mock_federation_resource.trigger("PUT", yield self.mock_federation_resource.trigger("PUT",
"/matrix/federation/v1/send/1000000/", "/_matrix/federation/v1/send/1000000/",
_make_edu_json("farm", "m.typing", _make_edu_json("farm", "m.typing",
content={ content={
"room_id": self.room_id, "room_id": self.room_id,
@ -216,7 +216,7 @@ class TypingNotificationsTestCase(unittest.TestCase):
put_json = self.mock_http_client.put_json put_json = self.mock_http_client.put_json
put_json.expect_call_and_return( put_json.expect_call_and_return(
call("farm", call("farm",
path="/matrix/federation/v1/send/1000000/", path="/_matrix/federation/v1/send/1000000/",
data=_expect_edu("farm", "m.typing", data=_expect_edu("farm", "m.typing",
content={ content={
"room_id": self.room_id, "room_id": self.room_id,

View File

@ -36,7 +36,7 @@ from mock import Mock
logging.getLogger().addHandler(logging.NullHandler()) logging.getLogger().addHandler(logging.NullHandler())
PATH_PREFIX = "/matrix/client/api/v1" PATH_PREFIX = "/_matrix/client/api/v1"
class EventStreamPaginationApiTestCase(unittest.TestCase): class EventStreamPaginationApiTestCase(unittest.TestCase):

View File

@ -37,7 +37,7 @@ ONLINE = PresenceState.ONLINE
myid = "@apple:test" myid = "@apple:test"
PATH_PREFIX = "/matrix/client/api/v1" PATH_PREFIX = "/_matrix/client/api/v1"
class JustPresenceHandlers(object): class JustPresenceHandlers(object):

View File

@ -26,7 +26,7 @@ from synapse.api.errors import SynapseError, AuthError
from synapse.server import HomeServer from synapse.server import HomeServer
myid = "@1234ABCD:test" myid = "@1234ABCD:test"
PATH_PREFIX = "/matrix/client/api/v1" PATH_PREFIX = "/_matrix/client/api/v1"
class ProfileTestCase(unittest.TestCase): class ProfileTestCase(unittest.TestCase):
""" Tests profile management. """ """ Tests profile management. """

View File

@ -32,7 +32,7 @@ from .utils import RestTestCase
from mock import Mock from mock import Mock
PATH_PREFIX = "/matrix/client/api/v1" PATH_PREFIX = "/_matrix/client/api/v1"
class RoomPermissionsTestCase(RestTestCase): class RoomPermissionsTestCase(RestTestCase):

View File

@ -30,7 +30,7 @@ angular.module('mFileUpload', ['matrixService', 'mUtilities'])
*/ */
this.uploadFile = function(file) { this.uploadFile = function(file) {
var deferred = $q.defer(); var deferred = $q.defer();
console.log("Uploading " + file.name + "... to /matrix/content"); console.log("Uploading " + file.name + "... to /_matrix/content");
matrixService.uploadContent(file).then( matrixService.uploadContent(file).then(
function(response) { function(response) {
var content_url = response.data.content_token; var content_url = response.data.content_token;

View File

@ -38,7 +38,7 @@ angular.module('matrixService', [])
// Current version of permanent storage // Current version of permanent storage
var configVersion = 0; var configVersion = 0;
var prefixPath = "/matrix/client/api/v1"; var prefixPath = "/_matrix/client/api/v1";
var MAPPING_PREFIX = "alias_for_"; var MAPPING_PREFIX = "alias_for_";
var doRequest = function(method, path, params, data, $httpParams) { var doRequest = function(method, path, params, data, $httpParams) {
@ -168,7 +168,7 @@ angular.module('matrixService', [])
// Retrieves the room ID corresponding to a room alias // Retrieves the room ID corresponding to a room alias
resolveRoomAlias:function(room_alias) { resolveRoomAlias:function(room_alias) {
var path = "/matrix/client/api/v1/directory/room/$room_alias"; var path = "/_matrix/client/api/v1/directory/room/$room_alias";
room_alias = encodeURIComponent(room_alias); room_alias = encodeURIComponent(room_alias);
path = path.replace("$room_alias", room_alias); path = path.replace("$room_alias", room_alias);
@ -308,7 +308,7 @@ angular.module('matrixService', [])
// hit the Identity Server for a 3PID request. // hit the Identity Server for a 3PID request.
linkEmail: function(email, clientSecret, sendAttempt) { linkEmail: function(email, clientSecret, sendAttempt) {
var path = "/matrix/identity/api/v1/validate/email/requestToken" var path = "/_matrix/identity/api/v1/validate/email/requestToken"
var data = "clientSecret="+clientSecret+"&email=" + encodeURIComponent(email)+"&sendAttempt="+sendAttempt; var data = "clientSecret="+clientSecret+"&email=" + encodeURIComponent(email)+"&sendAttempt="+sendAttempt;
var headers = {}; var headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded"; headers["Content-Type"] = "application/x-www-form-urlencoded";
@ -316,7 +316,7 @@ angular.module('matrixService', [])
}, },
authEmail: function(clientSecret, tokenId, code) { authEmail: function(clientSecret, tokenId, code) {
var path = "/matrix/identity/api/v1/validate/email/submitToken"; var path = "/_matrix/identity/api/v1/validate/email/submitToken";
var data = "token="+code+"&sid="+tokenId+"&clientSecret="+clientSecret; var data = "token="+code+"&sid="+tokenId+"&clientSecret="+clientSecret;
var headers = {}; var headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded"; headers["Content-Type"] = "application/x-www-form-urlencoded";
@ -324,7 +324,7 @@ angular.module('matrixService', [])
}, },
bindEmail: function(userId, tokenId, clientSecret) { bindEmail: function(userId, tokenId, clientSecret) {
var path = "/matrix/identity/api/v1/3pid/bind"; var path = "/_matrix/identity/api/v1/3pid/bind";
var data = "mxid="+encodeURIComponent(userId)+"&sid="+tokenId+"&clientSecret="+clientSecret; var data = "mxid="+encodeURIComponent(userId)+"&sid="+tokenId+"&clientSecret="+clientSecret;
var headers = {}; var headers = {};
headers["Content-Type"] = "application/x-www-form-urlencoded"; headers["Content-Type"] = "application/x-www-form-urlencoded";
@ -332,7 +332,7 @@ angular.module('matrixService', [])
}, },
uploadContent: function(file) { uploadContent: function(file) {
var path = "/matrix/content"; var path = "/_matrix/content";
var headers = { var headers = {
"Content-Type": undefined // undefined means angular will figure it out "Content-Type": undefined // undefined means angular will figure it out
}; };