mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-15 03:25:42 +08:00
Use Firebase realtime database + Netlify cloud function to replace hits.seeyoufarm.com for usage statistics.
This commit is contained in:
@@ -610,7 +610,7 @@ wget -N https://gitlab.com/fscarmen/warp/-/raw/main/api.sh && bash api.sh [optio
|
||||
|
||||
## WARP Teams 获取并用于 Linux 的方法
|
||||
|
||||
* https://token.warpapi.us.kg/ , 通过 fscarmen 的网站
|
||||
* https://warp-token.cloudflare.now.cc/ , 通过 fscarmen 的网站
|
||||
|
||||
* https://web--public--warp-team-api--coia-mfs4.code.run/, 通过 Coia 的网站
|
||||
|
||||
@@ -665,7 +665,7 @@ https://github.com/acacia233/Project-WARP-Unlock
|
||||
|
||||
服务提供(排名不分先后):
|
||||
* fscarmen 的 Warp API: https://warp.cloudflare.now.cc/
|
||||
* fscarmen 的 Zero Trust Token API: https://token.warpapi.us.kg/
|
||||
* fscarmen 的 Zero Trust Token API: https://warp-token.cloudflare.now.cc/
|
||||
* CloudFlare Warp(+): https://1.1.1.1/
|
||||
* WGCF 项目原作者: https://github.com/ViRb3/wgcf/
|
||||
* Coia 和 warp-go 团队: https://gitlab.com/ProjectWARP/warp-go
|
||||
|
||||
@@ -423,9 +423,14 @@ check_cdn() {
|
||||
|
||||
# 脚本当天及累计运行次数统计
|
||||
statistics_of_run-times() {
|
||||
local COUNT=$(curl --retry 2 -ksm2 "https://hit.forvps.gq/https://cdn.jsdelivr.net/gh/fscarmen/warp/menu.sh" 2>&1 | grep -m1 -oE "[0-9]+[ ]+/[ ]+[0-9]+") &&
|
||||
TODAY=$(awk -F ' ' '{print $1}' <<< "$COUNT") &&
|
||||
TOTAL=$(awk -F ' ' '{print $3}' <<< "$COUNT")
|
||||
local UPDATE_OR_GET=$1
|
||||
local SCRIPT=$2
|
||||
if grep -q 'update' <<< "$UPDATE_OR_GET"; then
|
||||
{ wget -qO- --timeout=3 "https://stat-api.netlify.app/updateStats?script=${SCRIPT}" > /tmp/statistics; }&
|
||||
elif grep -q 'get' <<< "$UPDATE_OR_GET"; then
|
||||
[ -s /tmp/statistics ] && [[ $(cat /tmp/statistics) =~ \"todayCount\":([0-9]+),\"totalCount\":([0-9]+) ]] && local TODAY="${BASH_REMATCH[1]}" && local TOTAL="${BASH_REMATCH[2]}" && rm -f /tmp/statistics
|
||||
info " $(text 41) "
|
||||
fi
|
||||
}
|
||||
|
||||
# 选择语言,先判断 /etc/wireguard/language 里的语言选择,没有的话再让用户选择,默认英语。处理中文显示的问题
|
||||
@@ -2394,7 +2399,8 @@ EOF
|
||||
echo -e "\n==============================================================\n"
|
||||
info " IPv4: $WAN4 $COUNTRY4 $ASNORG4 "
|
||||
info " IPv6: $WAN6 $COUNTRY6 $ASNORG6 "
|
||||
info " $(text 41) " && [ -n "$QUOTA" ] && info " $(text 133) "
|
||||
statistics_of_run-times get
|
||||
[ -n "$QUOTA" ] && info " $(text 133) "
|
||||
info " $PRIORITY_NOW , $(text 186) "
|
||||
echo -e "\n==============================================================\n"
|
||||
hint " $(text 43) \n" && help
|
||||
@@ -3248,7 +3254,7 @@ NAME=$3
|
||||
# 主程序运行 1/3
|
||||
|
||||
check_cdn
|
||||
statistics_of_run-times
|
||||
statistics_of_run-times update menu.sh
|
||||
select_language
|
||||
check_operating_system
|
||||
|
||||
|
||||
+11
-4
@@ -259,9 +259,13 @@ check_cdn() {
|
||||
|
||||
# 脚本当天及累计运行次数统计
|
||||
statistics_of_run-times() {
|
||||
local COUNT=$(curl --retry 2 -ksm2 "https://hit.forvps.gq/https://raw.githubusercontent.com/fscarmen/warp/main/warp-go.sh" 2>&1 | grep -m1 -oE "[0-9]+[ ]+/[ ]+[0-9]+") &&
|
||||
TODAY=$(cut -d " " -f1 <<< "$COUNT") &&
|
||||
TOTAL=$(cut -d " " -f3 <<< "$COUNT")
|
||||
local UPDATE_OR_GET=$1
|
||||
local SCRIPT=$2
|
||||
if grep -q 'update' <<< "$UPDATE_OR_GET"; then
|
||||
{ wget -qO- --timeout=3 "https://stat-api.netlify.app/updateStats?script=${SCRIPT}" > /tmp/statistics; }&
|
||||
elif grep -q 'get' <<< "$UPDATE_OR_GET"; then
|
||||
[ -s /tmp/statistics ] && [[ $(cat /tmp/statistics) =~ \"todayCount\":([0-9]+),\"totalCount\":([0-9]+) ]] && TODAY="${BASH_REMATCH[1]}" && TOTAL="${BASH_REMATCH[2]}" && rm -f /tmp/statistics
|
||||
fi
|
||||
}
|
||||
|
||||
# 选择语言,先判断 /opt/warp-go/language 里的语言选择,没有的话再让用户选择,默认英语。处理中文显示的问题
|
||||
@@ -1494,6 +1498,9 @@ EOF
|
||||
[ "$ACCOUNT_TYPE" = 'plus' ] && check_quota
|
||||
result_priority
|
||||
|
||||
# 获取运行次数
|
||||
statistics_of_run-times get
|
||||
|
||||
echo -e "\n==============================================================\n"
|
||||
info " IPv4: $WAN4 $COUNTRY4 $ASNORG4 "
|
||||
info " IPv6: $WAN6 $COUNTRY6 $ASNORG6 "
|
||||
@@ -1627,7 +1634,7 @@ NAME="$3"
|
||||
|
||||
# 主程序运行 1/3
|
||||
check_cdn
|
||||
statistics_of_run-times
|
||||
statistics_of_run-times update warp-go.sh
|
||||
select_language
|
||||
check_operating_system
|
||||
check_arch
|
||||
|
||||
Reference in New Issue
Block a user