mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Use the non-live version which has the required changes, fix a bug in the error path.
This commit is contained in:
@@ -54,7 +54,7 @@ function loadHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendToPhoneListener(status) {
|
function sendToPhoneListener(status, responseText) {
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS) {
|
||||||
document.getElementById('msg').innerHTML = chrome.i18n.getMessage('sent_message');
|
document.getElementById('msg').innerHTML = chrome.i18n.getMessage('sent_message');
|
||||||
activateSignOutLink();
|
activateSignOutLink();
|
||||||
@@ -65,7 +65,7 @@ function sendToPhoneListener(status) {
|
|||||||
activateSignOutLink();
|
activateSignOutLink();
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('msg').innerHTML =
|
document.getElementById('msg').innerHTML =
|
||||||
chrome.i18n.getMessage('error_sending_message', req.responseText);
|
chrome.i18n.getMessage('error_sending_message', responseText);
|
||||||
activateSignOutLink();
|
activateSignOutLink();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ if (deviceRegistrationId == undefined || deviceRegistrationId == null) {
|
|||||||
// use javascript console
|
// use javascript console
|
||||||
var host = localStorage['c2dmHost'];
|
var host = localStorage['c2dmHost'];
|
||||||
if (host == undefined) {
|
if (host == undefined) {
|
||||||
host = "chrometophone.appspot.com";
|
// This won't work very well, there is a cert validation issue (cert
|
||||||
|
// is for *.appspot.com ), workaround is to open the URL in the browser
|
||||||
|
// and accept the cert warnings.
|
||||||
|
host = "9.chrometophone.appspot.com";
|
||||||
}
|
}
|
||||||
var baseUrl = 'https://' + host;
|
var baseUrl = 'https://' + host;
|
||||||
var sendUrl = baseUrl + '/send?ver=' + apiVersion;
|
var sendUrl = baseUrl + '/send?ver=' + apiVersion;
|
||||||
@@ -71,14 +74,14 @@ function sendToPhone(title, url, msgType, selection, listener) {
|
|||||||
if (req.status == 200) {
|
if (req.status == 200) {
|
||||||
var body = req.responseText;
|
var body = req.responseText;
|
||||||
if (body.indexOf('OK') == 0) {
|
if (body.indexOf('OK') == 0) {
|
||||||
listener(STATUS_SUCCESS);
|
listener(STATUS_SUCCESS, "");
|
||||||
} else if (body.indexOf('LOGIN_REQUIRED') == 0) {
|
} else if (body.indexOf('LOGIN_REQUIRED') == 0) {
|
||||||
listener(STATUS_LOGIN_REQUIRED);
|
listener(STATUS_LOGIN_REQUIRED, responseText);
|
||||||
} else if (body.indexOf('DEVICE_NOT_REGISTERED') == 0) {
|
} else if (body.indexOf('DEVICE_NOT_REGISTERED') == 0) {
|
||||||
listener(STATUS_DEVICE_NOT_REGISTERED);
|
listener(STATUS_DEVICE_NOT_REGISTERED, responseText);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
listener(STATUS_GENERAL_ERROR);
|
listener(STATUS_GENERAL_ERROR, responseText);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
'method': 'POST',
|
'method': 'POST',
|
||||||
@@ -90,7 +93,7 @@ function sendToPhone(title, url, msgType, selection, listener) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
listener(STATUS_LOGIN_REQUIRED);
|
listener(STATUS_LOGIN_REQUIRED, "Login required");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user