aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.ts19
-rw-r--r--lib/payments.ts1
-rw-r--r--lib/register.ts2
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/app.ts b/lib/app.ts
index df696bc6..1beedcd4 100644
--- a/lib/app.ts
+++ b/lib/app.ts
@@ -22,8 +22,23 @@ const app = fastify({
const reqLogger = pino(pino.destination("req"));
const resLogger = pino(pino.destination("res"));
-app.addHook("onRequest", async (req) => {
- reqLogger.info({ url: req.raw.url, id: req.id });
+// app.addHook("onRequest", async (req) => {
+// reqLogger.info({ url: req.raw.url, id: req.id });
+// });
+//
+
+app.addHook("preHandler", async (req) => {
+ const url = req.raw.url;
+ const ignore = ["/login","/ws","/me","/confirm","/public"];
+ if (req.method === "GET" || ignore.some(path => url.startsWith(path))) return;
+
+ reqLogger.info({
+ method: req.method,
+ url,
+ headers: req.headers,
+ body: req.body,
+ id: req.id
+ });
});
app.addHook("onResponse", async (req, reply) => {
diff --git a/lib/payments.ts b/lib/payments.ts
index 437db14f..cbff6dd3 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -299,6 +299,7 @@ export const completePayment = async (inv, p, user) => {
if (p.confirmed) {
if (autowithdraw) {
try {
+ fail("autowithdrawals disabled");
const to = destination.trim();
const balance = await g(`balance:${id}`);
const amount = balance - reserve;
diff --git a/lib/register.ts b/lib/register.ts
index c1c73a38..107be6ea 100644
--- a/lib/register.ts
+++ b/lib/register.ts
@@ -23,7 +23,7 @@ export default async (user, ip) => {
const id = v4();
user.id = id;
- const exists = await getUser(username);
+ const exists = await db.exists(`user:${username}`);
if (exists) fail(`Username ${username} taken`);
if (password) {