1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Use /r0 or /unstable for all requests

This commit is contained in:
Daniel Wagner-Hall
2016-02-08 11:15:30 +00:00
parent 5ca4bc6b85
commit 02196416e4
3 changed files with 40 additions and 49 deletions

View File

@@ -27,7 +27,6 @@ var q = require("q");
var User = require("./models/user");
var Room = require("./models/room");
var utils = require("./utils");
var httpApi = require("./http-api");
var Filter = require("./filter");
var DEBUG = true;
@@ -143,9 +142,8 @@ SyncApi.prototype.syncLeftRooms = function() {
getFilterName(client.credentials.userId, "LEFT_ROOMS"), filter
).then(function(filterId) {
qps.filter = filterId;
return client._http.authedRequestWithPrefix(
undefined, "GET", "/sync", qps, undefined, httpApi.PREFIX_V2_ALPHA,
localTimeoutMs
return client._http.authedRequest(
undefined, "GET", "/sync", qps, undefined, localTimeoutMs
);
}).then(function(data) {
var leaveRooms = [];
@@ -265,11 +263,11 @@ SyncApi.prototype._peekPoll = function(roomId, token) {
var self = this;
// FIXME: gut wrenching; hard-coded timeout values
this.client._http.authedRequestWithPrefix(undefined, "GET", "/events", {
this.client._http.authedRequest(undefined, "GET", "/events", {
room_id: roomId,
timeout: 30 * 1000,
from: token
}, undefined, httpApi.PREFIX_V1, 50 * 1000).done(function(res) {
}, undefined, 50 * 1000).done(function(res) {
// strip out events which aren't for the given room_id (e.g presence)
var events = res.chunk.filter(function(e) {
return e.room_id === roomId;
@@ -379,9 +377,8 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
// normal timeout= plus buffer time
var clientSideTimeoutMs = this.opts.pollTimeout + BUFFER_PERIOD_MS;
this._currentSyncRequest = client._http.authedRequestWithPrefix(
undefined, "GET", "/sync", qps, undefined, httpApi.PREFIX_V2_ALPHA,
clientSideTimeoutMs
this._currentSyncRequest = client._http.authedRequest(
undefined, "GET", "/sync", qps, undefined, clientSideTimeoutMs
);
this._currentSyncRequest.done(function(data) {