File size: 2,046 Bytes
5e05517
 
 
 
 
 
 
de1073a
5e05517
 
 
de1073a
5e05517
de1073a
 
 
 
5e05517
 
 
 
f50c7ba
 
 
 
 
 
 
 
 
5e05517
f50c7ba
 
 
de1073a
f50c7ba
 
 
 
 
 
 
de1073a
 
f50c7ba
 
de1073a
f50c7ba
 
 
 
 
 
 
 
821b7f4
 
f50c7ba
 
 
 
 
 
 
 
5e05517
 
 
 
 
 
 
 
 
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
const express = require('express');
const app = express();
const port = process.env.PORT || 7860;
const requestIp = require('request-ip');

app.use(express.static('public'));

// Create a route that returns the HTML with Beijing time and IP
app.get('/', (req, res) => {
  const clientIp = requestIp.getClientIp(req) || "Unknown";
  
  // Get current time in Beijing (UTC+8)
  const now = new Date();
  const beijingTime = new Date(now.getTime() + (8 * 60 * 60 * 1000));
  const hours = beijingTime.getUTCHours().toString().padStart(2, '0');
  const minutes = beijingTime.getUTCMinutes().toString().padStart(2, '0');
  const timeString = `${hours}:${minutes}`;
  
  const html = `
    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <style>
        body, html {
          margin: 0;
          padding: 0;
          height: 100%;
          font-family: Arial, sans-serif;
        }
        .container {
          display: flex;
          align-items: center;
          padding: 6px 10px;
          background: linear-gradient(135deg, #ff0844 0%, #8000ff 50%, #0061ff 100%);
          border-radius: 6px;
          color: white;
          height: 100%;
          box-sizing: border-box;
        }
        .clock-emoji {
          margin-right: 6px;
          font-size: 14px;
        }
        .info-text {
          font-size: 13px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      </style>
    </head>
    <body>
      <div class="container">
        <span class="clock-emoji">🕒</span>
        <span class="info-text">${timeString} | IP ${clientIp}</span>
      </div>
      <script>
        // Reload the page every minute to update time
        setTimeout(() => {
          window.location.reload();
        }, 60000);
      </script>
    </body>
    </html>
  `;
  
  res.send(html);
});

app.listen(port, '0.0.0.0', () => {
  console.log(`Server running on port ${port}`);
});