tabstabstabstabstabs
This commit is contained in:
parent
8a2b35b48d
commit
832daf54db
3 changed files with 144 additions and 149 deletions
|
@ -1,7 +1,7 @@
|
||||||
/************************************************
|
/************************************************
|
||||||
*** Utilities to communicate with the server ***
|
*** Utilities to communicate with the server ***
|
||||||
************************************************/
|
************************************************/
|
||||||
var URL_BASE = "http://textsecure-test.herokuapp.com";
|
var URL_BASE = "http://sushiforeveryone.bluematt.me";
|
||||||
//var URL_BASE = "https://textsecure-service.whispersystems.org";
|
//var URL_BASE = "https://textsecure-service.whispersystems.org";
|
||||||
var URL_CALLS = {};
|
var URL_CALLS = {};
|
||||||
URL_CALLS['accounts'] = "/v1/accounts";
|
URL_CALLS['accounts'] = "/v1/accounts";
|
||||||
|
@ -42,9 +42,8 @@ var API = new function() {
|
||||||
|
|
||||||
beforeSend : function(xhr) {
|
beforeSend : function(xhr) {
|
||||||
if (param.user !== undefined &&
|
if (param.user !== undefined &&
|
||||||
param.password !== undefined) {
|
param.password !== undefined)
|
||||||
xhr.setRequestHeader("Authorization", "Basic " + btoa(getString(param.user) + ":" + getString(param.password)));
|
xhr.setRequestHeader("Authorization", "Basic " + btoa(getString(param.user) + ":" + getString(param.password)));
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
success : function(response, textStatus, jqXHR) {
|
success : function(response, textStatus, jqXHR) {
|
||||||
|
@ -69,7 +68,6 @@ var API = new function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.requestVerificationCode = function(number, success_callback, error_callback) {
|
this.requestVerificationCode = function(number, success_callback, error_callback) {
|
||||||
this.doAjax({
|
this.doAjax({
|
||||||
call : 'accounts',
|
call : 'accounts',
|
||||||
|
@ -141,5 +139,4 @@ var API = new function() {
|
||||||
do_auth : true
|
do_auth : true
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}(); // API
|
}(); // API
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
var FakeWhisperAPI = function() {
|
var FakeWhisperAPI = function() {
|
||||||
|
|
||||||
this.doAjax = function(param) {
|
this.doAjax = function(param) {
|
||||||
if (param.success_callback) {
|
if (param.success_callback) {
|
||||||
setTimeout(param.success_callback, 100, param.response);
|
setTimeout(param.success_callback, 100, param.response);
|
||||||
|
|
|
@ -891,7 +891,6 @@ function subscribeToPush(message_callback) {
|
||||||
var proto = decodeIncomingPushMessageProtobuf(plaintext);
|
var proto = decodeIncomingPushMessageProtobuf(plaintext);
|
||||||
// After this point, a) decoding errors are not the server's fault, and
|
// After this point, a) decoding errors are not the server's fault, and
|
||||||
// b) we should handle them gracefully and tell the user they received an invalid message
|
// b) we should handle them gracefully and tell the user they received an invalid message
|
||||||
|
|
||||||
API.pushMessage(message.id);
|
API.pushMessage(message.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Error decoding message: " + e);
|
console.log("Error decoding message: " + e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue