mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-13 06:56:54 +03:00
@@ -27,6 +27,7 @@ main() {
|
||||
|
||||
[ -f /etc/config/dhcp-opkg ] && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp
|
||||
fi
|
||||
|
||||
openwrt_release=$(cat /etc/openwrt_release | grep -Eo [0-9]{2}[.][0-9]{2}[.][0-9]* | cut -d '.' -f 1 | tail -n 1)
|
||||
if [ $openwrt_release -ge 24 ]; then
|
||||
if uci get dhcp.@dnsmasq[0].confdir | grep -q /tmp/dnsmasq.d; then
|
||||
@@ -37,6 +38,7 @@ main() {
|
||||
uci commit dhcp
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "/etc/init.d/podkop" ]; then
|
||||
printf "\033[32;1mPodkop is already installed. Just upgrade it? (y/n)\033[0m\n"
|
||||
printf "\033[32;1my - Only upgrade podkop\033[0m\n"
|
||||
@@ -393,7 +395,8 @@ check_system() {
|
||||
|
||||
# Check available space
|
||||
AVAILABLE_SPACE=$(df /tmp | awk 'NR==2 {print $4}')
|
||||
REQUIRED_SPACE=20480 # 20MB in KB
|
||||
# Change after switch sing-box
|
||||
REQUIRED_SPACE=1024 # 20MB in KB
|
||||
|
||||
echo "Available space: $((AVAILABLE_SPACE/1024))MB"
|
||||
echo "Required space: $((REQUIRED_SPACE/1024))MB"
|
||||
|
||||
@@ -167,6 +167,32 @@ return view.extend({
|
||||
return true;
|
||||
};
|
||||
|
||||
o = s.taboption('basic', form.Flag, 'custom_local_domains_list_enabled', _('Local Domain Lists'), _('Use the list from the router filesystem'));
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
o.ucisection = 'main';
|
||||
|
||||
o = s.taboption('basic', form.DynamicList, 'custom_local_domains', _('Local Domain Lists Path'), _('Enter to the list file path'));
|
||||
o.placeholder = '/path/file.lst';
|
||||
o.depends('custom_local_domains_list_enabled', '1');
|
||||
o.rmempty = false;
|
||||
o.ucisection = 'main';
|
||||
o.validate = function (section_id, value) {
|
||||
if (!value || value.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
const pathRegex = /^\/[a-zA-Z0-9_\-\/\.]+$/;
|
||||
if (!pathRegex.test(value)) {
|
||||
throw new Error(_('Invalid path format. Path must start with "/" and contain only valid characters (letters, numbers, "-", "_", "/", ".")'));
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
return _('Invalid path format');
|
||||
}
|
||||
};
|
||||
|
||||
o = s.taboption('basic', form.Flag, 'custom_download_domains_list_enabled', _('Remote Domain Lists'), _('Download and use domain lists from remote URLs'));
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
"luci-app-podkop": {
|
||||
"description": "Grant UCI and RPC access to LuCI app podkop",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/init.d/podkop": [
|
||||
"exec"
|
||||
]
|
||||
},
|
||||
"ubus": {
|
||||
"luci.podkop": [
|
||||
"get_sample1",
|
||||
"get_sample2"
|
||||
"service": [
|
||||
"list"
|
||||
]
|
||||
},
|
||||
"uci": [
|
||||
@@ -18,4 +22,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
config main 'main'
|
||||
option mode ''
|
||||
option interface ''
|
||||
option proxy_config_type ''
|
||||
#option outbound_json ''
|
||||
option proxy_config_type ''
|
||||
#option outbound_json ''
|
||||
#option proxy_string ''
|
||||
option domain_list_enabled '1'
|
||||
option domain_list 'ru_inside'
|
||||
@@ -30,14 +30,14 @@ config main 'main'
|
||||
option socks5 '0'
|
||||
option exclude_ntp '0'
|
||||
option update_interval ''
|
||||
option custom_domains_text
|
||||
option custom_domains_text
|
||||
|
||||
config second 'second'
|
||||
option second_enable '0'
|
||||
option second_mode 'proxy'
|
||||
option second_interface ''
|
||||
option second_proxy_config_type ''
|
||||
#option second_outbound_json ''
|
||||
option second_proxy_config_type ''
|
||||
#option second_outbound_json ''
|
||||
#option second_proxy_string ''
|
||||
option second_domain_service_enabled '0'
|
||||
#list second_service_list 'youtube'
|
||||
|
||||
@@ -692,7 +692,7 @@ lists_domains_download() {
|
||||
|
||||
count=0
|
||||
while true; do
|
||||
if ping -c 1 -W 3 github.com >/dev/null 2>&1; then
|
||||
if curl -m 3 github.com; then
|
||||
wget -q -O /tmp/dnsmasq.d/podkop-domains.lst $URL
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i 's/fw4#vpn_domains/PodkopTable#podkop_domains/g' /tmp/dnsmasq.d/podkop-domains.lst
|
||||
@@ -783,6 +783,7 @@ list_subnets_download() {
|
||||
esac
|
||||
|
||||
local filename=$(basename "$URL")
|
||||
mkdir -p /tmp/podkop
|
||||
wget -q -O "/tmp/podkop/$filename" "$URL"
|
||||
while IFS= read -r subnet; do
|
||||
nft add element inet PodkopTable podkop_subnets { $subnet }
|
||||
@@ -816,6 +817,7 @@ list_custom_download_domains_create() {
|
||||
local config="/tmp/dnsmasq.d/${name}-${filename}.lst"
|
||||
|
||||
rm -f "$config"
|
||||
mkdir -p /tmp/podkop
|
||||
wget -q -O "/tmp/podkop/${filename}" "$URL"
|
||||
while IFS= read -r domain; do
|
||||
echo "nftset=/$domain/4#inet#PodkopTable#${name}_domains" >>$config
|
||||
@@ -1148,7 +1150,8 @@ check_proxy() {
|
||||
response=$(sing-box tools fetch ifconfig.me -D /etc/sing-box 2>/dev/null)
|
||||
if ! echo "$response" | grep -q "403 Forbidden"; then
|
||||
nolog "Proxy check completed successfully"
|
||||
echo "$response" | sed 's/\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)/XXX.\2.\3.\4/'
|
||||
#echo "$response" | sed 's/\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)/XXX.\2.\3.\4/'
|
||||
echo "$response" | sed -n 's/^[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)$/X.X.X.\1/p'
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
@@ -1188,7 +1191,7 @@ check_nft() {
|
||||
check_github() {
|
||||
nolog "Checking GitHub connectivity..."
|
||||
|
||||
if ! ping -c 1 -W 3 github.com >/dev/null 2>&1; then
|
||||
if ! curl -m 3 github.com; then
|
||||
nolog "Error: Cannot connect to GitHub"
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user