fix analytics
This commit is contained in:
20
index.js
20
index.js
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user