small changes for beta testing
This commit is contained in:
parent
72e235406c
commit
74df47b426
|
@ -30,6 +30,14 @@ app.get("/callback", async (req, res) => {
|
||||||
}),
|
}),
|
||||||
}).then((a) => a.json());
|
}).then((a) => a.json());
|
||||||
|
|
||||||
|
if (!who.success) {
|
||||||
|
res.json({
|
||||||
|
error: "AUTHENTICATION FAILED",
|
||||||
|
error_message: who.error || "no error specified",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const [username, hostname] = who.user.sub.split("@");
|
const [username, hostname] = who.user.sub.split("@");
|
||||||
|
|
||||||
await prisma.user.upsert({
|
await prisma.user.upsert({
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Canvas {
|
||||||
size: this.CANVAS_SIZE,
|
size: this.CANVAS_SIZE,
|
||||||
zoom: 7,
|
zoom: 7,
|
||||||
pixel: {
|
pixel: {
|
||||||
cooldown: 60,
|
cooldown: 10,
|
||||||
multiplier: 3,
|
multiplier: 3,
|
||||||
maxStack: 6,
|
maxStack: 6,
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,22 +80,25 @@ export class SocketServer {
|
||||||
// - needs to be exponential (takes longer to aquire more pixels stacked)
|
// - needs to be exponential (takes longer to aquire more pixels stacked)
|
||||||
// - convert to config options instead of hard-coded
|
// - convert to config options instead of hard-coded
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
Logger.debug("Running pixel stacking...");
|
const DEBUG = false;
|
||||||
|
|
||||||
|
if (DEBUG) Logger.debug("Running pixel stacking...");
|
||||||
const redis = await Redis.getClient();
|
const redis = await Redis.getClient();
|
||||||
const sockets = await this.io.local.fetchSockets();
|
const sockets = await this.io.local.fetchSockets();
|
||||||
|
|
||||||
for (const socket of sockets) {
|
for (const socket of sockets) {
|
||||||
const sub = await redis.get(Redis.key("socketToSub", socket.id));
|
const sub = await redis.get(Redis.key("socketToSub", socket.id));
|
||||||
if (!sub) {
|
if (!sub) {
|
||||||
Logger.warn(`Socket ${socket.id} has no user`);
|
if (DEBUG) Logger.warn(`Socket ${socket.id} has no user`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = await User.fromSub(sub);
|
const user = await User.fromSub(sub);
|
||||||
if (!user) {
|
if (!user) {
|
||||||
Logger.warn(
|
if (DEBUG)
|
||||||
`Socket ${socket.id}'s user (${sub}) does not exist in the database`
|
Logger.warn(
|
||||||
);
|
`Socket ${socket.id}'s user (${sub}) does not exist in the database`
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +119,9 @@ export class SocketServer {
|
||||||
user.pixelStack < getClientConfig().canvas.pixel.maxStack
|
user.pixelStack < getClientConfig().canvas.pixel.maxStack
|
||||||
) {
|
) {
|
||||||
await user.modifyStack(1);
|
await user.modifyStack(1);
|
||||||
Logger.debug(sub + " has gained another pixel in their stack");
|
|
||||||
|
if (DEBUG)
|
||||||
|
Logger.debug(sub + " has gained another pixel in their stack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
Loading…
Reference in New Issue