Skip to content

Commit

Permalink
Remove before-load.js and Google Analytics (PR #4719)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw authored Aug 16, 2023
1 parent cfb1a86 commit 3c92649
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 50 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
src/types/libdef/npm
res/before-load.js
docs-user
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ esproposal.optional_chaining=enable

[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/res/before-load\.js
<PROJECT_ROOT>/dist/.*

[libs]
Expand Down
4 changes: 1 addition & 3 deletions docs-user/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ window.$docsify = {
loadSidebar: true,
loadNavbar: true,
subMaxLevel: 2,
// If changing the Google Analytics ID, change it in res/before-load.js as well.
ga: 'UA-35433268-81',
// Photon blue-50
themeColor: '#0a84ff',
noCompileLinks: ['.*\\.svg']
noCompileLinks: ['.*\\.svg'],
};
3 changes: 1 addition & 2 deletions res/_headers
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

# 1. script-src
# a. 'wasm-unsafe-eval' allows to execute wasm scripts without compromising the javascript CSP.
# b. We use Google Analytics to track the usage of the application.
# 2. style-src
# a. `unsafe-inline` is necessary to support favicons.
# b. Google Fonts are used in the docs.
Expand All @@ -26,7 +25,7 @@
# 7. `frame-ancestors` is the same purpose as `X-Frame-Options` above.
# 8. `form-action`prevents forms, we don't need this.`
# 9. `frame-src` allows the embedding of YouTube videos in the docs.
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src http: https: data:; object-src 'none'; connect-src *; frame-ancestors 'self'; form-action 'none'; frame-src www.youtube-nocookie.com
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src http: https: data:; object-src 'none'; connect-src *; frame-ancestors 'self'; form-action 'none'; frame-src www.youtube-nocookie.com

# Set the correct MIME type for WebAssembly modules.
/*.wasm
Expand Down
39 changes: 0 additions & 39 deletions res/before-load.js

This file was deleted.

1 change: 0 additions & 1 deletion res/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1" />
<title>Firefox Profiler</title>
<script src='/before-load.js'></script>
</head>
<body style='background-color: #363959; /* ink-70 */'>
<div id="root"></div>
Expand Down
3 changes: 1 addition & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const serverConfig = {
default-src 'self';
script-src
'self'
'wasm-unsafe-eval'
https://www.google-analytics.com;
'wasm-unsafe-eval';
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
font-src 'self' https://fonts.gstatic.com;
img-src http: https: data:;
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { ensureExists } from './utils/flow';

// Mock out Google Analytics for anything that's not production so that we have run-time
// code coverage in development and testing.
// Note that ga isn't included nowadays. We still keep this code because we
// intend to replace ga with Glean in the future, and this will still be useful.
if (process.env.NODE_ENV === 'development') {
window.ga = (event: string, ...payload: mixed[]) => {
const style = 'color: #FF6D00; font-weight: bold';
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const config = {
'res/_headers',
'res/_redirects',
'res/zee-worker.js',
'res/before-load.js',
'res/contribute.json',
'res/service-worker-compat.js',
{ from: 'docs-user', to: 'docs' },
Expand Down

0 comments on commit 3c92649

Please sign in to comment.