mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-27 12:50:35 +03:00
Compare commits
11 Commits
v0.8.20260
...
v0.8.20260
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee8089e1bb | ||
|
|
4dd7030c60 | ||
|
|
00490e3b5d | ||
|
|
126e7dea89 | ||
|
|
fc85552e4e | ||
|
|
e15eaafa33 | ||
|
|
5b331132a1 | ||
|
|
5711c1f2d4 | ||
|
|
0ee7ae325e | ||
|
|
c4ce5c1aeb | ||
|
|
d50aa75e94 |
58
.github/workflows/releases.yml
vendored
58
.github/workflows/releases.yml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
workflows: ["build"]
|
||||
types: [completed]
|
||||
release:
|
||||
types: [published, created, edited]
|
||||
types: [published, unpublished, created, edited, deleted, prereleased]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -25,6 +25,62 @@ jobs:
|
||||
ref: gh-pages
|
||||
continue-on-error: true
|
||||
|
||||
- name: Wait for GitHub API consistency (release events)
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
REPO: ${{ github.repository }}
|
||||
ACTION: ${{ github.event.action }}
|
||||
TARGET_ID: ${{ github.event.release.id }}
|
||||
TARGET_NAME: ${{ github.event.release.name }}
|
||||
run: |
|
||||
set -e
|
||||
echo "Release action: $ACTION"
|
||||
echo "Target release id: $TARGET_ID"
|
||||
max=10
|
||||
delay=6
|
||||
check() {
|
||||
curl -s https://api.github.com/repos/$REPO/releases
|
||||
}
|
||||
for iter in $(seq 1 $max); do
|
||||
case "$ACTION" in
|
||||
created)
|
||||
echo "Release created (draft). No API wait needed."
|
||||
exit 0
|
||||
;;
|
||||
published|prereleased)
|
||||
if check | jq "any(.[]; .id == $TARGET_ID)"; then
|
||||
echo "Release appeared in API"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
deleted)
|
||||
if ! check | jq "any(.[]; .id == $TARGET_ID)"; then
|
||||
echo "Release disappeared from API"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
unpublished)
|
||||
if check | jq "any(.[]; .id == $TARGET_ID and .draft == true)"; then
|
||||
echo "Release is now draft"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
edited)
|
||||
if check | jq "any(.[]; .id == $TARGET_ID and .name == \"$TARGET_NAME\")"; then
|
||||
echo "Release updated"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "No consistency wait needed for action: $ACTION"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
echo "Retry $iter/$max..."
|
||||
sleep "$delay"
|
||||
done
|
||||
echo "WARNING: API consistency timeout for action $ACTION"
|
||||
|
||||
- name: Save FULL releases.json
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-zapret2
|
||||
PKG_VERSION:=0.8.20260111
|
||||
PKG_VERSION:=0.8.20260113
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||
|
||||
@@ -386,7 +386,7 @@ return view.extend({
|
||||
|
||||
let btn_diag = create_btn('btn_diag', btn_style_action, _('Diagnostics'));
|
||||
btn_diag.onclick = ui.createHandlerFn(this, () => { diagnost.openDiagnostDialog(this.pkg_arch) });
|
||||
layout_append('', null, [ btn_diag ] );
|
||||
layout_append('Diagnostic tools', null, [ btn_diag ] );
|
||||
|
||||
let btn_update = create_btn('btn_update', btn_style_action, _('Update'));
|
||||
btn_update.onclick = ui.createHandlerFn(this, () => { updater.openUpdateDialog(this.pkg_arch) });
|
||||
|
||||
126
zapret2/Makefile
126
zapret2/Makefile
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=zapret2
|
||||
PKG_VERSION:=0.8.20260111
|
||||
PKG_VERSION:=0.8.20260113
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=bol-van
|
||||
@@ -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:=3aad1f9ed9ada87877da683ebec08dfa98807948
|
||||
PKG_SOURCE_DATE:=2026-01-11
|
||||
PKG_SOURCE_VERSION:=dced388652c49fea6eb82401f79146b484a9cd7a
|
||||
PKG_SOURCE_DATE:=2026-01-13
|
||||
|
||||
#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?
|
||||
@@ -72,10 +72,17 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/zapret2
|
||||
/opt/zapret2/config
|
||||
/opt/zapret2/ipset/
|
||||
/opt/zapret2/init.d/openwrt/custom.d/
|
||||
/opt/zapret2/ipset/zapret-hosts-google.txt
|
||||
/opt/zapret2/ipset/zapret-hosts-user.txt
|
||||
/opt/zapret2/ipset/zapret-hosts-user-exclude.txt
|
||||
/opt/zapret2/ipset/zapret-ip-exclude.txt
|
||||
/opt/zapret2/ipset/zapret-hosts-auto.txt
|
||||
/opt/zapret2/init.d/openwrt/custom.d/10-script.sh
|
||||
/opt/zapret2/init.d/openwrt/custom.d/20-script.sh
|
||||
/opt/zapret2/init.d/openwrt/custom.d/50-script.sh
|
||||
/opt/zapret2/init.d/openwrt/custom.d/60-script.sh
|
||||
/opt/zapret2/init.d/openwrt/custom.d/90-script.sh
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
@@ -109,6 +116,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./init.d.sh $(1)/etc/init.d/zapret2
|
||||
$(INSTALL_DATA) ./config.default $(1)/opt/zapret2/config.default
|
||||
$(INSTALL_DATA) ./config.default $(1)/opt/zapret2/config
|
||||
$(INSTALL_DATA) ./ipset/zapret-hosts-google.txt $(1)/opt/zapret2/ipset/zapret-hosts-google.txt
|
||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret2/ipset/zapret-hosts-user.txt
|
||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret2/ipset/zapret-hosts-user-exclude.txt
|
||||
@@ -124,12 +132,24 @@ define Package/$(PKG_NAME)/install
|
||||
$(CP) ./custom.d/* $(1)/opt/zapret2/init.d/openwrt/custom.d/
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret2-uci-def-cfg.sh
|
||||
# install all sh-scripts
|
||||
$(CP) ./*.sh $(1)/opt/zapret2/
|
||||
# Fix permisions
|
||||
rm -f $(1)/opt/zapret2/init.d.sh
|
||||
# Create empty conf files
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/ipset/zapret-hosts-auto.txt
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/ipset/cust1.txt
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/ipset/cust2.txt
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/ipset/cust3.txt
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/ipset/cust4.txt
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/init.d/openwrt/custom.d/10-script.sh
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/init.d/openwrt/custom.d/20-script.sh
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/init.d/openwrt/custom.d/60-script.sh
|
||||
$(INSTALL_DATA) /dev/null $(1)/opt/zapret2/init.d/openwrt/custom.d/90-script.sh
|
||||
# Fix permissions
|
||||
chmod 644 $(1)/opt/zapret2/ipset/*.txt
|
||||
chmod 644 $(1)/opt/zapret2/ipset_def/*.txt
|
||||
chmod 644 $(1)/opt/zapret2/init.d/openwrt/custom.d/*.sh
|
||||
chmod 644 $(1)/opt/zapret2/config.default
|
||||
chmod 644 $(1)/opt/zapret2/config*
|
||||
chmod 755 $(1)/opt/zapret2/*.sh
|
||||
chmod 755 $(1)/opt/zapret2/$(MAKE_PATH)/*
|
||||
chmod 755 $(1)/opt/zapret2/ip2net/*
|
||||
@@ -140,19 +160,66 @@ define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
# check if we are on real system
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
if [ -f "/etc/init.d/zapret2" ]; then
|
||||
SCRIPT=$$( readlink /etc/init.d/zapret2 )
|
||||
ZAPRET_DIR=/opt/zapret2
|
||||
ZAPRET_INITD=/etc/init.d/zapret2
|
||||
ZAPRET_CFG=/etc/config/zapret2
|
||||
if [ -f "$${ZAPRET_INITD}" ]; then
|
||||
SCRIPT=$$( readlink "$${ZAPRET_INITD}" )
|
||||
if [ -n "$${SCRIPT}" ]; then
|
||||
echo "Please uninstall original zapret2 utility!"
|
||||
echo "Please uninstall incompatible \"zapret2\" service!"
|
||||
exit 44
|
||||
fi
|
||||
fi
|
||||
if command -v apk >/dev/null; then
|
||||
PKG_MGR="apk"
|
||||
PKG_CHECK="apk info -e "
|
||||
PKG_REMOVE="apk del --force "
|
||||
else
|
||||
PKG_MGR="opkg"
|
||||
PKG_CHECK="opkg status "
|
||||
PKG_REMOVE="opkg remove --force-remove "
|
||||
fi
|
||||
if [ "$${PKG_UPGRADE}" = "1" ]; then
|
||||
# stop service if PKG_UPGRADE
|
||||
if [ -x "/etc/init.d/zapret2" ]; then
|
||||
/etc/init.d/zapret2 running && /etc/init.d/zapret2 stop >/dev/null 2>&1
|
||||
if [ -x "$${ZAPRET_INITD}" ]; then
|
||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if $${PKG_CHECK} zapret2 >/dev/null 2>&1; then
|
||||
if [ ! -f "/opt/zapret2/sync_config.sh" ]; then
|
||||
echo "Please uninstall incompatible \"zapret2\" package!"
|
||||
exit 47
|
||||
fi
|
||||
if [ -f "$${ZAPRET_CFG}" ] && ! grep -q "run_on_boot" "$${ZAPRET_CFG}"; then
|
||||
echo "Please uninstall incompatible \"zapret2\" package!"
|
||||
exit 48
|
||||
fi
|
||||
fi
|
||||
if $${PKG_CHECK} luci-app-zapret2 >/dev/null 2>&1; then
|
||||
SVC_FILE=/www/luci-static/resources/view/zapret2/service.js
|
||||
if [ ! -f "$${SVC_FILE}" ] || ! grep -Fq "/remittor/zapret-openwrt" "$${SVC_FILE}"; then
|
||||
echo "Please uninstall incompatible \"luci-app-zapret2\" package!"
|
||||
exit 55
|
||||
fi
|
||||
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
|
||||
fi
|
||||
rm -f $${ZAPRET_CFG}
|
||||
rm -f $${ZAPRET_INITD}
|
||||
[ -d "$${ZAPRET_DIR}" ] && rm -rf $${ZAPRET_DIR}
|
||||
echo "All files of the previously installed package have been removed!"
|
||||
fi
|
||||
if $${PKG_CHECK} zapret2-mdig >/dev/null 2>&1; then
|
||||
$${PKG_REMOVE} zapret2-mdig
|
||||
fi
|
||||
if $${PKG_CHECK} zapret2-ip2net >/dev/null 2>&1; then
|
||||
$${PKG_REMOVE} zapret2-ip2net
|
||||
fi
|
||||
if [ ! -d "$${ZAPRET_DIR}" ]; then
|
||||
mkdir -p $${ZAPRET_DIR}
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
@@ -161,14 +228,25 @@ define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
# check if we are on real system
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
ZAPRET_DIR=/opt/zapret2
|
||||
ZAPRET_INITD=/etc/init.d/zapret2
|
||||
ZAPRET_CFG=/etc/config/zapret2
|
||||
ZAPRET_CONFIG=/opt/zapret2/config
|
||||
ZAPRET_CONFIG_DEF="/opt/zapret2/config.default"
|
||||
# Fix permissions
|
||||
chmod 644 $${ZAPRET_CFG} >/dev/null 2>&1
|
||||
chmod 644 $${ZAPRET_DIR}/ipset/*.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}/config* >/dev/null 2>&1
|
||||
# creating main config if its not exists
|
||||
if [ ! -f "$${ZAPRET_CONFIG}" ]; then
|
||||
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||
fi
|
||||
# remove fake uci-config
|
||||
[ -f "$${ZAPRET_CFG}" ] && [ ! -s "$${ZAPRET_CFG}" ] && rm -f "$${ZAPRET_CFG}"
|
||||
# check existing uci-config
|
||||
[ -f "/etc/config/zapret2" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
||||
[ -f "$${ZAPRET_CFG}" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
||||
# create or merge uci-config
|
||||
/opt/zapret2/uci-def-cfg.sh
|
||||
[ "$${ZAPRET_CFG_EXISTS}" = "1" ] && echo "Config /etc/config/zapret2 merged with default uci-config"
|
||||
@@ -180,13 +258,13 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || exit 58
|
||||
# enable main service
|
||||
/etc/init.d/zapret2 enable
|
||||
$${ZAPRET_INITD} enable
|
||||
# stop all
|
||||
/etc/init.d/zapret2 stop_fw
|
||||
/etc/init.d/zapret2 stop_daemons
|
||||
$${ZAPRET_INITD} stop_fw >/dev/null 2>&1
|
||||
$${ZAPRET_INITD} stop_daemons >/dev/null 2>&1
|
||||
ps w | grep '/opt/zapret2/nfq2/nfqws2' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||
# start main service
|
||||
/etc/init.d/zapret2 start
|
||||
$${ZAPRET_INITD} start
|
||||
# restart firewall
|
||||
[ -x /sbin/fw4 ] && fw4 -q restart || fw3 -q restart
|
||||
fi
|
||||
@@ -197,8 +275,10 @@ define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
# check if we are on real system
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
EXEDIR=/opt/zapret2
|
||||
ZAPRET_DIR=/opt/zapret2
|
||||
ZAPRET_BASE=/opt/zapret2
|
||||
ZAPRET_INITD=/etc/init.d/zapret2
|
||||
ZAPRET_CFG=/etc/config/zapret2
|
||||
ZAPRET_CONFIG=/opt/zapret2/config
|
||||
ZAPRET_CONFIG_DEF="/opt/zapret2/config.default"
|
||||
OPENWRT_FW_INCLUDE=/etc/firewall.zapret2
|
||||
@@ -213,8 +293,8 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
. "$${ZAPRET_BASE}/common/fwtype.sh"
|
||||
. "$${ZAPRET_BASE}/common/nft.sh"
|
||||
. "$${ZAPRET_BASE}/common/installer.sh"
|
||||
/etc/init.d/zapret2 running && /etc/init.d/zapret2 stop
|
||||
/etc/init.d/zapret2 disable
|
||||
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
||||
$${ZAPRET_INITD} disable >/dev/null 2>&1
|
||||
ps w | grep '/opt/zapret2/nfq2/nfqws2' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||
remove_openwrt_firewall
|
||||
nft_del_table
|
||||
@@ -227,7 +307,9 @@ define Package/$(PKG_NAME)/postrm
|
||||
#!/bin/sh
|
||||
# check if we are on real system
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
[ -f "/etc/config/zapret2-opkg" ] && rm -f "/etc/config/zapret2-opkg"
|
||||
rm -f /etc/config/zapret2-opkg*
|
||||
rm -f /etc/config/zapret2.opkg*
|
||||
rm -f /etc/config/zapret2.apk*
|
||||
[ -f "/opt/zapret2/config" ] && cp -f /opt/zapret2/config "/opt/zapret2/config.backup"
|
||||
#rm -rf /opt/zapret2
|
||||
#echo "Directory /opt/zapret2 removed!"
|
||||
|
||||
@@ -130,7 +130,7 @@ function restore_all_ipset_cfg
|
||||
restore_ipset_txt zapret-hosts-google.txt
|
||||
restore_ipset_txt zapret-hosts-user.txt
|
||||
restore_ipset_txt zapret-hosts-user-exclude.txt
|
||||
restore_ipset_txt zapret-ip-exclude.txt.txt
|
||||
restore_ipset_txt zapret-ip-exclude.txt
|
||||
}
|
||||
|
||||
function create_default_cfg
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
function set_cfg_reset_values
|
||||
{
|
||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||
local TAB="$( echo -n -e '\t' )"
|
||||
local TAB="$( printf '\t' )"
|
||||
uci batch <<-EOF
|
||||
set $cfgname.config.run_on_boot='0'
|
||||
# settings for zapret service
|
||||
@@ -52,7 +52,7 @@ function set_cfg_reset_values
|
||||
function clear_nfqws_strat
|
||||
{
|
||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||
local TAB="$( echo -n -e '\t' )"
|
||||
local TAB="$( printf '\t' )"
|
||||
uci batch <<-EOF
|
||||
set $cfgname.config.MODE_FILTER='hostlist'
|
||||
set $cfgname.config.NFQWS2_PORTS_TCP='80,443'
|
||||
@@ -66,7 +66,7 @@ function set_cfg_nfqws_strat
|
||||
{
|
||||
local strat=${1:--}
|
||||
local cfgname=${2:-$ZAPRET_CFG_NAME}
|
||||
local TAB="$( echo -n -e '\t' )"
|
||||
local TAB="$( printf '\t' )"
|
||||
|
||||
uci batch <<-EOF
|
||||
set $cfgname.config.MODE_FILTER='hostlist'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2026 remittor
|
||||
|
||||
. /opt/zapret/comfunc.sh
|
||||
. /opt/zapret2/comfunc.sh
|
||||
|
||||
ZAP_TMP_DIR=/tmp/zapret_dwc
|
||||
|
||||
@@ -81,7 +81,7 @@ while IFS='|' read -r TAG PROVIDER TIMES URL; do
|
||||
DST_IP="$( ping -c1 "$DOMAIN" 2>/dev/null | sed -n '1s/.*(\([0-9.]*\)).*/\1/p')"
|
||||
fi
|
||||
curl -k $URL --resolve $DOMAIN:443:$DST_IP -o /dev/null -s -w '%{size_download}\n' --max-time $CURL_TIMEOUT --range 0-$CURL_RANGETO
|
||||
) >"$ZAP_TMP_DIR/$ID3.$TAG.txt" 2>&1 &
|
||||
) >"$ZAP_TMP_DIR/$ID3=$TAG=$PROVIDER.txt" 2>&1 &
|
||||
done <<EOF
|
||||
$(printf '%s\n' "$TEST_SUITE" | sed -n '
|
||||
s/.*id:[[:space:]]*"\([^"]*\)".*provider:[[:space:]]*"\([^"]*\)".*times:[[:space:]]*\([0-9]\+\).*url:[[:space:]]*"\([^"]*\)".*/\1|\2|\3|\4/p
|
||||
@@ -90,11 +90,12 @@ EOF
|
||||
|
||||
wait
|
||||
|
||||
for file in $(ls "$ZAP_TMP_DIR"/*.txt | sort); do
|
||||
printf '%s\n' "$ZAP_TMP_DIR"/*.txt | sort | while IFS= read -r file; do
|
||||
[ -f "$file" ] || continue
|
||||
tag="${file##*/}"
|
||||
tag="${tag%.txt}"
|
||||
tag="${tag#*.}"
|
||||
FNAME="${file##*/}"
|
||||
ID=$( echo "$FNAME" | cut -d= -f1)
|
||||
TAG=$( echo "$FNAME" | cut -d= -f2)
|
||||
PROVIDER=$(echo "$FNAME" | cut -d= -f3 | sed 's/\.txt$//' )
|
||||
res=$( cat "$file" )
|
||||
res=$( trim "$res" )
|
||||
status=
|
||||
@@ -112,7 +113,7 @@ for file in $(ls "$ZAP_TMP_DIR"/*.txt | sort); do
|
||||
status="[ OK ]"
|
||||
fi
|
||||
fi
|
||||
printf '%12s: %s \n' "$tag" "$status"
|
||||
printf '%12s / %-13s: %s \n' "$TAG" "$PROVIDER" "$status"
|
||||
done
|
||||
|
||||
return 0
|
||||
|
||||
@@ -46,7 +46,7 @@ function sync_param
|
||||
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
||||
uncomment_param $param
|
||||
append_param $param
|
||||
local TAB="$( echo -n -e '\t' )"
|
||||
local TAB="$( printf '\t' )"
|
||||
if [ "$value" = "$TAB" ]; then
|
||||
value=""
|
||||
fi
|
||||
@@ -101,6 +101,7 @@ sync_param AUTOHOSTLIST_FAIL_TIME
|
||||
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
||||
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
||||
sync_param AUTOHOSTLIST_RETRANS_RESET
|
||||
sync_param AUTOHOSTLIST_UDP_IN
|
||||
sync_param AUTOHOSTLIST_UDP_OUT
|
||||
fi
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 remittor
|
||||
|
||||
[ ! -f /opt/zapret2/comfunc.sh ] && exit 0
|
||||
|
||||
. /opt/zapret2/comfunc.sh
|
||||
|
||||
mkdir -p $ZAPRET_BASE/ipset
|
||||
|
||||
# create empty txt files into ipset directory
|
||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-google.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-google.txt"
|
||||
#[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt"
|
||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-auto.txt"
|
||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user.txt"
|
||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-hosts-user-ipban.txt"
|
||||
#[ ! -f "$ZAPRET_BASE/ipset/zapret-ip.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip.txt"
|
||||
@@ -14,5 +18,6 @@
|
||||
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt"
|
||||
|
||||
# create or merge uci-config
|
||||
[ ! -f "$ZAPRET_BASE/renew-cfg.sh" ] && exit 0
|
||||
$ZAPRET_BASE/renew-cfg.sh
|
||||
|
||||
@@ -110,7 +110,7 @@ function pkg_mgr_update
|
||||
if [ "$PKG_MGR" = "opkg" ]; then
|
||||
PKG_TOTAL=$( opkg list | wc -l )
|
||||
PKG_INSTALLED=$( opkg list-installed | wc -l )
|
||||
if [ "$PKG_TOTAL" = "$PKG_INSTALLED" ]; then
|
||||
if [ "$PKG_TOTAL" -le "$PKG_INSTALLED" ] || [[ "$PKG_TOTAL" -le $((PKG_INSTALLED + 100)) ]]; then
|
||||
echo ">>> OPKG update..."
|
||||
opkg update
|
||||
return $?
|
||||
|
||||
Reference in New Issue
Block a user