aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-02-23 12:56:20 -0800
committerAdam Soltys <[email protected]>2024-02-23 12:56:20 -0800
commit9384f53f91ad4e68dacfb3ce5bd722555a3939e0 (patch)
tree359d89d4f4692b92df2f466b3d1f232fe5d0f0aa
parent4585996d3fcace056993d3f0c6959cd7f31e4438 (diff)
downloadcoinos-ui-9384f53f91ad4e68dacfb3ce5bd722555a3939e0.tar.gz
coinos-ui-9384f53f91ad4e68dacfb3ce5bd722555a3939e0.zip
hijack pay button
-rw-r--r--src/lib/invoice.js4
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte1
-rw-r--r--src/routes/(app)/[username]/(profile)/+page.svelte7
-rw-r--r--src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte5
4 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/invoice.js b/src/lib/invoice.js
index 98f6f2ca..d2d3d13d 100644
--- a/src/lib/invoice.js
+++ b/src/lib/invoice.js
@@ -28,7 +28,5 @@ export default async ({ cookies, request, url }) => {
if (invoice.memoPrompt && !invoice.memo) {
redirect(307, `/${user.username}/invoice/${id}/memo`);
- }
-
- else redirect(307, `/${user.username}/invoice/${id}`);
+ } else redirect(307, `/${user.username}/invoice/${id}`);
};
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index 65e936bb..3c64f80f 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -153,6 +153,7 @@
? `/send/${subject.username}`
: `/${subject.username}/receive`}
class="contents"
+ id="payButton"
>
<button
class="rounded-2xl border py-5 px-6 font-bold hover:opacity-80 flex w-60 grow"
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte
index e681c214..0fc26c85 100644
--- a/src/routes/(app)/[username]/(profile)/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/+page.svelte
@@ -71,6 +71,11 @@
dragDisabled = false;
}
+ $: if (total > 0 && browser) {
+ let payButton = document.querySelector("#payButton");
+ payButton.addEventListener("click", checkout);
+ }
+
let checkout = async () => {
let invoice = {
type: "lightning",
@@ -87,7 +92,7 @@
user: { username: subject.username },
});
- goto(`/send/invoice/${id}`, { invalidateAll: true });
+ goto(`/send/invoice/${id}`, { invalidateAll: true });
};
let reset = () =>
diff --git a/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte
index ec35c3fb..13493829 100644
--- a/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte
+++ b/src/routes/(app)/[username]/invoice/[id]/tip/+page.svelte
@@ -115,12 +115,15 @@
<input type="hidden" name="tip" value={tip} />
<input type="hidden" name="username" value={username} />
<input type="hidden" name="rate" value={invoice.rate} />
- <input type="hidden" name="memoPrompt" value={invoice.memoPrompt} />
<input type="hidden" name="prompt" value="false" />
<input type="hidden" name="type" value={type} />
<input type="hidden" name="hash" value={hash} />
<input type="hidden" name="items" value={JSON.stringify(items)} />
+ {#if invoice.memoPrompt}
+ <input type="hidden" name="memoPrompt" value={invoice.memoPrompt} />
+ {/if}
+
<h1 class="text-4xl font-semibold my-8">{$t("invoice.addTipq")}</h1>
{#if !showCustomAmount}
<div class="my-2 text-xl">{Math.round(tipPercent)}%</div>