mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-02-01 15:20:45 +03:00
Compare commits
10 Commits
v0.9.20260
...
v0.9.20260
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc90c8dace | ||
|
|
986b3a28b1 | ||
|
|
07f5b13f11 | ||
|
|
60044abbc0 | ||
|
|
01a1b8801d | ||
|
|
8302ed517f | ||
|
|
3f49fa3913 | ||
|
|
2e875efcf7 | ||
|
|
6a25a51571 | ||
|
|
a97d095aa6 |
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@@ -275,8 +275,6 @@ jobs:
|
||||
sed -i 's/CONFIG_LUCI_JSMIN=y/CONFIG_LUCI_JSMIN=n/g' .config
|
||||
sed -i 's/CONFIG_LUCI_CSSTIDY=y/CONFIG_LUCI_CSSTIDY=n/g' .config
|
||||
grep -q '^CONFIG_LUCI_CSSTIDY=' .config || echo 'CONFIG_LUCI_CSSTIDY=n' >> .config
|
||||
sed -i 's/CONFIG_PACKAGE_luajit2=n/CONFIG_PACKAGE_luajit2=y/g' .config
|
||||
grep -q '^CONFIG_PACKAGE_luajit2=' .config || echo 'CONFIG_PACKAGE_luajit2=y' >> .config
|
||||
echo "status=success" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Show config
|
||||
@@ -291,8 +289,7 @@ jobs:
|
||||
env:
|
||||
ARCH_TAG: ${{ matrix.arch }}
|
||||
run: |
|
||||
PKGLIST="package/feeds/packages/luajit2/compile"
|
||||
PKGLIST="$PKGLIST package/zapret-openwrt/zapret2/compile"
|
||||
PKGLIST="package/zapret-openwrt/zapret2/compile"
|
||||
if [ "$ARCH_TAG" = "$LUCI_ARCH" ]; then
|
||||
PKGLIST="$PKGLIST package/zapret-openwrt/luci-app-zapret2/compile"
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-zapret2
|
||||
PKG_VERSION:=0.9.20260130
|
||||
PKG_VERSION:=0.9.20260131
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||
|
||||
@@ -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,
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
},
|
||||
|
||||
|
||||
@@ -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 + '"'));
|
||||
|
||||
@@ -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,
|
||||
]),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=zapret2
|
||||
PKG_VERSION:=0.9.20260130
|
||||
PKG_VERSION:=0.9.20260131
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=bol-van
|
||||
@@ -14,30 +14,45 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret2.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=27c49bcfe473dfbc78dcdd89b4c8d3b5ca0118f8
|
||||
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?
|
||||
#PKG_HASH:=skip
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
LUA_JIT?=1
|
||||
|
||||
ifeq ($(LUA_JIT),1)
|
||||
LUAJIT_VER?=2.1
|
||||
LUA_VER?=5.1
|
||||
LUA_DEPEND:=luajit2
|
||||
LUA_INCLUDE:=-I$(STAGING_DIR)/usr/include/luajit-$(LUAJIT_VER)
|
||||
LUA_LIBRARY:=-L$(STAGING_DIR)/usr/lib -lluajit-$(LUA_VER)
|
||||
LUA_DEPEND:=
|
||||
LUAJIT_VER?=2.1
|
||||
ifeq ($(ARCH),riscv64)
|
||||
LUAJIT_URL:=https://github.com/infiWang/luajit2/archive
|
||||
LAUJIT_BRANCH:=v2.1-20260114-riscv64
|
||||
LUAJIT_COMMIT=4d8cf882a3a4ed3259407ad78614a60b02dd553f
|
||||
LUAJIT_RELEASE:=2.1-20260114-$(LUAJIT_COMMIT)
|
||||
LUAJIT_URL_FILE:=$(LUAJIT_COMMIT).tar.gz
|
||||
else
|
||||
LUAJIT_URL:=https://github.com/openresty/luajit2/archive/refs/tags
|
||||
LUAJIT_RELEASE:=2.1-20250826
|
||||
LUAJIT_URL_FILE:=v$(LUAJIT_RELEASE).tar.gz
|
||||
endif
|
||||
LUAJIT_TGZ:=$(PKG_NAME)-luajit-$(LUAJIT_RELEASE).tar.gz
|
||||
LUASRC_DIR:=$(PKG_BUILD_DIR)/luajit-$(LUAJIT_RELEASE)
|
||||
LUAOUT_DIR:=$(PKG_BUILD_DIR)/luajit-out
|
||||
LUA_INCLUDE:=-I$(LUAOUT_DIR)/include/luajit-$(LUAJIT_VER)
|
||||
LUA_LIBRARY:=-L$(LUAOUT_DIR)/lib -lluajit-$(LUA_VER)
|
||||
else
|
||||
LUA_VER?=5.4
|
||||
LUA_DEPEND:=lua$(LUA_VER)
|
||||
LUA_DEPEND:= +lua$(LUA_VER)
|
||||
LUA_INCLUDE:=-I$(STAGING_DIR)/usr/include/lua$(LUA_VER)
|
||||
LUA_LIBRARY:=-L$(STAGING_DIR)/usr/lib -llua$(LUA_VER)
|
||||
endif
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
#TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
|
||||
#TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
|
||||
|
||||
@@ -49,23 +64,74 @@ define Package/$(PKG_NAME)
|
||||
TITLE:=$(PKG_NAME)
|
||||
SUBMENU:=Zapret2
|
||||
URL:=https://github.com/bol-van/zapret2
|
||||
DEPENDS:= +nftables +curl +gzip +$(LUA_DEPEND)
|
||||
DEPENDS:= +nftables +curl +gzip $(LUA_DEPEND)
|
||||
DEPENDS+= +coreutils +coreutils-sort +coreutils-sleep
|
||||
DEPENDS+= +kmod-nft-nat +kmod-nft-offload +kmod-nft-queue
|
||||
DEPENDS+= +libnetfilter-queue +libmnl +libcap +zlib
|
||||
endef
|
||||
|
||||
ifeq ($(LUA_JIT),1)
|
||||
define Download/$(PKG_NAME)-luajit
|
||||
FILE:=$(LUAJIT_TGZ)
|
||||
URL:=$(LUAJIT_URL)
|
||||
URL_FILE:=$(LUAJIT_URL_FILE)
|
||||
HASH:=skip
|
||||
endef
|
||||
$(eval $(call Download,$(PKG_NAME)-luajit))
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
rm -f $(PKG_BUILD_DIR)/$(MAKE_PATH)/nfqws2
|
||||
rm -f $(PKG_BUILD_DIR)/ip2net/ip2net
|
||||
rm -f $(PKG_BUILD_DIR)/mdig/mdig
|
||||
if [ "$(LUA_JIT)" = 1 ]; then \
|
||||
if [ ! -f "$(DL_DIR)/$(LUAJIT_TGZ)" ]; then \
|
||||
echo "ERROR: LuaJIT tarball not found:"; \
|
||||
echo " $(LUAJIT_TGZ)"; \
|
||||
echo "Run: make package/$(PKG_NAME)/download"; \
|
||||
false; \
|
||||
fi ; \
|
||||
rm -rf $(LUASRC_DIR) ; \
|
||||
mkdir -p $(LUASRC_DIR) ; \
|
||||
tar -xzf "$(DL_DIR)/$(LUAJIT_TGZ)" --strip-components=1 -C "$(LUASRC_DIR)" ; \
|
||||
rm -rf $(LUAOUT_DIR) ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
#define Build/Configure
|
||||
#endef
|
||||
|
||||
ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH), x86_64 mips64))
|
||||
ifeq ($(CONFIG_ARCH_64BIT),)
|
||||
HOST_BITS := -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
if [ "$(LUA_JIT)" = 1 ]; then \
|
||||
$(MAKE) $(PKG_JOBS) -C $(LUASRC_DIR) \
|
||||
HOST_CC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_BITS)" \
|
||||
CROSS="$(TARGET_CROSS)" \
|
||||
XCFLAGS="-DLUAJIT_DISABLE_FFI" \
|
||||
TARGET_CFLAGS="-Os -s -flto=auto $(TARGET_CFLAGS)" \
|
||||
TARGET_AR="$(TARGET_AR) rcus" \
|
||||
BUILDMODE=static \
|
||||
DESTDIR=$(LUAOUT_DIR) \
|
||||
PREFIX= \
|
||||
TARGET_SYS=Linux ; \
|
||||
rm -rf $(LUAOUT_DIR) ; \
|
||||
if [ ! -f $(LUASRC_DIR)/src/libluajit.a ]; then \
|
||||
echo "ERROR: file libluajit.a not found!"; \
|
||||
false; \
|
||||
fi ; \
|
||||
mkdir -p $(LUAOUT_DIR) ; \
|
||||
$(MAKE) -C $(LUASRC_DIR) \
|
||||
DESTDIR=$(LUAOUT_DIR) \
|
||||
PREFIX= \
|
||||
TARGET_SYS=Linux \
|
||||
install ; \
|
||||
fi
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) $(TARGET_CONFIGURE_OPTS) LUA_JIT=$(LUA_JIT) LUA_CFLAGS="$(LUA_INCLUDE)" LUA_LIB="$(LUA_LIBRARY)"
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/ip2net $(TARGET_CONFIGURE_OPTS)
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/mdig $(TARGET_CONFIGURE_OPTS)
|
||||
@@ -214,10 +280,6 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
exit 55
|
||||
fi
|
||||
fi
|
||||
if $${PKG_CHECK} luajit 2>/dev/null | grep -q . ; then
|
||||
echo "ERROR: conflict package \"luajit\". Required \"luajit2\" package. Please install new package \"zapret2\" manually!"
|
||||
exit 59
|
||||
fi
|
||||
if [ -f "$${ZAPRET_CFG}" ] && ! grep -q "run_on_boot" "$${ZAPRET_CFG}"; then
|
||||
if [ -x "$${ZAPRET_INITD}" ]; then
|
||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -547,23 +547,6 @@ if [ "$opt_update" != "" ]; then
|
||||
echo "Uninstall ip2net..."
|
||||
${PKG_REMOVE} ${ZAPRET_CFG_NAME}-ip2net
|
||||
fi
|
||||
if [ "$ZAPRET_CFG_NAME" = zapret2 -a "$PKG_MGR" = opkg ]; then
|
||||
if [ "$ZAP_CUR_PKG_VER" != "" ]; then
|
||||
ZAP_VER_CMP=$( pkg_version_cmp "$ZAP_CUR_PKG_VER" "0.9.20260129-r1" )
|
||||
if [ "$ZAP_VER_CMP" = "L" ]; then
|
||||
echo "WARN: Detect installed zapret2 with luajit depend."
|
||||
ZAP_DEPENDS=$( opkg whatdepends luajit | awk '/^\s/{print $1}' | grep -q -v -E '^(luajit|zapret2|luci-app-zapret2)$' )
|
||||
if [ "$ZAP_DEPENDS" != "" ]; then
|
||||
echo "ERROR: Cannot remove package luajit! Please install package \"zapret2\" manually!"
|
||||
return 239
|
||||
fi
|
||||
[ -x /etc/init.d/zapret2 ] && /etc/init.d/zapret2 stop
|
||||
sleep 1
|
||||
opkg remove --force-remove --force-depends luajit
|
||||
opkg install --force-reinstall luajit2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo "Install downloaded packages..."
|
||||
if [ "$PKG_MGR" != "apk" ]; then
|
||||
opkg install --force-reinstall "$ZAP_PKG_BASE_FN"
|
||||
|
||||
Reference in New Issue
Block a user