@yorha2b-lab/autodev 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,86 +1,89 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Bunker Native Stats & Intelligence
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
schedule:
|
|
5
|
-
- cron: '45 19 * * *'
|
|
5
|
+
- cron: '45 19 * * *' # 北京时间凌晨 03:45 自动巡航
|
|
6
6
|
workflow_dispatch:
|
|
7
7
|
|
|
8
8
|
env:
|
|
9
9
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
|
-
|
|
12
|
+
recon-and-ledger:
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
permissions:
|
|
15
15
|
contents: write
|
|
16
16
|
steps:
|
|
17
|
-
- name: Checkout
|
|
17
|
+
- name: Checkout Data Branch
|
|
18
18
|
uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: run-ghrs
|
|
21
|
-
uses: jgehrcke/github-repo-stats@v1.4.1
|
|
22
19
|
with:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
ref: github-repo-stats
|
|
21
|
+
token: ${{ secrets.STATS_TOKEN }}
|
|
22
|
+
fetch-depth: 0
|
|
26
23
|
|
|
27
|
-
- name:
|
|
24
|
+
- name: Intelligence Gathering & Sovereign Merge
|
|
28
25
|
run: |
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if [ -d "$DATA_DIR" ]; then sudo cp -r $DATA_DIR /tmp/bunker_assets/; fi
|
|
36
|
-
if [ -d "$REPORT_DIR" ]; then sudo cp -r $REPORT_DIR /tmp/bunker_assets/; fi
|
|
37
|
-
if [ -d "$PLOT_DIR" ]; then sudo cp -r $PLOT_DIR /tmp/bunker_assets/; fi
|
|
26
|
+
echo "🤖 Pod 042: 启动‘全频道情报采集协议 [坐标修正版]’..."
|
|
27
|
+
|
|
28
|
+
# A. [情报收集]:修正 API 路径,加入 /popular/ 层级
|
|
29
|
+
curl -s -H "Authorization: token ${{ secrets.STATS_TOKEN }}" \
|
|
30
|
+
-H "Accept: application/vnd.github.v3+json" \
|
|
31
|
+
https://api.github.com/repos/${{ github.repository }}/traffic/clones > raw_clones.json
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
sudo chown -R runner:docker .
|
|
43
|
-
git rm -rf . 2>/dev/null || true
|
|
44
|
-
sudo rm -rf *
|
|
33
|
+
curl -s -H "Authorization: token ${{ secrets.STATS_TOKEN }}" \
|
|
34
|
+
-H "Accept: application/vnd.github.v3+json" \
|
|
35
|
+
https://api.github.com/repos/${{ github.repository }}/traffic/popular/referrers > raw_referrers.json
|
|
45
36
|
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if [ -f "report.md" ]; then sudo mv report.md README.md; fi
|
|
37
|
+
# B. [格式处理]
|
|
38
|
+
mkdir -p ghrs-data
|
|
39
|
+
echo "date,clones,uniques" > /tmp/new_data.csv
|
|
40
|
+
jq -r '.clones[] | "\(.timestamp[0:10]),\(.count),\(.uniques)"' raw_clones.json >> /tmp/new_data.csv
|
|
51
41
|
|
|
52
|
-
#
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
# C. [物理焊接]
|
|
43
|
+
LEDGER="ghrs-data/clones_ledger.csv"
|
|
44
|
+
if [ ! -f "$LEDGER" ]; then
|
|
45
|
+
cp /tmp/new_data.csv "$LEDGER"
|
|
46
|
+
else
|
|
47
|
+
echo "📡 执行物理序列重组..."
|
|
48
|
+
(head -n 1 "$LEDGER"; tail -n +2 "$LEDGER"; tail -n +2 /tmp/new_data.csv) | \
|
|
49
|
+
sed 's/\//-/g' | \
|
|
50
|
+
awk -F',' 'NR>1 {
|
|
51
|
+
split($1, a, "-");
|
|
52
|
+
if(length(a[2])==1) a[2]="0"a[2];
|
|
53
|
+
if(length(a[3])==1) a[3]="0"a[3];
|
|
54
|
+
printf "%s-%s-%s,%s,%s\n", a[1], a[2], a[3], $2, $3
|
|
55
|
+
}' | awk -F',' '!a[$1]++' | sort -r > /tmp/final_ledger.csv
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
echo "date,clones,uniques" > "$LEDGER"
|
|
58
|
+
cat /tmp/final_ledger.csv >> "$LEDGER"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# D. [战绩结算]
|
|
62
|
+
TOTAL_CLONES=$(awk -F',' 'NR>1 {sum+=$2} END {print sum}' "$LEDGER")
|
|
63
|
+
echo "{\"total_clones\": $TOTAL_CLONES}" > bunker-stats.json
|
|
64
|
+
|
|
65
|
+
# E. [报表装修]
|
|
66
|
+
echo "# 🛰️ 地堡运行报告 (Sovereign Report)" > README.md
|
|
67
|
+
echo "### 📊 累计物理克隆总数: **$TOTAL_CLONES**" >> README.md
|
|
68
|
+
echo "数据已根据 AGPL-3.0 协议物理封存。愿人类荣光永存。" >> README.md
|
|
69
|
+
echo "" >> README.md
|
|
70
|
+
echo "#### 📡 流量来源实时追踪 (Top Referrers)" >> README.md
|
|
71
|
+
echo "| 来源站点 | 总访问量 | 独立指挥官 |" >> README.md
|
|
72
|
+
echo "| :--- | :--- | :--- |" >> README.md
|
|
73
|
+
# 增加判定,防止 referrers 为空时 jq 报错
|
|
74
|
+
if [ -s raw_referrers.json ]; then
|
|
75
|
+
jq -r '.[] | "| \(.referrer) | \(.count) | \(.uniques) |"' raw_referrers.json >> README.md
|
|
75
76
|
else
|
|
76
|
-
echo "
|
|
77
|
-
exit 1
|
|
77
|
+
echo "| 暂无外部来源信号 | - | - |" >> README.md
|
|
78
78
|
fi
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
echo "" >> README.md
|
|
80
|
+
echo "> 📡 信号状态:全频道在线 | 数据物理封存点: $(date +'%Y-%m-%d %H:%M:%S') CST" >> README.md
|
|
81
|
+
|
|
82
|
+
- name: Sync Ledger to Cloud
|
|
83
|
+
run: |
|
|
82
84
|
git config user.name github-actions
|
|
83
85
|
git config user.email github-actions@github.com
|
|
84
86
|
git add -A
|
|
85
|
-
|
|
87
|
+
TOTAL=$(grep -oE "[0-9]+" bunker-stats.json | head -n 1)
|
|
88
|
+
git commit -m "chore: intelligence update - total $TOTAL" || echo "no changes"
|
|
86
89
|
git push origin github-repo-stats --force
|
package/example/example.json
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"key": "mage"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
+
"staticInfo": {
|
|
21
|
+
"has": false,
|
|
22
|
+
"text": ""
|
|
23
|
+
},
|
|
20
24
|
"table": {
|
|
21
25
|
"pagination": true,
|
|
22
26
|
"expandable": true,
|
|
23
27
|
"rowSelection": true,
|
|
24
|
-
"staticInfo": {
|
|
25
|
-
"has": false,
|
|
26
|
-
"text": ""
|
|
27
|
-
},
|
|
28
28
|
"operation": [
|
|
29
29
|
{
|
|
30
30
|
"label": "查看",
|
package/package.json
CHANGED
|
@@ -47,6 +47,12 @@ const expandedRowRender = record => (<div>自定义渲染</div>)
|
|
|
47
47
|
{{/if}}
|
|
48
48
|
|
|
49
49
|
const modalSubmit = async values => {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let response
|
|
51
|
+
if(modal.type==='add'){
|
|
52
|
+
response = await request('/api')
|
|
53
|
+
}
|
|
54
|
+
if({{{responseSuccess}}}){
|
|
55
|
+
setModal({ visible: false })
|
|
56
|
+
refresh()
|
|
57
|
+
}
|
|
52
58
|
}
|
|
@@ -70,6 +70,59 @@ export const exportDataToExcel = async (url, options, columns, fileName, formatt
|
|
|
70
70
|
} */
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export const streamDownload = async ({ url, options, headers = {} }, fileName = '下载') => {
|
|
74
|
+
|
|
75
|
+
const response = await fetch(url, { ...options, headers })
|
|
76
|
+
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
console.error(response.statusText)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const blob = await response.blob()
|
|
83
|
+
|
|
84
|
+
if (!blob.size) {
|
|
85
|
+
console.error('文件为空')
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const slice = blob.slice(0, 10)
|
|
90
|
+
const text = (await slice.text()).trim()
|
|
91
|
+
|
|
92
|
+
if (text.startsWith('{') || text.startsWith('[')) {
|
|
93
|
+
try {
|
|
94
|
+
const fullText = await blob.text()
|
|
95
|
+
const json = JSON.parse(fullText)
|
|
96
|
+
console.error(json?.msg ?? '系统异常')
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error(error)
|
|
99
|
+
}
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const disposition = response.headers.get('content-disposition')
|
|
104
|
+
let name = fileName
|
|
105
|
+
|
|
106
|
+
if (disposition) {
|
|
107
|
+
const match = disposition.match(/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/)
|
|
108
|
+
if (match) {
|
|
109
|
+
name = decodeURIComponent(match[1] || match[2])
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const link = document.createElement('a')
|
|
114
|
+
const urlObj = URL.createObjectURL(blob)
|
|
115
|
+
|
|
116
|
+
link.href = urlObj
|
|
117
|
+
link.download = name
|
|
118
|
+
|
|
119
|
+
document.body.appendChild(link)
|
|
120
|
+
link.click()
|
|
121
|
+
link.remove()
|
|
122
|
+
|
|
123
|
+
setTimeout(() => URL.revokeObjectURL(urlObj), 1000)
|
|
124
|
+
}
|
|
125
|
+
|
|
73
126
|
export const moneyRender = (value, { decimals = 2, currency = 'CNY', language = 'zh-CN', showSymbol = true } = {}) => {
|
|
74
127
|
if (value === null || value === undefined || value === '') return '-'
|
|
75
128
|
const number = Number(value)
|