Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/components/diff-container.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import DiffView from './diff-view.jsx';
import { diffTypesFor } from '../js/constants/diff-types';
import '../css/diff-container.css';
import YmdTimestampHeader from './ymd-timestamp-header.jsx';
import DiffFooter from './footer.jsx';
Expand Down Expand Up @@ -150,10 +151,16 @@ export default class DiffContainer extends React.Component {
if (!this.state.error) {
const urlA = new URL(conf.snapshotsPrefix + timestampA + '/' + encodeURIComponent(url), window.location.origin);
const urlB = new URL(conf.snapshotsPrefix + timestampB + '/' + encodeURIComponent(url), window.location.origin);
const webMonURL = new URL(conf.webMonitoringProcessingURL, window.location.origin);
return (<DiffView webMonitoringProcessingURL={webMonURL.toString()}
const ext = '.' + url.split('.').pop();
const availableTypes = diffTypesFor(ext);
const isPdf = availableTypes.length > 0 && ext === '.pdf';
const diffType = availableTypes.length > 0 ? availableTypes[0].value : 'SIDE_BY_SIDE_RENDERED';
const backendURL = isPdf
? new URL(conf.pdfMonitoringProcessingURL, window.location.origin)
: new URL(conf.webMonitoringProcessingURL, window.location.origin);
return (<DiffView webMonitoringProcessingURL={backendURL.toString()}
page={{ url: encodeURIComponent(url) }}
diffType={'SIDE_BY_SIDE_RENDERED'} a={urlA} b={urlB}
diffType={diffType} a={urlA} b={urlB}
loader={loader} errorHandledCallback={this.errorHandled}/>);
}
};
Expand Down
1 change: 1 addition & 0 deletions src/components/diff-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default class DiffView extends React.Component {
<InlineRenderedDiff diffData={this.state.diffData} page={this.props.page} />
);
case diffTypes.SIDE_BY_SIDE_RENDERED.value:
case diffTypes.PDF_SIDE_BY_SIDE_RENDERED.value:
return (
<SideBySideRenderedDiff diffData={this.state.diffData} page={this.props.page}
loader={this.props.loader}/>
Expand Down
1 change: 1 addition & 0 deletions src/conf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"webMonitoringProcessingURL": "http://localhost:8888",
"pdfMonitoringProcessingURL": "http://localhost:8889",
"limit": "1000",
"snapshotsPrefix": "http://web.archive.org/web/",
"urlPrefix": "/diff/",
Expand Down
8 changes: 8 additions & 0 deletions src/js/constants/diff-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const diffTypes = {
CHANGES_ONLY_SOURCE: {
description: 'Changes Only Source',
diffService: 'html_source_dmp'
},
PDF_SIDE_BY_SIDE_RENDERED: {
description: 'Side-by-Side Rendered for PDF',
diffService: 'pdf_rendered'
}
};

Expand Down Expand Up @@ -69,6 +73,10 @@ const diffTypesByMediaType = {
diffTypes.RAW_SIDE_BY_SIDE,
diffTypes.RAW_FROM_CONTENT,
diffTypes.RAW_TO_CONTENT
],

'application/pdf': [
diffTypes.PDF_SIDE_BY_SIDE_RENDERED
]
};

Expand Down