aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx4
-rw-r--r--src/server/server_Initialization.ts80
2 files changed, 47 insertions, 37 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
index cb10de65b..e48a6ada4 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx
@@ -324,7 +324,7 @@ export class DocCreatorMenu extends ObservableReactComponent<{}> {
<FontAwesomeIcon icon={'plus'}/>
</button>
{altLayout ? <button
- className='docCreatorMenu-zoom-button zoom-in'
+ className='docCreatorMenu-zoom-button trash'
onPointerDown={e => this.setUpButtonClick(e, () => runInAction(() => this._savedLayouts.splice(this._savedLayouts.indexOf(altLayout), 1)))}>
<FontAwesomeIcon icon={'trash'}/>
</button> : null}
@@ -337,7 +337,7 @@ export class DocCreatorMenu extends ObservableReactComponent<{}> {
gridTemplateRows: `${scaledDown(docHeight)}px`,
gridAutoRows: `${scaledDown(docHeight)}px`,
rowGap: `${scaledDown(layout.yMargin)}px`,
- columnGap: `${scaledDown(layout.xMargin)}px`
+ columnGap: `${scaledDown(layout.xMargin)}px`
}}>
{this._layout.type === LayoutType.Stacked ?
<div
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts
index 9183688c6..c3d31e74d 100644
--- a/src/server/server_Initialization.ts
+++ b/src/server/server_Initialization.ts
@@ -155,41 +155,51 @@ function proxyServe(req: any, requrl: string, response: any) {
};
const retrieveHTTPBody = () => {
// req.headers.cookie = '';
- req.pipe(request(requrl))
- .on('error', (e: any) => {
- console.log(`CORS url error: ${requrl}`, e);
- response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666">
- <title>Error</title>
- <div align="center"><h1>Failed to load: ${requrl} </h1></div>
- <p>${e}</p>
- </body></html>`);
- })
- .on('response', (res: any) => {
- res.headers;
- const headers = Object.keys(res.headers);
- const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
- headers.forEach(headerName => {
- const header = res.headers[headerName];
- if (Array.isArray(header)) {
- res.headers[headerName] = header.filter(h => !headerCharRegex.test(h));
- } else if (headerCharRegex.test(header || '')) {
- delete res.headers[headerName];
- } else res.headers[headerName] = header;
- if (headerName === 'content-encoding') {
- wasinBrFormat = res.headers[headerName] === 'br';
- res.headers[headerName] = 'gzip';
- }
- });
- res.headers['x-permitted-cross-domain-policies'] = 'all';
- res.headers['x-frame-options'] = '';
- res.headers['content-security-policy'] = '';
- // eslint-disable-next-line no-multi-assign
- response.headers = response._headers = res.headers;
- })
- .on('end', sendModifiedBody)
- .pipe(htmlBodyMemoryStream)
- .on('error', (e: any) => console.log('http body pipe error', e));
- };
+ try {
+ const reqval = request(requrl);
+ req.pipe(reqval)
+ .on('error', (e: any) => {
+ console.log(`CORS url error: ${requrl}`, e);
+ response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666">
+ <title>Error</title>
+ <div align="center"><h1>Failed to load: ${requrl} </h1></div>
+ <p>${e}</p>
+ </body></html>`);
+ })
+ .on('response', (res: any) => {
+ res.headers;
+ const headers = Object.keys(res.headers);
+ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
+ headers.forEach(headerName => {
+ const header = res.headers[headerName];
+ if (Array.isArray(header)) {
+ res.headers[headerName] = header.filter(h => !headerCharRegex.test(h));
+ } else if (headerCharRegex.test(header || '')) {
+ delete res.headers[headerName];
+ } else res.headers[headerName] = header;
+ if (headerName === 'content-encoding') {
+ wasinBrFormat = res.headers[headerName] === 'br';
+ res.headers[headerName] = 'gzip';
+ }
+ });
+ res.headers['x-permitted-cross-domain-policies'] = 'all';
+ res.headers['x-frame-options'] = '';
+ res.headers['content-security-policy'] = '';
+ // eslint-disable-next-line no-multi-assign
+ response.headers = response._headers = res.headers;
+ })
+ .on('end', sendModifiedBody)
+ .pipe(htmlBodyMemoryStream)
+ .on('error', (e: any) => console.log('http body pipe error', e));
+ } catch (e) {
+ console.log("Request failed: ", e);
+ response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666">
+ <title>Error</title>
+ <div align="center"><h1>Failed to load: ${requrl} </h1></div>
+ <p>${e}</p>
+ </body></html>`);
+ }
+ }
retrieveHTTPBody();
}