Skip to content

Commit 0ac7858

Browse files
committed
fix: 修复Hits徽章访问量统计,使用 https://github.com/oneclickvirt/hitscounter
1 parent d3aae53 commit 0ac7858

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 更新日志
22

3+
2024.11.17
4+
5+
- 增加自启动任务,确保容器在意外重启的情况下依然能自启动SSH进程
6+
37
2024.06.05
48

59
- 更新SSH设置规则,适配Ubuntu24

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# docker
22

3-
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FspiritLHLS%2Fdocker&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
3+
[![Hits](https://hits.spiritlhl.net/docker.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false)](https://hits.spiritlhl.net)
44

55
## 更新
66

7-
2024.11.17
7+
2025.03.29
88

9-
- 增加自启动任务,确保容器在意外重启的情况下依然能自启动SSH进程
9+
- 修复Hits徽章访问量统计,使用 https://github.com/oneclickvirt/hitscounter
1010

1111
[更新日志](CHANGELOG.md)
1212

scripts/dockerinstall.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,11 @@ rebuild_cloud_init() {
7575
fi
7676
}
7777

78-
statistics_of_run-times() {
79-
COUNT=$(
80-
curl -4 -ksm1 "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FspiritLHLS%2Fdocker&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=&edge_flat=true" 2>&1 ||
81-
curl -6 -ksm1 "https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FspiritLHLS%2Fdocker&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=&edge_flat=true" 2>&1
82-
) &&
83-
TODAY=$(expr "$COUNT" : '.*\s\([0-9]\{1,\}\)\s/.*') && TOTAL=$(expr "$COUNT" : '.*/\s\([0-9]\{1,\}\)\s.*')
78+
statistics_of_run_times() {
79+
COUNT=$(curl -4 -ksm1 "https://hits.spiritlhl.net/docker?action=hit&title=Hits&title_bg=%23555555&count_bg=%2324dde1&edge_flat=false" 2>/dev/null ||
80+
curl -6 -ksm1 "https://hits.spiritlhl.net/docker?action=hit&title=Hits&title_bg=%23555555&count_bg=%2324dde1&edge_flat=false" 2>/dev/null)
81+
TODAY=$(echo "$COUNT" | grep -oP '"daily":\s*[0-9]+' | sed 's/"daily":\s*\([0-9]*\)/\1/')
82+
TOTAL=$(echo "$COUNT" | grep -oP '"total":\s*[0-9]+' | sed 's/"total":\s*\([0-9]*\)/\1/')
8483
}
8584

8685
check_update() {
@@ -321,7 +320,7 @@ if [ ! -d /usr/local/bin ]; then
321320
mkdir -p /usr/local/bin
322321
fi
323322
rebuild_cloud_init
324-
statistics_of_run-times
323+
statistics_of_run_times
325324
_green "脚本当天运行次数:${TODAY},累计运行次数:${TOTAL}"
326325
check_update
327326
if ! command -v sudo >/dev/null 2>&1; then

0 commit comments

Comments
 (0)