mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 00:10:52 +00:00
Add hashed pubkey to usage data
This commit is contained in:
parent
c16ea1e8e8
commit
1e48e46275
@ -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] Persistent color-coded relay list
|
||||||
- [x] Smart relay selection and display
|
- [x] Smart relay selection and display
|
||||||
- [x] Connection quality information
|
- [x] Connection quality information
|
||||||
- [ ] Invoice, bech32 entity, mention, link, image, and video rendering
|
- [x] Invoice, bech32 entity, mention, link, image, and video rendering
|
||||||
- [ ] Installable as a progressive web app
|
- [x] Installable as a progressive web app
|
||||||
|
- [x] Media uploads
|
||||||
|
- [x] Lightning zaps
|
||||||
- [ ] Feeds customizable by person, relay, and topic
|
- [ ] Feeds customizable by person, relay, and topic
|
||||||
- [ ] Media uploads
|
|
||||||
- [ ] Lightning tips and zaps
|
|
||||||
- [ ] Keyword mutes
|
- [ ] Keyword mutes
|
||||||
- [ ] Exportable copy of all user events
|
- [ ] Exportable copy of all user events
|
||||||
- [ ] Reporting and basic distributed moderation
|
- [ ] Reporting and basic distributed moderation
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# Current
|
# 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
|
- [ ] Try adding boxes/separation on feeds based on user feedback
|
||||||
- [ ] Strip zero width spaces from compose
|
- [ ] Strip zero width spaces from compose
|
||||||
- [ ] Fix iOS/safari/firefox
|
- [ ] Fix iOS/safari/firefox
|
||||||
|
@ -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
|
// Log usage on navigate
|
||||||
const unsubHistory = globalHistory.listen(({location}) => {
|
const unsubHistory = globalHistory.listen(({location}) => {
|
||||||
if (!location.hash) {
|
if (!location.hash) {
|
||||||
// Remove identifying information, e.g. pubkeys, event ids, etc
|
logUsage(btoa(['page', getPageName()].join(':')))
|
||||||
const name = location.pathname.slice(1)
|
|
||||||
.replace(/(npub|nprofile|note|nevent)[^\/]+/g, (_, m) => `<${m}>`)
|
|
||||||
|
|
||||||
logUsage(btoa(['page', name].join(':')))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
logUsage(btoa(['page', getPageName()].join(':')))
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
unsubHistory()
|
unsubHistory()
|
||||||
unsubModal()
|
unsubModal()
|
||||||
|
@ -6,7 +6,7 @@ import {navigate} from "svelte-routing"
|
|||||||
import {nip19} from 'nostr-tools'
|
import {nip19} from 'nostr-tools'
|
||||||
import {writable, get} from "svelte/store"
|
import {writable, get} from "svelte/store"
|
||||||
import {globalHistory} from "svelte-routing/src/history"
|
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 {warn} from 'src/util/logger'
|
||||||
import user from 'src/agent/user'
|
import user from 'src/agent/user'
|
||||||
|
|
||||||
@ -114,11 +114,14 @@ setTimeout(() => {
|
|||||||
const session = Math.random().toString().slice(2)
|
const session = Math.random().toString().slice(2)
|
||||||
|
|
||||||
export const logUsage = async name => {
|
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()
|
const {dufflepudUrl, reportAnalytics} = user.getSettings()
|
||||||
|
|
||||||
if (reportAnalytics) {
|
if (reportAnalytics) {
|
||||||
try {
|
try {
|
||||||
await fetch(`${dufflepudUrl}/usage/${session}/${name}`, {method: 'post' })
|
await fetch(`${dufflepudUrl}/usage/${ident}/${session}/${name}`, {method: 'post'})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!e.toString().includes('Failed to fetch')) {
|
if (!e.toString().includes('Failed to fetch')) {
|
||||||
warn(e)
|
warn(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user