Skip to content

Commit 28c2cd9

Browse files
Improved the formatting to align with OED's
standards.
1 parent 6ac1a5b commit 28c2cd9

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

src/client/app/emotionCache.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
//imports the createSche function from React's Emotion library
21
import createCache from '@emotion/cache';
32

43
//creates the nonce for the script being run
5-
//he nonce works alongside the webpack_nonce and plotly_nonce to protect against unwated scripts
4+
//the nonce works alongside the webpack_nonce and plotly_nonce to protect against unwanted scripts
65
const nonce = (document.querySelector('script[nonce]') as HTMLScriptElement | null)?.nonce;
76

87
const emotionCache = createCache({

src/client/app/index.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
import 'bootstrap/dist/css/bootstrap.css';
6+
import * as React from 'react';
7+
import { createRoot } from 'react-dom/client';
8+
import { Provider } from 'react-redux';
9+
import { store } from './store';
10+
import RouteComponent from './components/RouteComponent';
11+
import { initApp } from './redux/slices/appStateSlice';
12+
import './styles/index.css';
13+
import { CacheProvider } from '@emotion/react';
14+
import emotionCache from './emotionCache';
415

5-
//these lines take the nonce, and create the webpack and plotly nonces from it
6-
//these are additional nonces that contribute to styling with webpacvk and plotly
16+
//these lines take the nonce, and create the webpack and plotly nonces from it
17+
//these are additional nonces that contribute to styling with webpack and plotly
718
const __webpack_nonce__ = (document.querySelector('script[nonce]') as HTMLScriptElement | null)?.nonce;
819
(window as any).__webpack_nonce__ = __webpack_nonce__;
920
(window as any).__plotly_nonce__ = __webpack_nonce__;
@@ -31,19 +42,9 @@ document.head.appendChild = function (node: any) {
3142
throw err;
3243
}
3344
};
34-
import 'bootstrap/dist/css/bootstrap.css';
35-
import * as React from 'react';
36-
import { createRoot } from 'react-dom/client';
37-
import { Provider } from 'react-redux';
38-
import { store } from './store';
39-
import RouteComponent from './components/RouteComponent';
40-
import { initApp } from './redux/slices/appStateSlice';
41-
import './styles/index.css';
4245

4346
store.dispatch(initApp());
4447

45-
import { CacheProvider } from '@emotion/react';
46-
import emotionCache from './emotionCache';
4748
// Renders the entire application, starting with RouteComponent, into the root div
4849
const container = document.getElementById('root') as HTMLElement;
4950
const root = createRoot(container);

src/server/app.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ const conversionArray = require('./routes/conversionArray');
3232
const units = require('./routes/units');
3333
const conversions = require('./routes/conversions');
3434
const ciks = require('./routes/ciks');
35-
36-
const crypto = require('node:crypto')
35+
const crypto = require('node:crypto');
3736

3837
// Limit the rate of overall requests to OED
3938
// Note that the rate limit may make the automatic test return the value of 429. In that case, the limiters below need to be increased.
@@ -149,8 +148,8 @@ router.get('*', (req, res) => {
149148
let htmlPlusData = html.toString().replace('SUBDIR', subdir);
150149

151150
//assigns a value to the nonce in order to check for authenticity
152-
const nonce = crypto.randomBytes(16).toString('base64url')
153-
htmlPlusData = htmlPlusData.replace(/{{nonce}}/g, nonce)
151+
const nonce = crypto.randomBytes(16).toString('base64url');
152+
htmlPlusData = htmlPlusData.replace(/{{nonce}}/g, nonce);
154153

155154
res.setHeader('Content-Security-Policy', `default-src 'self'; img-src 'self' data: ; font-src 'self' https://maxcdn.bootstrapcdn.com ; media-src 'self'; script-src 'self' 'nonce-${nonce}' ; style-src 'self' 'nonce-${nonce}' 'unsafe-inline';`)
156155

0 commit comments

Comments
 (0)