feat: Добавлены веб-интерфейс управления и скрипт для генерации клиентских конфигураций VLESS из URL.
This commit is contained in:
@@ -19,58 +19,10 @@ if [[ ! -f "$TEMPLATE_FILE" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect if input is a subscription link (HTTP/HTTPS)
|
||||
if [[ "$URL_INPUT" =~ ^http ]]; then
|
||||
echo "Detecting subscription link..."
|
||||
|
||||
# Build URL with client parameter for APIs that require it
|
||||
SUB_URL="$URL_INPUT"
|
||||
|
||||
# Try fetching as-is first
|
||||
SUB_CONTENT=$(curl -sSL "$SUB_URL")
|
||||
|
||||
# If empty, try adding client parameter (some APIs require this)
|
||||
if [[ -z "$SUB_CONTENT" ]]; then
|
||||
echo "Empty response, trying with client=v2rayng parameter..."
|
||||
if [[ "$SUB_URL" == *"?"* ]]; then
|
||||
SUB_URL="${URL_INPUT}&client=v2rayng"
|
||||
else
|
||||
SUB_URL="${URL_INPUT}?client=v2rayng"
|
||||
fi
|
||||
SUB_CONTENT=$(curl -sSL "$SUB_URL")
|
||||
fi
|
||||
|
||||
if [[ -z "$SUB_CONTENT" ]]; then
|
||||
echo "Error: Failed to download subscription from $SUB_URL" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if base64 encoded (simple check: no spaces, looks like b64)
|
||||
# Trying to decode. If fails, assume it's plain text lists
|
||||
if DECODED=$(echo "$SUB_CONTENT" | base64 -d 2>/dev/null); then
|
||||
echo "Decoded base64 subscription."
|
||||
RAW_CONFIGS="$DECODED"
|
||||
else
|
||||
echo "Using plain text subscription."
|
||||
RAW_CONFIGS="$SUB_CONTENT"
|
||||
fi
|
||||
|
||||
# Find first vless reality link (vless://... + security=reality or just vless://)
|
||||
# We try to find one that explicitly has reality, if not, pick ANY vless
|
||||
TARGET_URL=$(echo "$RAW_CONFIGS" | grep -o 'vless://[^[:space:]]*' | grep 'security=reality' | head -n 1)
|
||||
|
||||
if [[ -z "$TARGET_URL" ]]; then
|
||||
echo "No VLESS Reality link found, trying any VLESS..."
|
||||
TARGET_URL=$(echo "$RAW_CONFIGS" | grep -o 'vless://[^[:space:]]*' | head -n 1)
|
||||
fi
|
||||
|
||||
if [[ -z "$TARGET_URL" ]]; then
|
||||
echo "Error: No VLESS URL found in subscription." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Selected URL from subscription: ${TARGET_URL:0:30}..."
|
||||
URL_INPUT="$TARGET_URL"
|
||||
# Check if input starts with vless://
|
||||
if [[ "$URL_INPUT" != vless://* ]]; then
|
||||
echo "Error: Only vless:// URLs are supported." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Strip scheme
|
||||
|
||||
Reference in New Issue
Block a user