Merge pull request #3851 from dibdot/adblock
luci-app-adblock: revert poll/view class changes
This commit is contained in:
commit
9ffbf0781e
5 changed files with 10 additions and 17 deletions
|
@ -1,9 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
'require view';
|
|
||||||
'require fs';
|
'require fs';
|
||||||
'require ui';
|
'require ui';
|
||||||
|
|
||||||
return view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.blacklist'), '');
|
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.blacklist'), '');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
'require view';
|
|
||||||
'require fs';
|
'require fs';
|
||||||
'require ui';
|
'require ui';
|
||||||
|
|
||||||
|
@ -187,7 +186,7 @@ function handleAction(ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
return L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['report', '+', '50', 'false', 'json']),'');
|
return L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['report', '+', '50', 'false', 'json']),'');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
'require view';
|
|
||||||
'require poll';
|
|
||||||
'require fs';
|
'require fs';
|
||||||
|
|
||||||
return view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
L.resolveDefault(fs.stat('/sbin/logread'), null),
|
L.resolveDefault(fs.stat('/sbin/logread'), null),
|
||||||
|
@ -12,7 +10,7 @@ return view.extend({
|
||||||
},
|
},
|
||||||
render: function(stat) {
|
render: function(stat) {
|
||||||
var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
|
var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
|
||||||
poll.add(function() {
|
L.Poll.add(function() {
|
||||||
return L.resolveDefault(fs.exec_direct(logger, ['-e', 'adblock-'])).then(function(res) {
|
return L.resolveDefault(fs.exec_direct(logger, ['-e', 'adblock-'])).then(function(res) {
|
||||||
var log = document.getElementById("logfile");
|
var log = document.getElementById("logfile");
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
'require view';
|
|
||||||
'require poll';
|
|
||||||
'require fs';
|
'require fs';
|
||||||
'require ui';
|
'require ui';
|
||||||
'require uci';
|
'require uci';
|
||||||
|
@ -100,7 +98,7 @@ async function handleAction(ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
poll.start();
|
L.Poll.start();
|
||||||
fs.exec_direct('/etc/init.d/adblock', [ev])
|
fs.exec_direct('/etc/init.d/adblock', [ev])
|
||||||
var running = 1;
|
var running = 1;
|
||||||
while (running === 1) {
|
while (running === 1) {
|
||||||
|
@ -111,10 +109,10 @@ async function handleAction(ev) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
poll.stop();
|
L.Poll.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
return view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['list']), {}),
|
L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['list']), {}),
|
||||||
|
@ -131,7 +129,7 @@ return view.extend({
|
||||||
/*
|
/*
|
||||||
poll runtime information
|
poll runtime information
|
||||||
*/
|
*/
|
||||||
pollData: poll.add(function() {
|
pollData: L.Poll.add(function() {
|
||||||
return L.resolveDefault(fs.read_direct('/tmp/adb_runtime.json'), 'null').then(function(res) {
|
return L.resolveDefault(fs.read_direct('/tmp/adb_runtime.json'), 'null').then(function(res) {
|
||||||
var info = JSON.parse(res);
|
var info = JSON.parse(res);
|
||||||
var status = document.getElementById('status');
|
var status = document.getElementById('status');
|
||||||
|
@ -144,7 +142,7 @@ return view.extend({
|
||||||
} else {
|
} else {
|
||||||
if (status.classList.contains("spinning")) {
|
if (status.classList.contains("spinning")) {
|
||||||
status.classList.remove("spinning");
|
status.classList.remove("spinning");
|
||||||
poll.stop();
|
L.Poll.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status.textContent.substr(0,6) === 'paused' && document.getElementById('btn_suspend')) {
|
if (status.textContent.substr(0,6) === 'paused' && document.getElementById('btn_suspend')) {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
'require view';
|
|
||||||
'require fs';
|
'require fs';
|
||||||
'require ui';
|
'require ui';
|
||||||
|
|
||||||
return view.extend({
|
return L.view.extend({
|
||||||
load: function() {
|
load: function() {
|
||||||
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.whitelist'), '');
|
return L.resolveDefault(fs.read_direct('/etc/adblock/adblock.whitelist'), '');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue