mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 03:17:02 +00:00
Make analytics and error reporting optional
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/* eslint prefer-rest-params: 0 */
|
/* eslint prefer-rest-params: 0 */
|
||||||
|
|
||||||
import {page} from "$app/stores"
|
import {page} from "$app/stores"
|
||||||
|
import {getSetting} from "@app/state"
|
||||||
|
|
||||||
const w = window as any
|
const w = window as any
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ w.plausible =
|
|||||||
|
|
||||||
export const setupAnalytics = () => {
|
export const setupAnalytics = () => {
|
||||||
page.subscribe($page => {
|
page.subscribe($page => {
|
||||||
if ($page.route) {
|
if ($page.route && getSetting("report_usage")) {
|
||||||
w.plausible("pageview", {u: $page.route.id})
|
w.plausible("pageview", {u: $page.route.id})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -305,6 +305,8 @@ export type Settings = {
|
|||||||
values: {
|
values: {
|
||||||
show_media: boolean
|
show_media: boolean
|
||||||
hide_sensitive: boolean
|
hide_sensitive: boolean
|
||||||
|
report_usage: boolean
|
||||||
|
report_errors: boolean
|
||||||
send_delay: number
|
send_delay: number
|
||||||
upload_type: "nip96" | "blossom"
|
upload_type: "nip96" | "blossom"
|
||||||
nip96_urls: string[]
|
nip96_urls: string[]
|
||||||
@@ -315,6 +317,8 @@ export type Settings = {
|
|||||||
export const defaultSettings = {
|
export const defaultSettings = {
|
||||||
show_media: true,
|
show_media: true,
|
||||||
hide_sensitive: true,
|
hide_sensitive: true,
|
||||||
|
report_usage: true,
|
||||||
|
report_errors: false,
|
||||||
send_delay: 3000,
|
send_delay: 3000,
|
||||||
upload_type: "nip96",
|
upload_type: "nip96",
|
||||||
nip96_urls: ["https://nostr.build"],
|
nip96_urls: ["https://nostr.build"],
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
import * as Sentry from "@sentry/browser"
|
import * as Sentry from "@sentry/browser"
|
||||||
|
import {getSetting} from "@app/state"
|
||||||
|
|
||||||
export const setupTracking = () => {
|
export const setupTracking = () => {
|
||||||
if (import.meta.env.VITE_GLITCHTIP_API_KEY) {
|
if (import.meta.env.VITE_GLITCHTIP_API_KEY) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: import.meta.env.VITE_GLITCHTIP_API_KEY,
|
dsn: import.meta.env.VITE_GLITCHTIP_API_KEY,
|
||||||
tracesSampleRate: 0.01,
|
beforeSend(event: any) {
|
||||||
|
if (!getSetting("report_errors")) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return event
|
||||||
|
},
|
||||||
integrations(integrations) {
|
integrations(integrations) {
|
||||||
return integrations.filter(integration => integration.name !== "Breadcrumbs")
|
return integrations.filter(integration => integration.name !== "Breadcrumbs")
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<form class="content column gap-4" {onsubmit}>
|
<form class="content column gap-4" {onsubmit}>
|
||||||
<div class="card2 bg-alt col-4 shadow-xl">
|
<div class="card2 bg-alt col-4 shadow-xl">
|
||||||
<p class="text-lg">Content Settings</p>
|
<strong class="text-lg">Content Settings</strong>
|
||||||
<FieldInline>
|
<FieldInline>
|
||||||
{#snippet label()}
|
{#snippet label()}
|
||||||
<p>Hide sensitive content?</p>
|
<p>Hide sensitive content?</p>
|
||||||
@@ -77,7 +77,37 @@
|
|||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Field>
|
</Field>
|
||||||
<p class="text-lg">Editor Settings</p>
|
<strong class="text-lg">Privacy Settings</strong>
|
||||||
|
<FieldInline>
|
||||||
|
{#snippet label()}
|
||||||
|
<p>Report errors?</p>
|
||||||
|
{/snippet}
|
||||||
|
{#snippet input()}
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="toggle toggle-primary"
|
||||||
|
bind:checked={settings.report_errors} />
|
||||||
|
{/snippet}
|
||||||
|
{#snippet info()}
|
||||||
|
<p>
|
||||||
|
Allow {PLATFORM_NAME} to send error reports to help improve the app.
|
||||||
|
</p>
|
||||||
|
{/snippet}
|
||||||
|
</FieldInline>
|
||||||
|
<FieldInline>
|
||||||
|
{#snippet label()}
|
||||||
|
<p>Report usage?</p>
|
||||||
|
{/snippet}
|
||||||
|
{#snippet input()}
|
||||||
|
<input type="checkbox" class="toggle toggle-primary" bind:checked={settings.report_usage} />
|
||||||
|
{/snippet}
|
||||||
|
{#snippet info()}
|
||||||
|
<p>
|
||||||
|
Allow {PLATFORM_NAME} to collect anonymous usage data.
|
||||||
|
</p>
|
||||||
|
{/snippet}
|
||||||
|
</FieldInline>
|
||||||
|
<strong class="text-lg">Editor Settings</strong>
|
||||||
<FieldInline>
|
<FieldInline>
|
||||||
{#snippet label()}
|
{#snippet label()}
|
||||||
<p>Send Delay</p>
|
<p>Send Delay</p>
|
||||||
@@ -119,7 +149,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{#snippet info()}
|
{#snippet info()}
|
||||||
<p>Choose a media server type and url for files you upload to flotilla.</p>
|
<p>Choose a media server type and url for files you upload to {PLATFORM_NAME}.</p>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Field>
|
</Field>
|
||||||
<div class="mt-4 flex flex-row items-center justify-between gap-4">
|
<div class="mt-4 flex flex-row items-center justify-between gap-4">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import {hexToBytes} from "@noble/hashes/utils"
|
import {hexToBytes} from "@noble/hashes/utils"
|
||||||
import {displayPubkey, displayProfile} from "@welshman/util"
|
import {displayPubkey, displayProfile} from "@welshman/util"
|
||||||
import {pubkey, session, displayNip05, deriveProfile} from "@welshman/app"
|
import {pubkey, session, displayNip05, deriveProfile} from "@welshman/app"
|
||||||
|
import {slideAndFade} from "@lib/transition"
|
||||||
import Icon from "@lib/components/Icon.svelte"
|
import Icon from "@lib/components/Icon.svelte"
|
||||||
import FieldInline from "@lib/components/FieldInline.svelte"
|
import FieldInline from "@lib/components/FieldInline.svelte"
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
@@ -29,6 +30,8 @@
|
|||||||
const startEject = () => pushModal(InfoKeys)
|
const startEject = () => pushModal(InfoKeys)
|
||||||
|
|
||||||
const startDelete = () => pushModal(ProfileDelete)
|
const startDelete = () => pushModal(ProfileDelete)
|
||||||
|
|
||||||
|
let showAdvanced = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="content column gap-4">
|
<div class="content column gap-4">
|
||||||
@@ -122,10 +125,24 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<Alerts />
|
<Alerts />
|
||||||
<div class="card2 bg-alt col-4 shadow-xl">
|
<div class="card2 bg-alt shadow-xl">
|
||||||
<Button class="btn btn-outline btn-error" onclick={startDelete}>
|
<div class="flex items-center justify-between">
|
||||||
<Icon icon="trash-bin-2" />
|
<strong>Advanced</strong>
|
||||||
Delete your profile
|
<Button onclick={() => (showAdvanced = !showAdvanced)}>
|
||||||
</Button>
|
{#if showAdvanced}
|
||||||
|
<Icon icon="alt-arrow-down" />
|
||||||
|
{:else}
|
||||||
|
<Icon icon="alt-arrow-up" />
|
||||||
|
{/if}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{#if showAdvanced}
|
||||||
|
<div transition:slideAndFade class="pt-4">
|
||||||
|
<Button class="btn btn-outline btn-error" onclick={startDelete}>
|
||||||
|
<Icon icon="trash-bin-2" />
|
||||||
|
Delete your profile
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user