fix analytics

This commit is contained in:
sky
2026-02-14 16:57:52 -05:00
parent 09cb2c6198
commit b47c0a64d4
5 changed files with 48 additions and 40 deletions

View File

@ -1,5 +1,4 @@
import { log } from "./log.js";
import bodyParser from "body-parser";
import express from "express";
import cookieParser from "cookie-parser";
import fs from "node:fs/promises";
@ -18,7 +17,6 @@ import { getRawData, generateAccountPage, editProfile, saveData, getUsers, isAdm
import { callAI } from "./ai.js";
import { Readable } from 'stream';
import os from "node:os";
import chokidar from 'chokidar';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@ -109,22 +107,6 @@ wss.on("connection", function connection(ws, req, res) {
ws.on("close", () => { server.close() });
});
app.post(
"/api/event",
(req, res) => {
fetch("https://analytics.skysthelimit.dev/api/event", {
method: "post",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: req.body
}).then(async (response) => {
res.send(response.status);
})
}
);
app.post("/register", async (req, res) => {
let status = await createAccount(req.body.username, req.body.password, req.body["h-captcha-response"]);
if (status["success"]) {
@ -178,7 +160,7 @@ app.post("/api/account/upload", async (req, res, next) => {
});
app.post("/api/analytics/game", async (req, res) => {
if (req.body && req.body.path.length < 16) {
if (req.body && req.body.path.length < 32) {
const query = top.prepare(`
INSERT INTO stats (game, plays)
VALUES ($id, 1)