Remove unneeded dependency
This commit is contained in:
parent
2bad69ace0
commit
eb536063db
@ -12,7 +12,6 @@
|
||||
"inferno-bootstrap": "^5.0.0",
|
||||
"inferno-dev-utils": "^5.3.0",
|
||||
"inferno-router": "^5.0.1",
|
||||
"isomorphic-ws": "^4.0.0",
|
||||
"lodash": "^4.17.5",
|
||||
"ws": "^5.1.1"
|
||||
},
|
||||
@ -63,8 +62,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js",
|
||||
"dist": "yarn run build && build",
|
||||
"electron-start": "node src/electron/wait-inferno",
|
||||
"dist": "yarn run build && build",
|
||||
"electron-start": "node src/electron/wait-inferno",
|
||||
"electron": "electron .",
|
||||
"fix": "eslint --fix src/**/*.js",
|
||||
"lint": "eslint src/**/*.js",
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as _ from 'lodash';
|
||||
import { Component } from 'inferno';
|
||||
import { BrowserRouter, Link, NavLink } from 'inferno-router';
|
||||
import WS from 'isomorphic-ws';
|
||||
import { Loader } from './components';
|
||||
import {
|
||||
Container,
|
||||
@ -27,7 +26,7 @@ export class App extends Component {
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
window.clientWS = new WS('ws://localhost:65432/');
|
||||
window.clientWS = new WebSocket('ws://localhost:65432/');
|
||||
|
||||
window.clientWS.addEventListener('open', this.onWebSocketOpen);
|
||||
window.clientWS.addEventListener('message', console);
|
||||
|
@ -6,7 +6,9 @@ log.transports.console.level = 'info';
|
||||
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
const WS = require('isomorphic-ws');
|
||||
|
||||
// eslint-disable-next-line
|
||||
const WebSocket = require('ws');
|
||||
|
||||
// eslint-disable-next-line
|
||||
global.eval = () => {};
|
||||
@ -71,9 +73,17 @@ app.on('activate', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const wss = new WS.Server({
|
||||
const wss = new WebSocket.Server({
|
||||
perMessageDeflate: false,
|
||||
port: 65432,
|
||||
});
|
||||
wss.broadcast = (data) => {
|
||||
wss.clients.forEach(client => {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
client.send(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
||||
require('./websocket-events')(wss);
|
||||
|
@ -9,18 +9,16 @@ const exiftool = new ExifTool();
|
||||
module.exports = (wss) => {
|
||||
wss.on('connection', ws => {
|
||||
ws.send(JSONMessage('server-log', 'Connected to client!'));
|
||||
|
||||
ws.on('message', (...args) => {
|
||||
const [type, message] = JSON.parse(args);
|
||||
switch (type) {
|
||||
case 'dropped-files':
|
||||
const filemap = [];
|
||||
message.forEach(async file => {
|
||||
const filemap = message.map(async file => {
|
||||
const tags = await getExifTags(file);
|
||||
console.info(tags);
|
||||
filemap[file] = tags;
|
||||
// console.info('Parsed tags', JSON.stringify(tags));
|
||||
return JSON.parse(JSON.stringify(tags));
|
||||
});
|
||||
ws.send(JSONMessage('parsed-exif-tags', filemap));
|
||||
wss.broadcast(JSONMessage('parsed-exif-tags', filemap));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -30,6 +28,6 @@ module.exports = (wss) => {
|
||||
});
|
||||
};
|
||||
|
||||
function getExifTags (imgPath) {
|
||||
return exiftool.read(imgPath);
|
||||
async function getExifTags (imgPath) {
|
||||
await exiftool.read(imgPath);
|
||||
}
|
||||
|
@ -4657,10 +4657,6 @@ isomorphic-fetch@^2.1.1:
|
||||
node-fetch "^1.0.1"
|
||||
whatwg-fetch ">=0.10.0"
|
||||
|
||||
isomorphic-ws@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.0.tgz#7b528b238c920eeb3f5fe429ac416df669ea4cba"
|
||||
|
||||
isstream@~0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||
|
Loading…
Reference in New Issue
Block a user