1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 22:35:55 +00:00

rework initial sanitycheck to use JSON

This commit is contained in:
Andrew Dolgov
2011-03-18 17:39:23 +03:00
parent 81f6deea47
commit ebb948c24e
7 changed files with 22 additions and 127 deletions

View File

@@ -1055,36 +1055,26 @@ function backend_sanity_check_callback(transport) {
return;
}
if (!transport.responseXML) {
if (!store) {
fatalError(3, "Sanity check: Received reply is not XML",
transport.responseText);
return;
}
}
var reply = transport.responseXML.getElementsByTagName("error")[0];
var reply = JSON.parse(transport.responseText);
if (!reply) {
fatalError(3, "Sanity check: invalid RPC reply", transport.responseText);
return;
}
var error_code = reply.getAttribute("error-code");
var error_code = reply['error']['code'];
if (error_code && error_code != 0) {
return fatalError(error_code, reply.getAttribute("error-msg"));
return fatalError(error_code, reply['error']['message']);
}
console.log("sanity check ok");
var params = transport.responseXML.getElementsByTagName("init-params")[0];
var params = reply['init-params'];
if (params) {
console.log('reading init-params...');
params = JSON.parse(params.firstChild.nodeValue);
if (params) {
for (k in params) {
var v = params[k];