-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcurrent_deployed.html
More file actions
479 lines (456 loc) · 22.5 KB
/
current_deployed.html
File metadata and controls
479 lines (456 loc) · 22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Google SSR Actions - 订阅聚合</title>
<link rel="stylesheet" href="styles.css" />
<script>
const AUTH_HASH = "37092303178fc51f57a52ea39e166a4954ec86c075de3a9df7a221c9ef7e0891";
const AUTH_USER = "liebesu";
async function sha256(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}
function showAuth() {
const mask = document.getElementById('auth-mask');
const userInput = document.getElementById('auth-user');
const passInput = document.getElementById('auth-input');
const err = document.getElementById('auth-err');
const btn = document.getElementById('auth-btn');
mask.style.display = 'flex';
userInput.focus();
async function submit() {
const user = userInput.value.trim();
const pwd = passInput.value || '';
const h = await sha256(pwd);
const userRequired = (AUTH_USER || '').trim().length > 0;
const userOk = userRequired ? (user === (AUTH_USER||'').trim()) : true;
if (userOk && h.toLowerCase() === AUTH_HASH.toLowerCase()) {
console.log('🎉 认证成功!');
try{
localStorage.setItem('gauth', h);
localStorage.setItem('guser', user);
console.log('✅ 认证信息已保存到localStorage');
}catch(e){
console.error('保存认证信息失败:', e);
}
mask.style.display = 'none';
document.documentElement.style.display = '';
console.log('✅ 页面已显示,开始加载内容...');
// 手动触发页面内容加载
setTimeout(() => {
try {
if (typeof loadMeta === 'function') loadMeta();
if (typeof loadDailyChart === 'function') loadDailyChart();
if (typeof loadSparklines === 'function') loadSparklines();
if (typeof loadSerpAPIKeys === 'function') loadSerpAPIKeys();
console.log('✅ 所有内容加载函数已触发');
} catch(e) {
console.error('内容加载出错:', e);
}
}, 100);
} else {
console.log('❌ 认证失败');
err.textContent = '用户名或密码错误,请重试';
}
}
btn.addEventListener('click', submit);
passInput.addEventListener('keydown', (e)=>{ if(e.key==='Enter'){ submit(); }});
}
function gate() {
console.log('🔐 认证检查开始...');
console.log('AUTH_HASH:', AUTH_HASH ? '已设置' : '未设置');
console.log('AUTH_USER:', AUTH_USER ? '已设置' : '未设置');
if (!AUTH_HASH || AUTH_HASH.trim() === '') {
console.log('✅ 无需认证,直接显示页面');
document.documentElement.style.display = '';
return;
}
try{
const tk = localStorage.getItem('gauth');
const gu = (localStorage.getItem('guser') || '').trim();
const userRequired = (AUTH_USER || '').trim().length > 0;
const passOk = !!tk && (tk.toLowerCase() === AUTH_HASH.toLowerCase());
const userOk = userRequired ? (gu === (AUTH_USER||'').trim()) : true;
console.log('存储的认证:', tk ? '存在' : '不存在');
console.log('存储的用户:', gu || '无');
console.log('密码验证:', passOk ? '通过' : '失败');
console.log('用户验证:', userOk ? '通过' : '失败');
console.log('目标哈希:', AUTH_HASH);
console.log('存储哈希:', tk);
if (passOk && userOk) {
console.log('✅ 认证成功,显示页面');
document.documentElement.style.display = '';
// 确保内容加载函数在页面显示后执行
setTimeout(() => {
try {
if (typeof loadMeta === 'function') loadMeta();
if (typeof loadDailyChart === 'function') loadDailyChart();
if (typeof loadSparklines === 'function') loadSparklines();
if (typeof loadSerpAPIKeys === 'function') loadSerpAPIKeys();
console.log('✅ 自动加载所有内容完成');
} catch(e) {
console.error('自动内容加载出错:', e);
}
}, 100);
return;
}
}catch(e){
console.error('认证检查出错:', e);
}
console.log('❌ 认证失败,显示登录框');
showAuth(); // 直接显示认证弹窗而不是跳转
}
// 确保页面初始化正确
document.documentElement.style.display = 'none';
// 添加多重初始化保障
document.addEventListener('DOMContentLoaded', gate);
window.addEventListener('load', function() {
// 如果页面加载完成后仍然隐藏,强制检查认证
if (document.documentElement.style.display === 'none') {
console.log('⚠️ 页面加载完成但仍隐藏,重新检查认证...');
gate();
}
});
// 添加fallback机制
setTimeout(function() {
if (document.documentElement.style.display === 'none') {
console.log('⚠️ 超时fallback,强制显示认证框...');
showAuth();
}
}, 3000);
// 根据是否有配额数据隐藏卡片
document.addEventListener('DOMContentLoaded', ()=>{
const qleft = '472'; const qcap = '1250'; const kok='5'; const kt='5';
const hideQuota = (!qleft || qleft==='0') && (!qcap || qcap==='0') && (!kok || kok==='0') && (!kt || kt==='0');
if(hideQuota){
document.querySelectorAll('.stat.quota').forEach(el=>el.style.display='none');
}
});
</script>
</head>
<body>
<div class="wrap">
<div id="auth-mask" class="auth-mask" style="display:none">
<div class="auth-card">
<h3 class="auth-title">访问认证</h3>
<p class="auth-sub">请输入用户名和密码以查看页面内容</p>
<div style="background:#1f2937; padding:8px; border-radius:6px; margin:8px 0; font-size:12px; color:#94a3b8;">
<strong>调试信息:</strong><br>
用户名: <span id="debug-user">liebesu</span><br>
哈希值: <span id="debug-hash">37092303178fc51f57a52ea39e166a4954ec86c075de3a9df7a221c9ef7e0891</span>
</div>
<input id="auth-user" class="auth-input" type="text" placeholder="输入用户名" />
<input id="auth-input" class="auth-input" type="password" placeholder="输入密码" />
<button id="auth-btn" class="auth-btn">进入</button>
<div id="auth-err" class="auth-err"></div>
</div>
</div>
<div class="header">
<h1>Google SSR Actions</h1>
<small>构建时间(中国时区):2025-09-24 10:28:59</small>
</div>
<div class="subtitle">源 113/193 · 节点 1200 · 新增 4 · 移除 0</div>
<div class="stats" id="stats-cards">
<div class="stat quota" data-hide="q"><div class="num">472</div><div>剩余额度</div></div>
<div class="stat quota" data-hide="q"><div class="num">1250</div><div>总额度</div></div>
<div class="stat quota" data-hide="q"><div class="num">5/5</div><div>可用密钥/总密钥</div></div>
<div class="stat"><div class="num">2025-09-24 13:28:59</div><div>下次更新时间(中国时区)</div></div>
</div>
<div class="grid">
<div class="card card-metrics">
<h3>关键指标(7/30天)</h3>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px">
<div>
<small>新增(7天)</small>
<canvas id="spark-added-7" height="40"></canvas>
</div>
<div>
<small>失效(7天)</small>
<canvas id="spark-removed-7" height="40"></canvas>
</div>
<div>
<small>存活(30天)</small>
<canvas id="spark-alive-30" height="40"></canvas>
</div>
</div>
</div>
<div class="card card-files">
<h3>订阅文件</h3>
<ul>
<li><a href="sub/all.txt"><code>sub/all.txt</code></a> 全量订阅 (文本格式)</li>
<li><a href="sub/all.yaml"><code>sub/all.yaml</code></a> Clash配置 (包含完整节点信息)</li>
<li><a href="sub/all_providers.yaml"><code>sub/all_providers.yaml</code></a> Clash配置 (使用proxy-providers)</li>
</ul>
<p><small style="color:#94a3b8">📌 所有订阅文件和接口可直接访问,无需页面认证</small></p>
</div>
<div class="card card-sources">
<h3>URL 源</h3>
<ul>
<li><a href="sub/urls.txt"><code>urls.txt</code></a> 当前可用源</li>
<li><a href="sub/all_urls.txt"><code>all_urls.txt</code></a> 完整源列表</li>
<li><a href="sub/google_urls.txt"><code>google_urls.txt</code></a> Google发现(108)</li>
<li><a href="sub/github_urls.txt"><code>github_urls.txt</code></a> GitHub发现(5)</li>
</ul>
</div>
<div class="card card-health">
<h3>健康信息</h3>
<ul class="health-list">
<li>构建时间(中国时区):<b>2025-09-24 10:28:59</b></li>
<li>下次更新时间(中国时区):<b>2025-09-24 13:28:59</b></li>
<li>源:<b>113/193</b> · 新增 <b>4</b> · 移除 <b>0</b></li>
<li>节点:<b>1200</b> · 协议 SS <b>147</b> | VMess <b>81</b> | VLESS <b>77</b> | Trojan <b>39</b> | HY2 <b>856</b></li>
<li>来源:Google <b>108</b> | GitHub <b>5</b></li>
</ul>
</div>
<div class="card card-serpapi">
<h3>SerpAPI 密钥状态</h3>
<div id="serpapi-status">
<div class="serpapi-summary">
<span class="status-item">可用密钥: <b id="keys-ok">5</b>/<b id="keys-total">5</b></span>
<span class="status-item">总剩余额度: <b id="quota-left">472</b>/<b id="quota-cap">1250</b></span>
</div>
<div id="serpapi-keys-list" class="serpapi-keys-list">
<!-- 动态加载密钥详情 -->
</div>
</div>
</div>
<div class="card card-protocols">
<h3>协议分布</h3>
<ul>
<li>SS:147</li>
<li>VMess:81</li>
<li>VLESS:77</li>
<li>Trojan:39</li>
<li>Hysteria2:856</li>
</ul>
</div>
<div class="card card-extras">
<h3>辅助输出</h3>
<ul>
<li><a href="sub/github.txt"><code>github.txt</code></a> GitHub节点</li>
<li><a href="sub/proto/ss-base64.txt"><code>ss-base64.txt</code></a> SS Base64</li>
<li><a href="health.json"><code>health.json</code></a> 健康信息</li>
</ul>
<p><small style="color:#94a3b8">💡 API接口和JSON数据可通过程序直接调用</small></p>
</div>
<div class="card card-wide card-details">
<h3>源详细信息</h3>
<p><small>包含机场名称、容量/剩余、协议、复制与测速、详情页。</small></p>
<div id="url-meta"><small>加载中...</small></div>
<div class="chart">
<h4 style="margin:0 0 8px 0">每日新增可用URL</h4>
<canvas id="dailyChart" height="120"></canvas>
</div>
<script>
function copyText(text){
navigator.clipboard.writeText(text).then(()=>{
alert('已复制订阅链接');
}).catch(()=>{});
}
async function testSpeed(url){
const t0 = performance.now();
try{ await fetch(url, {method:'HEAD', mode:'no-cors'}); }catch(e){}
const t1 = performance.now();
return Math.round(t1 - t0);
}
async function runBatchSpeed(urls, concurrency){
const results = new Array(urls.length).fill(null);
let idx = 0;
async function worker(){
while(idx < urls.length){
const i = idx++;
const u = urls[i];
const ms = await testSpeed(u);
results[i] = ms;
const cell = document.querySelector(`[data-url-id="${i}"]`);
if(cell){
cell.textContent = ms;
cell.style.color = ms<=300?'#10b981':(ms<=800?'#60a5fa':'#f59e0b');
}
}
}
const workers = Array.from({length: Math.min(concurrency, urls.length)}, ()=>worker());
await Promise.all(workers.map(w=>w()));
return results;
}
async function loadMeta() {
try {
const res = await fetch('sub/url_meta.json', { cache: 'no-cache' });
if (!res.ok) throw new Error('fetch failed');
let data = await res.json();
// 只展示可用源
data = (Array.isArray(data) ? data : []).filter(x=>x && x.available);
// 按质量分倒序排序
data.sort((a,b)=> (b.quality_score||0) - (a.quality_score||0));
const rows = data.map(function(item, i){
const q = (item.quality_score ?? 0);
const qColor = q>=80?'#10b981':(q>=60?'#60a5fa':'#f59e0b');
const src = (item.source||'').toLowerCase();
const pillColor = src==='github'?'#111827': '#0b1220';
const pillText = src==='github'?'GitHub':'Google';
return '<tr>' +
'<td><div style="display:flex;gap:8px;align-items:center">' +
'<a href="' + (item.url||'#') + '" target="_blank">源</a>' +
'<small style="color:#94a3b8">' + (item.provider||item.host||'') + '</small>' +
'</div></td>' +
'<td>' + (item.available ? '✅' : '❌') + '</td>' +
'<td>' + (item.nodes_total ?? 0) + '</td>' +
'<td>' + (item.protocols ?? '') + '</td>' +
'<td>' + ((item.traffic?.remaining ?? '-') + ' / ' + (item.traffic?.total ?? '-') + ' ' + (item.traffic?.unit ?? '')) + '</td>' +
'<td data-url-id="' + i + '">' + (item.response_ms ?? '-') + '</td>' +
'<td><b style="color:' + qColor + '">' + q + '</b></td>' +
'<td><span class="pill" style="background:' + pillColor + '">' + pillText + '</span></td>' +
'<td>' + (item.first_seen || '-') + '</td>' +
'<td>' +
'<button onclick="copyText(\'' + (item.url||'') + '\')" style="padding:4px 8px;border-radius:8px;border:1px solid #1f2937;background:#0b1220;color:#e5e7eb">复制</button>' +
'<button class="btn-speed" data-url="' + (item.url||'') + '" style="margin-left:6px;padding:4px 8px;border-radius:8px;border:1px solid #1f2937;background:#0b1220;color:#e5e7eb">测速</button>' +
(item.detail_page ? '<a href="' + item.detail_page + '" style="margin-left:8px">详情</a>' : '') +
'</td>' +
'</tr>';
}).join('');
const html = '<table>' +
'<thead><tr>' +
'<th style="text-align:left">URL/机场</th>' +
'<th>可用</th>' +
'<th>节点数</th>' +
'<th>协议</th>' +
'<th>流量(剩余/总量)</th>' +
'<th>耗时(ms)</th>' +
'<th>质量</th>' +
'<th>来源</th>' +
'<th>采集</th>' +
'<th>操作</th>' +
'</tr></thead>' +
'<tbody>' + rows + '</tbody>' +
'</table>';
document.getElementById('url-meta').innerHTML = html;
// 绑定单击测速
document.querySelectorAll('.btn-speed').forEach(btn=>{
btn.addEventListener('click', async (e)=>{
const u = e.currentTarget.getAttribute('data-url');
const ms = await testSpeed(u);
e.currentTarget.closest('tr').querySelector('[data-url-id]').textContent = ms;
});
});
// 批量测速(限并发 6)
const urls = data.map(x=>x.url);
runBatchSpeed(urls, 6);
} catch(e) {
document.getElementById('url-meta').innerHTML = '<small>未获取到源详情</small>';
}
}
async function loadDailyChart() {
try {
const r = await fetch('sub/stats_daily.json', { cache:'no-cache' });
if (!r.ok) return;
const d = await r.json();
const labels = d.map(x=>x.date);
const google = d.map(x=>x.google_added||0);
const github = d.map(x=>x.github_added||0);
const added = d.map(x=>x.new_total||0);
const removed = d.map(x=>x.removed_total||0);
const canvas = document.getElementById('dailyChart');
const ctx = canvas.getContext('2d');
// 极简绘制
const max = Math.max(1, ...google, ...github, ...added, ...removed);
const W = canvas.width = canvas.clientWidth;
const H = canvas.height;
function plot(series, color, yoff) {
ctx.strokeStyle=color; ctx.lineWidth=2; ctx.beginPath();
series.forEach((v,i)=>{
const x = (W-20) * (i/(series.length-1)) + 10;
const y = H-10 - (H-20) * (v/max);
if (i===0) ctx.moveTo(x,y); else ctx.lineTo(x,y);
}); ctx.stroke();
}
ctx.clearRect(0,0,W,H); ctx.fillStyle='#0b1220'; ctx.fillRect(0,0,W,H);
plot(google,'#60a5fa'); plot(github,'#10b981'); plot(added,'#a78bfa'); plot(removed,'#f87171');
} catch(e) {}
}
function drawSparkline(canvasId, series, color){
const c = document.getElementById(canvasId); if(!c) return; const ctx=c.getContext('2d');
const W = c.width = c.clientWidth || 160; const H = c.height; const max = Math.max(1, ...series);
ctx.clearRect(0,0,W,H); ctx.strokeStyle=color; ctx.lineWidth=2; ctx.beginPath();
series.forEach((v,i)=>{ const x=(W-6)*(i/(series.length-1))+3; const y=H-3 - (H-6)*(v/max); if(i===0) ctx.moveTo(x,y); else ctx.lineTo(x,y); });
ctx.stroke();
}
async function loadSparklines(){
try{
const r = await fetch('sub/stats_daily.json', { cache:'no-cache' }); if(!r.ok) return;
const d = await r.json();
const last7 = d.slice(-7);
const last30 = d.slice(-30);
drawSparkline('spark-added-7', last7.map(x=>x.new_total||0), '#60a5fa');
drawSparkline('spark-removed-7', last7.map(x=>x.removed_total||0), '#f87171');
drawSparkline('spark-alive-30', last30.map(x=>x.alive_total||0), '#10b981');
}catch(e){}
}
// 加载 SerpAPI 密钥详情
async function loadSerpAPIKeys() {
try {
const r = await fetch('health.json', { cache:'no-cache' });
if(!r.ok) return;
const health = await r.json();
const keys = health.serpapi_keys_detail || [];
const container = document.getElementById('serpapi-keys-list');
if(!container) return;
if(keys.length === 0) {
container.innerHTML = '<div class="serpapi-key-item error">暂无密钥信息</div>';
return;
}
container.innerHTML = keys.map(key => {
if(key.error) {
const keyInfo = key.key_masked ? `(${key.key_masked})` : '';
return `<div class="serpapi-key-item error">
<div class="key-header">
<span class="key-index">Key ${key.index} ${keyInfo}</span>
<span class="key-status">错误</span>
</div>
<div class="key-details">
<div style="color:#ef4444">${key.error}</div>
${key.status === 'key_valid_unchecked' ? '<div style="color:#10b981;margin-top:4px">✓ 密钥格式有效,但无法检查配额</div>' : ''}
${key.status === 'key_invalid' ? '<div style="color:#ef4444;margin-top:4px">✗ 密钥格式无效</div>' : ''}
</div>
</div>`;
}
const used = key.used_searches || 0;
const total = key.searches_per_month || 0;
const left = key.total_searches_left || 0;
const usagePercent = total > 0 ? Math.round((used / total) * 100) : 0;
const statusClass = left <= 0 ? 'exhausted' : (usagePercent > 80 ? 'warning' : 'ok');
const resetDate = key.reset_date ? new Date(key.reset_date).toLocaleDateString('zh-CN') : '未知';
const keyInfo = key.key_masked ? `(${key.key_masked})` : '';
return `
<div class="serpapi-key-item ${statusClass}">
<div class="key-header">
<span class="key-index">Key ${key.index} ${keyInfo}</span>
<span class="key-status">${left <= 0 ? '已用尽' : (usagePercent > 80 ? '即将用尽' : '正常')}</span>
</div>
<div class="key-details">
<div class="quota-bar">
<div class="quota-fill" style="width: ${usagePercent}%"></div>
</div>
<div class="quota-text">已用 ${used}/${total} (${usagePercent}%) · 剩余 ${left}</div>
<div class="reset-info">重置时间: ${resetDate}</div>
</div>
</div>
`;
}).join('');
} catch(e) {
console.warn('SerpAPI keys load failed:', e);
const container = document.getElementById('serpapi-keys-list');
if(container) container.innerHTML = '<div class="serpapi-key-item error">加载失败</div>';
}
}
loadMeta(); loadDailyChart(); loadSparklines(); loadSerpAPIKeys();
</script>
</div>
</div>
<p><small>仅展示可用源(自动过滤失效/超额/限速来源)。 构建(UTC):2025-09-24 02:28:59 · 下次(UTC):2025-09-24 05:28:59</small></p>
</div>
</body>
</html>