1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-20 22:21:29 +00:00

use JSON for init-params

This commit is contained in:
Andrew Dolgov
2010-11-05 16:16:30 +03:00
parent 2188495806
commit f1f3a642d6
3 changed files with 69 additions and 89 deletions

View File

@@ -460,7 +460,7 @@ function parse_counters(reply, scheduled_call) {
if (has_img && feed_img) {
if (!feed_img.src.match(id + ".ico")) {
feed_img.src = getInitParam("icons_location") + "/" + id + ".ico";
feed_img.src = getInitParam("icons_url") + "/" + id + ".ico";
}
}
@@ -2167,21 +2167,25 @@ function backend_sanity_check_callback(transport) {
if (params) {
console.log('reading init-params...');
var param = params.firstChild;
//var param = params.firstChild;
while (param) {
var k = param.getAttribute("key");
var v = param.getAttribute("value");
console.log(k + " => " + v);
init_params[k] = v;
params = JSON.parse(params.firstChild.nodeValue);
if (db) {
db.execute("DELETE FROM init_params WHERE key = ?", [k]);
db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)",
[k, v]);
if (params) {
for (var i = 0; i < params.length; i++) {
var k = params[i].param;
var v = params[i].value;
console.log(k + " => " + v);
init_params[k] = v;
if (db) {
db.execute("DELETE FROM init_params WHERE key = ?", [k]);
db.execute("INSERT INTO init_params (key,value) VALUES (?, ?)",
[k, v]);
}
}
param = param.nextSibling;
}
}