diff --git a/README.md b/README.md index b5947283..04112fab 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ If you like Coracle and want to support its development, you can donate sats via - [x] Persistent color-coded relay list - [x] Smart relay selection and display - [x] Connection quality information -- [ ] Invoice, bech32 entity, mention, link, image, and video rendering -- [ ] Installable as a progressive web app +- [x] Invoice, bech32 entity, mention, link, image, and video rendering +- [x] Installable as a progressive web app +- [x] Media uploads +- [x] Lightning zaps - [ ] Feeds customizable by person, relay, and topic -- [ ] Media uploads -- [ ] Lightning tips and zaps - [ ] Keyword mutes - [ ] Exportable copy of all user events - [ ] Reporting and basic distributed moderation diff --git a/ROADMAP.md b/ROADMAP.md index 752897af..fa2be597 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,7 +1,5 @@ # Current -- [ ] Show image upload rather than plop url in -- [ ] Hash pubkey so we can track usage by unique user - [ ] Try adding boxes/separation on feeds based on user feedback - [ ] Strip zero width spaces from compose - [ ] Fix iOS/safari/firefox diff --git a/src/App.svelte b/src/App.svelte index e2209bff..34977948 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -96,17 +96,20 @@ } }) + // Remove identifying information, e.g. pubkeys, event ids, etc + const getPageName = () => + location.pathname.slice(1) + .replace(/(npub|nprofile|note|nevent)[^\/]+/g, (_, m) => `<${m}>`) + // Log usage on navigate const unsubHistory = globalHistory.listen(({location}) => { if (!location.hash) { - // Remove identifying information, e.g. pubkeys, event ids, etc - const name = location.pathname.slice(1) - .replace(/(npub|nprofile|note|nevent)[^\/]+/g, (_, m) => `<${m}>`) - - logUsage(btoa(['page', name].join(':'))) + logUsage(btoa(['page', getPageName()].join(':'))) } }) + logUsage(btoa(['page', getPageName()].join(':'))) + return () => { unsubHistory() unsubModal() diff --git a/src/app/ui.ts b/src/app/ui.ts index 80c3c720..91995fc3 100644 --- a/src/app/ui.ts +++ b/src/app/ui.ts @@ -6,7 +6,7 @@ import {navigate} from "svelte-routing" import {nip19} from 'nostr-tools' import {writable, get} from "svelte/store" import {globalHistory} from "svelte-routing/src/history" -import {sleep} from "src/util/misc" +import {sleep, hash} from "src/util/misc" import {warn} from 'src/util/logger' import user from 'src/agent/user' @@ -114,11 +114,14 @@ setTimeout(() => { const session = Math.random().toString().slice(2) export const logUsage = async name => { + // Hash the user's pubkey so we can identify unique users without knowing + // anything about them + const ident = hash(user.getPubkey()) const {dufflepudUrl, reportAnalytics} = user.getSettings() if (reportAnalytics) { try { - await fetch(`${dufflepudUrl}/usage/${session}/${name}`, {method: 'post' }) + await fetch(`${dufflepudUrl}/usage/${ident}/${session}/${name}`, {method: 'post'}) } catch (e) { if (!e.toString().includes('Failed to fetch')) { warn(e)