Compare commits

..

5 Commits

Author SHA1 Message Date
remittor
cc90c8dace Bump version to v0.9.20260131 2026-01-31 17:29:07 +03:00
remittor
986b3a28b1 diag: dwc: Update DPI check suites 2026-01-31 16:55:21 +03:00
remittor
07f5b13f11 updater: Fix error "XHR request timed out" 2026-01-31 16:49:08 +03:00
remittor
60044abbc0 luci: Fix buttons on modal dialogues 2026-01-31 13:16:44 +03:00
remittor
01a1b8801d luci: service: Stop update status when modal dialog active 2026-01-31 13:12:27 +03:00
8 changed files with 89 additions and 48 deletions

View File

@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-zapret2
PKG_VERSION:=0.9.20260130
PKG_RELEASE:=2
PKG_VERSION:=0.9.20260131
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_MAINTAINER:=remittor <https://github.com/remittor>

View File

@@ -158,13 +158,17 @@ return baseclass.extend({
E('br'), E('br'),
this.logArea,
]),
E('div', { 'class': 'right' }, [
this.btn_sitescheck,
' ',
this.btn_dpicheck,
' ',
this.btn_cancel,
])
E('div', { 'style': 'display:flex; justify-content:space-between; align-items:center; margin-top:1px;' }, [
E('div', { 'class': 'left' }, [
this.btn_sitescheck,
' ',
this.btn_dpicheck,
]),
E('div', { 'class': 'right' }, [
' ',
this.btn_cancel,
]),
]),
]);
}
});

View File

@@ -175,6 +175,10 @@ return view.extend({
statusPoll: function()
{
if (tools.isModalActive()) {
this.POLL.running = false;
return; // not update page when any modal dialog is active
}
this.getAppStatus().then(
L.bind(this.setAppStatus, this)
);
@@ -228,6 +232,7 @@ return view.extend({
let cancel_button = E('button', {
'class': btn_style_neutral,
'click': ui.hideModal,
'class': btn_style_warning,
}, _('Cancel'));
let resetcfg_btn = E('button', {
@@ -277,11 +282,14 @@ return view.extend({
nfqws_strat,
E('br'), E('br')
]),
E('div', { 'class': 'right' }, [
cancel_button,
' ',
resetcfg_btn,
])
E('div', { 'style': 'display:flex; justify-content:space-between; align-items:center; margin-top:1px;' }, [
E('div', { 'class': 'left' }, [
resetcfg_btn,
]),
E('div', { 'class': 'right' }, [
cancel_button,
]),
]),
]);
},

View File

@@ -761,7 +761,12 @@ return baseclass.extend({
},
}),
execAndRead: async function({ cmd = [ ], log = '', logArea = null, callback = null, ctx = null, hiderow = [ ], rpc_timeout = 5, rpc_root = false } = {})
isModalActive: function()
{
return document.body.classList.contains('modal-overlay-active');
},
execAndRead: async function({ cmd = [ ], log = '', logArea = null, callback = null, ctx = null, hiderow = [ ] } = {})
{
function appendLog(msg, end = '\n')
{
@@ -775,36 +780,49 @@ return baseclass.extend({
}
}
let hide_rows = Array.isArray(hiderow) ? hiderow : [ hiderow ];
let rpc_opt = { "timeout": rpc_timeout*1000 };
if (rpc_root) {
rpc_opt.uid = 0; // run under root
}
const logFile = log; // file for reading: '/tmp/zapret_pkg_install.log'
const rcFile = logFile + '.rc';
try {
await fs.exec('/bin/busybox', [ 'rm', '-f', logFile + '*' ], null, rpc_opt);
await fs.exec('/bin/busybox', [ 'rm', '-f', logFile + '*' ], null);
appendLog('Output file cleared!');
} catch (e) {
return callback.call(ctx, 500, 'ERROR: Failed to clear output file');
}
let processStarted = false;
let opt_list = [ logFile ];
try {
let opt_list = [ logFile ];
opt_list.push(...cmd);
let res = await fs.exec(this.appDir+'/script-exec.sh', opt_list, null, rpc_opt);
if (res.code != 0) {
return callback.call(ctx, 525, 'ERROR: cannot run "' + cmd[0] + '" script! (error = ' + res.code + ')');
}
appendLog('Process started...');
//console.log('script-exec.sh ... '+JSON.stringify(opt_list));
let proc = new Promise((resolve) => {
fs.exec(this.appDir+'/script-exec.sh', opt_list, null)
.then (() => { resolve(); })
.catch(() => { resolve(); });
});
} catch (e) {
return callback.call(ctx, 520, 'ERROR: Failed on execute process: ' + e.message);
}
let lastLen = 0;
let retCode = -1;
return await new Promise(async (resolve, reject) => {
let ticks = 0;
async function epoll()
{
ticks += 1;
try {
let res = await fs.exec('/bin/cat', [ logFile ], null, rpc_opt);
let res = await fs.exec('/bin/cat', [ logFile ], null);
if (res.code != 0) {
if (ticks > 1) {
console.log('ERROR: execAndRead: '+JSON.stringify(opt_list));
resolve(callback.call(ctx, 541, 'ERROR: Failed on read process log: code = ' + res.code));
return;
}
setTimeout(epoll, 500);
return; // skip first step with error
}
if (!processStarted) {
appendLog('Process started...');
processStarted = true;
}
if (res.stdout && res.stdout.length > lastLen) {
let log = res.stdout.slice(lastLen);
hide_rows.forEach(re => {
@@ -814,7 +832,7 @@ return baseclass.extend({
lastLen = res.stdout.length;
}
if (retCode < 0) {
let rc = await fs.exec('/bin/cat', [ rcFile ], null, rpc_opt);
let rc = await fs.exec('/bin/cat', [ rcFile ], null);
if (rc.code != 0) {
fixLogEnd();
resolve(callback.call(ctx, 545, 'ERROR: cannot read file "' + rcFile + '"'));

View File

@@ -201,13 +201,17 @@ return baseclass.extend({
E('hr'),
this.logArea,
]),
E('div', { 'class': 'right' }, [
this.btn_check,
' ',
this.btn_install,
' ',
this.btn_cancel,
])
E('div', { 'style': 'display:flex; justify-content:space-between; align-items:center; margin-top:1px;' }, [
E('div', { 'class': 'left' }, [
this.btn_check,
' ',
this.btn_install,
]),
E('div', { 'class': 'right' }, [
' ',
this.btn_cancel,
]),
]),
]);
}
},
});

View File

@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=zapret2
PKG_VERSION:=0.9.20260130
PKG_RELEASE:=2
PKG_VERSION:=0.9.20260131
PKG_RELEASE:=1
PKG_MAINTAINER:=bol-van
PKG_LICENSE:=MIT
@@ -14,8 +14,8 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
PKG_SOURCE_URL:=https://github.com/bol-van/zapret2.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=27d387c76dd3a356a284b2875d5787a3b4d3cb4e
PKG_SOURCE_DATE:=2026-01-30
PKG_SOURCE_VERSION:=a531da39fd7cf9d4c5c9c6fcf33d76b1d930c0d5
PKG_SOURCE_DATE:=2026-01-31
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret2/archive/refs/tags/v$(PKG_VERSION).tar.gz?

View File

@@ -88,7 +88,7 @@ TEST_SUITE='
{ id: "US.AWS-01", provider: "🇺🇸 AWS", times: 1, url: "https://corp.kaltura.com/wp-content/cache/min/1/wp-content/themes/airfleet/dist/styles/theme.css" },
{ id: "US.GC-01", provider: "🇺🇸 Google Cloud", times: 1, url: "https://api.usercentrics.eu/gvl/v3/en.json" },
{ id: "US.FST-01", provider: "🇺🇸 Fastly", times: 1, url: "https://www.jetblue.com/footer/footer-element-es2015.js" },
{ id: "CA.FST-01", provider: "🇨🇦 Fastly", times: 1, url: "https://www.cnn10.com/" },
{ id: "CA.FST-01", provider: "🇨🇦 Fastly", times: 1, url: "https://ssl.p.jwpcdn.com/player/v/8.40.5/bidding.js" },
{ id: "US.AKM-01", provider: "🇺🇸 Akamai", times: 1, url: "https://www.roxio.com/static/roxio/images/products/creator/nxt9/call-action-footer-bg.jpg" },
{ id: "PL.AKM-01", provider: "🇵🇱 Akamai", times: 1, url: "https://media-assets.stryker.com/is/image/stryker/gateway_1?$max_width_1410$" },
{ id: "US.CDN77-01", provider: "🇺🇸 CDN77", times: 1, url: "https://cdn.eso.org/images/banner1920/eso2520a.jpg" },

View File

@@ -1,15 +1,22 @@
#!/bin/sh
# Copyright (c) 2024 remittor
PID_FILE=/tmp/zapret-script-exec.pid
[ -f $PID_FILE ] && exit 70
LOG_FILE=$1
RC_FILE=$1.rc
shift 1
SH_FILE=$2
shift 2
[ ! -f $SH_FILE ] && exit 71
: > $LOG_FILE
: > $RC_FILE
(
exec </dev/null >/dev/null 2>&1
"$@" >> $LOG_FILE 2>&1
RETCODE=$?
start-stop-daemon -S -b -p $PID_FILE -x /bin/sh -- -c '
LOG_FILE=$1
RC_FILE=$2
SH_FILE=$3
shift 3
sh $SH_FILE "$@" > $LOG_FILE 2>&1
RET_CODE=$?
sleep 1
echo $RETCODE > $RC_FILE
) &
echo $RET_CODE > $RC_FILE
' sh $LOG_FILE $RC_FILE $SH_FILE "$@"
exit 0