From 6e5c851fe1c4e7402014c5a42c8a5f919365a2c7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 Feb 2026 22:49:08 -0800 Subject: trigger import --- routes/users.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/routes/users.ts b/routes/users.ts index 8d67444d..3fe9077a 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -959,7 +959,7 @@ export default { async updateAccount(req, res) { const { id } = req.params; const { id: uid } = req.user; - const { name, autowithdraw, threshold, reserve, destination, currency } = + const { name, autowithdraw, threshold, reserve, destination, currency, fingerprint, pubkey } = req.body; const pos = await db.lPos(`${uid}:accounts`, id); @@ -972,8 +972,25 @@ export default { if (reserve !== undefined) account.reserve = reserve; if (destination !== undefined) account.destination = destination.trim(); if (currency !== undefined) account.currency = currency; + + let needsImport = false; + if (fingerprint !== undefined && pubkey !== undefined) { + account.fingerprint = fingerprint; + account.pubkey = pubkey; + account.importedAt = null; + needsImport = true; + } + await s(`account:${id}`, account); + if (needsImport) { + importAccountHistory(account).then(() => { + emit(uid, "payment", { aid: id, type: "import" }); + }).catch((e) => + console.error("importAccountHistory failed:", e.message), + ); + } + res.send(account); }, -- cgit v1.2.3