From 404b390186b9786df598b8e2f9adc20fa8910040 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 06:58:33 -0700 Subject: fix R$ symbol --- src/components/Numpad.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 82512678..5ea1418c 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -31,7 +31,7 @@ AUD: '$', NZD: '$', MXN: '$', - BRL: '$', + BRL: 'R$', HKD: '$', TWD: '$', JPY: '¥', -- cgit v1.2.3 From b25d9f80dba70f8768484d1143025f5cb120d98d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 13:57:29 -0700 Subject: send token with heartbeat --- src/lib/socket.js | 2 +- src/routes/(app)/+layout.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/socket.js b/src/lib/socket.js index aef8a513..e8859fa6 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -7,7 +7,7 @@ import { browser } from '$app/environment'; let socket, token; -export const auth = () => token && send('login', token) && send('heartbeat'); +export const auth = () => token && send('login', token); export const send = (type, data) => { socket?.readyState === 1 && socket.send(JSON.stringify({ type, data })); diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 9eb8f18c..655e28c7 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -39,7 +39,7 @@ lost = Date.now() - $last > 15000; if (lost) connect(token); if (counter > 5) { - send('heartbeat'); + send('heartbeat', token); counter = 0; } timer = setTimeout(checkSocket, 1000); -- cgit v1.2.3 From c95b31063e35c814a7676b1039b3e82f24fd6424 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 14:02:50 -0700 Subject: log --- src/routes/(app)/+layout.svelte | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 655e28c7..2eac7fd4 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -39,6 +39,7 @@ lost = Date.now() - $last > 15000; if (lost) connect(token); if (counter > 5) { + console.log("heartbeat"); send('heartbeat', token); counter = 0; } -- cgit v1.2.3 From cecf46ee4ad8bbbb9d2c5ff4eb71d6a6dc61c4cc Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 14:25:45 -0700 Subject: update layout data --- src/routes/(app)/+layout.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 2eac7fd4..11872952 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -14,8 +14,12 @@ export let data; - let { subject } = $page.data; - let { rate, user, token, rates } = data; + let { rate, user, subject, token, rates } = data; + + $: update(data); + let update = (data) => { + ({ rate, user, subject, token, rates } = data); + } onMount(() => { let localStorageLocale = localStorage.getItem(localeLocalStorageKey); -- cgit v1.2.3 From 8d5dad486398552fc9f763f8ef8c99897873f6b2 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 20:50:44 -0700 Subject: increase lost connection window --- src/routes/(app)/+layout.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 11872952..9bc92990 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -40,10 +40,9 @@ let checkSocket = () => { counter++; - lost = Date.now() - $last > 15000; + lost = Date.now() - $last > 30000; if (lost) connect(token); if (counter > 5) { - console.log("heartbeat"); send('heartbeat', token); counter = 0; } -- cgit v1.2.3 From 7c967ae84b2f5620d3efed2ce1e93551ddbde04a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 22:26:25 -0700 Subject: skip undefined locations --- src/components/LocationsMap.svelte | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index 8a1b6afd..20ef8878 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -100,9 +100,7 @@ let markers = new MarkerClusterGroup(); locations.forEach((location) => { - if (location['deleted_at']) { - return; - } + if (location['deleted_at'] || !(location.lan && location.lon)) return; location = location['osm_json']; -- cgit v1.2.3 From 1cf10289b840d6fc56986d114fd762da75f4b103 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 22:27:50 -0700 Subject: filter out payments with no lat/lon --- src/components/LocationsMap.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index 20ef8878..d84fa4ae 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -38,7 +38,7 @@ locations = locations.filter( (location) => - location['osm_json'].tags && location['osm_json'].tags['payment:coinos'] === 'yes' + location['osm_json'].tags && location['osm_json'].tags['payment:coinos'] === 'yes' && location.lat && location.lon ); /* const locations = [ -- cgit v1.2.3 From 9cce167a005d8261e4d5fbbcf0d97506a0ae8d5d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 22:34:46 -0700 Subject: fix locations --- src/components/LocationsMap.svelte | 42 +++++--------------------------------- src/routes/+page.svelte | 7 +++++-- 2 files changed, 10 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index d84fa4ae..20eea6c0 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -38,43 +38,12 @@ locations = locations.filter( (location) => - location['osm_json'].tags && location['osm_json'].tags['payment:coinos'] === 'yes' && location.lat && location.lon + location['osm_json'].tags && + location['osm_json'].tags['payment:coinos'] === 'yes' && + location['osm_json'].lat && + location['osm_json'].lon ); - /* const locations = [ - { - lat: 49.27034, - lng: -123.141373, - info: 'Rolf Vancouver
1628 W 1st Ave #231, Vancouver
www.rolfbodywork.com' - }, - { lat: 49.26419, lng: -123.15702, info: 'Tacos Jorge
2287 W Broadway, Vancouver' }, - { - lat: 49.28273, - lng: -123.120735, - info: 'Engage Strategies
LinkedIn' - }, - { - lat: 49.28134, - lng: -123.02373, - info: 'Lumota Collection
Clothing Design/Upcycling - Appointment Only
778-726-3776
369 Boundary Rd, Vancouver, BC V5K 2B1
IG: Lumotacollection
FB: Lumotacollection' - }, - { - lat: 49.22643, - lng: -122.93085, - info: 'Goodwin Contracting
Project Management/Consulting - Appointment Only
403-812-1085
8017 17th Ave, Burnaby, BC V3N 1M5' - }, - { - lat: 51.04813, - lng: -114.07999, - info: 'Goodwin Contracting
Project Management/Consulting - Appointment Only
403-812-1085
8017 17th Ave, Burnaby, BC V3N 1M5' - }, - { - lat: 49.2677, - lng: -123.10124, - info: 'General Strike Coffee
Artisan coffee shop
1965 Main St, Vancouver, BC V5T 2K6
IG: generalstrikecoffee' - } - ];*/ - L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner/{z}/{x}/{y}.png', { maxZoom: 18, subdomains: ['a', 'b', 'c', 'd'] @@ -100,10 +69,9 @@ let markers = new MarkerClusterGroup(); locations.forEach((location) => { - if (location['deleted_at'] || !(location.lan && location.lon)) return; + if (location['deleted_at']) return; location = location['osm_json']; - let marker = L.marker([location.lat, location.lon]); marker.bindPopup( diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2db2854a..2748e5c0 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -15,8 +15,11 @@ import { onMount } from 'svelte'; export let data; - let { user } = data; - let { locations } = data; + let { locations, user } = data; + let update = (data) => ({ locations, user } = data); + $: update(data); + + console.log(data, locations.length); let howItWorks; let faq; -- cgit v1.2.3 From 145b9014b53c3c4809ca5d221f47f54a055c9eab Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 22:36:43 -0700 Subject: remove lost connection notice --- src/routes/(app)/+layout.svelte | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 9bc92990..33e953ee 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -73,12 +73,6 @@ -{#if lost} -
- Lost connection to server, try refreshing -
-{/if} -
-- cgit v1.2.3 From 35a80133c67ef1cfca1844815dc7188f6013c55b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 13 Apr 2023 22:38:04 -0700 Subject: remove log --- src/routes/+page.svelte | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2748e5c0..3a5a54f3 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -19,8 +19,6 @@ let update = (data) => ({ locations, user } = data); $: update(data); - console.log(data, locations.length); - let howItWorks; let faq; let about; -- cgit v1.2.3 From d25869556f91ece19a1d1586da7587f9e8afdf7c Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 14 Apr 2023 22:02:45 -0700 Subject: forward ip header --- src/routes/(app)/register/+page.server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/routes/(app)/register/+page.server.js b/src/routes/(app)/register/+page.server.js index e71b2a60..8a8ca81c 100644 --- a/src/routes/(app)/register/+page.server.js +++ b/src/routes/(app)/register/+page.server.js @@ -16,7 +16,7 @@ export const actions = { if (loginRedirect === 'undefined') loginRedirect = undefined; try { - await post('/register', { user }); + await post('/register', { user }, { "cf-connecting-ip": request.headers.get('cf-connecting-ip') }); } catch (e) { if (e.message.includes('taken')) error = e.message; } -- cgit v1.2.3 From 472a9c99b298bcfabf944905f833ffe61cf22d63 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 17 Apr 2023 08:32:49 -0700 Subject: print button --- src/routes/(app)/payment/[id]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 9e61cbd6..1da3f872 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -113,7 +113,7 @@ {/if} - {#if user.username.toLowerCase() === 'laughingbean'} + {#if ['laughingbean', 'burnabyartigiano', 'milanowestend'].includes(user.username.toLowerCase()) } Date: Mon, 17 Apr 2023 09:05:54 -0700 Subject: redirect to scanned urls --- src/routes/(app)/send/[...text]/+page.server.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js index 9c7d4185..dbe2b660 100644 --- a/src/routes/(app)/send/[...text]/+page.server.js +++ b/src/routes/(app)/send/[...text]/+page.server.js @@ -6,6 +6,8 @@ import { fail, redirect } from '@sveltejs/kit'; let parse = async (t, host) => { if (!t) return; + if (t.startsWith('http')) throw redirect(307, t); + let amount, user, id; t = t.trim(); -- cgit v1.2.3 From 702e6ed3516be6dbd82afbffcb3eb4704a3e03b4 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 17 Apr 2023 23:03:59 -0700 Subject: expire pin after 5 minutes --- src/lib/store.js | 2 +- src/routes/(app)/+layout.svelte | 33 ++++++++++++++++------ .../[username]/settings/[...tab]/+page.svelte | 2 ++ src/routes/(app)/send/+layout.svelte | 3 -- 4 files changed, 27 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/lib/store.js b/src/lib/store.js index ce984b17..4e88c90c 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -46,7 +46,7 @@ export const newPayment = persistLocal('newPayment'); export const password = persistLocal('password'); export const passwordPrompt = writable(); export const payments = persistLocal('transactions', []); -export const pin = persistSession('pin', undefined); +export const pin = writable(); export const rate = writable(); export const request = writable(); export const requestRedirect = writable(); diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 33e953ee..891de9ac 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -2,7 +2,7 @@ import { SvelteToast } from '@zerodevx/svelte-toast'; import { onDestroy, onMount } from 'svelte'; import { close, connect, send } from '$lib/socket'; - import { last, invoice, request, passwordPrompt } from '$lib/store'; + import { last, invoice, request, passwordPrompt, pin } from '$lib/store'; import { page } from '$app/stores'; import { browser } from '$app/environment'; import { goto } from '$app/navigation'; @@ -16,10 +16,10 @@ let { rate, user, subject, token, rates } = data; - $: update(data); - let update = (data) => { - ({ rate, user, subject, token, rates } = data); - } + $: update(data); + let update = (data) => { + ({ rate, user, subject, token, rates } = data); + }; onMount(() => { let localStorageLocale = localStorage.getItem(localeLocalStorageKey); @@ -29,13 +29,17 @@ if (lng) localStorage.setItem(localeLocalStorageKey, lng); }); - browser && checkSocket(); + if (browser) { + checkSocket(); + expirePin(); + } }); $: browser && connect(token); let lost, - timer, + checkTimer, + expireTimer, counter = 0; let checkSocket = () => { @@ -46,10 +50,21 @@ send('heartbeat', token); counter = 0; } - timer = setTimeout(checkSocket, 1000); + + checkTimer = setTimeout(checkSocket, 1000); }; - onDestroy(() => browser && clearTimeout(timer)); + let expirePin = () => { + $pin = null; + expireTimer = setTimeout(expirePin, 300000); + }; + + onDestroy(() => { + if (browser) { + clearTimeout(checkTimer); + clearTimeout(expireTimer); + } + }); {#if browser && $passwordPrompt} diff --git a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte index 1b212abe..2bd465a7 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte @@ -33,6 +33,8 @@ $: form?.success && success('Settings saved!'); + $: form?.message && fail(form.message); + $: if (form?.message?.startsWith('Pin')) { fail('Wrong pin, try again'); $pin = ''; diff --git a/src/routes/(app)/send/+layout.svelte b/src/routes/(app)/send/+layout.svelte index 6192cd40..47c11f1c 100644 --- a/src/routes/(app)/send/+layout.svelte +++ b/src/routes/(app)/send/+layout.svelte @@ -1,10 +1,7 @@