mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-31 23:00:42 +03:00
Compare commits
18 Commits
v72.202601
...
v72.202601
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c2f472b78 | ||
|
|
39c4fd6279 | ||
|
|
91ec462bcf | ||
|
|
015bf4befe | ||
|
|
75ccdb6a1b | ||
|
|
98c5d5b0ed | ||
|
|
cf7661f2b9 | ||
|
|
4327f98bb7 | ||
|
|
694716a512 | ||
|
|
be1027dfd7 | ||
|
|
0edcc6c4a0 | ||
|
|
a71965b382 | ||
|
|
d45d07df82 | ||
|
|
f4a68178b7 | ||
|
|
32c6f9cfc3 | ||
|
|
6660ea0a20 | ||
|
|
5f470e8f82 | ||
|
|
d6304e6e24 |
58
.github/workflows/releases.yml
vendored
58
.github/workflows/releases.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflows: ["build"]
|
workflows: ["build"]
|
||||||
types: [completed]
|
types: [completed]
|
||||||
release:
|
release:
|
||||||
types: [published, created, edited]
|
types: [published, unpublished, created, edited, deleted, prereleased]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -25,6 +25,62 @@ jobs:
|
|||||||
ref: gh-pages
|
ref: gh-pages
|
||||||
continue-on-error: true
|
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
|
- name: Save FULL releases.json
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -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.20260111
|
PKG_VERSION:=72.20260113
|
||||||
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>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
'require uci';
|
'require uci';
|
||||||
'require ui';
|
'require ui';
|
||||||
'require view';
|
'require view';
|
||||||
'require view.zapret2.tools as tools';
|
'require view.zapret.tools as tools';
|
||||||
|
|
||||||
const btn_style_neutral = 'btn';
|
const btn_style_neutral = 'btn';
|
||||||
const btn_style_action = 'btn cbi-button-action';
|
const btn_style_action = 'btn cbi-button-action';
|
||||||
@@ -53,7 +53,6 @@ return baseclass.extend({
|
|||||||
} else {
|
} else {
|
||||||
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
|
wnd.appendLog('ERROR: Process finished with retcode = ' + rc);
|
||||||
}
|
}
|
||||||
wnd.setStage(999);
|
|
||||||
wnd.appendLog('=========================================================');
|
wnd.appendLog('=========================================================');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ return view.extend({
|
|||||||
|
|
||||||
let btn_diag = create_btn('btn_diag', btn_style_action, _('Diagnostics'));
|
let btn_diag = create_btn('btn_diag', btn_style_action, _('Diagnostics'));
|
||||||
btn_diag.onclick = ui.createHandlerFn(this, () => { diagnost.openDiagnostDialog(this.pkg_arch) });
|
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'));
|
let btn_update = create_btn('btn_update', btn_style_action, _('Update'));
|
||||||
btn_update.onclick = ui.createHandlerFn(this, () => { updater.openUpdateDialog(this.pkg_arch) });
|
btn_update.onclick = ui.createHandlerFn(this, () => { updater.openUpdateDialog(this.pkg_arch) });
|
||||||
|
|||||||
137
zapret/Makefile
137
zapret/Makefile
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=zapret
|
PKG_NAME:=zapret
|
||||||
PKG_VERSION:=72.20260111
|
PKG_VERSION:=72.20260113
|
||||||
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:=a775aa7aaa4903a8c0870f9c16918e9d19d83772
|
PKG_SOURCE_VERSION:=75d2f1195d4beb69eaa614afb117a43e82998518
|
||||||
PKG_SOURCE_DATE:=2026-01-11
|
PKG_SOURCE_DATE:=2026-01-13
|
||||||
|
|
||||||
#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?
|
||||||
@@ -57,10 +57,17 @@ define Build/Compile
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/conffiles
|
define Package/$(PKG_NAME)/conffiles
|
||||||
/etc/config/zapret
|
|
||||||
/opt/zapret/config
|
/opt/zapret/config
|
||||||
/opt/zapret/ipset/
|
/opt/zapret/ipset/zapret-hosts-google.txt
|
||||||
/opt/zapret/init.d/openwrt/custom.d/
|
/opt/zapret/ipset/zapret-hosts-user.txt
|
||||||
|
/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
||||||
|
/opt/zapret/ipset/zapret-ip-exclude.txt
|
||||||
|
/opt/zapret/ipset/zapret-hosts-auto.txt
|
||||||
|
/opt/zapret/init.d/openwrt/custom.d/10-script.sh
|
||||||
|
/opt/zapret/init.d/openwrt/custom.d/20-script.sh
|
||||||
|
/opt/zapret/init.d/openwrt/custom.d/50-script.sh
|
||||||
|
/opt/zapret/init.d/openwrt/custom.d/60-script.sh
|
||||||
|
/opt/zapret/init.d/openwrt/custom.d/90-script.sh
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
define Package/$(PKG_NAME)/install
|
||||||
@@ -90,6 +97,7 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./init.d.sh $(1)/etc/init.d/zapret
|
$(INSTALL_BIN) ./init.d.sh $(1)/etc/init.d/zapret
|
||||||
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config.default
|
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config.default
|
||||||
|
$(INSTALL_DATA) ./config.default $(1)/opt/zapret/config
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-google.txt $(1)/opt/zapret/ipset/zapret-hosts-google.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-google.txt $(1)/opt/zapret/ipset/zapret-hosts-google.txt
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret/ipset/zapret-hosts-user.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-user.txt $(1)/opt/zapret/ipset/zapret-hosts-user.txt
|
||||||
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
$(INSTALL_DATA) ./ipset/zapret-hosts-user-exclude.txt $(1)/opt/zapret/ipset/zapret-hosts-user-exclude.txt
|
||||||
@@ -105,42 +113,96 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(CP) ./custom.d/* $(1)/opt/zapret/init.d/openwrt/custom.d/
|
$(CP) ./custom.d/* $(1)/opt/zapret/init.d/openwrt/custom.d/
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret-uci-def-cfg.sh
|
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/etc/uci-defaults/zapret-uci-def-cfg.sh
|
||||||
$(INSTALL_BIN) ./uci-def-cfg.sh $(1)/opt/zapret/uci-def-cfg.sh
|
# install all sh-scripts
|
||||||
$(INSTALL_BIN) ./comfunc.sh $(1)/opt/zapret/comfunc.sh
|
$(CP) ./*.sh $(1)/opt/zapret/
|
||||||
$(INSTALL_BIN) ./def-cfg.sh $(1)/opt/zapret/def-cfg.sh
|
rm -f $(1)/opt/zapret/init.d.sh
|
||||||
$(INSTALL_BIN) ./renew-cfg.sh $(1)/opt/zapret/renew-cfg.sh
|
# Create empty conf files
|
||||||
$(INSTALL_BIN) ./restore-def-cfg.sh $(1)/opt/zapret/restore-def-cfg.sh
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/zapret-hosts-auto.txt
|
||||||
$(INSTALL_BIN) ./sync_config.sh $(1)/opt/zapret/sync_config.sh
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust1.txt
|
||||||
$(INSTALL_BIN) ./script-exec.sh $(1)/opt/zapret/script-exec.sh
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust2.txt
|
||||||
$(INSTALL_BIN) ./update-pkg.sh $(1)/opt/zapret/update-pkg.sh
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust3.txt
|
||||||
# Fix permisions
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/ipset/cust4.txt
|
||||||
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/10-script.sh
|
||||||
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/20-script.sh
|
||||||
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/60-script.sh
|
||||||
|
$(INSTALL_DATA) /dev/null $(1)/opt/zapret/init.d/openwrt/custom.d/90-script.sh
|
||||||
|
# Fix permissions
|
||||||
chmod 644 $(1)/opt/zapret/ipset/*.txt
|
chmod 644 $(1)/opt/zapret/ipset/*.txt
|
||||||
chmod 644 $(1)/opt/zapret/ipset_def/*.txt
|
chmod 644 $(1)/opt/zapret/ipset_def/*.txt
|
||||||
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
chmod 644 $(1)/opt/zapret/init.d/openwrt/custom.d/*.sh
|
||||||
chmod 644 $(1)/opt/zapret/config.default
|
chmod 644 $(1)/opt/zapret/config*
|
||||||
chmod 755 $(1)/opt/zapret/*.sh
|
chmod 755 $(1)/opt/zapret/*.sh
|
||||||
chmod 755 $(1)/opt/zapret/$(MAKE_PATH)/*
|
chmod 755 $(1)/opt/zapret/$(MAKE_PATH)/*
|
||||||
chmod 755 $(1)/opt/zapret/ip2net/*
|
chmod 755 $(1)/opt/zapret/ip2net/*
|
||||||
chmod 755 $(1)/opt/zapret/mdig/*
|
chmod 755 $(1)/opt/zapret/mdig/*
|
||||||
|
# Disable TPWS in blockcheck
|
||||||
|
grep -q '^SKIP_TPWS=' $(1)/opt/zapret/blockcheck.sh || sed -i '/^NFT_TABLE=blockcheck$$$$/a SKIP_TPWS=$$$${SKIP_TPWS:-1}' $(1)/opt/zapret/blockcheck.sh
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/preinst
|
define Package/$(PKG_NAME)/preinst
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
if [ -f "/etc/init.d/zapret" ]; then
|
ZAPRET_DIR=/opt/zapret
|
||||||
SCRIPT=$$( readlink /etc/init.d/zapret )
|
ZAPRET_INITD=/etc/init.d/zapret
|
||||||
|
ZAPRET_CFG=/etc/config/zapret
|
||||||
|
if [ -f "$${ZAPRET_INITD}" ]; then
|
||||||
|
SCRIPT=$$( readlink "$${ZAPRET_INITD}" )
|
||||||
if [ -n "$${SCRIPT}" ]; then
|
if [ -n "$${SCRIPT}" ]; then
|
||||||
echo "Please uninstall original zapret utility!"
|
echo "Please uninstall incompatible \"zapret\" service!"
|
||||||
exit 44
|
exit 44
|
||||||
fi
|
fi
|
||||||
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
|
if [ "$${PKG_UPGRADE}" = "1" ]; then
|
||||||
# stop service if PKG_UPGRADE
|
# stop service if PKG_UPGRADE
|
||||||
if [ -x "/etc/init.d/zapret" ]; then
|
if [ -x "$${ZAPRET_INITD}" ]; then
|
||||||
/etc/init.d/zapret running && /etc/init.d/zapret stop >/dev/null 2>&1
|
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if $${PKG_CHECK} zapret >/dev/null 2>&1; then
|
||||||
|
if [ ! -f "/opt/zapret/sync_config.sh" ]; then
|
||||||
|
echo "Please uninstall incompatible \"zapret\" package!"
|
||||||
|
exit 47
|
||||||
|
fi
|
||||||
|
if [ -f "$${ZAPRET_CFG}" ] && ! grep -q "run_on_boot" "$${ZAPRET_CFG}"; then
|
||||||
|
echo "Please uninstall incompatible \"zapret\" package!"
|
||||||
|
exit 48
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if $${PKG_CHECK} luci-app-zapret >/dev/null 2>&1; then
|
||||||
|
SVC_FILE=/www/luci-static/resources/view/zapret/service.js
|
||||||
|
if [ ! -f "$${SVC_FILE}" ] || ! grep -Fq "/remittor/zapret-openwrt" "$${SVC_FILE}"; then
|
||||||
|
echo "Please uninstall incompatible \"luci-app-zapret\" 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} zapret-mdig >/dev/null 2>&1; then
|
||||||
|
$${PKG_REMOVE} zapret-mdig
|
||||||
|
fi
|
||||||
|
if $${PKG_CHECK} zapret-ip2net >/dev/null 2>&1; then
|
||||||
|
$${PKG_REMOVE} zapret-ip2net
|
||||||
|
fi
|
||||||
|
if [ ! -d "$${ZAPRET_DIR}" ]; then
|
||||||
|
mkdir -p $${ZAPRET_DIR}
|
||||||
|
fi
|
||||||
if [ ! -f "/opt/zapret/ipset/zapret-hosts-google.txt" ]; then
|
if [ ! -f "/opt/zapret/ipset/zapret-hosts-google.txt" ]; then
|
||||||
if [ -f "/opt/zapret/ipset/zapret-hosts-user.txt" ]; then
|
if [ -f "/opt/zapret/ipset/zapret-hosts-user.txt" ]; then
|
||||||
CFGLISTHASH=$$( md5sum "/opt/zapret/ipset/zapret-hosts-user.txt" | awk '{print $$1;}' )
|
CFGLISTHASH=$$( md5sum "/opt/zapret/ipset/zapret-hosts-user.txt" | awk '{print $$1;}' )
|
||||||
@@ -157,8 +219,17 @@ define Package/$(PKG_NAME)/postinst
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
|
ZAPRET_DIR=/opt/zapret
|
||||||
|
ZAPRET_INITD=/etc/init.d/zapret
|
||||||
|
ZAPRET_CFG=/etc/config/zapret
|
||||||
ZAPRET_CONFIG=/opt/zapret/config
|
ZAPRET_CONFIG=/opt/zapret/config
|
||||||
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
ZAPRET_CONFIG_DEF="/opt/zapret/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
|
# 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}"
|
||||||
@@ -171,8 +242,10 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
echo "Current file $${ZAPRET_CONFIG} backuped to $${ZAPRET_CONFIG_BACKUP}"
|
echo "Current file $${ZAPRET_CONFIG} backuped to $${ZAPRET_CONFIG_BACKUP}"
|
||||||
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
fi
|
fi
|
||||||
|
# remove fake uci-config
|
||||||
|
[ -f "$${ZAPRET_CFG}" ] && [ ! -s "$${ZAPRET_CFG}" ] && rm -f "$${ZAPRET_CFG}"
|
||||||
# check existing uci-config
|
# check existing uci-config
|
||||||
[ -f "/etc/config/zapret" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
[ -f "$${ZAPRET_CFG}" ] && ZAPRET_CFG_EXISTS=1 || ZAPRET_CFG_EXISTS=0
|
||||||
# create or merge uci-config
|
# create or merge uci-config
|
||||||
/opt/zapret/uci-def-cfg.sh
|
/opt/zapret/uci-def-cfg.sh
|
||||||
[ "$${ZAPRET_CFG_EXISTS}" = "1" ] && echo "Config /etc/config/zapret merged with default uci-config"
|
[ "$${ZAPRET_CFG_EXISTS}" = "1" ] && echo "Config /etc/config/zapret merged with default uci-config"
|
||||||
@@ -184,13 +257,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 || cp -f "$${ZAPRET_CONFIG_DEF}" "$${ZAPRET_CONFIG}"
|
||||||
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || exit 58
|
sh -n "$${ZAPRET_CONFIG}" 2>/dev/null || exit 58
|
||||||
# enable main service
|
# enable main service
|
||||||
/etc/init.d/zapret enable
|
$${ZAPRET_INITD} enable
|
||||||
# stop all
|
# stop all
|
||||||
/etc/init.d/zapret stop_fw
|
$${ZAPRET_INITD} stop_fw >/dev/null 2>&1
|
||||||
/etc/init.d/zapret stop_daemons
|
$${ZAPRET_INITD} stop_daemons >/dev/null 2>&1
|
||||||
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||||
# start main service
|
# start main service
|
||||||
/etc/init.d/zapret start
|
$${ZAPRET_INITD} start
|
||||||
# restart firewall
|
# restart firewall
|
||||||
[ -x /sbin/fw4 ] && fw4 -q restart || fw3 -q restart
|
[ -x /sbin/fw4 ] && fw4 -q restart || fw3 -q restart
|
||||||
fi
|
fi
|
||||||
@@ -201,8 +274,10 @@ define Package/$(PKG_NAME)/prerm
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
EXEDIR=/opt/zapret
|
ZAPRET_DIR=/opt/zapret
|
||||||
ZAPRET_BASE=/opt/zapret
|
ZAPRET_BASE=/opt/zapret
|
||||||
|
ZAPRET_INITD=/etc/init.d/zapret
|
||||||
|
ZAPRET_CFG=/etc/config/zapret
|
||||||
ZAPRET_CONFIG=/opt/zapret/config
|
ZAPRET_CONFIG=/opt/zapret/config
|
||||||
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
ZAPRET_CONFIG_DEF="/opt/zapret/config.default"
|
||||||
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
OPENWRT_FW_INCLUDE=/etc/firewall.zapret
|
||||||
@@ -217,8 +292,8 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
|||||||
. "$${ZAPRET_BASE}/common/fwtype.sh"
|
. "$${ZAPRET_BASE}/common/fwtype.sh"
|
||||||
. "$${ZAPRET_BASE}/common/nft.sh"
|
. "$${ZAPRET_BASE}/common/nft.sh"
|
||||||
. "$${ZAPRET_BASE}/common/installer.sh"
|
. "$${ZAPRET_BASE}/common/installer.sh"
|
||||||
/etc/init.d/zapret running && /etc/init.d/zapret stop
|
$${ZAPRET_INITD} running && $${ZAPRET_INITD} stop >/dev/null 2>&1
|
||||||
/etc/init.d/zapret disable
|
$${ZAPRET_INITD} disable >/dev/null 2>&1
|
||||||
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
ps w | grep '/opt/zapret/nfq/nfqws' | grep -v grep | awk '{print $$1}' | xargs -r kill -9
|
||||||
remove_openwrt_firewall
|
remove_openwrt_firewall
|
||||||
nft_del_table
|
nft_del_table
|
||||||
@@ -231,7 +306,9 @@ define Package/$(PKG_NAME)/postrm
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# check if we are on real system
|
# check if we are on real system
|
||||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||||
[ -f "/etc/config/zapret-opkg" ] && rm -f "/etc/config/zapret-opkg"
|
rm -f /etc/config/zapret-opkg*
|
||||||
|
rm -f /etc/config/zapret.opkg*
|
||||||
|
rm -f /etc/config/zapret.apk*
|
||||||
[ -f "/opt/zapret/config" ] && cp -f /opt/zapret/config "/opt/zapret/config.backup"
|
[ -f "/opt/zapret/config" ] && cp -f /opt/zapret/config "/opt/zapret/config.backup"
|
||||||
#rm -rf /opt/zapret
|
#rm -rf /opt/zapret
|
||||||
#echo "Directory /opt/zapret removed!"
|
#echo "Directory /opt/zapret removed!"
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ function restore_all_ipset_cfg
|
|||||||
restore_ipset_txt zapret-hosts-google.txt
|
restore_ipset_txt zapret-hosts-google.txt
|
||||||
restore_ipset_txt zapret-hosts-user.txt
|
restore_ipset_txt zapret-hosts-user.txt
|
||||||
restore_ipset_txt zapret-hosts-user-exclude.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
|
function create_default_cfg
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
function set_cfg_reset_values
|
function set_cfg_reset_values
|
||||||
{
|
{
|
||||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( echo -n -e '\t' )"
|
local TAB="$( printf '\t' )"
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.run_on_boot='0'
|
set $cfgname.config.run_on_boot='0'
|
||||||
# settings for zapret service
|
# settings for zapret service
|
||||||
@@ -47,7 +47,7 @@ function set_cfg_reset_values
|
|||||||
function clear_nfqws_strat
|
function clear_nfqws_strat
|
||||||
{
|
{
|
||||||
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
local cfgname=${1:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( echo -n -e '\t' )"
|
local TAB="$( printf '\t' )"
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.MODE_FILTER='hostlist'
|
set $cfgname.config.MODE_FILTER='hostlist'
|
||||||
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
set $cfgname.config.NFQWS_PORTS_TCP='80,443'
|
||||||
@@ -61,7 +61,7 @@ function set_cfg_nfqws_strat
|
|||||||
{
|
{
|
||||||
local strat=${1:--}
|
local strat=${1:--}
|
||||||
local cfgname=${2:-$ZAPRET_CFG_NAME}
|
local cfgname=${2:-$ZAPRET_CFG_NAME}
|
||||||
local TAB="$( echo -n -e '\t' )"
|
local TAB="$( printf '\t' )"
|
||||||
|
|
||||||
uci batch <<-EOF
|
uci batch <<-EOF
|
||||||
set $cfgname.config.MODE_FILTER='hostlist'
|
set $cfgname.config.MODE_FILTER='hostlist'
|
||||||
|
|||||||
@@ -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')"
|
DST_IP="$( ping -c1 "$DOMAIN" 2>/dev/null | sed -n '1s/.*(\([0-9.]*\)).*/\1/p')"
|
||||||
fi
|
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
|
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
|
done <<EOF
|
||||||
$(printf '%s\n' "$TEST_SUITE" | sed -n '
|
$(printf '%s\n' "$TEST_SUITE" | sed -n '
|
||||||
s/.*id:[[:space:]]*"\([^"]*\)".*provider:[[:space:]]*"\([^"]*\)".*times:[[:space:]]*\([0-9]\+\).*url:[[:space:]]*"\([^"]*\)".*/\1|\2|\3|\4/p
|
s/.*id:[[:space:]]*"\([^"]*\)".*provider:[[:space:]]*"\([^"]*\)".*times:[[:space:]]*\([0-9]\+\).*url:[[:space:]]*"\([^"]*\)".*/\1|\2|\3|\4/p
|
||||||
@@ -90,11 +90,12 @@ EOF
|
|||||||
|
|
||||||
wait
|
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
|
[ -f "$file" ] || continue
|
||||||
tag="${file##*/}"
|
FNAME="${file##*/}"
|
||||||
tag="${tag%.txt}"
|
ID=$( echo "$FNAME" | cut -d= -f1)
|
||||||
tag="${tag#*.}"
|
TAG=$( echo "$FNAME" | cut -d= -f2)
|
||||||
|
PROVIDER=$(echo "$FNAME" | cut -d= -f3 | sed 's/\.txt$//' )
|
||||||
res=$( cat "$file" )
|
res=$( cat "$file" )
|
||||||
res=$( trim "$res" )
|
res=$( trim "$res" )
|
||||||
status=
|
status=
|
||||||
@@ -112,7 +113,7 @@ for file in $(ls "$ZAP_TMP_DIR"/*.txt | sort); do
|
|||||||
status="[ OK ]"
|
status="[ OK ]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
printf '%12s: %s \n' "$tag" "$status"
|
printf '%12s / %-13s: %s \n' "$TAG" "$PROVIDER" "$status"
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ gosuslugi.ru
|
|||||||
mos-gorsud.ru
|
mos-gorsud.ru
|
||||||
gov.ru
|
gov.ru
|
||||||
sudrf.ru
|
sudrf.ru
|
||||||
|
ottai.com
|
||||||
ipstream.one
|
ipstream.one
|
||||||
#################################### Epicgames
|
#################################### Epicgames
|
||||||
easy.ac
|
easy.ac
|
||||||
@@ -253,4 +254,109 @@ vod-secure.twitch.tv
|
|||||||
irc-ws.chat.twitch.tv
|
irc-ws.chat.twitch.tv
|
||||||
pubsub-edge.twitch.tv
|
pubsub-edge.twitch.tv
|
||||||
vod-pop-secure.twitch.tv
|
vod-pop-secure.twitch.tv
|
||||||
|
#################################### Valorant
|
||||||
|
pvp.net
|
||||||
|
vivox.com
|
||||||
|
sd-rtn.com
|
||||||
|
riotcdn.net
|
||||||
|
adobess.com
|
||||||
|
valorant.com
|
||||||
|
akamaihd.net
|
||||||
|
riotgames.com
|
||||||
|
playvalorant.com
|
||||||
|
#################################### TikTok
|
||||||
|
musical.ly
|
||||||
|
tiktok.com
|
||||||
|
tiktokv.eu
|
||||||
|
tiktokv.us
|
||||||
|
tiktokw.eu
|
||||||
|
tiktokw.us
|
||||||
|
muscdn.com
|
||||||
|
tiktokd.net
|
||||||
|
tiktokd.org
|
||||||
|
tiktokv.com
|
||||||
|
tiktokcdn.com
|
||||||
|
ibytedtos.com
|
||||||
|
ttwstatic.com
|
||||||
|
tik-tokapi.com
|
||||||
|
tiktok-row.net
|
||||||
|
tiktokminis.us
|
||||||
|
byteoversea.com
|
||||||
|
tiktok-minis.com
|
||||||
|
tiktokcdn-eu.com
|
||||||
|
tiktokcdn-us.com
|
||||||
|
tiktokeu-cdn.com
|
||||||
|
tiktokrow-cdn.com
|
||||||
|
tiktokglobalshopv.com
|
||||||
|
tiktokcdn.com.akamaized.net
|
||||||
|
tiktokcdn.com.edgesuite.net
|
||||||
|
tiktokcdn-us.com.edgesuite.net
|
||||||
|
#################################### Hoyoverse
|
||||||
|
hoyo.link
|
||||||
|
hoyolab.com
|
||||||
|
yuanshen.com
|
||||||
|
hoyoverse.com
|
||||||
|
genshinimpact.com
|
||||||
|
zenlesszonezero.com
|
||||||
|
#################################### Xiaomi
|
||||||
|
mi.com
|
||||||
|
miui.com
|
||||||
|
wali.com
|
||||||
|
c.mi.com
|
||||||
|
mgslb.com
|
||||||
|
mifile.cn
|
||||||
|
xiaomi.cn
|
||||||
|
mipay.com
|
||||||
|
youpin.cn
|
||||||
|
zmifi.com
|
||||||
|
mi-idc.com
|
||||||
|
mi-img.com
|
||||||
|
mijia.tech
|
||||||
|
mitvos.com
|
||||||
|
miwifi.com
|
||||||
|
xiaomi.com
|
||||||
|
xiaomi.net
|
||||||
|
duokan.com
|
||||||
|
saxyit.com
|
||||||
|
mi-fan.com
|
||||||
|
mihome.com
|
||||||
|
xiaomisa.cn
|
||||||
|
migames.com
|
||||||
|
miaibox.com
|
||||||
|
mi-home.com
|
||||||
|
xiaomicp.com
|
||||||
|
xiaomidns.cn
|
||||||
|
xiaomiev.com
|
||||||
|
xiaomiinc.cn
|
||||||
|
xiaominr.com
|
||||||
|
xiaomisa.com
|
||||||
|
xiaomisa.net
|
||||||
|
xiaomisa.org
|
||||||
|
roborock.com
|
||||||
|
mi-robot.com
|
||||||
|
yeelight.com
|
||||||
|
miot-spec.cn
|
||||||
|
xiaomidns.com
|
||||||
|
xiaomidns.net
|
||||||
|
xiaomiinc.com
|
||||||
|
xiaomiinc.net
|
||||||
|
duokanbox.com
|
||||||
|
youpin.com.cn
|
||||||
|
miot-spec.org
|
||||||
|
miot-spec.com
|
||||||
|
xiaomiwear.com
|
||||||
|
xiaomimimo.com
|
||||||
|
dreamehome.com
|
||||||
|
xiaomiprint.com
|
||||||
|
xiaomidns.com.cn
|
||||||
|
xiaomiinc.com.cn
|
||||||
|
xiaomimobile.com
|
||||||
|
xiaomixiaoai.com
|
||||||
|
xiaomiyoupin.com
|
||||||
|
xiaoaiassist.com
|
||||||
|
xiaomi-mijia.com
|
||||||
|
xiaomifactory.com
|
||||||
|
airstarfinance.net
|
||||||
|
dreame-technology.cn
|
||||||
|
dreame-technology.com
|
||||||
####################################
|
####################################
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function sync_param
|
|||||||
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
local value="$( uci -q get $ZAPRET_CFG_SEC.$param )"
|
||||||
uncomment_param $param
|
uncomment_param $param
|
||||||
append_param $param
|
append_param $param
|
||||||
local TAB="$( echo -n -e '\t' )"
|
local TAB="$( printf '\t' )"
|
||||||
if [ "$value" = "$TAB" ]; then
|
if [ "$value" = "$TAB" ]; then
|
||||||
value=""
|
value=""
|
||||||
fi
|
fi
|
||||||
@@ -101,6 +101,7 @@ sync_param AUTOHOSTLIST_FAIL_TIME
|
|||||||
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
if [ $ZAPRET_CFG_NAME = "zapret2" ]; then
|
||||||
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
sync_param AUTOHOSTLIST_INCOMING_MAXSEQ
|
||||||
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
sync_param AUTOHOSTLIST_RETRANS_MAXSEQ
|
||||||
|
sync_param AUTOHOSTLIST_RETRANS_RESET
|
||||||
sync_param AUTOHOSTLIST_UDP_IN
|
sync_param AUTOHOSTLIST_UDP_IN
|
||||||
sync_param AUTOHOSTLIST_UDP_OUT
|
sync_param AUTOHOSTLIST_UDP_OUT
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (c) 2024 remittor
|
# Copyright (c) 2024 remittor
|
||||||
|
|
||||||
|
[ ! -f /opt/zapret/comfunc.sh ] && exit 0
|
||||||
|
|
||||||
. /opt/zapret/comfunc.sh
|
. /opt/zapret/comfunc.sh
|
||||||
|
|
||||||
|
mkdir -p $ZAPRET_BASE/ipset
|
||||||
|
|
||||||
# create empty txt files into ipset directory
|
# 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-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.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-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"
|
#[ ! -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"
|
[ ! -f "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt" ] && touch "$ZAPRET_BASE/ipset/zapret-ip-user-ipban.txt"
|
||||||
|
|
||||||
# create or merge uci-config
|
# create or merge uci-config
|
||||||
|
[ ! -f "$ZAPRET_BASE/renew-cfg.sh" ] && exit 0
|
||||||
$ZAPRET_BASE/renew-cfg.sh
|
$ZAPRET_BASE/renew-cfg.sh
|
||||||
|
|
||||||
Reference in New Issue
Block a user