diff options
| author | Adam Soltys <[email protected]> | 2026-06-25 18:08:07 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-25 18:08:07 -0700 |
| commit | 1edb9ac5723f2d5fda5093437b2e375f98af3777 (patch) | |
| tree | 1af7769f023da7d1a57f835285259bf749a0d86b /src/app.js | |
| parent | 6245a4583e786beaa6d5c02f7abfb646eddf00c6 (diff) | |
| download | coinosv3-1edb9ac5723f2d5fda5093437b2e375f98af3777.tar.gz coinosv3-1edb9ac5723f2d5fda5093437b2e375f98af3777.zip | |
Settings: let users opt out of coinos realtime notifications (privacy)
The WS watcher is the one place the app shares addresses off-device (it
subscribes your scripthashes to coinos to push instant payment updates). Add an
'Instant notifications' toggle in the explorer settings: off means the app never
connects to coinos and polls your chosen explorer instead — a bit slower, more
requests, but nothing is told to coinos. wsUrl returns null when disabled, so
startRealtime cleanly skips the socket and relies on the polling fallback.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/app.js')
| -rw-r--r-- | src/app.js | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -8,7 +8,7 @@ import { Wallet, newMnemonic, isValidMnemonic, utxoId, previewGift, giftOutpoint import { qrSvg } from './qr.js'; import { scanQr } from './scan.js'; import { getSyncConfig, setSyncConfig } from './nostr.js'; -import { getExplorerConfig, setExplorerConfig, EXPLORER_PRESETS } from './api.js'; +import { getExplorerConfig, setExplorerConfig, EXPLORER_PRESETS, getRealtimeEnabled, setRealtimeEnabled } from './api.js'; import { t, LANGS, getLang, setLang, isRTL, loadLocale } from './i18n.js'; import { fmtBtc, @@ -1298,6 +1298,13 @@ async function doRevoke(id) { // or a custom Esplora/electrs REST URL (e.g. your own node). function explorerCard() { const cfg = getExplorerConfig(); + const rt = getRealtimeEnabled(); + const setRealtime = (on) => { + if (on === getRealtimeEnabled()) return; + setRealtimeEnabled(on); + render(); + if (!wallet.offline) wallet.startRealtime(); // reconnect or drop the watcher + }; return h( 'div', { class: 'card col' }, @@ -1330,7 +1337,17 @@ function explorerCard() { }), h('div', { class: 'small faint' }, t('explorerUrlHint')) ) - : null + : null, + // Realtime via coinos — the one place addresses are shared off-device. Opt + // out to poll the explorer above instead (a bit slower, nothing told to coinos). + h('div', { class: 'row between', style: 'margin-top:8px' }, + h('span', { class: 'lab', style: 'margin:0' }, t('instantNotif')), + h('div', { class: 'seg' }, + h('button', { type: 'button', class: rt ? 'active' : '', onClick: () => setRealtime(true) }, t('syncOn')), + h('button', { type: 'button', class: !rt ? 'active' : '', onClick: () => setRealtime(false) }, t('syncOff')) + ) + ), + h('div', { class: 'small faint' }, t('instantNotifDesc')) ); } |
