Skip to content

Commit

Permalink
feat: 加上首页
Browse files Browse the repository at this point in the history
  • Loading branch information
14790897 committed Oct 19, 2024
1 parent 0768f30 commit b561fde
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#支持多账户,使用逗号分隔每个账户,密码中有特殊字符可能会导致识别失败
USERNAMES=nihao,zaijian
PASSWORDS="123,456" # 密码外面要加上双引号,密码内部如果有双引号,需要加上转义字符,linux使用\转义,Windows使用"转义 (注意GitHub action不需要增加处理,也不需要加引号)
USERNAMES=nihao,zhaijian
PASSWORDS="123,456" # 密码外面要加上双引号,密码内部如果有双引号,需要加上转义字符,linux使用\转义,Windows使用"转义 (注意GitHub action不需要增加处理,也不需要加引号)
WEBSITE=https://linux.do # 需要阅读的网站,支持后面那些:https://meta.discourse.org, https://meta.appinn.net, https://community.openai.com
#运行时间,单位为分钟
RUN_TIME_LIMIT_MINUTES=20
Expand Down
71 changes: 64 additions & 7 deletions bypasscf.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ healthApp.get("/health", (req, res) => {

// 将字节转换为MB
const memoryUsageMB = {
rss: (memoryUsage.rss / (1024 * 1024)).toFixed(2), // 转换为MB并保留两位小数
heapTotal: (memoryUsage.heapTotal / (1024 * 1024)).toFixed(2),
heapUsed: (memoryUsage.heapUsed / (1024 * 1024)).toFixed(2),
external: (memoryUsage.external / (1024 * 1024)).toFixed(2),
arrayBuffers: (memoryUsage.arrayBuffers / (1024 * 1024)).toFixed(2),
rss: `${(memoryUsage.rss / (1024 * 1024)).toFixed(2)} MB`, // 转换为MB并保留两位小数
heapTotal: `${(memoryUsage.heapTotal / (1024 * 1024)).toFixed(2)} MB`,
heapUsed: `${(memoryUsage.heapUsed / (1024 * 1024)).toFixed(2)} MB`,
external: `${(memoryUsage.external / (1024 * 1024)).toFixed(2)} MB`,
arrayBuffers: `${(memoryUsage.arrayBuffers / (1024 * 1024)).toFixed(2)} MB`,
};

const healthData = {
Expand All @@ -433,9 +433,66 @@ healthApp.get("/health", (req, res) => {

res.status(200).json(healthData);
});

healthApp.get("/", (req, res) => {
res.send(`
<html>
<head>
<title>Auto Read</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
max-width: 600px;
text-align: center;
}
h1 {
color: #007bff;
}
p {
font-size: 18px;
margin: 15px 0;
}
a {
color: #007bff;
text-decoration: none;
font-weight: bold;
}
a:hover {
text-decoration: underline;
}
footer {
margin-top: 20px;
font-size: 14px;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to the Auto Read App</h1>
<p>You can check the server's health at <a href="/health">/health</a>.</p>
<p>GitHub: <a href="https://github.com/14790897/auto-read-liunxdo" target="_blank">https://github.com/14790897/auto-read-liunxdo</a></p>
<footer>&copy; 2024 Auto Read App</footer>
</div>
</body>
</html>
`);
});
healthApp.listen(HEALTH_PORT, () => {
console.log(
`Health check endpoint is running at http://localhost:${HEALTH_PORT}/health`
);
});
});
69 changes: 63 additions & 6 deletions bypasscf_likeUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ healthApp.get("/health", (req, res) => {

// 将字节转换为MB
const memoryUsageMB = {
rss: (memoryUsage.rss / (1024 * 1024)).toFixed(2), // 转换为MB并保留两位小数
heapTotal: (memoryUsage.heapTotal / (1024 * 1024)).toFixed(2),
heapUsed: (memoryUsage.heapUsed / (1024 * 1024)).toFixed(2),
external: (memoryUsage.external / (1024 * 1024)).toFixed(2),
arrayBuffers: (memoryUsage.arrayBuffers / (1024 * 1024)).toFixed(2),
rss: `${(memoryUsage.rss / (1024 * 1024)).toFixed(2)} MB`, // 转换为MB并保留两位小数
heapTotal: `${(memoryUsage.heapTotal / (1024 * 1024)).toFixed(2)} MB`,
heapUsed: `${(memoryUsage.heapUsed / (1024 * 1024)).toFixed(2)} MB`,
external: `${(memoryUsage.external / (1024 * 1024)).toFixed(2)} MB`,
arrayBuffers: `${(memoryUsage.arrayBuffers / (1024 * 1024)).toFixed(2)} MB`,
};

const healthData = {
Expand All @@ -433,7 +433,64 @@ healthApp.get("/health", (req, res) => {

res.status(200).json(healthData);
});

healthApp.get("/", (req, res) => {
res.send(`
<html>
<head>
<title>Auto Read</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
max-width: 600px;
text-align: center;
}
h1 {
color: #007bff;
}
p {
font-size: 18px;
margin: 15px 0;
}
a {
color: #007bff;
text-decoration: none;
font-weight: bold;
}
a:hover {
text-decoration: underline;
}
footer {
margin-top: 20px;
font-size: 14px;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to the Auto Read App</h1>
<p>You can check the server's health at <a href="/health">/health</a>.</p>
<p>GitHub: <a href="https://github.com/14790897/auto-read-liunxdo" target="_blank">https://github.com/14790897/auto-read-liunxdo</a></p>
<footer>&copy; 2024 Auto Read App</footer>
</div>
</body>
</html>
`);
});
healthApp.listen(HEALTH_PORT, () => {
console.log(
`Health check endpoint is running at http://localhost:${HEALTH_PORT}/health`
Expand Down

0 comments on commit b561fde

Please sign in to comment.