diff --git a/package.json b/package.json index 53f3c0e4..f6d444e0 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,7 @@ "fbemitter": "^2.1.1", "lodash": "^4.17.4", "lz-string": "^1.4.4", + "pako": "^1.0.6", "prop-types": "^15.5.8", "react": "^15.5.4", "react-dom": "^15.5.4", diff --git a/src/app/Coriolis.jsx b/src/app/Coriolis.jsx index 1f1765b6..9fc6b0a3 100644 --- a/src/app/Coriolis.jsx +++ b/src/app/Coriolis.jsx @@ -20,7 +20,7 @@ import ComparisonPage from './pages/ComparisonPage'; import ShipyardPage from './pages/ShipyardPage'; import ErrorDetails from './pages/ErrorDetails'; -const zlib = require('zlib'); +const zlib = require('pako'); /** * Coriolis App @@ -90,7 +90,7 @@ export default class Coriolis extends React.Component { _importBuild(r) { try { // Need to decode and gunzip the data, then build the ship - const data = zlib.gunzipSync(new Buffer(r.params.data, 'base64')); + const data = zlib.inflate(new Buffer(r.params.data, 'base64'), { to: 'string' }); const json = JSON.parse(data); const ship = CompanionApiUtils.shipFromJson(json); r.params.ship = ship.id;