This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Had to make the Raven installation stuff its own script so it wouldn't run before raven.js was loaded. Also fixed my Regexps for HTML injection; they didn't work so well when the HTML was minified.
- Loading branch information
Showing
2 changed files
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,11 @@ import serialize from 'serialize-javascript'; | |
const html = fs | ||
.readFileSync(path.resolve(__dirname, '..', '..', 'build', 'index.html')) | ||
.toString() | ||
.replace(/<script.+?bootstrap\.js\".+?<\/script>/, '') | ||
.replace(/(<script)(.+?bundle.+?<\/script>)/, '$1 defer="defer" $2'); | ||
.replace( | ||
'<script type="text/javascript" src="/./static/js/bootstrap.js">', | ||
'' | ||
) | ||
.replace(/(src="\/static\/js\/main\.\w+?\.js")/g, ' defer="defer" $1'); | ||
|
||
type Arguments = { | ||
styleTags: string, | ||
|
@@ -20,7 +23,7 @@ type Arguments = { | |
export const createScriptTag = ({ src }: { src: string }) => | ||
`<script defer="defer" src="${src}"></script>`; | ||
|
||
const sentry = `<script defer="defer" src="https://cdn.ravenjs.com/3.14.0/raven.min.js" crossorigin="anonymous"></script><script>Raven.config('https://[email protected]/154812', { whitelistUrls: [/spectrum.chat/, /www.spectrum.chat/] }).install();</script>`; | ||
const sentry = `<script defer="defer" src="https://cdn.ravenjs.com/3.14.0/raven.min.js" crossorigin="anonymous"></script><script defer="defer" src="/install-raven.js"></script>`; | ||
|
||
export const getHTML = ({ | ||
styleTags, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Raven.config('https://[email protected]/154812', { | ||
whitelistUrls: [/spectrum.chat/, /www.spectrum.chat/], | ||
}).install(); |