fix ip log issue, make changes to embed
Some checks failed
Code quality checks / biome (push) Failing after 11s
Some checks failed
Code quality checks / biome (push) Failing after 11s
This commit is contained in:
parent
23f37beef3
commit
b109f67125
2 changed files with 15 additions and 9 deletions
|
@ -225,17 +225,18 @@ class ServerHandler {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers: Headers = response.headers;
|
const headers = request.headers;
|
||||||
let ip: string | null = server.requestIP(request)?.address || null;
|
let ip = server.requestIP(request)?.address;
|
||||||
|
|
||||||
if (!ip) {
|
if (!ip || ip.startsWith("172.") || ip === "127.0.0.1") {
|
||||||
ip =
|
ip =
|
||||||
headers.get("CF-Connecting-IP") ||
|
headers.get("CF-Connecting-IP")?.trim() ||
|
||||||
headers.get("X-Real-IP") ||
|
headers.get("X-Real-IP")?.trim() ||
|
||||||
headers.get("X-Forwarded-For") ||
|
headers.get("X-Forwarded-For")?.split(",")[0].trim() ||
|
||||||
null;
|
"unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
logger.custom(
|
logger.custom(
|
||||||
`[${request.method}]`,
|
`[${request.method}]`,
|
||||||
`(${response.status})`,
|
`(${response.status})`,
|
||||||
|
|
|
@ -5,9 +5,14 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<meta property="og:title" content="<%= username %>'s Presence">
|
<%
|
||||||
|
const displayName = username.endsWith('s') ? `${username}'` : `${username}'s`;
|
||||||
|
const profileUrl = `https://discord.com/users/${user.id}`;
|
||||||
|
%>
|
||||||
|
<meta property="og:title" content="<%= displayName %> Discord Presence">
|
||||||
|
<meta property="og:description" content="<%= activities?.[0]?.state || 'See what ' + displayName + ' is doing on Discord.' %>">
|
||||||
<meta property="og:image" content="https://cdn.discordapp.com/avatars/<%= user.id %>/<%= user.avatar %>">
|
<meta property="og:image" content="https://cdn.discordapp.com/avatars/<%= user.id %>/<%= user.avatar %>">
|
||||||
<meta property="og:description" content="<%= activities[0]?.state || 'Discord Presence' %>">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
|
||||||
<title><%= title %></title>
|
<title><%= title %></title>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue