mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-31 06:40:42 +03:00
Compare commits
7 Commits
v72.202601
...
v72.202601
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0dbf3653d | ||
|
|
df196ef9a9 | ||
|
|
c6dfbc5c7e | ||
|
|
436b4ed52e | ||
|
|
e16e4cb7f8 | ||
|
|
247f650b8a | ||
|
|
d0c7bc694d |
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-zapret
|
PKG_NAME:=luci-app-zapret
|
||||||
PKG_VERSION:=72.20260119
|
PKG_VERSION:=72.20260126
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||||
|
|||||||
@@ -49,5 +49,7 @@ return baseclass.extend({
|
|||||||
dst_obj.packager.path = '/bin/opkg';
|
dst_obj.packager.path = '/bin/opkg';
|
||||||
dst_obj.packager.args = [ 'list-installed', '*'+this.appName+'*' ];
|
dst_obj.packager.args = [ 'list-installed', '*'+this.appName+'*' ];
|
||||||
}
|
}
|
||||||
|
dst_obj.skey_pkg_dict = this.appName + '-pkg-dict';
|
||||||
|
dst_obj.skey_need_restart = this.appName + '-need-restart';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ return view.extend({
|
|||||||
fs.exec(tools.execPath, [ 'enabled' ]), // svc_en
|
fs.exec(tools.execPath, [ 'enabled' ]), // svc_en
|
||||||
tools.getSvcInfo(), // svc_info
|
tools.getSvcInfo(), // svc_info
|
||||||
fs.exec('/bin/busybox', [ 'ps' ]), // process list
|
fs.exec('/bin/busybox', [ 'ps' ]), // process list
|
||||||
fs.exec(tools.packager.path, tools.packager.args), // installed packages
|
tools.getPackageDict(), // installed packages
|
||||||
tools.getStratList(), // nfqws strategy list
|
tools.getStratList(), // nfqws strategy list
|
||||||
fs.exec('/bin/cat', [ '/etc/openwrt_release' ]), // CPU arch
|
fs.exec('/bin/cat', [ '/etc/openwrt_release' ]), // CPU arch
|
||||||
uci.load(tools.appName), // config
|
uci.load(tools.appName), // config
|
||||||
@@ -73,9 +73,9 @@ return view.extend({
|
|||||||
}
|
}
|
||||||
let svc_boot = status_array[0] ? true : false;
|
let svc_boot = status_array[0] ? true : false;
|
||||||
let svc_en = status_array[1]; // stdout: empty or error text
|
let svc_en = status_array[1]; // stdout: empty or error text
|
||||||
let svc_info = status_array[2]; // stdout: JSON as text
|
let svc_info = status_array[2]; // dict for services
|
||||||
let proc_list = status_array[3]; // stdout: multiline text
|
let proc_list = status_array[3]; // stdout: multiline text
|
||||||
let pkg_list = status_array[4]; // stdout: installed packages
|
let pkg_dict = status_array[4]; // stdout: installed packages
|
||||||
let stratlist = status_array[5]; // array of strat names
|
let stratlist = status_array[5]; // array of strat names
|
||||||
let sys_info = status_array[6]; // stdout: openwrt distrib info
|
let sys_info = status_array[6]; // stdout: openwrt distrib info
|
||||||
|
|
||||||
@@ -95,8 +95,8 @@ return view.extend({
|
|||||||
this.disableButtons(true, -1, elems);
|
this.disableButtons(true, -1, elems);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pkg_list.code != 0) {
|
if (!pkg_dict) {
|
||||||
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': setAppStatus()'));
|
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': getPackageDict()'));
|
||||||
this.disableButtons(true, -1, elems);
|
this.disableButtons(true, -1, elems);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -135,89 +135,27 @@ return view.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceAction: function(action, button) {
|
serviceActionEx: async function(action, button, args = [ ], hide_modal = false, btn_dis = true)
|
||||||
if (button) {
|
{
|
||||||
let elem = document.getElementById(button);
|
let btn = document.getElementById(button);
|
||||||
this.disableButtons(true, elem);
|
this.disableButtons(true, btn);
|
||||||
}
|
|
||||||
poll.stop();
|
poll.stop();
|
||||||
|
try {
|
||||||
let _this = this;
|
await tools.serviceActionEx(action, args, false);
|
||||||
|
|
||||||
return tools.handleServiceAction(tools.appName, action)
|
|
||||||
.then(() => {
|
|
||||||
return _this.getAppStatus().then(
|
|
||||||
(status_array) => {
|
|
||||||
_this.setAppStatus(status_array);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
ui.addNotification(null, E('p', _('Unable to run service action.') + ' Error: ' + e.message));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
serviceActionEx: function(action, button, args = [ ], hide_modal = false) {
|
|
||||||
if (button) {
|
|
||||||
let elem = document.getElementById(button);
|
|
||||||
this.disableButtons(true, elem);
|
|
||||||
}
|
|
||||||
poll.stop();
|
|
||||||
|
|
||||||
let _this = this;
|
|
||||||
let exec_cmd = null;
|
|
||||||
let exec_arg = [ ];
|
|
||||||
let errmsg = 'ERROR:';
|
|
||||||
if (action == 'start' || action == 'restart') {
|
|
||||||
exec_cmd = tools.syncCfgPath;
|
|
||||||
errmsg = _('Unable to run sync_config.sh script.');
|
|
||||||
}
|
|
||||||
else if (action == 'reset') {
|
|
||||||
exec_cmd = tools.defaultCfgPath;
|
|
||||||
exec_arg = args; // (reset_ipset)(sync) ==> restore all configs + sync config
|
|
||||||
errmsg = _('Unable to run restore-def-cfg.sh script.');
|
|
||||||
action = null;
|
|
||||||
} else {
|
|
||||||
ui.addNotification(null, E('p', 'ERROR: unknown action'));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return fs.exec(exec_cmd, exec_arg)
|
|
||||||
.then(function(res) {
|
|
||||||
if (res.code != 0) {
|
|
||||||
ui.addNotification(null, E('p', errmsg + ' res.code = ' + res.code));
|
|
||||||
action = null; // return with error
|
|
||||||
}
|
|
||||||
if (hide_modal) {
|
if (hide_modal) {
|
||||||
ui.hideModal();
|
ui.hideModal();
|
||||||
}
|
}
|
||||||
if (!action) {
|
} catch(e) {
|
||||||
return _this.getAppStatus().then(
|
//ui.addNotification(null, E('p', 'Error: ' + e.message));
|
||||||
(status_array) => {
|
} finally {
|
||||||
_this.setAppStatus(status_array);
|
if (btn && btn_dis) {
|
||||||
}
|
setTimeout(() => { btn.disabled = true; }, 0);
|
||||||
);
|
}
|
||||||
|
if (!poll.active()) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 10));
|
||||||
|
poll.start();
|
||||||
}
|
}
|
||||||
return _this.serviceAction(action, null);
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
ui.addNotification(null, E('p', errmsg + ' Error: ' + e.message));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
appAction: function(action, button) {
|
|
||||||
if (button) {
|
|
||||||
let elem = document.getElementById(button);
|
|
||||||
this.disableButtons(true, elem);
|
|
||||||
}
|
}
|
||||||
poll.stop();
|
|
||||||
return fs.exec_direct(tools.execPath, [ action ]).then(res => {
|
|
||||||
return this.getAppStatus().then(
|
|
||||||
(status_array) => {
|
|
||||||
this.setAppStatus(status_array);
|
|
||||||
ui.hideModal();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
statusPoll: function() {
|
statusPoll: function() {
|
||||||
@@ -226,7 +164,12 @@ return view.extend({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
dialogResetCfg: function(ev) {
|
dialogResetCfg: function(ev)
|
||||||
|
{
|
||||||
|
if (tools.checkUnsavedChanges()) {
|
||||||
|
ui.addNotification(null, E('p', _('You have unapplied changes')));
|
||||||
|
return;
|
||||||
|
}
|
||||||
ev.target.blur();
|
ev.target.blur();
|
||||||
|
|
||||||
let reset_base = E('label', [
|
let reset_base = E('label', [
|
||||||
@@ -274,7 +217,7 @@ return view.extend({
|
|||||||
let resetcfg_btn = E('button', {
|
let resetcfg_btn = E('button', {
|
||||||
'class': btn_style_action,
|
'class': btn_style_action,
|
||||||
}, _('Reset settings'));
|
}, _('Reset settings'));
|
||||||
resetcfg_btn.onclick = ui.createHandlerFn(this, () => {
|
resetcfg_btn.onclick = ui.createHandlerFn(this, async () => {
|
||||||
//cancel_button.disabled = true;
|
//cancel_button.disabled = true;
|
||||||
let opt_flags = '';
|
let opt_flags = '';
|
||||||
if (document.getElementById('cfg_reset_base').checked == false) {
|
if (document.getElementById('cfg_reset_base').checked == false) {
|
||||||
@@ -342,9 +285,11 @@ return view.extend({
|
|||||||
}
|
}
|
||||||
let cfg = uci.get(tools.appName, 'config');
|
let cfg = uci.get(tools.appName, 'config');
|
||||||
|
|
||||||
let pkg_list = status_array[4];
|
tools.checkAndRestartSvc(status_array[2]); // svc_info
|
||||||
if (pkg_list === undefined || typeof(pkg_list) !== 'object' || pkg_list.code != 0) {
|
|
||||||
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': setAppStatus()'));
|
let pkgdict = status_array[4];
|
||||||
|
if (pkgdict == null) {
|
||||||
|
ui.addNotification(null, E('p', _('Unable to enumerate installed packages') + ': render()'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,9 +335,9 @@ return view.extend({
|
|||||||
};
|
};
|
||||||
|
|
||||||
let btn_enable = create_btn('btn_enable', btn_style_success, _('Enable'));
|
let btn_enable = create_btn('btn_enable', btn_style_success, _('Enable'));
|
||||||
btn_enable.onclick = ui.createHandlerFn(this, this.serviceAction, 'enable', 'btn_enable');
|
btn_enable.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'enable', 'btn_enable');
|
||||||
let btn_disable = create_btn('btn_disable', btn_style_warning, _('Disable'));
|
let btn_disable = create_btn('btn_disable', btn_style_warning, _('Disable'));
|
||||||
btn_disable.onclick = ui.createHandlerFn(this, this.serviceAction, 'disable', 'btn_disable');
|
btn_disable.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'disable', 'btn_disable');
|
||||||
layout_append(_('Service autorun control'), null, [ btn_enable, btn_disable ] );
|
layout_append(_('Service autorun control'), null, [ btn_enable, btn_disable ] );
|
||||||
|
|
||||||
let btn_start = create_btn('btn_start', btn_style_action, _('Start'));
|
let btn_start = create_btn('btn_start', btn_style_action, _('Start'));
|
||||||
@@ -400,7 +345,7 @@ return view.extend({
|
|||||||
let btn_restart = create_btn('btn_restart', btn_style_action, _('Restart'));
|
let btn_restart = create_btn('btn_restart', btn_style_action, _('Restart'));
|
||||||
btn_restart.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'restart', 'btn_restart');
|
btn_restart.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'restart', 'btn_restart');
|
||||||
let btn_stop = create_btn('btn_stop', btn_style_warning, _('Stop'));
|
let btn_stop = create_btn('btn_stop', btn_style_warning, _('Stop'));
|
||||||
btn_stop.onclick = ui.createHandlerFn(this, this.serviceAction, 'stop', 'btn_stop');
|
btn_stop.onclick = ui.createHandlerFn(this, this.serviceActionEx, 'stop', 'btn_stop');
|
||||||
layout_append(_('Service daemons control'), null, [ btn_start, btn_restart, btn_stop ] );
|
layout_append(_('Service daemons control'), null, [ btn_start, btn_restart, btn_stop ] );
|
||||||
|
|
||||||
let btn_reset = create_btn('btn_reset', btn_style_action, _('Reset settings'));
|
let btn_reset = create_btn('btn_reset', btn_style_action, _('Reset settings'));
|
||||||
@@ -428,15 +373,15 @@ return view.extend({
|
|||||||
};
|
};
|
||||||
this.setAppStatus(status_array, elems);
|
this.setAppStatus(status_array, elems);
|
||||||
|
|
||||||
poll.add(L.bind(this.statusPoll, this));
|
poll.add(L.bind(this.statusPoll, this), 2); // interval 2 sec
|
||||||
|
|
||||||
let page_title = tools.AppName;
|
let page_title = tools.AppName;
|
||||||
let pkgdict = tools.decode_pkg_list(pkg_list.stdout, false);
|
|
||||||
page_title += '   ';
|
page_title += '   ';
|
||||||
if (pkgdict[tools.appName] === undefined || pkgdict[tools.appName] == '') {
|
if (pkgdict[tools.appName] === undefined || pkgdict[tools.appName] == '') {
|
||||||
page_title += 'unknown version';
|
page_title += 'unknown version';
|
||||||
} else {
|
} else {
|
||||||
page_title += 'v' + pkgdict[tools.appName];
|
page_title += 'v' + pkgdict[tools.appName];
|
||||||
|
page_title = page_title.replace(/-r1$/, '');
|
||||||
}
|
}
|
||||||
let aux1 = E('em');
|
let aux1 = E('em');
|
||||||
let aux2 = E('em');
|
let aux2 = E('em');
|
||||||
|
|||||||
@@ -13,43 +13,18 @@ document.head.appendChild(E('link', {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
return view.extend({
|
return view.extend({
|
||||||
parsers: { },
|
svc_info: null,
|
||||||
|
|
||||||
appStatusCode: null,
|
|
||||||
|
|
||||||
depends: function(elem, key, array, empty=true) {
|
|
||||||
if (empty && array.length === 0) {
|
|
||||||
elem.depends(key, '_dummy');
|
|
||||||
} else {
|
|
||||||
array.forEach(e => elem.depends(key, e));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
validateIpPort: function(section, value) {
|
|
||||||
return (/^$|^([0-9]{1,3}\.){3}[0-9]{1,3}(#[\d]{2,5})?$/.test(value)) ? true : _('Expecting:')
|
|
||||||
+ ` ${_('One of the following:')}\n - ${_('valid IP address')}\n - ${_('valid address#port')}\n`;
|
|
||||||
},
|
|
||||||
|
|
||||||
validateUrl: function(section, value) {
|
|
||||||
return (/^$|^https?:\/\/[\w.-]+(:[0-9]{2,5})?[\w\/~.&?+=-]*$/.test(value)) ? true : _('Expecting:')
|
|
||||||
+ ` ${_('valid URL')}\n`;
|
|
||||||
},
|
|
||||||
|
|
||||||
load: function() {
|
load: function() {
|
||||||
return Promise.all([
|
return tools.baseLoad();
|
||||||
{ code: -1}, // L.resolveDefault(fs.exec(tools.execPath, [ 'raw-status' ]), 1),
|
|
||||||
null, // L.resolveDefault(fs.list(tools.parsersDir), null),
|
|
||||||
uci.load(tools.appName),
|
|
||||||
]).catch(e => {
|
|
||||||
ui.addNotification(null, E('p', _('Unable to read the contents') + ': %s '.format(e.message) ));
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function(data) {
|
render: function(data) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.appStatusCode = data[0].code;
|
this.svc_info = data.svc_info;
|
||||||
|
tools.checkAndRestartSvc(this.svc_info);
|
||||||
|
|
||||||
let m, s, o, tabname;
|
let m, s, o, tabname;
|
||||||
|
|
||||||
@@ -480,12 +455,14 @@ return view.extend({
|
|||||||
return map_promise;
|
return map_promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSaveApply: function(ev, mode) {
|
handleSaveApply: function(ev, mode)
|
||||||
|
{
|
||||||
return this.handleSave(ev).then(() => {
|
return this.handleSave(ev).then(() => {
|
||||||
ui.changes.apply(mode == '0');
|
ui.changes.apply(mode == '0');
|
||||||
//if (this.appStatusCode != 1 && this.appStatusCode != 2) {
|
if (this.svc_info?.dmn.inited) {
|
||||||
// window.setTimeout(() => fs.exec(tools.execPath, [ 'restart' ]), 3000);
|
localStorage.setItem(tools.skey_need_restart, '1');
|
||||||
//}
|
console.log('STOR KEY: '+tools.skey_need_restart+' = 1');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -101,6 +101,29 @@ return baseclass.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPackageDict: function()
|
||||||
|
{
|
||||||
|
let exec_cmd = this.packager.path;
|
||||||
|
let exec_arg = this.packager.args;
|
||||||
|
return fs.exec(exec_cmd, exec_arg).then(res => {
|
||||||
|
let pdict_json = localStorage.getItem(this.skey_pkg_dict);
|
||||||
|
if (res.code != 0) {
|
||||||
|
console.log(this.appName + ': Unable to enumerate installed packages. code = ' + res.code);
|
||||||
|
if (pdict_json != null) {
|
||||||
|
return JSON.parse(pdict_json); // return cached value
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
let pdict = this.decode_pkg_list(res.stdout);
|
||||||
|
if (pdict != pdict_json) {
|
||||||
|
localStorage.setItem(this.skey_pkg_dict, JSON.stringify(pdict)); // renew cache
|
||||||
|
}
|
||||||
|
return pdict;
|
||||||
|
}).catch(e => {
|
||||||
|
ui.addNotification(null, E('p', _('Unable to enumerate installed packages.') + ' Error: %s'.format(e)));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getStratList: function() {
|
getStratList: function() {
|
||||||
let exec_cmd = '/bin/busybox';
|
let exec_cmd = '/bin/busybox';
|
||||||
let exec_arg = [ 'awk', '-F', '"', '/if \\[ "\\$strat" = "/ {print $4}', this.defCfgPath ];
|
let exec_arg = [ 'awk', '-F', '"', '/if \\[ "\\$strat" = "/ {print $4}', this.defCfgPath ];
|
||||||
@@ -114,7 +137,9 @@ return baseclass.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleServiceAction: function(name, action) {
|
handleServiceAction: function(name, action, throwed = false)
|
||||||
|
{
|
||||||
|
console.log('handleServiceAction: '+name+' '+action);
|
||||||
return this.callInitAction(name, action).then(success => {
|
return this.callInitAction(name, action).then(success => {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw _('Command failed');
|
throw _('Command failed');
|
||||||
@@ -122,9 +147,100 @@ return baseclass.extend({
|
|||||||
return true;
|
return true;
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
ui.addNotification(null, E('p', _('Service action failed "%s %s": %s').format(name, action, e)));
|
ui.addNotification(null, E('p', _('Service action failed "%s %s": %s').format(name, action, e)));
|
||||||
|
if (throwed) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
serviceActionEx: async function(action, args = [ ], throwed = false)
|
||||||
|
{
|
||||||
|
let errmsg = null;
|
||||||
|
try {
|
||||||
|
let exec_cmd = null;
|
||||||
|
let exec_arg = [ ];
|
||||||
|
if (action == 'start' || action == 'restart') {
|
||||||
|
if (this.checkUnsavedChanges()) {
|
||||||
|
await ui.changes.apply(true);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
|
}
|
||||||
|
exec_cmd = this.syncCfgPath;
|
||||||
|
errmsg = _('Unable to run sync_config.sh script.');
|
||||||
|
}
|
||||||
|
if (action == 'reset') {
|
||||||
|
exec_cmd = this.defaultCfgPath;
|
||||||
|
exec_arg = args; // (reset_ipset)(sync) ==> restore all configs + sync config
|
||||||
|
errmsg = _('Unable to run restore-def-cfg.sh script.');
|
||||||
|
action = null;
|
||||||
|
}
|
||||||
|
if (exec_cmd) {
|
||||||
|
let res = await fs.exec(exec_cmd, exec_arg);
|
||||||
|
if (res.code != 0) {
|
||||||
|
throw Error('res.code = ' + res.code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errmsg = null;
|
||||||
|
await this.handleServiceAction(this.appName, action, throwed);
|
||||||
|
} catch(e) {
|
||||||
|
if (throwed) {
|
||||||
|
throw e;
|
||||||
|
} else {
|
||||||
|
let msg = errmsg ? errmsg : _('Unable to run service action') + ' "' + action + '".';
|
||||||
|
ui.addNotification(null, E('p', msg + ' Error: ' + e.message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
baseLoad: function(callback, cbarg)
|
||||||
|
{
|
||||||
|
return Promise.all([
|
||||||
|
this.getSvcInfo(), // svc_info
|
||||||
|
uci.load(this.appName),
|
||||||
|
])
|
||||||
|
.then( ([svcInfo, uci_data]) => {
|
||||||
|
let svc_info = this.decode_svc_info(true, svcInfo, [ ], null);
|
||||||
|
let ret = { svc_info, uci_data };
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
const res = callback(cbarg, ret);
|
||||||
|
if (res && typeof res.then === 'function') {
|
||||||
|
return res.then(() => ret);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
ui.addNotification(null, E('p', _('Unable to read the contents') + ' (baseLoad): %s '.format(e.message) ));
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
checkAndRestartSvc: function(svcInfo)
|
||||||
|
{
|
||||||
|
let svc_info = null;
|
||||||
|
if (svcInfo?.autorun !== undefined && svcInfo?.dmn !== undefined) {
|
||||||
|
svc_info = svcInfo;
|
||||||
|
} else
|
||||||
|
if (typeof(svcInfo) == 'object') {
|
||||||
|
svc_info = this.decode_svc_info(true, svcInfo, [ ], null);
|
||||||
|
}
|
||||||
|
//console.log('checkAndRestartSvc: svc_info = '+JSON.stringify(svc_info));
|
||||||
|
let need_restart = localStorage.getItem(this.skey_need_restart);
|
||||||
|
if (need_restart) {
|
||||||
|
localStorage.removeItem(this.skey_need_restart);
|
||||||
|
if (svcInfo?.dmn !== undefined && svc_info.dmn.inited) {
|
||||||
|
this.serviceActionEx('restart');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
checkUnsavedChanges: function()
|
||||||
|
{
|
||||||
|
if (!ui.changes) return false;
|
||||||
|
if (!ui.changes.changes) return false;
|
||||||
|
return ui.changes.changes[this.appName] ? true : false;
|
||||||
|
},
|
||||||
|
|
||||||
normalizeValue: function(v) {
|
normalizeValue: function(v) {
|
||||||
return (v && typeof(v) === 'string') ? v.trim().replace(/\r?\n/g, '') : v;
|
return (v && typeof(v) === 'string') ? v.trim().replace(/\r?\n/g, '') : v;
|
||||||
},
|
},
|
||||||
@@ -141,7 +257,7 @@ return baseclass.extend({
|
|||||||
return m ? m[2] : defval;
|
return m ? m[2] : defval;
|
||||||
},
|
},
|
||||||
|
|
||||||
decode_pkg_list: function(pkg_list, with_suffix_r1 = true) {
|
decode_pkg_list: function(pkg_list) {
|
||||||
let pkg_dict = { };
|
let pkg_dict = { };
|
||||||
if (!pkg_list) {
|
if (!pkg_list) {
|
||||||
return pkg_dict;
|
return pkg_dict;
|
||||||
@@ -180,11 +296,7 @@ return baseclass.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rev >= 0) {
|
if (rev >= 0) {
|
||||||
if (rev == 1 && !with_suffix_r1) {
|
ver += '-r' + rev;
|
||||||
// nothing
|
|
||||||
} else {
|
|
||||||
ver += '-r' + rev;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pkg_dict[name] = ver;
|
pkg_dict[name] = ver;
|
||||||
}
|
}
|
||||||
@@ -219,13 +331,15 @@ return baseclass.extend({
|
|||||||
},
|
},
|
||||||
"status": this.statusDict.error,
|
"status": this.statusDict.error,
|
||||||
};
|
};
|
||||||
if (proc_list.code != 0) {
|
let plist = proc_list;
|
||||||
return -2;
|
if (proc_list?.code !== undefined) {
|
||||||
}
|
if (proc_list.code != 0) {
|
||||||
let plist = this.get_pid_list(proc_list.stdout);
|
return -2;
|
||||||
|
}
|
||||||
if (plist.length < 4) {
|
plist = this.get_pid_list(proc_list.stdout);
|
||||||
return -3;
|
if (plist.length < 4) {
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeof(svc_info) !== 'object') {
|
if (typeof(svc_info) !== 'object') {
|
||||||
return -4;
|
return -4;
|
||||||
|
|||||||
@@ -136,6 +136,10 @@ return baseclass.extend({
|
|||||||
|
|
||||||
openUpdateDialog: function(pkg_arch)
|
openUpdateDialog: function(pkg_arch)
|
||||||
{
|
{
|
||||||
|
if (tools.checkUnsavedChanges()) {
|
||||||
|
ui.addNotification(null, E('p', _('You have unapplied changes')));
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.stage = 0;
|
this.stage = 0;
|
||||||
this.pkg_arch = pkg_arch;
|
this.pkg_arch = pkg_arch;
|
||||||
this.pkg_url = null;
|
this.pkg_url = null;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=zapret
|
PKG_NAME:=zapret
|
||||||
PKG_VERSION:=72.20260119
|
PKG_VERSION:=72.20260126
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
PKG_MAINTAINER:=bol-van
|
||||||
@@ -14,8 +14,8 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=c849e55ef0f1c244206f5a05ff7b1ab41a3824ee
|
PKG_SOURCE_VERSION:=119e243b3664d6a512ed8b6ab61dcba00987105c
|
||||||
PKG_SOURCE_DATE:=2026-01-19
|
PKG_SOURCE_DATE:=2026-01-26
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
||||||
@@ -242,6 +242,10 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
chmod 644 $${ZAPRET_DIR}/ipset_def/*.txt >/dev/null 2>&1
|
chmod 644 $${ZAPRET_DIR}/ipset_def/*.txt >/dev/null 2>&1
|
||||||
chmod 644 $${ZAPRET_DIR}/init.d/openwrt/custom.d/*.sh >/dev/null 2>&1
|
chmod 644 $${ZAPRET_DIR}/init.d/openwrt/custom.d/*.sh >/dev/null 2>&1
|
||||||
chmod 644 $${ZAPRET_DIR}/config* >/dev/null 2>&1
|
chmod 644 $${ZAPRET_DIR}/config* >/dev/null 2>&1
|
||||||
|
# cleanup custom.d directory
|
||||||
|
rm -f $${ZAPRET_DIR}/init.d/openwrt/custom.d/*-opkg*
|
||||||
|
rm -f $${ZAPRET_DIR}/init.d/openwrt/custom.d/*.opkg*
|
||||||
|
rm -f $${ZAPRET_DIR}/init.d/openwrt/custom.d/*.apk*
|
||||||
# creating main config if its not exists
|
# creating main config if its not exists
|
||||||
if [ ! -f "$${ZAPRET_CONFIG}" ]; then
|
if [ ! -f "$${ZAPRET_CONFIG}" ]; then
|
||||||
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ function init_before_start
|
|||||||
[ ! -f "$HOSTLIST_FN" ] && touch "$HOSTLIST_FN"
|
[ ! -f "$HOSTLIST_FN" ] && touch "$HOSTLIST_FN"
|
||||||
chmod 644 $ZAPRET_BASE/ipset/*.txt
|
chmod 644 $ZAPRET_BASE/ipset/*.txt
|
||||||
chmod 666 $ZAPRET_BASE/ipset/*.log
|
chmod 666 $ZAPRET_BASE/ipset/*.log
|
||||||
|
rm -f $ZAPRET_BASE/init.d/openwrt/custom.d/*-opkg*
|
||||||
|
rm -f $ZAPRET_BASE/init.d/openwrt/custom.d/*.opkg*
|
||||||
|
rm -f $ZAPRET_BASE/init.d/openwrt/custom.d/*.apk*
|
||||||
rm -f /tmp/$ZAPRET_CFG_NAME+*.log
|
rm -f /tmp/$ZAPRET_CFG_NAME+*.log
|
||||||
#*/
|
#*/
|
||||||
if [ "$DAEMON_LOG_ENABLE" = "1" ]; then
|
if [ "$DAEMON_LOG_ENABLE" = "1" ]; then
|
||||||
|
|||||||
@@ -288,4 +288,39 @@ huaweicloud-dns.org
|
|||||||
#################################### Okko
|
#################################### Okko
|
||||||
okko.tv
|
okko.tv
|
||||||
playfamily.ru
|
playfamily.ru
|
||||||
|
#################################### Beeline
|
||||||
|
beeline.ru
|
||||||
|
beeline.tv
|
||||||
|
#################################### Delta Force
|
||||||
|
volces.com
|
||||||
|
wetest.net
|
||||||
|
intlgame.com
|
||||||
|
fleetlogd.com
|
||||||
|
dgameglobal.com
|
||||||
|
tdatamaster.com
|
||||||
|
playdeltaforce.com
|
||||||
|
quovadisglobal.com
|
||||||
|
jupiterlauncher.com
|
||||||
|
anticheatexpert.com
|
||||||
|
#################################### Microsoft
|
||||||
|
live.com
|
||||||
|
lync.com
|
||||||
|
skype.com
|
||||||
|
microsoft
|
||||||
|
msauth.net
|
||||||
|
office.net
|
||||||
|
office.com
|
||||||
|
msocdn.com
|
||||||
|
mojang.com
|
||||||
|
windows.net
|
||||||
|
msftauth.net
|
||||||
|
xboxlive.com
|
||||||
|
microsoft.com
|
||||||
|
office365.com
|
||||||
|
azureedge.net
|
||||||
|
skypeassets.com
|
||||||
|
windowsupdate.com
|
||||||
|
microsoftonline.com
|
||||||
|
microsoftonline-p.com
|
||||||
|
minecraftservices.com
|
||||||
####################################
|
####################################
|
||||||
|
|||||||
Reference in New Issue
Block a user