fix issue with rain and snow, fix ejs formatting

This commit is contained in:
creations 2025-04-09 18:35:08 -04:00
parent 78c2eb4545
commit c54d959e7e
Signed by: creations
GPG key ID: 8F553AA4320FC711
2 changed files with 85 additions and 76 deletions

View file

@ -37,6 +37,8 @@ async function handler(): Promise<Response> {
status = presence.discord_status; status = presence.discord_status;
} }
console.log(presence.kv.rain);
const ejsTemplateData: EjsTemplateData = { const ejsTemplateData: EjsTemplateData = {
title: presence.discord_user.global_name || presence.discord_user.username, title: presence.discord_user.global_name || presence.discord_user.username,
username: username:
@ -51,10 +53,13 @@ async function handler(): Promise<Response> {
}, },
instance, instance,
readme, readme,
allowSnow: presence.kv.snow || false, allowSnow: presence.kv.snow === "true",
allowRain: presence.kv.rain || false, allowRain: presence.kv.rain === "true",
}; };
console.log("allowSnow", presence.kv.snow);
console.log("allowRain", presence.kv.rain);
return await renderEjsTemplate("index", ejsTemplateData); return await renderEjsTemplate("index", ejsTemplateData);
} }

View file

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head data-user-id="<%= user.id %>" data-instance-uri="<%= instance %>"> <head data-user-id="<%= user.id %>" data-instance-uri="<%= instance %>">
<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">
@ -13,6 +14,7 @@
<link rel="stylesheet" href="/public/css/index.css"> <link rel="stylesheet" href="/public/css/index.css">
<script src="/public/js/index.js" defer></script> <script src="/public/js/index.js" defer></script>
<%= typeof allowSnow %> <%= allowSnow %>
<% if (allowSnow) { %> <% if (allowSnow) { %>
<script src="/public/js/snow.js" defer></script> <script src="/public/js/snow.js" defer></script>
<% } %> <% } %>
@ -22,6 +24,7 @@
<meta name="color-scheme" content="dark"> <meta name="color-scheme" content="dark">
</head> </head>
<body> <body>
<div class="user-card"> <div class="user-card">
<div class="avatar-status-wrapper"> <div class="avatar-status-wrapper">
@ -32,7 +35,7 @@
<% } %> <% } %>
<% if (platform.mobile) { %> <% if (platform.mobile) { %>
<svg class="platform-icon mobile-only" viewBox="0 0 1000 1500" fill="#43a25a" aria-label="Mobile" width="17" height="17"> <svg class="platform-icon mobile-only" viewBox="0 0 1000 1500" fill="#43a25a" aria-label="Mobile" width="17" height="17">
<path d="M 187 0 L 813 0 C 916.277 0 1000 83.723 1000 187 L 1000 1313 C 1000 1416.277 916.277 1500 813 1500 L 187 1500 C 83.723 1500 0 1416.277 0 1313 L 0 187 C 0 83.723 83.723 0 187 0 Z M 125 1000 L 875 1000 L 875 250 L 125 250 Z M 500 1125 C 430.964 1125 375 1180.964 375 1250 C 375 1319.036 430.964 1375 500 1375 C 569.036 1375 625 1319.036 625 1250 C 625 1180.964 569.036 1125 500 1125 Z"/> <path d="M 187 0 L 813 0 C 916.277 0 1000 83.723 1000 187 L 1000 1313 C 1000 1416.277 916.277 1500 813 1500 L 187 1500 C 83.723 1500 0 1416.277 0 1313 L 0 187 C 0 83.723 83.723 0 187 0 Z M 125 1000 L 875 1000 L 875 250 L 125 250 Z M 500 1125 C 430.964 1125 375 1180.964 375 1250 C 375 1319.036 430.964 1375 500 1375 C 569.036 1375 625 1319.036 625 1250 C 625 1180.964 569.036 1125 500 1125 Z" />
</svg> </svg>
<% } else { %> <% } else { %>
<div class="status-indicator <%= status %>"></div> <div class="status-indicator <%= status %>"></div>
@ -206,4 +209,5 @@
</section> </section>
<% } %> <% } %>
</body> </body>
</html> </html>