diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/config.yml @@ -0,0 +1 @@ +{} diff --git a/src/back/index.ts b/src/back/index.ts index f010df2..8c63b40 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -47,6 +47,13 @@ const postAnalytics = async ( req: Request | Bun.BunRequest, server: Bun.Server, ) => { + console.log(String( + req.headers.get("CF-Connecting-IP") || + req.headers.get("X-Real-IP") || + req.headers.get("X-Forwarded-For")?.split(",")[0] || + (typeof server.requestIP(req) === "string" + ? server.requestIP(req) + : server.requestIP(req)?.address || ""))); return await fetch("https://plausible.creations.works/api/event", { method: "POST", headers: { @@ -54,11 +61,11 @@ const postAnalytics = async ( "User-Agent": req.headers.get("user-agent") || "", "X-Forwarded-For": String( req.headers.get("CF-Connecting-IP") || - req.headers.get("X-Real-IP") || - req.headers.get("X-Forwarded-For")?.split(",")[0] || - (typeof server.requestIP(req) === "string" - ? server.requestIP(req) - : server.requestIP(req)?.address || ""), + req.headers.get("X-Real-IP") || + req.headers.get("X-Forwarded-For")?.split(",")[0] || + (typeof server.requestIP(req) === "string" + ? server.requestIP(req) + : server.requestIP(req)?.address || ""), ), }, body: JSON.stringify({ diff --git a/src/front/components/Lanyard/index.tsx b/src/front/components/Lanyard/index.tsx index a47021c..ca5d211 100644 --- a/src/front/components/Lanyard/index.tsx +++ b/src/front/components/Lanyard/index.tsx @@ -3,17 +3,17 @@ import { createRef } from "tsx-dom"; import socket from "../../Socket"; const statusTypes = { - online: "rgb(0, 150, 0)", - idle: "rgb(150, 150, 0)", - dnd: "rgb(150, 0, 0)", - offline: "rgb(150, 150, 150)", + online: "0, 150, 0", + idle: "150, 150, 0", + dnd: "150, 0, 0", + offline: "150, 150, 150", }; const gradientTypes = { - online: "rgba(0, 150, 0, 0.1)", - idle: "rgba(150, 150, 0, 0.1)", - dnd: "rgba(150, 0, 0, 0.1)", - offline: "rgba(150, 150, 150, 0.1)", + online: "0, 150, 0", + idle: "150, 150, 0", + dnd: "150, 0, 0", + offline: "150, 150, 150", }; const activityTypes: Record = { @@ -31,21 +31,19 @@ export default () => { socket.addEventListener("lanyard", (event: Event) => { const lanyard = (event as CustomEvent).detail; - document.body.style = `--status-color: ${statusTypes[lanyard.discord_status]}; --gradient-color: ${gradientTypes[lanyard.discord_status]};`; + document.body.style = `--status-color: rgb(${statusTypes[lanyard.discord_status]}); --gradient-color: rgba(${gradientTypes[lanyard.discord_status]}, 0.1);`; if (container.current) { - container.current.className = "shj-lang-json"; container.current.textContent = JSON.stringify( { status: lanyard.discord_status, - activities: lanyard.activities.map((act) => { + activities: [... new Set(lanyard.activities.map((act) => { const type = activityTypes[act.type]; - const parts = [type]; - if (act.name !== type) parts.push(act.name); - if (act.details) parts.push(act.details); - if (act.state) parts.push(act.state); + const parts = [`${type} ${act.name}`]; + if (act.details && act.details !== act.name) parts.push(act.details); + if (act.state && act.state !== act.name) parts.push(act.state); return parts; - }), + }))], }, null, 2,