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:
18
functions.js
18
functions.js
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user