Skip to content

Commit

Permalink
Add Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 authored and williamchong committed Oct 3, 2024
1 parent d87199c commit d6b3c12
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3153,19 +3153,21 @@ function webViewerPostMessage(evt) {
} else {
({ action, data } = evt.data);
}
const filename = data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf";
const url = `https://liker.land/${filename}`;
switch (action) {
case "openBase64File":
PDFViewerApplication.open({
data: atob(data.data),
originalUrl: data.name,
filename: data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf",
url,
filename,
});
break;
case "openArrayBufferFile":
PDFViewerApplication.open({
data: new Uint8Array(data.data),
originalUrl: data.name,
filename: data.name ? `${data.name}.pdf` : "liker-land_ebook.pdf",
url,
filename,
});
break;
}
Expand Down
4 changes: 4 additions & 0 deletions web/viewer-snippet.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="locale/locale.json">
<script
src="https://js.sentry-cdn.com/e214bf98fc5b536dea2fa999bcc2670e.min.js"
crossorigin="anonymous"
></script>
<script src="../build/pdf.mjs" type="module"></script>
8 changes: 8 additions & 0 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ function webViewerLoad() {
PDFViewerApplication.run(config);
}

if (window.Sentry) {
window.Sentry.onLoad(function () {
window.Sentry.init({
tracesSampleRate: 0.1,
});
});
}

// Block the "load" event until all pages are loaded, to ensure that printing
// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553
document.blockUnblockOnload?.(true);
Expand Down

0 comments on commit d6b3c12

Please sign in to comment.