aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-11-15 23:34:24 -0800
committerAdam Soltys <[email protected]>2023-11-15 23:34:24 -0800
commit417f669783b275d21382e80eb4c8e793a09666a8 (patch)
treec956e6feedb0723739b3f2f7606fcdce7710fbf0
parenta81cb5add30036b5cf206e9f8003287922344725 (diff)
downloadcoinos-server-417f669783b275d21382e80eb4c8e793a09666a8.tar.gz
coinos-server-417f669783b275d21382e80eb4c8e793a09666a8.zip
fix images
-rw-r--r--routes/payments.js35
1 files changed, 32 insertions, 3 deletions
diff --git a/routes/payments.js b/routes/payments.js
index e8f9888e..416f4510 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -39,7 +39,7 @@ export default {
let { amount, hash, maxfee, fund, memo, payreq, username } = body;
try {
- if (await g('freeze')) fail("Problem sending payment");
+ if (await g("freeze")) fail("Problem sending payment");
amount = parseInt(amount);
if (amount < 0) fail("Invalid amount");
@@ -513,11 +513,40 @@ export default {
async fix({ body: { uid, username }, user }, res) {
try {
if (!user.admin) fail("unauthorized");
+
for await (let k of db.scanIterator({ MATCH: "balance:*" })) {
let bal = await g(k);
if (bal < 0) s(k, 0);
}
+ for await (let k of db.scanIterator({ MATCH: "user:*" })) {
+ let u = await g(k);
+ let id = k.split(":")[1];
+
+ if (typeof u === "String") {
+ id = u;
+ u = await g(`user:${u}`);
+ }
+
+ if (!(u && u.username)) continue;
+
+ let touched;
+
+ console.log(u.username, u.profile, u.banner);
+
+ if (u.profile) {
+ u.profile = `${u.id}-profile`;
+ touched = true;
+ }
+
+ if (u.banner) {
+ u.banner = `${u.id}-banner`;
+ touched = true;
+ }
+
+ if (touched) await s(`user:${u.id}`, u);
+ }
+
res.send("ok");
} catch (e) {
console.log(e);
@@ -525,10 +554,10 @@ export default {
}
},
- async freeze({ body: { secret }}, res) {
+ async freeze({ body: { secret } }, res) {
try {
if (secret !== config.adminpass) fail("unauthorized");
- await s('freeze', true);
+ await s("freeze", true);
res.send("ok");
} catch (e) {
console.log(e);