mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-04 18:11:49 +00:00
Added handleCors URL parameter to turn off using cors-anywhere
This commit is contained in:
@@ -179,6 +179,7 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
|
|||||||
const parsedGen = Number(getParam('gen'));
|
const parsedGen = Number(getParam('gen'));
|
||||||
const generation = !isNaN(parsedGen) ? parsedGen : undefined;
|
const generation = !isNaN(parsedGen) ? parsedGen : undefined;
|
||||||
const hash = getParam('file');
|
const hash = getParam('file');
|
||||||
|
const handleCors = getParam('handleCors') !== 'false';
|
||||||
|
|
||||||
if (hash && hash !== this.state.hash) {
|
if (hash && hash !== this.state.hash) {
|
||||||
// New "load from file" data.
|
// New "load from file" data.
|
||||||
@@ -209,7 +210,7 @@ export class ChartView extends React.Component<RouteComponentProps, State> {
|
|||||||
this.loadFromUrl(url, {
|
this.loadFromUrl(url, {
|
||||||
indi,
|
indi,
|
||||||
generation,
|
generation,
|
||||||
handleCors: url.startsWith('http'),
|
handleCors: url.startsWith('http') && handleCors,
|
||||||
});
|
});
|
||||||
} else if (!url && !gedcom && hash !== this.state.hash) {
|
} else if (!url && !gedcom && hash !== this.state.hash) {
|
||||||
this.props.history.replace({pathname: '/'});
|
this.props.history.replace({pathname: '/'});
|
||||||
|
|||||||
Reference in New Issue
Block a user