添加文件:beian.js、generate204.js、ipapi.js、trace.js
This commit is contained in:
81
beian.js
Normal file
81
beian.js
Normal file
@@ -0,0 +1,81 @@
|
||||
async function handleRequest(request) {
|
||||
// ICP备案号
|
||||
const icp = "苏ICP备2022009869号-2";
|
||||
|
||||
// 公安备案号
|
||||
const publicSecurity = "苏公网安备32132402000606号";
|
||||
|
||||
// HTML页面
|
||||
const html = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>小小的日记本</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.main-content {
|
||||
flex: 1;
|
||||
}
|
||||
.beian-footer {
|
||||
background-color: #f5f5f5;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.beian-footer p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #666;
|
||||
}
|
||||
a:hover {
|
||||
color: #333;
|
||||
}
|
||||
.separator {
|
||||
color: #999;
|
||||
}
|
||||
.beian-footer img {
|
||||
height: 14px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main-content"></div>
|
||||
<div class="beian-footer">
|
||||
<p><a href="https://beian.miit.gov.cn/" target="_blank">${icp}</a> <span class="separator">|</span> <a href="https://beian.mps.gov.cn/#/query/webSearch?code=32132402000606" target="_blank"><img src="https://image.cloudyun.top/i/2026/02/09/o49mk.png" alt="公安备案" style="vertical-align: middle;"> ${publicSecurity}</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
return new Response(html, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'text/html; charset=utf-8'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addEventListener('fetch', event => {
|
||||
return event.respondWith(handleRequest(event.request));
|
||||
});
|
||||
4
generate204.js
Normal file
4
generate204.js
Normal file
@@ -0,0 +1,4 @@
|
||||
addEventListener('fetch', event => {
|
||||
const response = new Response(null, { status: 204 });
|
||||
event.respondWith(response);
|
||||
});
|
||||
57
ipapi.js
Normal file
57
ipapi.js
Normal file
@@ -0,0 +1,57 @@
|
||||
async function handleRequest(request) {
|
||||
|
||||
// 创建一个空对象来存储请求头数据
|
||||
const headers = {}
|
||||
|
||||
// 遍历请求头数据并将其存储在对象中
|
||||
for (const [name, value] of request.headers.entries()) {
|
||||
headers[name] = value
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
const path = url.pathname;
|
||||
|
||||
// 用来返回的数据
|
||||
let returnData = {}
|
||||
returnData["ip"] = headers["EO-Connecting-IP"];
|
||||
returnData["user-agent"] = headers["User-Agent"];
|
||||
if(returnData["user-agent"] === undefined){
|
||||
returnData["user-agent"] = headers["user-agent"];
|
||||
}
|
||||
returnData["geo"] = request.eo.geo;
|
||||
returnData["version"] = "0.4";
|
||||
|
||||
if(path === "/"){
|
||||
const returnDataStr = "/\t\t\tHelp\n/info\t\t\tALL Info(JSON)\n/ip\t\t\tIP(String)\n/ip/json\t\tIP(Json)\n/ua\t\t\tUser-Agent Data\n/country\t\tCountry";
|
||||
return new Response(returnDataStr, {status: 200})
|
||||
|
||||
} else if(path === "/country"){
|
||||
const country = returnData["geo"]?.countryCodeAlpha2 || "Country not available";
|
||||
return new Response(country, {status: 200})
|
||||
|
||||
} else if(path === "/ua"){
|
||||
const returnDataStr = returnData["user-agent"];
|
||||
return new Response(returnDataStr, {status: 200})
|
||||
}else if(path === "/info"){
|
||||
const returnDataStr = JSON.stringify(returnData);
|
||||
return new Response(returnDataStr, {status: 200,headers: {'Content-Type':'application/json'}})
|
||||
}else if(path === "/ip/json"){
|
||||
let returnDataTemp ={};
|
||||
returnDataTemp["ip"] = returnData["ip"];
|
||||
returnDataTemp["geo"] = returnData["geo"];
|
||||
const returnDataStr = JSON.stringify(returnDataTemp)
|
||||
return new Response(returnDataStr, {status: 200,headers: {'Content-Type':'application/json'}})
|
||||
}else if(path === "/ip"){
|
||||
const returnDataStr = returnData["ip"];
|
||||
return new Response(returnDataStr, {status: 200})
|
||||
}else if(path === "/favicon.ico"){
|
||||
// 浏览器图标响应200
|
||||
return new Response("", {status: 200})
|
||||
}else{
|
||||
return new Response("404", {status: 404})
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener('fetch', event => {
|
||||
return event.respondWith(handleRequest(event.request));
|
||||
});
|
||||
Reference in New Issue
Block a user