aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/app.ts5
-rw-r--r--lib/db.ts1
-rw-r--r--lib/payments.ts1
-rw-r--r--routes/users.ts7
4 files changed, 8 insertions, 6 deletions
diff --git a/lib/app.ts b/lib/app.ts
index 837d2647..df696bc6 100644
--- a/lib/app.ts
+++ b/lib/app.ts
@@ -81,7 +81,10 @@ app.register(fastifyStatic, {
prefix: "/public/",
});
-await app.register(cors, { origin: true });
+await app.register(cors, {
+ origin: true,
+ credentials: true,
+});
app.setErrorHandler((error, _, reply) => {
if (error instanceof fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) {
diff --git a/lib/db.ts b/lib/db.ts
index 762afa41..56921adb 100644
--- a/lib/db.ts
+++ b/lib/db.ts
@@ -48,6 +48,7 @@ if redis.call('exists', paymentKey) == 1 then
redis.call('incrby', creditKey, credit)
redis.call('del', hashKey)
redis.call('lrem', paymentsKey, 0, pid)
+ redis.call('lrem', 'payments', 0, pid)
return pid
else
error("Payment has already been reversed" .. paymentKey)
diff --git a/lib/payments.ts b/lib/payments.ts
index 9c9f1794..437db14f 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -160,6 +160,7 @@ export const debit = async ({
await s(`payment:${id}`, p);
await db
.multi()
+ .lPush("payments", id)
.lPush(`${aid || uid}:payments`, id)
.set(`${aid || uid}:payments:last`, p.created)
.exec();
diff --git a/routes/users.ts b/routes/users.ts
index e39b3337..776c2562 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -304,9 +304,6 @@ export default {
try {
let { username, password, token: twofa } = req.body;
- if (username !== "coinos")
- l("logging in", username, req.headers["cf-connecting-ip"]);
-
username = username.toLowerCase().replace(/\s/g, "");
let user = await getUser(username);
@@ -333,8 +330,8 @@ export default {
}
}
- if (username !== "coinos" && username !== "funk" && username !== "btcpos")
- l("logged in", username);
+ if (username !== "coinos")
+ l("logged in", username, req.headers['cf-connecting-ip']);
const payload = { id: user.id };
const token = jwt.sign(payload, config.jwt);