Skip to content

Commit a37636a

Browse files
feat: out-of-box login (plaintext admin/admin in generated config); conclusion line follows selected window
- first-run config ships web_user/web_password enabled; edit to change, empty string disables, or use --localhost to delegate auth to a reverse proxy - bottom conclusion line now computes P99/loss/bursts from the selected TIME/DIV window (1h/6h/24h) instead of always 24h; {win} placeholder localized across 15 languages
1 parent 9fc5a7c commit a37636a

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ const demoConfig = `{
2222
// targets/*.list 探测目标(一行一个,重启生效)
2323
// webhooks.jsonc 推送渠道
2424
// alerts.jsonc 告警阈值
25-
"listen": "0.0.0.0:8517"
25+
"listen": "0.0.0.0:8517",
2626
27-
// Web 登录:去掉下面两行的注释即启用(或运行 ./pingping --localhost 交给反代认证)
28-
//,"web_user": "admin"
29-
//,"web_password": "change-me"
27+
// Web 登录(明文,改成自己的;password 留空 "" = 关闭登录;
28+
// 或 ./pingping --localhost 只绑本机,认证交给 Caddy/Nginx 反代)
29+
"web_user": "admin",
30+
"web_password": "admin"
3031
}
3132
`
3233

static/i18n.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const I18N = {
77
push: '推送实时报告', pushed: '报告已推送至全部 webhook',
88
lossLbl: '丢包 %', burstLbl: '突发·窗口内', filterAll: '全部',
99
legend: '亮线 = 每轮中位数 · 烟雾 = 全部样本 · 红柱 = 丢包% · ◆ = 突发',
10-
concOK: '🟢 {name}:近 24h P99 {p99} ms · 丢包 {loss}% · 突发 {bursts} 次',
10+
concOK: '🟢 {name}:近 {win} P99 {p99} ms · 丢包 {loss}% · 突发 {bursts} 次',
1111
concAlert: '🔴 {name}:{kind} —— 处理中',
1212
thType: '类型', thName: '名称', thHost: '地址', thInterval: '间隔',
1313
thPace: '节奏', thSens: '敏感度', thStatus: '状态',
@@ -24,7 +24,7 @@ const I18N = {
2424
push: '推送即時報告', pushed: '報告已推送至全部 webhook',
2525
lossLbl: '丟包 %', burstLbl: '突發·視窗內', filterAll: '全部',
2626
legend: '亮線 = 每輪中位數 · 煙霧 = 全部樣本 · 紅柱 = 丟包% · ◆ = 突發',
27-
concOK: '🟢 {name}:近 24h P99 {p99} ms · 丟包 {loss}% · 突發 {bursts} 次',
27+
concOK: '🟢 {name}:近 {win} P99 {p99} ms · 丟包 {loss}% · 突發 {bursts} 次',
2828
concAlert: '🔴 {name}:{kind} —— 處理中',
2929
thType: '類型', thName: '名稱', thHost: '位址', thInterval: '間隔',
3030
thPace: '節奏', thSens: '敏感度', thStatus: '狀態',
@@ -41,7 +41,7 @@ const I18N = {
4141
push: 'Push live report', pushed: 'Report pushed to all webhooks',
4242
lossLbl: 'Loss %', burstLbl: 'Bursts · window', filterAll: 'All',
4343
legend: 'Line = per-round median · Smoke = all samples · Red bars = loss% · ◆ = burst',
44-
concOK: '🟢 {name}: 24h P99 {p99} ms · loss {loss}% · {bursts} bursts',
44+
concOK: '🟢 {name}: {win} P99 {p99} ms · loss {loss}% · {bursts} bursts',
4545
concAlert: '🔴 {name}: {kind} — active',
4646
thType: 'Type', thName: 'Name', thHost: 'Address', thInterval: 'Interval',
4747
thPace: 'Pace', thSens: 'Sensitivity', thStatus: 'Status',
@@ -58,7 +58,7 @@ const I18N = {
5858
push: 'レポートを送信', pushed: '全 webhook に送信しました',
5959
lossLbl: '損失 %', burstLbl: 'バースト·期間内', filterAll: 'すべて',
6060
legend: '輝線 = 各ラウンド中央値 · 煙 = 全サンプル · 赤棒 = 損失% · ◆ = バースト',
61-
concOK: '🟢 {name}:24h P99 {p99} ms · 損失 {loss}% · バースト {bursts} 回',
61+
concOK: '🟢 {name}:{win} P99 {p99} ms · 損失 {loss}% · バースト {bursts} 回',
6262
concAlert: '🔴 {name}:{kind} —— 対応中',
6363
thType: '種別', thName: '名称', thHost: 'アドレス', thInterval: '間隔',
6464
thPace: 'ペース', thSens: '感度', thStatus: '状態',
@@ -75,7 +75,7 @@ const I18N = {
7575
push: '실시간 보고서 전송', pushed: '모든 webhook에 전송됨',
7676
lossLbl: '손실 %', burstLbl: '버스트·기간 내', filterAll: '전체',
7777
legend: '밝은 선 = 라운드 중앙값 · 연기 = 전체 샘플 · 빨간 막대 = 손실% · ◆ = 버스트',
78-
concOK: '🟢 {name}: 24h P99 {p99} ms · 손실 {loss}% · 버스트 {bursts}회',
78+
concOK: '🟢 {name}: {win} P99 {p99} ms · 손실 {loss}% · 버스트 {bursts}회',
7979
concAlert: '🔴 {name}: {kind} — 대응 중',
8080
thType: '유형', thName: '이름', thHost: '주소', thInterval: '간격',
8181
thPace: '페이스', thSens: '민감도', thStatus: '상태',
@@ -92,7 +92,7 @@ const I18N = {
9292
push: 'Bericht senden', pushed: 'Bericht an alle Webhooks gesendet',
9393
lossLbl: 'Verlust %', burstLbl: 'Bursts · Fenster', filterAll: 'Alle',
9494
legend: 'Linie = Median je Runde · Rauch = alle Messwerte · Rote Balken = Verlust% · ◆ = Burst',
95-
concOK: '🟢 {name}: 24h P99 {p99} ms · Verlust {loss}% · {bursts} Bursts',
95+
concOK: '🟢 {name}: {win} P99 {p99} ms · Verlust {loss}% · {bursts} Bursts',
9696
concAlert: '🔴 {name}: {kind} — aktiv',
9797
thType: 'Typ', thName: 'Name', thHost: 'Adresse', thInterval: 'Intervall',
9898
thPace: 'Takt', thSens: 'Empfindlichkeit', thStatus: 'Status',
@@ -109,7 +109,7 @@ const I18N = {
109109
push: 'Envoyer le rapport', pushed: 'Rapport envoyé à tous les webhooks',
110110
lossLbl: 'Perte %', burstLbl: 'Rafales · fenêtre', filterAll: 'Tous',
111111
legend: 'Ligne = médiane par tour · Fumée = tous les échantillons · Barres rouges = perte% · ◆ = rafale',
112-
concOK: '🟢 {name} : P99 24h {p99} ms · perte {loss}% · {bursts} rafales',
112+
concOK: '🟢 {name} : P99 {win} {p99} ms · perte {loss}% · {bursts} rafales',
113113
concAlert: '🔴 {name} : {kind} — en cours',
114114
thType: 'Type', thName: 'Nom', thHost: 'Adresse', thInterval: 'Intervalle',
115115
thPace: 'Cadence', thSens: 'Sensibilité', thStatus: 'État',
@@ -126,7 +126,7 @@ const I18N = {
126126
push: 'Enviar informe', pushed: 'Informe enviado a todos los webhooks',
127127
lossLbl: 'Pérdida %', burstLbl: 'Ráfagas · ventana', filterAll: 'Todos',
128128
legend: 'Línea = mediana por ronda · Humo = todas las muestras · Barras rojas = pérdida% · ◆ = ráfaga',
129-
concOK: '🟢 {name}: P99 24h {p99} ms · pérdida {loss}% · {bursts} ráfagas',
129+
concOK: '🟢 {name}: P99 {win} {p99} ms · pérdida {loss}% · {bursts} ráfagas',
130130
concAlert: '🔴 {name}: {kind} — activo',
131131
thType: 'Tipo', thName: 'Nombre', thHost: 'Dirección', thInterval: 'Intervalo',
132132
thPace: 'Ritmo', thSens: 'Sensibilidad', thStatus: 'Estado',
@@ -143,7 +143,7 @@ const I18N = {
143143
push: 'Enviar relatório', pushed: 'Relatório enviado a todos os webhooks',
144144
lossLbl: 'Perda %', burstLbl: 'Rajadas · janela', filterAll: 'Todos',
145145
legend: 'Linha = mediana por rodada · Fumaça = todas as amostras · Barras vermelhas = perda% · ◆ = rajada',
146-
concOK: '🟢 {name}: P99 24h {p99} ms · perda {loss}% · {bursts} rajadas',
146+
concOK: '🟢 {name}: P99 {win} {p99} ms · perda {loss}% · {bursts} rajadas',
147147
concAlert: '🔴 {name}: {kind} — ativo',
148148
thType: 'Tipo', thName: 'Nome', thHost: 'Endereço', thInterval: 'Intervalo',
149149
thPace: 'Ritmo', thSens: 'Sensibilidade', thStatus: 'Estado',
@@ -160,7 +160,7 @@ const I18N = {
160160
push: 'Invia rapporto', pushed: 'Rapporto inviato a tutti i webhook',
161161
lossLbl: 'Perdita %', burstLbl: 'Raffiche · finestra', filterAll: 'Tutti',
162162
legend: 'Linea = mediana per giro · Fumo = tutti i campioni · Barre rosse = perdita% · ◆ = raffica',
163-
concOK: '🟢 {name}: P99 24h {p99} ms · perdita {loss}% · {bursts} raffiche',
163+
concOK: '🟢 {name}: P99 {win} {p99} ms · perdita {loss}% · {bursts} raffiche',
164164
concAlert: '🔴 {name}: {kind} — attivo',
165165
thType: 'Tipo', thName: 'Nome', thHost: 'Indirizzo', thInterval: 'Intervallo',
166166
thPace: 'Ritmo', thSens: 'Sensibilità', thStatus: 'Stato',
@@ -177,7 +177,7 @@ const I18N = {
177177
push: 'Отправить отчёт', pushed: 'Отчёт отправлен на все webhook',
178178
lossLbl: 'Потери %', burstLbl: 'Всплески · окно', filterAll: 'Все',
179179
legend: 'Линия = медиана раунда · Дым = все замеры · Красные столбцы = потери% · ◆ = всплеск',
180-
concOK: '🟢 {name}: P99 за 24ч {p99} мс · потери {loss}% · всплесков {bursts}',
180+
concOK: '🟢 {name}: P99 за {win} {p99} мс · потери {loss}% · всплесков {bursts}',
181181
concAlert: '🔴 {name}: {kind} — активно',
182182
thType: 'Тип', thName: 'Имя', thHost: 'Адрес', thInterval: 'Интервал',
183183
thPace: 'Темп', thSens: 'Чувствительность', thStatus: 'Статус',
@@ -194,7 +194,7 @@ const I18N = {
194194
push: 'ส่งรายงานสด', pushed: 'ส่งรายงานไปยัง webhook ทั้งหมดแล้ว',
195195
lossLbl: 'สูญหาย %', burstLbl: 'เบิร์สต์·ในหน้าต่าง', filterAll: 'ทั้งหมด',
196196
legend: 'เส้นสว่าง = ค่ามัธยฐานต่อรอบ · ควัน = ตัวอย่างทั้งหมด · แท่งแดง = สูญหาย% · ◆ = เบิร์สต์',
197-
concOK: '🟢 {name}: P99 24ชม. {p99} ms · สูญหาย {loss}% · เบิร์สต์ {bursts} ครั้ง',
197+
concOK: '🟢 {name}: P99 {win} {p99} ms · สูญหาย {loss}% · เบิร์สต์ {bursts} ครั้ง',
198198
concAlert: '🔴 {name}: {kind} — กำลังเกิด',
199199
thType: 'ชนิด', thName: 'ชื่อ', thHost: 'ที่อยู่', thInterval: 'ช่วงเวลา',
200200
thPace: 'จังหวะ', thSens: 'ความไว', thStatus: 'สถานะ',
@@ -211,7 +211,7 @@ const I18N = {
211211
push: 'Kirim laporan', pushed: 'Laporan terkirim ke semua webhook',
212212
lossLbl: 'Loss %', burstLbl: 'Burst · jendela', filterAll: 'Semua',
213213
legend: 'Garis = median per putaran · Asap = semua sampel · Batang merah = loss% · ◆ = burst',
214-
concOK: '🟢 {name}: P99 24j {p99} ms · loss {loss}% · {bursts} burst',
214+
concOK: '🟢 {name}: P99 {win} {p99} ms · loss {loss}% · {bursts} burst',
215215
concAlert: '🔴 {name}: {kind} — aktif',
216216
thType: 'Tipe', thName: 'Nama', thHost: 'Alamat', thInterval: 'Interval',
217217
thPace: 'Tempo', thSens: 'Sensitivitas', thStatus: 'Status',
@@ -228,7 +228,7 @@ const I18N = {
228228
push: 'Gửi báo cáo', pushed: 'Đã gửi báo cáo tới tất cả webhook',
229229
lossLbl: 'Mất gói %', burstLbl: 'Bùng phát · cửa sổ', filterAll: 'Tất cả',
230230
legend: 'Đường sáng = trung vị mỗi vòng · Khói = toàn bộ mẫu · Cột đỏ = mất gói% · ◆ = bùng phát',
231-
concOK: '🟢 {name}: P99 24h {p99} ms · mất gói {loss}% · {bursts} lần bùng phát',
231+
concOK: '🟢 {name}: P99 {win} {p99} ms · mất gói {loss}% · {bursts} lần bùng phát',
232232
concAlert: '🔴 {name}: {kind} — đang xảy ra',
233233
thType: 'Loại', thName: 'Tên', thHost: 'Địa chỉ', thInterval: 'Chu kỳ',
234234
thPace: 'Nhịp', thSens: 'Độ nhạy', thStatus: 'Trạng thái',
@@ -245,7 +245,7 @@ const I18N = {
245245
push: 'إرسال التقرير', pushed: 'تم إرسال التقرير إلى جميع الـ webhook',
246246
lossLbl: 'الفقد %', burstLbl: 'اندفاعات · النافذة', filterAll: 'الكل',
247247
legend: 'الخط = الوسيط لكل جولة · الدخان = كل العينات · الأعمدة الحمراء = الفقد% · ◆ = اندفاع',
248-
concOK: '🟢 {name}: P99 خلال 24س {p99} ms · فقد {loss}% · {bursts} اندفاعات',
248+
concOK: '🟢 {name}: P99 خلال {win} {p99} ms · فقد {loss}% · {bursts} اندفاعات',
249249
concAlert: '🔴 {name}: {kind} — جارٍ',
250250
thType: 'النوع', thName: 'الاسم', thHost: 'العنوان', thInterval: 'الفاصل',
251251
thPace: 'الإيقاع', thSens: 'الحساسية', thStatus: 'الحالة',

static/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@
219219
$('bursts').className = 'v' + (bursts ? ' bad' : '');
220220
$('conclusion').textContent = t.status.alert
221221
? T('concAlert', { name: t.name, kind: T('kind_' + t.status.kind) })
222-
: T('concOK', { name: t.name, p99: t.last_24h.p99.toFixed(1),
223-
loss: t.last_24h.loss_pct.toFixed(2), bursts: t.last_24h.bursts });
222+
: T('concOK', { name: t.name, win: minutes === 60 ? '1h' : minutes === 360 ? '6h' : '24h',
223+
p99: (pool.length ? q(.99) : 0).toFixed(1), loss: lossPct.toFixed(2), bursts: bursts });
224224
const phos = getComputedStyle(document.documentElement).getPropertyValue('--phos').trim();
225225
chart.setOption({
226226
animation: false,

0 commit comments

Comments
 (0)