Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5928784ba9 | |||
|
|
0a5229f4f6 | ||
|
|
5ecb6ef997 | ||
|
|
340c2b3505 | ||
|
|
515c0be38b | ||
|
|
59c59bcb17 |
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
REPO="https://api.github.com/repos/itdoginfo/podkop/releases/latest"
|
REPO="https://git.encrypt-t.ru/yanistye/podkop/releases/latest"
|
||||||
DOWNLOAD_DIR="/tmp/podkop"
|
DOWNLOAD_DIR="/tmp/podkop"
|
||||||
COUNT=3
|
COUNT=3
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v curl &> /dev/null; then
|
if command -v curl &> /dev/null; then
|
||||||
check_response=$(curl -s "https://api.github.com/repos/itdoginfo/podkop/releases/latest")
|
check_response=$(curl -s "https://git.encrypt-t.ru/yanistye/podkop/releases/latest")
|
||||||
|
|
||||||
if echo "$check_response" | grep -q 'API rate limit '; then
|
if echo "$check_response" | grep -q 'API rate limit '; then
|
||||||
msg "You've reached rate limit from GitHub. Repeat in five minutes."
|
msg "You've reached rate limit from GitHub. Repeat in five minutes."
|
||||||
|
|||||||
@@ -240,14 +240,8 @@ migration() {
|
|||||||
validate_service() {
|
validate_service() {
|
||||||
local service="$1"
|
local service="$1"
|
||||||
|
|
||||||
for domain_service in $COMMUNITY_DOMAIN_SERVICES; do
|
for community_service in $COMMUNITY_SERVICES; do
|
||||||
if [ "$service" = "$domain_service" ]; then
|
if [ "$service" = "$community_service" ]; then
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for subnet_service in $COMMUNITY_SUBNET_SERVICES; do
|
|
||||||
if [ "$service" = "$subnet_service" ]; then
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -977,13 +971,7 @@ configure_community_list_handler() {
|
|||||||
|
|
||||||
config=$(sing_box_cm_add_remote_ruleset "$config" "$ruleset_tag" "$format" "$url" "$detour" "$update_interval")
|
config=$(sing_box_cm_add_remote_ruleset "$config" "$ruleset_tag" "$format" "$url" "$detour" "$update_interval")
|
||||||
config=$(sing_box_cm_patch_route_rule "$config" "$route_rule_tag" "rule_set" "$ruleset_tag")
|
config=$(sing_box_cm_patch_route_rule "$config" "$route_rule_tag" "rule_set" "$ruleset_tag")
|
||||||
|
|
||||||
for service in $COMMUNITY_DOMAIN_SERVICES; do
|
|
||||||
if [ "$tag" = "$service" ]; then
|
|
||||||
_add_ruleset_to_dns_rules "$ruleset_tag"
|
_add_ruleset_to_dns_rules "$ruleset_tag"
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_user_domain_or_subnets_list() {
|
configure_user_domain_or_subnets_list() {
|
||||||
|
|||||||
@@ -63,5 +63,4 @@ SUBNETS_HETZNER="${GITHUB_RAW_URL}/Subnets/IPv4/hetzner.lst"
|
|||||||
SUBNETS_OVH="${GITHUB_RAW_URL}/Subnets/IPv4/ovh.lst"
|
SUBNETS_OVH="${GITHUB_RAW_URL}/Subnets/IPv4/ovh.lst"
|
||||||
SUBNETS_DIGITALOCEAN="${GITHUB_RAW_URL}/Subnets/IPv4/digitalocean.lst"
|
SUBNETS_DIGITALOCEAN="${GITHUB_RAW_URL}/Subnets/IPv4/digitalocean.lst"
|
||||||
SUBNETS_CLOUDFRONT="${GITHUB_RAW_URL}/Subnets/IPv4/cloudfront.lst"
|
SUBNETS_CLOUDFRONT="${GITHUB_RAW_URL}/Subnets/IPv4/cloudfront.lst"
|
||||||
COMMUNITY_DOMAIN_SERVICES="russia_inside russia_outside ukraine_inside geoblock block porn news anime youtube hdrezka tiktok google_ai google_play hodca"
|
COMMUNITY_SERVICES="russia_inside russia_outside ukraine_inside geoblock block porn news anime youtube hdrezka tiktok google_ai google_play hodca discord meta twitter cloudflare cloudfront digitalocean hetzner ovh telegram"
|
||||||
COMMUNITY_SUBNET_SERVICES="discord meta twitter cloudflare cloudfront digitalocean hetzner ovh telegram"
|
|
||||||
@@ -40,6 +40,14 @@ is_base64() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks if the given string looks like a Shadowsocks userinfo
|
||||||
|
is_shadowsocks_userinfo_format() {
|
||||||
|
local str="$1"
|
||||||
|
local regex='^[^:]+:[^:]+(:[^:]+)?$'
|
||||||
|
|
||||||
|
[[ "$str" =~ $regex ]]
|
||||||
|
}
|
||||||
|
|
||||||
# Checks if the given file exists
|
# Checks if the given file exists
|
||||||
file_exists() {
|
file_exists() {
|
||||||
local filepath="$1"
|
local filepath="$1"
|
||||||
@@ -176,6 +184,13 @@ url_get_file_extension() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove url fragment (everything after the first '#')
|
||||||
|
url_strip_fragment() {
|
||||||
|
local url="$1"
|
||||||
|
|
||||||
|
echo "${url%%#*}"
|
||||||
|
}
|
||||||
|
|
||||||
# Decodes and returns a base64-encoded string
|
# Decodes and returns a base64-encoded string
|
||||||
base64_decode() {
|
base64_decode() {
|
||||||
local str="$1"
|
local str="$1"
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ sing_box_cf_add_proxy_outbound() {
|
|||||||
local udp_over_tcp="$4"
|
local udp_over_tcp="$4"
|
||||||
|
|
||||||
url=$(url_decode "$url")
|
url=$(url_decode "$url")
|
||||||
|
url=$(url_strip_fragment "$url")
|
||||||
|
|
||||||
local scheme="${url%%://*}"
|
local scheme="${url%%://*}"
|
||||||
case "$scheme" in
|
case "$scheme" in
|
||||||
@@ -131,8 +132,12 @@ sing_box_cf_add_proxy_outbound() {
|
|||||||
local userinfo tag host port method password udp_over_tcp
|
local userinfo tag host port method password udp_over_tcp
|
||||||
|
|
||||||
userinfo=$(url_get_userinfo "$url")
|
userinfo=$(url_get_userinfo "$url")
|
||||||
if is_base64 "$userinfo"; then
|
if ! is_shadowsocks_userinfo_format "$userinfo"; then
|
||||||
userinfo=$(base64_decode "$userinfo")
|
userinfo=$(base64_decode "$userinfo")
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Cannot decode shadowsocks userinfo or it does not match the expected format. Aborted." "fatal"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tag=$(get_outbound_tag_by_section "$section")
|
tag=$(get_outbound_tag_by_section "$section")
|
||||||
|
|||||||
Reference in New Issue
Block a user