kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Let Sentry DSN be configurable in SoapboxConfig
rodzic
73f407455e
commit
e07fa23e0d
|
@ -54,6 +54,8 @@ const messages = defineMessages({
|
||||||
tileServerAttributionLabel: { id: 'soapbox_config.tile_server_attribution_label', defaultMessage: 'Map tiles attribution' },
|
tileServerAttributionLabel: { id: 'soapbox_config.tile_server_attribution_label', defaultMessage: 'Map tiles attribution' },
|
||||||
redirectRootNoLoginLabel: { id: 'soapbox_config.redirect_root_no_login_label', defaultMessage: 'Redirect homepage' },
|
redirectRootNoLoginLabel: { id: 'soapbox_config.redirect_root_no_login_label', defaultMessage: 'Redirect homepage' },
|
||||||
redirectRootNoLoginHint: { id: 'soapbox_config.redirect_root_no_login_hint', defaultMessage: 'Path to redirect the homepage when a user is not logged in.' },
|
redirectRootNoLoginHint: { id: 'soapbox_config.redirect_root_no_login_hint', defaultMessage: 'Path to redirect the homepage when a user is not logged in.' },
|
||||||
|
sentryDsnLabel: { id: 'soapbox_config.sentry_dsn_label', defaultMessage: 'Sentry DSN' },
|
||||||
|
sentryDsnHint: { id: 'soapbox_config.sentry_dsn_hint', defaultMessage: 'DSN URL for error reporting. Works with Sentry and GlitchTip.' },
|
||||||
});
|
});
|
||||||
|
|
||||||
type ValueGetter<T = Element> = (e: React.ChangeEvent<T>) => any;
|
type ValueGetter<T = Element> = (e: React.ChangeEvent<T>) => any;
|
||||||
|
@ -285,6 +287,18 @@ const SoapboxConfig: React.FC = () => {
|
||||||
onChange={handleChange(['redirectRootNoLogin'], (e) => e.target.value)}
|
onChange={handleChange(['redirectRootNoLogin'], (e) => e.target.value)}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
|
<ListItem
|
||||||
|
label={intl.formatMessage(messages.sentryDsnLabel)}
|
||||||
|
hint={intl.formatMessage(messages.sentryDsnHint)}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
type='text'
|
||||||
|
placeholder='https://01234abcdef@glitch.tip.tld/5678'
|
||||||
|
value={String(data.get('sentryDsn', ''))}
|
||||||
|
onChange={handleChange(['sentryDsn'], (e) => e.target.value)}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
|
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
import type { CaptureContext } from '@sentry/types';
|
|
||||||
|
|
||||||
/** Capture the exception in Sentry. */
|
|
||||||
async function captureException (exception: any, captureContext?: CaptureContext | undefined): Promise<void> {
|
|
||||||
try {
|
|
||||||
const Sentry = await import('@sentry/react');
|
|
||||||
Sentry.captureException(exception, captureContext);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { startSentry, captureException };
|
|
Ładowanie…
Reference in New Issue