Update client dependencies

This commit is contained in:
Ken-Håvard Lieng 2016-02-04 03:35:50 +01:00
parent dbe9d03352
commit 7108fa572c
19 changed files with 109 additions and 116 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,19 +4,19 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"devDependencies": { "devDependencies": {
"babel-core": "^6.4.0", "babel-core": "^6.4.5",
"babel-eslint": "^5.0.0-beta6", "babel-eslint": "^5.0.0-beta6",
"babel-loader": "^6.2.1", "babel-loader": "^6.2.2",
"babel-plugin-react-transform": "^2.0.0", "babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.3.13", "babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^1.10.3", "eslint": "^1.10.3",
"eslint-config-airbnb": "^3.1.0", "eslint-config-airbnb": "^4.0.0",
"eslint-loader": "^1.2.0", "eslint-loader": "^1.2.1",
"eslint-plugin-react": "^3.15.0", "eslint-plugin-react": "^3.16.1",
"express": "^4.13.3", "express": "^4.13.4",
"express-http-proxy": "^0.6.0", "express-http-proxy": "^0.6.0",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-autoprefixer": "3.1.0", "gulp-autoprefixer": "3.1.0",
@ -26,33 +26,33 @@
"gulp-gzip": "1.2.0", "gulp-gzip": "1.2.0",
"gulp-htmlmin": "^1.3.0", "gulp-htmlmin": "^1.3.0",
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"react-transform-catch-errors": "^1.0.1", "react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.1", "react-transform-hmr": "^1.0.2",
"redbox-react": "^1.2.0", "redbox-react": "^1.2.2",
"redux-devtools": "^3.0.1", "redux-devtools": "^3.1.0",
"redux-devtools-dock-monitor": "^1.0.1", "redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.2", "redux-devtools-log-monitor": "^1.0.4",
"webpack": "^1.12.11", "webpack": "^1.12.12",
"webpack-dev-middleware": "^1.4.0", "webpack-dev-middleware": "^1.5.1",
"webpack-hot-middleware": "^2.6.0" "webpack-hot-middleware": "^2.6.4"
}, },
"dependencies": { "dependencies": {
"autolinker": "^0.22.0", "autolinker": "^0.22.0",
"backo": "^1.1.0", "backo": "^1.1.0",
"base64-arraybuffer": "^0.1.5", "base64-arraybuffer": "^0.1.5",
"eventemitter2": "^0.4.14", "eventemitter2": "^0.4.14",
"history": "^2.0.0-rc2", "history": "^2.0.0-rc3",
"immutable": "^3.7.6", "immutable": "^3.7.6",
"lodash": "^4.0.0", "lodash": "^4.2.1",
"pure-render-decorator": "^0.2.0", "pure-render-decorator": "^0.2.0",
"react": "^0.14.6", "react": "^0.14.7",
"react-dom": "^0.14.6", "react-dom": "^0.14.7",
"react-infinite": "0.7.3", "react-infinite": "0.8.0",
"react-redux": "^4.0.6", "react-redux": "^4.2.1",
"react-router": "^2.0.0-rc5", "react-router": "^2.0.0-rc5",
"redux": "^3.0.5", "react-router-redux": "^3.0.0",
"redux-simple-router": "^2.0.2", "redux": "^3.2.1",
"redux-thunk": "^1.0.3", "redux-thunk": "^1.0.3",
"reselect": "^2.0.2" "reselect": "^2.0.3"
} }
} }

View File

@ -1,20 +1,18 @@
import * as actions from '../actions'; import * as actions from '../actions';
export function sendMessage(message, to, server) { export function sendMessage(message, to, server) {
return (dispatch, getState) => { return (dispatch, getState) => dispatch({
return dispatch({ type: actions.SEND_MESSAGE,
type: actions.SEND_MESSAGE, from: getState().servers.getIn([server, 'nick']),
from: getState().servers.getIn([server, 'nick']), message,
message, to,
to, server,
server, time: new Date(),
time: new Date(), socket: {
socket: { type: 'chat',
type: 'chat', data: { message, to, server }
data: { message, to, server } }
} });
});
};
} }
export function addMessage(message) { export function addMessage(message) {
@ -37,26 +35,22 @@ export function addMessages(messages) {
} }
export function broadcast(message, server, channels) { export function broadcast(message, server, channels) {
return addMessages(channels.map(channel => { return addMessages(channels.map(channel => ({
return { server,
server, to: channel,
to: channel, message,
message, type: 'info'
type: 'info' })));
};
}));
} }
export function inform(message, server, channel) { export function inform(message, server, channel) {
if (Array.isArray(message)) { if (Array.isArray(message)) {
return addMessages(message.map(msg => { return addMessages(message.map(msg => ({
return { server,
server, to: channel,
to: channel, message: msg,
message: msg, type: 'info'
type: 'info' })));
};
}));
} }
return addMessage({ return addMessage({

View File

@ -1,4 +1,4 @@
import { routeActions } from 'redux-simple-router'; import { routeActions } from 'react-router-redux';
import * as actions from '../actions'; import * as actions from '../actions';
export function select(server, channel, pm) { export function select(server, channel, pm) {

View File

@ -68,7 +68,7 @@ export default class MessageBox extends Component {
for (let i = 1; i < message.lines.length; i++) { for (let i = 1; i < message.lines.length; i++) {
lines.push( lines.push(
<MessageLine key={key + '-' + i} type={message.type} line={message.lines[i]} /> <MessageLine key={`${key}-${i}`} type={message.type} line={message.lines[i]} />
); );
} }
}); });

View File

@ -39,7 +39,7 @@ export default class MessageHeader extends Component {
<p className={classes.join(' ')}> <p className={classes.join(' ')}>
<span className="message-time">{timestamp(message.time)}</span> <span className="message-time">{timestamp(message.time)}</span>
{sender} {sender}
<span dangerouslySetInnerHTML={{ __html: ' ' + line }}></span> <span dangerouslySetInnerHTML={{ __html: ` ${line}` }}></span>
</p> </p>
); );
} }

View File

@ -14,7 +14,7 @@ export default class MessageLine extends Component {
} }
const style = { const style = {
paddingLeft: window.messageIndent + 'px' paddingLeft: `${window.messageIndent}px`
}; };
return ( return (

View File

@ -10,8 +10,8 @@ export default class Search extends Component {
const content = Autolinker.link(result.content, { stripPrefix: false }); const content = Autolinker.link(result.content, { stripPrefix: false });
const style = { const style = {
paddingLeft: window.messageIndent + 'px', paddingLeft: `${window.messageIndent}px`,
textIndent: -window.messageIndent + 'px' textIndent: `-${window.messageIndent}px`
}; };
return ( return (
@ -21,7 +21,7 @@ export default class Search extends Component {
{' '} {' '}
<span className="message-sender">{result.from}</span> <span className="message-sender">{result.from}</span>
</span> </span>
<span dangerouslySetInnerHTML={{ __html: ' ' + content }}></span> <span dangerouslySetInnerHTML={{ __html: ` ${content}` }}></span>
</p> </p>
); );
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { routeActions } from 'redux-simple-router'; import { routeActions } from 'react-router-redux';
import pure from 'pure-render-decorator'; import pure from 'pure-render-decorator';
import TabList from '../components/TabList'; import TabList from '../components/TabList';
import { select } from '../actions/tab'; import { select } from '../actions/tab';

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import { browserHistory } from 'react-router'; import { browserHistory } from 'react-router';
import { routeActions } from 'redux-simple-router'; import { routeActions } from 'react-router-redux';
import configureStore from './store'; import configureStore from './store';
import createRoutes from './routes'; import createRoutes from './routes';
import Socket from './util/Socket'; import Socket from './util/Socket';

View File

@ -12,9 +12,9 @@ function updateRenderName(user) {
let name = user.nick; let name = user.nick;
if (user.mode.indexOf('o') !== -1) { if (user.mode.indexOf('o') !== -1) {
name = '@' + name; name = `@${name}`;
} else if (user.mode.indexOf('v') !== -1) { } else if (user.mode.indexOf('v') !== -1) {
name = '+' + name; name = `+${name}`;
} }
return user.set('renderName', name); return user.set('renderName', name);
@ -79,9 +79,9 @@ export default createReducer(Map(), {
[actions.SOCKET_JOIN](state, action) { [actions.SOCKET_JOIN](state, action) {
const { server, channels, user } = action; const { server, channels, user } = action;
return state.updateIn([server, channels[0], 'users'], List(), users => { return state.updateIn([server, channels[0], 'users'], List(), users =>
return users.push(createUser(user)).sort(compareUsers); users.push(createUser(user)).sort(compareUsers)
}); );
}, },
[actions.SOCKET_PART](state, action) { [actions.SOCKET_PART](state, action) {
@ -110,9 +110,9 @@ export default createReducer(Map(), {
channels.forEach(channel => { channels.forEach(channel => {
s.updateIn([server, channel, 'users'], users => { s.updateIn([server, channel, 'users'], users => {
const i = users.findIndex(user => user.nick === action.old); const i = users.findIndex(user => user.nick === action.old);
return users.update(i, user => { return users.update(i, user =>
return updateRenderName(user.set('nick', action.new)); updateRenderName(user.set('nick', action.new))
}).sort(compareUsers); ).sort(compareUsers);
}); });
}); });
}); });

View File

@ -1,5 +1,5 @@
import { combineReducers } from 'redux'; import { combineReducers } from 'redux';
import { routeReducer } from 'redux-simple-router'; import { routeReducer } from 'react-router-redux';
import channels from './channels'; import channels from './channels';
import environment from './environment'; import environment from './environment';
import input from './input'; import input from './input';

View File

@ -1,5 +1,5 @@
import { Record, List } from 'immutable'; import { Record, List } from 'immutable';
import { UPDATE_LOCATION } from 'redux-simple-router'; import { UPDATE_LOCATION } from 'react-router-redux';
import createReducer from '../util/createReducer'; import createReducer from '../util/createReducer';
import * as actions from '../actions'; import * as actions from '../actions';
@ -39,7 +39,7 @@ export default createReducer(new State(), {
}, },
[UPDATE_LOCATION](state, action) { [UPDATE_LOCATION](state, action) {
if (action.location.pathname.indexOf('.') === -1 && state.selected.server) { if (action.payload.pathname.indexOf('.') === -1 && state.selected.server) {
return state.set('selected', new Tab()); return state.set('selected', new Tab());
} }

View File

@ -1,4 +1,4 @@
import { routeActions } from 'redux-simple-router'; import { routeActions } from 'react-router-redux';
import { broadcast, inform, addMessage, addMessages } from './actions/message'; import { broadcast, inform, addMessage, addMessages } from './actions/message';
import { select } from './actions/tab'; import { select } from './actions/tab';
import { normalizeChannel } from './util'; import { normalizeChannel } from './util';
@ -58,13 +58,11 @@ export default function handleSocket(socket, { dispatch, getState }) {
); );
socket.on('motd', ({ content, server }) => socket.on('motd', ({ content, server }) =>
dispatch(addMessages(content.map(line => { dispatch(addMessages(content.map(line => ({
return { server,
server, to: server,
to: server, message: line
message: line }))))
};
})))
); );
socket.on('whois', data => { socket.on('whois', data => {

View File

@ -1,6 +1,6 @@
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import { syncHistory } from 'redux-simple-router'; import { syncHistory } from 'react-router-redux';
import reducer from '../reducers'; import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket'; import createSocketMiddleware from '../middleware/socket';
import commands from '../commands'; import commands from '../commands';

View File

@ -1,6 +1,6 @@
import { createStore, applyMiddleware } from 'redux'; import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import { syncHistory } from 'redux-simple-router'; import { syncHistory } from 'react-router-redux';
import reducer from '../reducers'; import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket'; import createSocketMiddleware from '../middleware/socket';
import commands from '../commands'; import commands from '../commands';

View File

@ -13,7 +13,7 @@ export function normalizeChannel(channel) {
export function timestamp(date = new Date()) { export function timestamp(date = new Date()) {
const h = padStart(date.getHours(), 2, '0'); const h = padStart(date.getHours(), 2, '0');
const m = padStart(date.getMinutes(), 2, '0'); const m = padStart(date.getMinutes(), 2, '0');
return h + ':' + m; return `${h}:${m}`;
} }
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');

View File

@ -37,7 +37,7 @@ export default function wrapMessages(messages, width, charWidth, indent = 0) {
wrapped.push(line); wrapped.push(line);
if (i !== wlen - 1) { if (i !== wlen - 1) {
line = word + ' '; line = `${word} `;
lineWidth = (word.length + 1) * charWidth; lineWidth = (word.length + 1) * charWidth;
wordCount = 1; wordCount = 1;
} else { } else {
@ -51,7 +51,7 @@ export default function wrapMessages(messages, width, charWidth, indent = 0) {
hasWrapped = true; hasWrapped = true;
} else if (i !== wlen - 1) { } else if (i !== wlen - 1) {
line += word + ' '; line += `${word} `;
lineWidth += charWidth; lineWidth += charWidth;
} else { } else {
line += word; line += word;

View File

@ -8,6 +8,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"path"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
@ -78,12 +79,12 @@ func initFileServer() {
} }
for _, font := range fonts { for _, font := range fonts {
path := strings.TrimSuffix(font, ".gz") p := strings.TrimSuffix(font, ".gz")
files = append(files, &File{ files = append(files, &File{
Path: filepath.Join("font", path), Path: path.Join("font", p),
Asset: filepath.Join("font", font), Asset: path.Join("font", font),
ContentType: contentTypes[filepath.Ext(path)], ContentType: contentTypes[filepath.Ext(p)],
CacheControl: "max-age=31536000", CacheControl: "max-age=31536000",
Gzip: strings.HasSuffix(font, ".gz"), Gzip: strings.HasSuffix(font, ".gz"),
}) })