Skip to content

Commit 4d52834

Browse files
committed
review: dobby fixes on the GlitchTip PR
- docker-compose.yml glitchtip-init: invert the DEV_KEY rewrite condition. GlitchTip auto-creates a default ProjectKey on Project save, so get_or_create returns that auto-created key (key_created=False) and the `defaults={'public_key': DEV_KEY}` clause is ignored. The previous `if key_created and …` branch was unreachable, leaving the DSN pinned UUID never applied on fresh volumes. - errorReporting.ts: drop `navigator.platform` (deprecated; Firefox returns "" already). - CrashReport.svelte: - Wrap reportError() in try/catch so a synchronous SDK throw can't leave the button stuck on "Sending…". - Add `:focus-visible` outline on .crash-btn (WCAG 2.4.7). - Move the failed-state <p> into a stable role=status / aria-live live region so screen readers announce it (WCAG 4.1.3). - fileshare/+page.svelte: move <svelte:boundary> above <FileInput> so a render-time error in FileInput is caught by CrashReport instead of crashing the whole page.
1 parent dcc7d66 commit 4d52834

4 files changed

Lines changed: 42 additions & 18 deletions

File tree

docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,20 @@ services:
223223
# full volume wipe. Without this, a fresh postgres volume
224224
# regenerates the UUID and any hardcoded DSN in
225225
# static/config.js silently goes stale.
226+
#
227+
# GlitchTip auto-creates a default ProjectKey when a
228+
# Project is saved, so on a fresh volume the get_or_create
229+
# below returns that auto-created key (key_created=False)
230+
# and the defaults= clause is ignored. The `not key_created`
231+
# branch catches that case and rewrites public_key to
232+
# DEV_KEY.
226233
import uuid
227234
DEV_KEY = uuid.UUID('1d8ea2a49c904f079b116550780c0ece')
228235
key, key_created = ProjectKey.objects.get_or_create(
229236
project=project,
230237
defaults={'public_key': DEV_KEY},
231238
)
232-
if key_created and key.public_key != DEV_KEY:
239+
if not key_created and key.public_key != DEV_KEY:
233240
key.public_key = DEV_KEY
234241
key.save()
235242
dsn = f'http://{key.public_key.hex}@localhost:8001/{project.id}'

src/lib/components/filesharing/CrashReport.svelte

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@
1616
async function sendReport() {
1717
if (sendState === 'sending' || sendState === 'sent') return
1818
sendState = 'sending'
19-
const ok = await reportError(error, {
20-
appVersion: APP_VERSION,
21-
uiLocale: $locale,
22-
})
23-
sendState = ok ? 'sent' : 'failed'
19+
// Sentry's transport is fire-and-forget but the SDK can still
20+
// throw synchronously on a malformed DSN or an internal init
21+
// failure. Catch so the button isn't stuck on "Sending…" forever.
22+
try {
23+
const ok = await reportError(error, {
24+
appVersion: APP_VERSION,
25+
uiLocale: $locale,
26+
})
27+
sendState = ok ? 'sent' : 'failed'
28+
} catch {
29+
sendState = 'failed'
30+
}
2431
}
2532
2633
let reportingEnabled = isErrorReportingEnabled()
@@ -31,11 +38,17 @@
3138
<h3 class="crash-title">{$_('filesharing.crash.title')}</h3>
3239
<p class="crash-message">{$_('filesharing.crash.message')}</p>
3340

34-
{#if sendState === 'failed'}
35-
<p class="crash-status error">
36-
{$_('filesharing.crash.failed')}
37-
</p>
38-
{/if}
41+
<!-- Stable live-region wrapper so screen readers announce the
42+
failed-state message when it appears (WCAG 4.1.3 Status
43+
Messages, Level AA). The wrapper exists from first render;
44+
only its child swaps in, which is the announcement trigger. -->
45+
<div role="status" aria-live="polite" class="crash-status-region">
46+
{#if sendState === 'failed'}
47+
<p class="crash-status error">
48+
{$_('filesharing.crash.failed')}
49+
</p>
50+
{/if}
51+
</div>
3952

4053
<div class="crash-actions">
4154
{#if reportingEnabled}
@@ -150,4 +163,9 @@
150163
.crash-btn:not(:disabled):hover {
151164
transform: translateY(-1px);
152165
}
166+
167+
.crash-btn:focus-visible {
168+
outline: 2px solid var(--pg-text);
169+
outline-offset: 2px;
170+
}
153171
</style>

src/lib/errorReporting.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export async function reportError(
3737
}
3838
if (typeof navigator !== 'undefined') {
3939
ctx.userAgent = navigator.userAgent
40-
ctx.platform = navigator.platform
4140
ctx.language = navigator.language
4241
}
4342

src/routes/(app)/fileshare/+page.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@
8686
encryptState.encryptionState === EncryptionState.Error}
8787
class:done={encryptState.encryptionState === EncryptionState.Done}
8888
>
89-
<FileInput
90-
bind:files={encryptState.files}
91-
bind:percentages={encryptState.percentages}
92-
bind:done={encryptState.done}
93-
bind:stage={encryptState.encryptionState}
94-
/>
9589
<svelte:boundary>
90+
<FileInput
91+
bind:files={encryptState.files}
92+
bind:percentages={encryptState.percentages}
93+
bind:done={encryptState.done}
94+
bind:stage={encryptState.encryptionState}
95+
/>
9696
{#if encryptState.encryptionState === EncryptionState.FileSelection || encryptState.encryptionState === EncryptionState.Sign || encryptState.encryptionState === EncryptionState.Encrypting}
9797
<div class="inputs-container">
9898
<RecipientSelection

0 commit comments

Comments
 (0)