Spaces:
Runtime error

MetaQiu commited on
Commit
1d2a485
·
1 Parent(s): 44af558
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. static/index.html +122 -0
Dockerfile CHANGED
@@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y curl procps && rm -rf /var/lib/apt/list
12
  WORKDIR /code
13
 
14
  # 每次构建时更新此时间戳以强制刷新缓存
15
- ENV REFRESHED_AT=2025-11-26_03
16
 
17
  COPY --from=py-builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
18
  COPY --from=py-builder /usr/local/bin /usr/local/bin
 
12
  WORKDIR /code
13
 
14
  # 每次构建时更新此时间戳以强制刷新缓存
15
+ ENV REFRESHED_AT=2025-11-26_04
16
 
17
  COPY --from=py-builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
18
  COPY --from=py-builder /usr/local/bin /usr/local/bin
static/index.html CHANGED
@@ -481,6 +481,95 @@
481
  }
482
 
483
  .hidden { display: none !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  </style>
485
  </head>
486
  <body>
@@ -524,10 +613,31 @@
524
  <p style="font-size: 0.9rem; margin-top: 10px; opacity: 0.7;">支持 IPv4 和 IPv6</p>
525
  </div>
526
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  </div>
528
 
529
  <footer>
530
  <p>Powered by MaxMind GeoLite2 & GeoCN</p>
 
531
  </footer>
532
 
533
  <script>
@@ -535,6 +645,18 @@
535
  const searchBtn = document.getElementById('searchBtn');
536
  const resultSection = document.getElementById('resultSection');
537
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  // 自动聚焦
539
  ipInput.focus();
540
 
 
481
  }
482
 
483
  .hidden { display: none !important; }
484
+
485
+ /* API 文档样式 */
486
+ .api-docs {
487
+ background: var(--bg-card);
488
+ border: 1px solid var(--border);
489
+ border-radius: 20px;
490
+ padding: 30px;
491
+ width: 100%;
492
+ margin-top: 20px;
493
+ }
494
+
495
+ .docs-title {
496
+ font-size: 1.2rem;
497
+ margin-bottom: 20px;
498
+ color: var(--text-primary);
499
+ display: flex;
500
+ align-items: center;
501
+ gap: 10px;
502
+ }
503
+
504
+ .code-block {
505
+ background: #0f131a;
506
+ border: 1px solid var(--border);
507
+ border-radius: 12px;
508
+ padding: 0;
509
+ margin-bottom: 15px;
510
+ overflow: hidden;
511
+ }
512
+
513
+ .code-block:last-child {
514
+ margin-bottom: 0;
515
+ }
516
+
517
+ .code-header {
518
+ background: rgba(255, 255, 255, 0.03);
519
+ padding: 8px 16px;
520
+ display: flex;
521
+ justify-content: space-between;
522
+ align-items: center;
523
+ border-bottom: 1px solid var(--border);
524
+ }
525
+
526
+ .code-lang {
527
+ font-size: 0.8rem;
528
+ color: var(--text-muted);
529
+ font-weight: 600;
530
+ }
531
+
532
+ .copy-btn {
533
+ background: transparent;
534
+ border: 1px solid var(--border);
535
+ color: var(--text-secondary);
536
+ padding: 4px 10px;
537
+ border-radius: 6px;
538
+ font-size: 0.75rem;
539
+ cursor: pointer;
540
+ transition: all 0.2s;
541
+ }
542
+
543
+ .copy-btn:hover {
544
+ border-color: var(--accent);
545
+ color: var(--accent);
546
+ }
547
+
548
+ code {
549
+ display: block;
550
+ padding: 16px;
551
+ font-family: 'JetBrains Mono', monospace;
552
+ font-size: 0.9rem;
553
+ color: #a5b3ce;
554
+ overflow-x: auto;
555
+ white-space: pre;
556
+ }
557
+
558
+ .credits {
559
+ margin-top: 10px;
560
+ font-size: 0.9rem;
561
+ }
562
+
563
+ .credits a {
564
+ color: var(--accent);
565
+ text-decoration: none;
566
+ transition: color 0.2s;
567
+ }
568
+
569
+ .credits a:hover {
570
+ color: #fff;
571
+ text-decoration: underline;
572
+ }
573
  </style>
574
  </head>
575
  <body>
 
613
  <p style="font-size: 0.9rem; margin-top: 10px; opacity: 0.7;">支持 IPv4 和 IPv6</p>
614
  </div>
615
  </section>
616
+
617
+ <section class="api-docs">
618
+ <h2 class="docs-title">🛠️ API 使用说明</h2>
619
+ <div class="code-block">
620
+ <div class="code-header">
621
+ <span class="code-lang">Shell</span>
622
+ <button class="copy-btn" onclick="copyCode('curl')">复制</button>
623
+ </div>
624
+ <code id="code-curl">curl https://geo.metaqiu.cn/api/8.8.8.8</code>
625
+ </div>
626
+ <div class="code-block">
627
+ <div class="code-header">
628
+ <span class="code-lang">Python</span>
629
+ <button class="copy-btn" onclick="copyCode('py')">复制</button>
630
+ </div>
631
+ <code id="code-py">import requests
632
+ response = requests.get('https://geo.metaqiu.cn/api/8.8.8.8')
633
+ print(response.json())</code>
634
+ </div>
635
+ </section>
636
  </div>
637
 
638
  <footer>
639
  <p>Powered by MaxMind GeoLite2 & GeoCN</p>
640
+ <p class="credits">Made with <span style="color: #ef4444;">❤</span> by <a href="https://metaqiu.cn" target="_blank">MetaQiu</a></p>
641
  </footer>
642
 
643
  <script>
 
645
  const searchBtn = document.getElementById('searchBtn');
646
  const resultSection = document.getElementById('resultSection');
647
 
648
+ // 复制代码功能
649
+ function copyCode(type) {
650
+ const el = document.getElementById(`code-${type}`);
651
+ const text = el.innerText;
652
+ navigator.clipboard.writeText(text).then(() => {
653
+ const btn = el.parentElement.querySelector('.copy-btn');
654
+ const originalText = btn.innerText;
655
+ btn.innerText = '已复制!';
656
+ setTimeout(() => btn.innerText = originalText, 2000);
657
+ });
658
+ }
659
+
660
  // 自动聚焦
661
  ipInput.focus();
662