From 8fcc0dcbf977519b3505bf0a5d1b058aeb109326 Mon Sep 17 00:00:00 2001
From: Katie Thornhill
Date: Tue, 19 Nov 2019 23:06:33 -0500
Subject: [PATCH] chore: remove semi
---
Server/.eslintrc.js | 2 +-
Server/.prettierrc.js | 4 +-
Server/Roleypoly.js | 50 +++----
Server/api/auth.js | 72 ++++-----
Server/api/index.js | 22 +--
Server/api/servers.js | 116 +++++++--------
Server/api/servers_test.js | 28 ++--
Server/index.js | 136 ++++++++---------
Server/logger.js | 30 ++--
Server/models/Server.js | 4 +-
Server/models/Session.js | 4 +-
Server/models/index.js | 42 +++---
Server/services/Service.js | 8 +-
Server/services/discord-rpc.js | 4 +-
Server/services/discord.js | 138 +++++++++---------
Server/services/presentation.js | 38 ++---
Server/services/server.js | 38 ++---
Server/services/sessions.js | 28 ++--
Server/util/model-methods.js | 10 +-
UI/src/.prettierrc.js | 4 +-
UI/src/App.js | 36 ++---
UI/src/App.test.js | 12 +-
UI/src/actions/index.js | 74 +++++-----
UI/src/actions/ui.js | 8 +-
UI/src/components/add-server/index.js | 22 +--
UI/src/components/demos/roleypoly.js | 8 +-
UI/src/components/demos/typing.js | 12 +-
UI/src/components/dev-tools/index.js | 10 +-
UI/src/components/logotype/index.js | 6 +-
UI/src/components/oauth-bot-flow/index.js | 24 +--
UI/src/components/oauth-callback/index.js | 68 ++++-----
UI/src/components/oauth-flow/index.js | 58 ++++----
UI/src/components/role-editor/Category.js | 20 +--
.../components/role-editor/CategoryEditor.js | 12 +-
UI/src/components/role-editor/actions.js | 112 +++++++-------
UI/src/components/role-editor/index.js | 122 ++++++++--------
UI/src/components/role-picker/Category.js | 36 ++---
UI/src/components/role-picker/actions.js | 100 ++++++-------
UI/src/components/role-picker/index.js | 96 ++++++------
UI/src/components/role/demo.js | 14 +-
UI/src/components/role/draggable.js | 10 +-
UI/src/components/role/index.js | 34 ++---
UI/src/components/servers/Navigation.js | 24 +--
UI/src/components/servers/ServerCard.js | 34 ++---
UI/src/components/servers/ServerLanding.js | 26 ++--
UI/src/components/servers/UserCard.js | 30 ++--
UI/src/components/servers/index.js | 38 ++---
UI/src/components/wrapper/index.js | 16 +-
UI/src/index.js | 14 +-
UI/src/pages/Error404.js | 8 +-
UI/src/pages/Landing.js | 22 +--
UI/src/pages/WhyNoRoles.js | 12 +-
UI/src/pages/index.js | 22 +--
UI/src/reducers/index.js | 26 ++--
UI/src/reducers/role-editor.js | 34 ++---
UI/src/reducers/role-picker.js | 24 +--
UI/src/reducers/servers.js | 18 +--
UI/src/reducers/user.js | 12 +-
UI/src/registerServiceWorker.js | 44 +++---
UI/src/router/index.js | 28 ++--
UI/src/store/configureStore.dev.js | 24 +--
UI/src/store/configureStore.js | 4 +-
UI/src/store/configureStore.prod.js | 12 +-
UI/src/utils.js | 2 +-
64 files changed, 1073 insertions(+), 1073 deletions(-)
diff --git a/Server/.eslintrc.js b/Server/.eslintrc.js
index b0a06a6..23c1463 100644
--- a/Server/.eslintrc.js
+++ b/Server/.eslintrc.js
@@ -1,3 +1,3 @@
module.exports = {
extends: 'standard',
-};
+}
diff --git a/Server/.prettierrc.js b/Server/.prettierrc.js
index d58c0ce..d6ad977 100644
--- a/Server/.prettierrc.js
+++ b/Server/.prettierrc.js
@@ -5,5 +5,5 @@ module.exports = {
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
- semi: true,
-};
+ semi: false,
+}
diff --git a/Server/Roleypoly.js b/Server/Roleypoly.js
index 4856a79..5c7442c 100644
--- a/Server/Roleypoly.js
+++ b/Server/Roleypoly.js
@@ -1,38 +1,38 @@
-const log = new (require('./logger'))('Roleypoly');
-const Sequelize = require('sequelize');
-const fetchModels = require('./models');
-const fetchApis = require('./api');
+const log = new (require('./logger'))('Roleypoly')
+const Sequelize = require('sequelize')
+const fetchModels = require('./models')
+const fetchApis = require('./api')
class Roleypoly {
constructor(router, io, app) {
- this.router = router;
- this.io = io;
- this.ctx = {};
+ this.router = router
+ this.io = io
+ this.ctx = {}
this.ctx.config = {
appUrl: process.env.APP_URL,
- };
+ }
- this.ctx.io = io;
- this.__app = app;
+ this.ctx.io = io
+ this.__app = app
- if (log.debugOn) log.warn('debug mode is on');
+ if (log.debugOn) log.warn('debug mode is on')
- this.__initialized = this._mountServices();
+ this.__initialized = this._mountServices()
}
async awaitServices() {
- await this.__initialized;
+ await this.__initialized
}
async _mountServices() {
const sequelize = new Sequelize(process.env.DB_URL, {
logging: log.sql.bind(log, log),
- });
- this.ctx.sql = sequelize;
- this.M = fetchModels(sequelize);
- this.ctx.M = this.M;
- await sequelize.sync();
+ })
+ this.ctx.sql = sequelize
+ this.M = fetchModels(sequelize)
+ this.ctx.M = this.M
+ await sequelize.sync()
// this.ctx.redis = new (require('ioredis'))({
// port: process.env.REDIS_PORT || '6379',
@@ -42,16 +42,16 @@ class Roleypoly {
// enableReadyCheck: true,
// enableOfflineQueue: true
// })
- this.ctx.server = new (require('./services/server'))(this.ctx);
- this.ctx.discord = new (require('./services/discord'))(this.ctx);
- this.ctx.sessions = new (require('./services/sessions'))(this.ctx);
- this.ctx.P = new (require('./services/presentation'))(this.ctx);
+ this.ctx.server = new (require('./services/server'))(this.ctx)
+ this.ctx.discord = new (require('./services/discord'))(this.ctx)
+ this.ctx.sessions = new (require('./services/sessions'))(this.ctx)
+ this.ctx.P = new (require('./services/presentation'))(this.ctx)
}
async mountRoutes() {
- fetchApis(this.router, this.ctx);
- this.__app.use(this.router.middleware());
+ fetchApis(this.router, this.ctx)
+ this.__app.use(this.router.middleware())
}
}
-module.exports = Roleypoly;
+module.exports = Roleypoly
diff --git a/Server/api/auth.js b/Server/api/auth.js
index f163c42..516d26e 100644
--- a/Server/api/auth.js
+++ b/Server/api/auth.js
@@ -1,76 +1,76 @@
module.exports = (R, $) => {
R.post('/api/auth/token', async ctx => {
- const { token } = ctx.request.body;
+ const { token } = ctx.request.body
if (token == null || token === '') {
- ctx.body = { err: 'token_missing' };
- ctx.status = 400;
- return;
+ ctx.body = { err: 'token_missing' }
+ ctx.status = 400
+ return
}
if (ctx.session.accessToken === undefined || ctx.session.expiresAt < Date.now()) {
- const data = await $.discord.getAuthToken(token);
- ctx.session.accessToken = data.access_token;
- ctx.session.refreshToken = data.refresh_token;
- ctx.session.expiresAt = Date.now() + (ctx.expires_in || 1000 * 60 * 60 * 24);
+ const data = await $.discord.getAuthToken(token)
+ ctx.session.accessToken = data.access_token
+ ctx.session.refreshToken = data.refresh_token
+ ctx.session.expiresAt = Date.now() + (ctx.expires_in || 1000 * 60 * 60 * 24)
}
- const user = await $.discord.getUser(ctx.session.accessToken);
- ctx.session.userId = user.id;
- ctx.session.avatarHash = user.avatar;
+ const user = await $.discord.getUser(ctx.session.accessToken)
+ ctx.session.userId = user.id
+ ctx.session.avatarHash = user.avatar
ctx.body = {
id: user.id,
avatar: user.avatar,
username: user.username,
discriminator: user.discriminator,
- };
- });
+ }
+ })
R.get('/api/auth/user', async ctx => {
if (ctx.session.accessToken === undefined) {
- ctx.body = { err: 'not_logged_in' };
- ctx.status = 401;
- return;
+ ctx.body = { err: 'not_logged_in' }
+ ctx.status = 401
+ return
}
- const user = await $.discord.getUser(ctx.session.accessToken);
- ctx.session.userId = user.id;
- ctx.session.avatarHash = user.avatar;
+ const user = await $.discord.getUser(ctx.session.accessToken)
+ ctx.session.userId = user.id
+ ctx.session.avatarHash = user.avatar
ctx.body = {
id: user.id,
avatar: user.avatar,
username: user.username,
discriminator: user.discriminator,
- };
- });
+ }
+ })
R.get('/api/auth/redirect', ctx => {
- const url = $.discord.getAuthUrl();
+ const url = $.discord.getAuthUrl()
if (ctx.query.url === '✔️') {
- ctx.body = { url };
- return;
+ ctx.body = { url }
+ return
}
- ctx.redirect(url);
- });
+ ctx.redirect(url)
+ })
R.post('/api/auth/logout', ctx => {
- ctx.session = null;
- });
+ ctx.session = null
+ })
R.get('/api/oauth/bot', ctx => {
- const url = $.discord.getBotJoinUrl();
+ const url = $.discord.getBotJoinUrl()
if (ctx.query.url === '✔️') {
- ctx.body = { url };
- return;
+ ctx.body = { url }
+ return
}
- ctx.redirect(url);
- });
+ ctx.redirect(url)
+ })
R.get('/api/oauth/bot/callback', ctx => {
- console.log(ctx.request);
- });
-};
+ console.log(ctx.request)
+ })
+}
diff --git a/Server/api/index.js b/Server/api/index.js
index 139f044..ca717b0 100644
--- a/Server/api/index.js
+++ b/Server/api/index.js
@@ -1,22 +1,22 @@
-const log = new (require('../logger'))('api/index');
-const glob = require('glob');
+const log = new (require('../logger'))('api/index')
+const glob = require('glob')
-const PROD = process.env.NODE_ENV === 'production';
+const PROD = process.env.NODE_ENV === 'production'
module.exports = async (router, ctx) => {
- const apis = glob.sync(`./api/**/!(index).js`);
- log.debug('found apis', apis);
+ const apis = glob.sync(`./api/**/!(index).js`)
+ log.debug('found apis', apis)
for (let a of apis) {
if (a.endsWith('_test.js') && PROD) {
- log.debug(`skipping ${a}`);
- continue;
+ log.debug(`skipping ${a}`)
+ continue
}
- log.debug(`mounting ${a}`);
+ log.debug(`mounting ${a}`)
try {
- require(a.replace('api/', ''))(router, ctx);
+ require(a.replace('api/', ''))(router, ctx)
} catch (e) {
- log.error(`couldn't mount ${a}`, e);
+ log.error(`couldn't mount ${a}`, e)
}
}
-};
+}
diff --git a/Server/api/servers.js b/Server/api/servers.js
index 384ff18..8c2f511 100644
--- a/Server/api/servers.js
+++ b/Server/api/servers.js
@@ -1,91 +1,91 @@
module.exports = (R, $) => {
R.get('/api/servers', async ctx => {
try {
- const { userId } = ctx.session;
- const srv = $.discord.getRelevantServers(userId);
- const presentable = await $.P.presentableServers(srv, userId);
+ const { userId } = ctx.session
+ const srv = $.discord.getRelevantServers(userId)
+ const presentable = await $.P.presentableServers(srv, userId)
- ctx.body = presentable;
+ ctx.body = presentable
} catch (e) {
- console.error(e.trace || e.stack);
+ console.error(e.trace || e.stack)
}
- });
+ })
R.get('/api/server/:id', async ctx => {
- const { userId } = ctx.session;
- const { id } = ctx.params;
+ const { userId } = ctx.session
+ const { id } = ctx.params
- const srv = $.discord.client.guilds.get(id);
+ const srv = $.discord.client.guilds.get(id)
if (srv == null) {
- ctx.body = { err: 'not found' };
- ctx.status = 404;
- return;
+ ctx.body = { err: 'not found' }
+ ctx.status = 404
+ return
}
- let gm;
+ let gm
if (srv.members.has(userId)) {
- gm = $.discord.gm(id, userId);
+ gm = $.discord.gm(id, userId)
} else if ($.discord.isRoot(userId)) {
- gm = $.discord.fakeGm({ id: userId });
+ gm = $.discord.fakeGm({ id: userId })
} else {
- ctx.body = { err: 'not_a_member' };
- ctx.status = 400;
- return;
+ ctx.body = { err: 'not_a_member' }
+ ctx.status = 400
+ return
}
- const server = await $.P.presentableServer(srv, gm);
+ const server = await $.P.presentableServer(srv, gm)
- ctx.body = server;
- });
+ ctx.body = server
+ })
R.get('/api/server/:id/slug', async ctx => {
- const { userId } = ctx.session;
- const { id } = ctx.params;
+ const { userId } = ctx.session
+ const { id } = ctx.params
- const srv = $.discord.client.guilds.get(id);
+ const srv = $.discord.client.guilds.get(id)
- console.log(srv);
+ console.log(srv)
if (srv == null) {
- ctx.body = { err: 'not found' };
- ctx.status = 404;
- return;
+ ctx.body = { err: 'not found' }
+ ctx.status = 404
+ return
}
- ctx.body = await $.P.serverSlug(srv);
- });
+ ctx.body = await $.P.serverSlug(srv)
+ })
R.patch('/api/server/:id', async ctx => {
- const { userId } = ctx.session;
- const { id } = ctx.params;
+ const { userId } = ctx.session
+ const { id } = ctx.params
- let gm = $.discord.gm(id, userId);
+ let gm = $.discord.gm(id, userId)
if (gm == null && $.discord.isRoot(userId)) {
- gm = $.discord.fakeGm({ id: userId });
+ gm = $.discord.fakeGm({ id: userId })
}
// check perms
if (!$.discord.getPermissions(gm).canManageRoles) {
- ctx.status = 403;
- ctx.body = { err: 'cannot_manage_roles' };
- return;
+ ctx.status = 403
+ ctx.body = { err: 'cannot_manage_roles' }
+ return
}
- const { message = null, categories = null } = ctx.request.body;
+ const { message = null, categories = null } = ctx.request.body
// todo make less nasty
await $.server.update(id, {
...(message != null ? { message } : {}),
...(categories != null ? { categories } : {}),
- });
+ })
- ctx.body = { ok: true };
- });
+ ctx.body = { ok: true }
+ })
R.get('/api/admin/servers', async ctx => {
- const { userId } = ctx.session;
+ const { userId } = ctx.session
if (!$.discord.isRoot(userId)) {
- return;
+ return
}
ctx.body = $.discord.client.guilds.map(g => ({
@@ -93,16 +93,16 @@ module.exports = (R, $) => {
name: g.name,
members: g.members.array().length,
roles: g.roles.array().length,
- }));
- });
+ }))
+ })
R.patch('/api/servers/:server/roles', async ctx => {
- const { userId } = ctx.session;
- const { server } = ctx.params;
+ const { userId } = ctx.session
+ const { server } = ctx.params
- let gm = $.discord.gm(server, userId);
+ let gm = $.discord.gm(server, userId)
if (gm == null && $.discord.isRoot(userId)) {
- gm = $.discord.fakeGm({ id: userId });
+ gm = $.discord.fakeGm({ id: userId })
}
// check perms
@@ -112,24 +112,24 @@ module.exports = (R, $) => {
// return
// }
- const { added, removed } = ctx.request.body;
+ const { added, removed } = ctx.request.body
- const allowedRoles = await $.server.getAllowedRoles(server);
+ const allowedRoles = await $.server.getAllowedRoles(server)
- const pred = r => $.discord.safeRole(server, r) && allowedRoles.indexOf(r) !== -1;
+ const pred = r => $.discord.safeRole(server, r) && allowedRoles.indexOf(r) !== -1
if (added.length > 0) {
- gm = await gm.addRoles(added.filter(pred));
+ gm = await gm.addRoles(added.filter(pred))
}
setTimeout(() => {
if (removed.length > 0) {
- gm.removeRoles(removed.filter(pred));
+ gm.removeRoles(removed.filter(pred))
}
- }, 1000);
+ }, 1000)
// console.log('role patch', { added, removed, allowedRoles, addedFiltered: added.filterNot(pred), removedFiltered: removed.filterNot(pred) })
- ctx.body = { ok: true };
- });
-};
+ ctx.body = { ok: true }
+ })
+}
diff --git a/Server/api/servers_test.js b/Server/api/servers_test.js
index 67b766b..605c021 100644
--- a/Server/api/servers_test.js
+++ b/Server/api/servers_test.js
@@ -1,26 +1,26 @@
module.exports = (R, $) => {
R.get('/api/~/relevant-servers/:user', (ctx, next) => {
// ctx.body = 'ok'
- const srv = $.discord.getRelevantServers(ctx.params.user);
- ctx.body = $.discord.presentableServers(srv, ctx.params.user);
- return;
- });
+ const srv = $.discord.getRelevantServers(ctx.params.user)
+ ctx.body = $.discord.presentableServers(srv, ctx.params.user)
+ return
+ })
R.get('/api/~/roles/:id/:userId', (ctx, next) => {
// ctx.body = 'ok'
- const { id, userId } = ctx.params;
+ const { id, userId } = ctx.params
- const srv = $.discord.client.guilds.get(id);
+ const srv = $.discord.client.guilds.get(id)
if (srv === undefined) {
- ctx.body = { err: 'not found' };
- ctx.status = 404;
- return;
+ ctx.body = { err: 'not found' }
+ ctx.status = 404
+ return
}
- const gm = srv.members.get(userId);
- const roles = $.discord.presentableRoles(id, gm);
+ const gm = srv.members.get(userId)
+ const roles = $.discord.presentableRoles(id, gm)
- ctx.boy = roles;
- });
-};
+ ctx.boy = roles
+ })
+}
diff --git a/Server/index.js b/Server/index.js
index 728974d..d56dd59 100644
--- a/Server/index.js
+++ b/Server/index.js
@@ -1,96 +1,96 @@
-require('dotenv').config({ silent: true });
-const log = new (require('./logger'))('index');
+require('dotenv').config({ silent: true })
+const log = new (require('./logger'))('index')
-const http = require('http');
-const Koa = require('koa');
-const app = new Koa();
-const _io = require('socket.io');
-const fs = require('fs');
-const path = require('path');
-const router = require('koa-better-router')().loadMethods();
-const Roleypoly = require('./Roleypoly');
-const ksuid = require('ksuid');
+const http = require('http')
+const Koa = require('koa')
+const app = new Koa()
+const _io = require('socket.io')
+const fs = require('fs')
+const path = require('path')
+const router = require('koa-better-router')().loadMethods()
+const Roleypoly = require('./Roleypoly')
+const ksuid = require('ksuid')
// monkey patch async-reduce because F U T U R E
Array.prototype.areduce = async function(predicate, acc = []) {
// eslint-disable-line
for (let i of this) {
- acc = await predicate(acc, i);
+ acc = await predicate(acc, i)
}
- return acc;
-};
+ return acc
+}
Array.prototype.filterNot =
Array.prototype.filterNot ||
function(predicate) {
- return this.filter(v => !predicate(v));
- };
+ return this.filter(v => !predicate(v))
+ }
// Create the server and socket.io server
-const server = http.createServer(app.callback());
-const io = _io(server, { transports: ['websocket'], path: '/api/socket.io' });
+const server = http.createServer(app.callback())
+const io = _io(server, { transports: ['websocket'], path: '/api/socket.io' })
-const M = new Roleypoly(router, io, app); // eslint-disable-line no-unused-vars
+const M = new Roleypoly(router, io, app) // eslint-disable-line no-unused-vars
-app.keys = [process.env.APP_KEY];
+app.keys = [process.env.APP_KEY]
-const DEVEL = process.env.NODE_ENV === 'development';
+const DEVEL = process.env.NODE_ENV === 'development'
async function start() {
- await M.awaitServices();
+ await M.awaitServices()
// body parser
- const bodyParser = require('koa-bodyparser');
- app.use(bodyParser({ types: ['json'] }));
+ const bodyParser = require('koa-bodyparser')
+ app.use(bodyParser({ types: ['json'] }))
// Compress
- const compress = require('koa-compress');
- app.use(compress());
+ const compress = require('koa-compress')
+ app.use(compress())
// SPA + Static
if (process.env.NODE_ENV === 'production') {
- const pub = path.resolve(path.join(__dirname, 'public'));
- log.info('public path', pub);
+ const pub = path.resolve(path.join(__dirname, 'public'))
+ log.info('public path', pub)
- const staticFiles = require('koa-static');
+ const staticFiles = require('koa-static')
// app.use(staticFiles(pub, { defer: true, gzip: true, br: true }))
- const send = require('koa-send');
+ const send = require('koa-send')
app.use(async (ctx, next) => {
if (ctx.path.startsWith('/api')) {
- log.info('api breakout');
- return next();
+ log.info('api breakout')
+ return next()
}
- const chkPath = path.resolve(path.join(pub, ctx.path));
- log.info('chkPath', chkPath);
+ const chkPath = path.resolve(path.join(pub, ctx.path))
+ log.info('chkPath', chkPath)
if (!chkPath.startsWith(pub)) {
- return next();
+ return next()
}
try {
- fs.statSync(chkPath);
- log.info('sync pass');
- ctx.body = fs.readFileSync(chkPath);
- ctx.type = path.extname(ctx.path);
- log.info('body sent');
- ctx.status = 200;
- return next();
+ fs.statSync(chkPath)
+ log.info('sync pass')
+ ctx.body = fs.readFileSync(chkPath)
+ ctx.type = path.extname(ctx.path)
+ log.info('body sent')
+ ctx.status = 200
+ return next()
} catch (e) {
- log.warn('failed');
+ log.warn('failed')
if (ctx.path.startsWith('/static/')) {
- return next();
+ return next()
}
try {
- ctx.body = fs.readFileSync(path.join(pub, 'index.html'), { encoding: 'utf-8' });
+ ctx.body = fs.readFileSync(path.join(pub, 'index.html'), { encoding: 'utf-8' })
} catch (e) {
- ctx.body = e.stack || e.trace;
- ctx.status = 500;
+ ctx.body = e.stack || e.trace
+ ctx.status = 500
}
- log.info('index sent');
- ctx.status = 200;
- return next();
+ log.info('index sent')
+ ctx.status = 200
+ return next()
}
// try {
@@ -98,7 +98,7 @@ async function start() {
// } catch (e) {
// send(ctx, 'index.html', { root: pub })
// }
- });
+ })
// const sendOpts = {root: pub, index: 'index.html'}
// // const sendOpts = {}
// app.use(async (ctx, next) => {
@@ -123,29 +123,29 @@ async function start() {
// Request logger
app.use(async (ctx, next) => {
- let timeStart = new Date();
+ let timeStart = new Date()
try {
- await next();
+ await next()
} catch (e) {
- log.error(e);
- ctx.status = ctx.status || 500;
+ log.error(e)
+ ctx.status = ctx.status || 500
if (DEVEL) {
- ctx.body = ctx.body || e.stack;
+ ctx.body = ctx.body || e.stack
} else {
ctx.body = {
err: 'something terrible happened.',
- };
+ }
}
}
- let timeElapsed = new Date() - timeStart;
+ let timeElapsed = new Date() - timeStart
log.request(
`${ctx.status} ${ctx.method} ${ctx.url} - ${ctx.ip} - took ${timeElapsed}ms`
- );
+ )
// return null
- });
+ })
- const session = require('koa-session');
+ const session = require('koa-session')
app.use(
session(
{
@@ -154,21 +154,21 @@ async function start() {
siteOnly: true,
store: M.ctx.sessions,
genid: () => {
- return ksuid.randomSync().string;
+ return ksuid.randomSync().string
},
},
app
)
- );
+ )
- await M.mountRoutes();
+ await M.mountRoutes()
// SPA server
- log.info(`starting HTTP server on ${process.env.APP_PORT || 6769}`);
- server.listen(process.env.APP_PORT || 6769);
+ log.info(`starting HTTP server on ${process.env.APP_PORT || 6769}`)
+ server.listen(process.env.APP_PORT || 6769)
}
start().catch(e => {
- log.fatal('app failed to start', e);
-});
+ log.fatal('app failed to start', e)
+})
diff --git a/Server/logger.js b/Server/logger.js
index c01c86c..262a17f 100644
--- a/Server/logger.js
+++ b/Server/logger.js
@@ -1,4 +1,4 @@
-const chalk = require('chalk');
+const chalk = require('chalk')
// const { debug } = require('yargs').argv
// process.env.DEBUG = process.env.DEBUG || debug
// logger template//
@@ -6,54 +6,54 @@ const chalk = require('chalk');
class Logger {
constructor(name, debugOverride = false) {
- this.name = name;
+ this.name = name
this.debugOn =
- process.env.DEBUG === 'true' || process.env.DEBUG === '*' || debugOverride;
+ process.env.DEBUG === 'true' || process.env.DEBUG === '*' || debugOverride
}
fatal(text, ...data) {
- this.error(text, data);
+ this.error(text, data)
if (typeof data[data.length - 1] === 'number') {
- process.exit(data[data.length - 1]);
+ process.exit(data[data.length - 1])
} else {
- process.exit(1);
+ process.exit(1)
}
- throw text;
+ throw text
}
error(text, ...data) {
- console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data);
+ console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data)
}
warn(text, ...data) {
- console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data);
+ console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data)
}
notice(text, ...data) {
- console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data);
+ console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data)
}
info(text, ...data) {
- console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data);
+ console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data)
}
request(text, ...data) {
- console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`);
+ console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`)
}
debug(text, ...data) {
if (this.debugOn) {
- console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data);
+ console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data)
}
}
sql(logger, ...data) {
if (logger.debugOn) {
- console.log(chalk.bold('DEBUG SQL:\n '), data);
+ console.log(chalk.bold('DEBUG SQL:\n '), data)
}
}
}
-module.exports = Logger;
+module.exports = Logger
diff --git a/Server/models/Server.js b/Server/models/Server.js
index 6269f17..fd5f238 100644
--- a/Server/models/Server.js
+++ b/Server/models/Server.js
@@ -11,5 +11,5 @@ module.exports = (sql, DataTypes) => {
message: {
type: DataTypes.TEXT,
},
- });
-};
+ })
+}
diff --git a/Server/models/Session.js b/Server/models/Session.js
index 38fe049..55c1b80 100644
--- a/Server/models/Session.js
+++ b/Server/models/Session.js
@@ -3,5 +3,5 @@ module.exports = (sequelize, DataTypes) => {
id: { type: DataTypes.TEXT, primaryKey: true },
maxAge: DataTypes.BIGINT,
data: DataTypes.JSONB,
- });
-};
+ })
+}
diff --git a/Server/models/index.js b/Server/models/index.js
index 253d328..a492a77 100644
--- a/Server/models/index.js
+++ b/Server/models/index.js
@@ -1,37 +1,37 @@
-const log = new (require('../logger'))('models/index');
-const glob = require('glob');
-const path = require('path');
-const util = require('../util/model-methods');
+const log = new (require('../logger'))('models/index')
+const glob = require('glob')
+const path = require('path')
+const util = require('../util/model-methods')
module.exports = sql => {
- const models = {};
- const modelFiles = glob.sync('./models/**/!(index).js');
- log.debug('found models', modelFiles);
+ const models = {}
+ const modelFiles = glob.sync('./models/**/!(index).js')
+ log.debug('found models', modelFiles)
modelFiles.forEach(v => {
- let name = path.basename(v).replace('.js', '');
+ let name = path.basename(v).replace('.js', '')
if (v === './models/index.js') {
- log.debug('index.js hit, skipped');
- return;
+ log.debug('index.js hit, skipped')
+ return
}
try {
- log.debug('importing..', v.replace('models/', ''));
- let model = sql.import(v.replace('models/', ''));
- models[name] = model;
+ log.debug('importing..', v.replace('models/', ''))
+ let model = sql.import(v.replace('models/', ''))
+ models[name] = model
} catch (err) {
- log.fatal('error importing model ' + v, err);
- process.exit(-1);
+ log.fatal('error importing model ' + v, err)
+ process.exit(-1)
}
- });
+ })
Object.keys(models).forEach(v => {
if (models[v].hasOwnProperty('__associations')) {
- models[v].__associations(models);
+ models[v].__associations(models)
}
if (models[v].hasOwnProperty('__instanceMethods')) {
- models[v].__instanceMethods(models[v]);
+ models[v].__instanceMethods(models[v])
}
- });
+ })
- return models;
-};
+ return models
+}
diff --git a/Server/services/Service.js b/Server/services/Service.js
index 4ea5aa6..1039a85 100644
--- a/Server/services/Service.js
+++ b/Server/services/Service.js
@@ -1,10 +1,10 @@
-const Logger = require('../logger');
+const Logger = require('../logger')
class Service {
constructor(ctx) {
- this.ctx = ctx;
- this.log = new Logger(this.constructor.name);
+ this.ctx = ctx
+ this.log = new Logger(this.constructor.name)
}
}
-module.exports = Service;
+module.exports = Service
diff --git a/Server/services/discord-rpc.js b/Server/services/discord-rpc.js
index 61bce10..fb142d4 100644
--- a/Server/services/discord-rpc.js
+++ b/Server/services/discord-rpc.js
@@ -1,4 +1,4 @@
-const Service = require('./Service');
-const DiscordRPC = require('@roleypoly/rpc/discord');
+const Service = require('./Service')
+const DiscordRPC = require('@roleypoly/rpc/discord')
class DiscordRPCService extends Service {}
diff --git a/Server/services/discord.js b/Server/services/discord.js
index c3b9d72..d6ca528 100644
--- a/Server/services/discord.js
+++ b/Server/services/discord.js
@@ -1,30 +1,30 @@
-const Service = require('./Service');
-const discord = require('discord.js');
-const superagent = require('superagent');
+const Service = require('./Service')
+const discord = require('discord.js')
+const superagent = require('superagent')
class DiscordService extends Service {
constructor(ctx) {
- super(ctx);
+ super(ctx)
- this.botToken = process.env.DISCORD_BOT_TOKEN;
- this.clientId = process.env.DISCORD_CLIENT_ID;
- this.clientSecret = process.env.DISCORD_CLIENT_SECRET;
- this.oauthCallback = process.env.OAUTH_AUTH_CALLBACK;
- this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback`;
- this.appUrl = process.env.APP_URL;
- this.isBot = process.env.IS_BOT === 'true' || false;
- this.rootUsers = new Set((process.env.ROOT_USERS || '').split(','));
+ this.botToken = process.env.DISCORD_BOT_TOKEN
+ this.clientId = process.env.DISCORD_CLIENT_ID
+ this.clientSecret = process.env.DISCORD_CLIENT_SECRET
+ this.oauthCallback = process.env.OAUTH_AUTH_CALLBACK
+ this.botCallback = `${ctx.config.appUrl}/api/oauth/bot/callback`
+ this.appUrl = process.env.APP_URL
+ this.isBot = process.env.IS_BOT === 'true' || false
+ this.rootUsers = new Set((process.env.ROOT_USERS || '').split(','))
- this.client = new discord.Client();
- this.client.options.disableEveryone = true;
+ this.client = new discord.Client()
+ this.client.options.disableEveryone = true
- this.cmds = this._cmds();
+ this.cmds = this._cmds()
- this.startBot();
+ this.startBot()
}
ownGm(server) {
- return this.gm(server, this.client.user.id);
+ return this.gm(server, this.client.user.id)
}
fakeGm({ id = 0, nickname = '[none]', displayHexColor = '#ffffff' }) {
@@ -35,41 +35,41 @@ class DiscordService extends Service {
__faked: true,
roles: {
has() {
- return false;
+ return false
},
},
- };
+ }
}
isRoot(id) {
- return this.rootUsers.has(id);
+ return this.rootUsers.has(id)
}
async startBot() {
- await this.client.login(this.botToken);
+ await this.client.login(this.botToken)
// not all roleypolys are bots.
if (this.isBot) {
- this.log.info('this roleypoly is a bot');
- this.client.on('message', this.handleMessage.bind(this));
- this.client.on('guildCreate', this.handleJoin.bind(this));
+ this.log.info('this roleypoly is a bot')
+ this.client.on('message', this.handleMessage.bind(this))
+ this.client.on('guildCreate', this.handleJoin.bind(this))
}
for (let server of this.client.guilds.array()) {
- await this.ctx.server.ensure(server);
+ await this.ctx.server.ensure(server)
}
}
getRelevantServers(userId) {
- return this.client.guilds.filter(g => g.members.has(userId));
+ return this.client.guilds.filter(g => g.members.has(userId))
}
gm(serverId, userId) {
- return this.client.guilds.get(serverId).members.get(userId);
+ return this.client.guilds.get(serverId).members.get(userId)
}
getRoles(server) {
- return this.client.guilds.get(server).roles;
+ return this.client.guilds.get(server).roles
}
getPermissions(gm) {
@@ -77,23 +77,23 @@ class DiscordService extends Service {
return {
isAdmin: true,
canManageRoles: true,
- };
+ }
}
return {
isAdmin: gm.permissions.hasPermission('ADMINISTRATOR'),
canManageRoles: gm.permissions.hasPermission('MANAGE_ROLES', false, true),
- };
+ }
}
safeRole(server, role) {
- const r = this.getRoles(server).get(role);
- return r.editable && !r.hasPermission('MANAGE_ROLES', false, true);
+ const r = this.getRoles(server).get(role)
+ return r.editable && !r.hasPermission('MANAGE_ROLES', false, true)
}
// oauth step 2 flow, grab the auth token via code
async getAuthToken(code) {
- const url = 'https://discordapp.com/api/oauth2/token';
+ const url = 'https://discordapp.com/api/oauth2/token'
try {
const rsp = await superagent
.post(url)
@@ -104,27 +104,27 @@ class DiscordService extends Service {
grant_type: 'authorization_code',
code: code,
redirect_uri: this.oauthCallback,
- });
+ })
- return rsp.body;
+ return rsp.body
} catch (e) {
- this.log.error('getAuthToken failed', e);
- throw e;
+ this.log.error('getAuthToken failed', e)
+ throw e
}
}
async getUser(authToken) {
- const url = 'https://discordapp.com/api/v6/users/@me';
+ const url = 'https://discordapp.com/api/v6/users/@me'
try {
if (authToken == null || authToken === '') {
- throw new Error('not logged in');
+ throw new Error('not logged in')
}
- const rsp = await superagent.get(url).set('Authorization', `Bearer ${authToken}`);
- return rsp.body;
+ const rsp = await superagent.get(url).set('Authorization', `Bearer ${authToken}`)
+ return rsp.body
} catch (e) {
- this.log.error('getUser error', e);
- throw e;
+ this.log.error('getUser error', e)
+ throw e
}
}
@@ -153,20 +153,20 @@ class DiscordService extends Service {
// returns oauth authorize url with IDENTIFY permission
// we only need IDENTIFY because we only use it for matching IDs from the bot
getAuthUrl(state) {
- return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&redirect_uri=${this.oauthCallback}&response_type=code&scope=identify&state=${state}`;
+ return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&redirect_uri=${this.oauthCallback}&response_type=code&scope=identify&state=${state}`
}
// returns the bot join url with MANAGE_ROLES permission
// MANAGE_ROLES is the only permission we really need.
getBotJoinUrl() {
- return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456`;
+ return `https://discordapp.com/oauth2/authorize?client_id=${this.clientId}&scope=bot&permissions=268435456`
}
mentionResponse(message) {
message.channel.send(
`🔰 Assign your roles here! <${this.appUrl}/s/${message.guild.id}>`,
{ disableEveryone: true }
- );
+ )
}
_cmds() {
@@ -174,15 +174,15 @@ class DiscordService extends Service {
{
regex: /say (.*)/,
handler(message, matches, r) {
- r(matches[0]);
+ r(matches[0])
},
},
{
regex: /set username (.*)/,
async handler(message, matches) {
- const { username } = this.client.user;
- await this.client.user.setUsername(matches[0]);
- message.channel.send(`Username changed from ${username} to ${matches[0]}`);
+ const { username } = this.client.user
+ await this.client.user.setUsername(matches[0])
+ message.channel.send(`Username changed from ${username} to ${matches[0]}`)
},
},
{
@@ -200,8 +200,8 @@ class DiscordService extends Service {
(acc, g) => acc + g.roles.size,
0
)}`,
- ];
- message.channel.send(t.join('\n'));
+ ]
+ message.channel.send(t.join('\n'))
},
},
]
@@ -209,51 +209,51 @@ class DiscordService extends Service {
.map(({ regex, ...rest }) => ({
regex: new RegExp(`^${regex.source}`, regex.flags),
...rest,
- }));
+ }))
- return cmds;
+ return cmds
}
async handleCommand(message) {
- const cmd = message.content.replace(`<@${this.client.user.id}> `, '');
- this.log.debug(`got command from ${message.author.username}`, cmd);
+ const cmd = message.content.replace(`<@${this.client.user.id}> `, '')
+ this.log.debug(`got command from ${message.author.username}`, cmd)
for (let { regex, handler } of this.cmds) {
- const match = regex.exec(cmd);
+ const match = regex.exec(cmd)
if (match !== null) {
- this.log.debug('command accepted', { cmd, match });
+ this.log.debug('command accepted', { cmd, match })
try {
- await handler.call(this, message, match.slice(1));
- return;
+ await handler.call(this, message, match.slice(1))
+ return
} catch (e) {
- this.log.error('command errored', { e, cmd, message });
- message.channel.send(`❌ **An error occured.** ${e}`);
- return;
+ this.log.error('command errored', { e, cmd, message })
+ message.channel.send(`❌ **An error occured.** ${e}`)
+ return
}
}
}
// nothing matched?
- this.mentionResponse(message);
+ this.mentionResponse(message)
}
handleMessage(message) {
if (message.author.bot && message.channel.type !== 'text') {
// drop bot messages and dms
- return;
+ return
}
if (message.mentions.users.has(this.client.user.id)) {
if (this.rootUsers.has(message.author.id)) {
- this.handleCommand(message);
+ this.handleCommand(message)
} else {
- this.mentionResponse(message);
+ this.mentionResponse(message)
}
}
}
async handleJoin(guild) {
- await this.ctx.server.ensure(guild);
+ await this.ctx.server.ensure(guild)
}
}
-module.exports = DiscordService;
+module.exports = DiscordService
diff --git a/Server/services/presentation.js b/Server/services/presentation.js
index b3114ac..28d3390 100644
--- a/Server/services/presentation.js
+++ b/Server/services/presentation.js
@@ -1,13 +1,13 @@
-const Service = require('./Service');
-const LRU = require('lru-cache');
+const Service = require('./Service')
+const LRU = require('lru-cache')
class PresentationService extends Service {
constructor(ctx) {
- super(ctx);
- this.M = ctx.M;
- this.discord = ctx.discord;
+ super(ctx)
+ this.M = ctx.M
+ this.discord = ctx.discord
- this.cache = new LRU({ max: 500, maxAge: 100 * 60 * 5 });
+ this.cache = new LRU({ max: 500, maxAge: 100 * 60 * 5 })
}
serverSlug(server) {
@@ -16,31 +16,31 @@ class PresentationService extends Service {
name: server.name,
ownerID: server.ownerID,
icon: server.icon,
- };
+ }
}
async oldPresentableServers(collection, userId) {
- let servers = [];
+ let servers = []
for (let server of collection.array()) {
- const gm = server.members.get(userId);
+ const gm = server.members.get(userId)
- servers.push(await this.presentableServer(server, gm));
+ servers.push(await this.presentableServer(server, gm))
}
- return servers;
+ return servers
}
async presentableServers(collection, userId) {
return collection.array().areduce(async (acc, server) => {
- const gm = server.members.get(userId);
- acc.push(await this.presentableServer(server, gm, { incRoles: false }));
- return acc;
- });
+ const gm = server.members.get(userId)
+ acc.push(await this.presentableServer(server, gm, { incRoles: false }))
+ return acc
+ })
}
async presentableServer(server, gm, { incRoles = true } = {}) {
- const sd = await this.ctx.server.get(server.id);
+ const sd = await this.ctx.server.get(server.id)
return {
id: server.id,
@@ -58,7 +58,7 @@ class PresentationService extends Service {
message: sd.message,
categories: sd.categories,
perms: this.discord.getPermissions(gm),
- };
+ }
}
async rolesByServer(server) {
@@ -70,8 +70,8 @@ class PresentationService extends Service {
name: r.name,
position: r.position,
safe: this.discord.safeRole(server.id, r.id),
- }));
+ }))
}
}
-module.exports = PresentationService;
+module.exports = PresentationService
diff --git a/Server/services/server.js b/Server/services/server.js
index 45709b6..cec9f8a 100644
--- a/Server/services/server.js
+++ b/Server/services/server.js
@@ -1,16 +1,16 @@
-const Service = require('./Service');
+const Service = require('./Service')
class ServerService extends Service {
constructor(ctx) {
- super(ctx);
- this.Server = ctx.M.Server;
- this.P = ctx.P;
+ super(ctx)
+ this.Server = ctx.M.Server
+ this.P = ctx.P
}
async ensure(server) {
- let srv;
+ let srv
try {
- srv = await this.get(server.id);
+ srv = await this.get(server.id)
} catch (e) {}
if (srv == null) {
@@ -18,20 +18,20 @@ class ServerService extends Service {
id: server.id,
message: '',
categories: {},
- });
+ })
}
}
create({ id, message, categories }) {
- const srv = this.Server.build({ id, message, categories });
+ const srv = this.Server.build({ id, message, categories })
- return srv.save();
+ return srv.save()
}
async update(id, newData) {
- const srv = await this.get(id, false);
+ const srv = await this.get(id, false)
- return srv.update(newData);
+ return srv.update(newData)
}
async get(id, plain = true) {
@@ -39,26 +39,26 @@ class ServerService extends Service {
where: {
id,
},
- });
+ })
if (!plain) {
- return s;
+ return s
}
- return s.get({ plain: true });
+ return s.get({ plain: true })
}
async getAllowedRoles(id) {
- const server = await this.get(id);
+ const server = await this.get(id)
return Object.values(server.categories).reduce((acc, c) => {
if (c.hidden !== true) {
- return acc.concat(c.roles);
+ return acc.concat(c.roles)
}
- return acc;
- }, []);
+ return acc
+ }, [])
}
}
-module.exports = ServerService;
+module.exports = ServerService
diff --git a/Server/services/sessions.js b/Server/services/sessions.js
index 05d5894..e03d3bc 100644
--- a/Server/services/sessions.js
+++ b/Server/services/sessions.js
@@ -1,40 +1,40 @@
-const Service = require('./Service');
+const Service = require('./Service')
class SessionsService extends Service {
constructor(ctx) {
- super(ctx);
- this.Session = ctx.M.Session;
+ super(ctx)
+ this.Session = ctx.M.Session
}
async get(id, { rolling }) {
- const user = await this.Session.findOne({ where: { id } });
+ const user = await this.Session.findOne({ where: { id } })
if (user === null) {
- return null;
+ return null
}
- return user.data;
+ return user.data
}
async set(id, data, { maxAge, rolling, changed }) {
- let session = await this.Session.findOne({ where: { id } });
+ let session = await this.Session.findOne({ where: { id } })
if (session === null) {
- session = this.Session.build({ id });
+ session = this.Session.build({ id })
}
- session.data = data;
- session.maxAge = maxAge;
+ session.data = data
+ session.maxAge = maxAge
- return session.save();
+ return session.save()
}
async destroy(id) {
- const sess = await this.Session.findOne({ where: { id } });
+ const sess = await this.Session.findOne({ where: { id } })
if (sess != null) {
- return sess.destroy();
+ return sess.destroy()
}
}
}
-module.exports = SessionsService;
+module.exports = SessionsService
diff --git a/Server/util/model-methods.js b/Server/util/model-methods.js
index 18abb18..9e52fa6 100644
--- a/Server/util/model-methods.js
+++ b/Server/util/model-methods.js
@@ -1,10 +1,10 @@
-const ksuid = require('ksuid');
+const ksuid = require('ksuid')
module.exports = {
ksuid(field = 'id') {
return async function() {
- this.id = await ksuid.random();
- return this;
- };
+ this.id = await ksuid.random()
+ return this
+ }
},
-};
+}
diff --git a/UI/src/.prettierrc.js b/UI/src/.prettierrc.js
index d58c0ce..d6ad977 100644
--- a/UI/src/.prettierrc.js
+++ b/UI/src/.prettierrc.js
@@ -5,5 +5,5 @@ module.exports = {
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
- semi: true,
-};
+ semi: false,
+}
diff --git a/UI/src/App.js b/UI/src/App.js
index cbaabca..8f3b809 100644
--- a/UI/src/App.js
+++ b/UI/src/App.js
@@ -1,26 +1,26 @@
-import React, { Component } from 'react';
-import { Provider } from 'react-redux';
-import { ConnectedRouter } from 'react-router-redux';
-import { DragDropContext } from 'react-dnd';
-import HTML5Backend from 'react-dnd-html5-backend';
-import createHistory from 'history/createBrowserHistory';
-import configureStore from './store/configureStore';
-import './App.css';
-import './generic.sass';
+import React, { Component } from 'react'
+import { Provider } from 'react-redux'
+import { ConnectedRouter } from 'react-router-redux'
+import { DragDropContext } from 'react-dnd'
+import HTML5Backend from 'react-dnd-html5-backend'
+import createHistory from 'history/createBrowserHistory'
+import configureStore from './store/configureStore'
+import './App.css'
+import './generic.sass'
-import Wrapper from './components/wrapper';
-import AppRouter from './router';
-import { userInit } from './actions';
+import Wrapper from './components/wrapper'
+import AppRouter from './router'
+import { userInit } from './actions'
-const history = createHistory();
-const store = configureStore(undefined, history);
+const history = createHistory()
+const store = configureStore(undefined, history)
-window.__APP_STORE__ = store;
+window.__APP_STORE__ = store
@DragDropContext(HTML5Backend)
class App extends Component {
componentWillMount() {
- store.dispatch(userInit);
+ store.dispatch(userInit)
}
render() {
@@ -32,8 +32,8 @@ class App extends Component {
- );
+ )
}
}
-export default App;
+export default App
diff --git a/UI/src/App.test.js b/UI/src/App.test.js
index b84af98..76d121e 100644
--- a/UI/src/App.test.js
+++ b/UI/src/App.test.js
@@ -1,8 +1,8 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import App from './App';
+import React from 'react'
+import ReactDOM from 'react-dom'
+import App from './App'
it('renders without crashing', () => {
- const div = document.createElement('div');
- ReactDOM.render(, div);
-});
+ const div = document.createElement('div')
+ ReactDOM.render(, div)
+})
diff --git a/UI/src/actions/index.js b/UI/src/actions/index.js
index 0fae6fb..b9c331e 100644
--- a/UI/src/actions/index.js
+++ b/UI/src/actions/index.js
@@ -1,88 +1,88 @@
-import superagent from 'superagent';
-import { push } from 'react-router-redux';
+import superagent from 'superagent'
+import { push } from 'react-router-redux'
export const fetchServers = async dispatch => {
- const rsp = await superagent.get('/api/servers');
+ const rsp = await superagent.get('/api/servers')
dispatch({
type: Symbol.for('update servers'),
data: rsp.body,
- });
+ })
dispatch({
type: Symbol.for('app ready'),
- });
-};
+ })
+}
export const userInit = async dispatch => {
if (!window.location.pathname.startsWith('/oauth')) {
try {
- const rsp = await superagent.get('/api/auth/user');
+ const rsp = await superagent.get('/api/auth/user')
dispatch({
type: Symbol.for('set user'),
data: rsp.body,
- });
+ })
- dispatch(fetchServers);
+ dispatch(fetchServers)
} catch (e) {
dispatch({
type: Symbol.for('app ready'),
- });
+ })
// window.location.href = '/oauth/flow'
}
} else {
dispatch({
type: Symbol.for('app ready'),
- });
+ })
}
-};
+}
export const userLogout = async dispatch => {
try {
- await superagent.post('/api/auth/logout');
+ await superagent.post('/api/auth/logout')
} catch (e) {}
dispatch({
type: Symbol.for('reset user'),
- });
+ })
- window.location.href = '/';
-};
+ window.location.href = '/'
+}
export const startServerPolling = dispatch => {
- return poll(window.__APP_STORE__.dispatch, window.__APP_STORE__.getState); // let's not cheat... :c
-};
+ return poll(window.__APP_STORE__.dispatch, window.__APP_STORE__.getState) // let's not cheat... :c
+}
const poll = (dispatch, getState) => {
- const { servers } = getState();
- let stop = false;
+ const { servers } = getState()
+ let stop = false
const stopPolling = () => {
- stop = true;
- };
+ stop = true
+ }
const pollFunc = async () => {
if (stop) {
- return;
+ return
}
try {
- await fetchServers(dispatch);
+ await fetchServers(dispatch)
} catch (e) {
- console.error(e);
- setTimeout(pollFunc, 5000);
+ console.error(e)
+ setTimeout(pollFunc, 5000)
}
- const newServers = getState().servers;
+ const newServers = getState().servers
if (servers.size >= newServers.size) {
- setTimeout(pollFunc, 5000);
+ setTimeout(pollFunc, 5000)
} else {
- const old = servers.keySeq().toSet();
- const upd = newServers.keySeq().toSet();
- const newSrv = upd.subtract(old);
- stopPolling();
- dispatch(push(`/s/${newSrv.toJS()[0]}/edit`));
+ const old = servers.keySeq().toSet()
+ const upd = newServers.keySeq().toSet()
+ const newSrv = upd.subtract(old)
+ stopPolling()
+ dispatch(push(`/s/${newSrv.toJS()[0]}/edit`))
}
- };
+ }
- pollFunc();
- return stopPolling;
-};
+ pollFunc()
+ return stopPolling
+}
diff --git a/UI/src/actions/ui.js b/UI/src/actions/ui.js
index 7076c2f..fd564f9 100644
--- a/UI/src/actions/ui.js
+++ b/UI/src/actions/ui.js
@@ -2,12 +2,12 @@ export const fadeOut = cb => dispatch => {
dispatch({
type: Symbol.for('app fade'),
data: true,
- });
+ })
- setTimeout(cb, 300);
-};
+ setTimeout(cb, 300)
+}
export const fadeIn = {
type: Symbol.for('app fade'),
data: false,
-};
+}
diff --git a/UI/src/components/add-server/index.js b/UI/src/components/add-server/index.js
index a74165b..c529ae7 100644
--- a/UI/src/components/add-server/index.js
+++ b/UI/src/components/add-server/index.js
@@ -1,23 +1,23 @@
-import React, { Component } from 'react';
-import { Link } from 'react-router-dom';
-import TypingDemo from '../demos/typing';
-import RoleypolyDemo from '../demos/roleypoly';
-import * as Actions from '../../actions';
-import './styles.sass';
-import discordLogo from '../../pages/images/discord-logo.svg';
+import React, { Component } from 'react'
+import { Link } from 'react-router-dom'
+import TypingDemo from '../demos/typing'
+import RoleypolyDemo from '../demos/roleypoly'
+import * as Actions from '../../actions'
+import './styles.sass'
+import discordLogo from '../../pages/images/discord-logo.svg'
export default class AddServer extends Component {
- polling = null;
+ polling = null
componentDidMount() {
if (this.props.match.params.server !== undefined) {
- this.pollingStop = Actions.startServerPolling(this.props.dispatch);
+ this.pollingStop = Actions.startServerPolling(this.props.dispatch)
}
}
componentWillUnmount() {
if (this.pollingStop != null) {
- this.pollingStop();
+ this.pollingStop()
}
}
@@ -59,6 +59,6 @@ export default class AddServer extends Component {
- );
+ )
}
}
diff --git a/UI/src/components/demos/roleypoly.js b/UI/src/components/demos/roleypoly.js
index 5646fd2..c1de9b6 100644
--- a/UI/src/components/demos/roleypoly.js
+++ b/UI/src/components/demos/roleypoly.js
@@ -1,5 +1,5 @@
-import React from 'react';
-import RoleDemo from '../role/demo';
+import React from 'react'
+import RoleDemo from '../role/demo'
const RoleypolyDemo = () => (
@@ -9,6 +9,6 @@ const RoleypolyDemo = () => (
-);
+)
-export default RoleypolyDemo;
+export default RoleypolyDemo
diff --git a/UI/src/components/demos/typing.js b/UI/src/components/demos/typing.js
index 11e1373..130bd30 100644
--- a/UI/src/components/demos/typing.js
+++ b/UI/src/components/demos/typing.js
@@ -1,7 +1,7 @@
-import React from 'react';
-import moment from 'moment';
-import Typist from 'react-typist';
-import './typing.sass';
+import React from 'react'
+import moment from 'moment'
+import Typist from 'react-typist'
+import './typing.sass'
const Typing = () => (
@@ -26,6 +26,6 @@ const Typing = () => (
-);
+)
-export default Typing;
+export default Typing
diff --git a/UI/src/components/dev-tools/index.js b/UI/src/components/dev-tools/index.js
index f437a20..d5f2da2 100644
--- a/UI/src/components/dev-tools/index.js
+++ b/UI/src/components/dev-tools/index.js
@@ -1,10 +1,10 @@
-import React from 'react';
-import { createDevTools } from 'redux-devtools';
-import LogMonitor from 'redux-devtools-log-monitor';
-import DockMonitor from 'redux-devtools-dock-monitor';
+import React from 'react'
+import { createDevTools } from 'redux-devtools'
+import LogMonitor from 'redux-devtools-log-monitor'
+import DockMonitor from 'redux-devtools-dock-monitor'
export default createDevTools(
-);
+)
diff --git a/UI/src/components/logotype/index.js b/UI/src/components/logotype/index.js
index 5be9230..c906b16 100644
--- a/UI/src/components/logotype/index.js
+++ b/UI/src/components/logotype/index.js
@@ -1,4 +1,4 @@
-import React from 'react';
+import React from 'react'
const Logotype = ({
fill = 'var(--c-7)',
@@ -39,6 +39,6 @@ const Logotype = ({
>
-);
+)
-export default Logotype;
+export default Logotype
diff --git a/UI/src/components/oauth-bot-flow/index.js b/UI/src/components/oauth-bot-flow/index.js
index a166610..b62d451 100644
--- a/UI/src/components/oauth-bot-flow/index.js
+++ b/UI/src/components/oauth-bot-flow/index.js
@@ -1,9 +1,9 @@
-import React, { Component } from 'react';
-import { Redirect } from 'react-router-dom';
-import superagent from 'superagent';
-import { connect } from 'react-redux';
-import { push } from 'react-router-redux';
-import { fetchServers } from '../../actions';
+import React, { Component } from 'react'
+import { Redirect } from 'react-router-dom'
+import superagent from 'superagent'
+import { connect } from 'react-redux'
+import { push } from 'react-router-redux'
+import { fetchServers } from '../../actions'
@connect()
class OauthCallback extends Component {
@@ -11,14 +11,14 @@ class OauthCallback extends Component {
notReady: true,
message: 'chotto matte kudasai...',
url: null,
- };
+ }
async componentDidMount() {
const {
body: { url },
- } = await superagent.get('/api/oauth/bot?url=✔️');
- this.setState({ url, notReady: false });
- window.location.href = url;
+ } = await superagent.get('/api/oauth/bot?url=✔️')
+ this.setState({ url, notReady: false })
+ window.location.href = url
}
render() {
@@ -28,8 +28,8 @@ class OauthCallback extends Component {
Something oopsed, click me to get to where you meant.
- );
+ )
}
}
-export default OauthCallback;
+export default OauthCallback
diff --git a/UI/src/components/oauth-callback/index.js b/UI/src/components/oauth-callback/index.js
index 4da3423..a1ee984 100644
--- a/UI/src/components/oauth-callback/index.js
+++ b/UI/src/components/oauth-callback/index.js
@@ -1,8 +1,8 @@
-import React, { Component } from 'react';
-import { Redirect } from 'react-router-dom';
-import superagent from 'superagent';
-import { connect } from 'react-redux';
-import { fetchServers } from '../../actions';
+import React, { Component } from 'react'
+import { Redirect } from 'react-router-dom'
+import superagent from 'superagent'
+import { connect } from 'react-redux'
+import { fetchServers } from '../../actions'
@connect()
class OauthCallback extends Component {
@@ -10,66 +10,66 @@ class OauthCallback extends Component {
notReady: true,
message: 'chotto matte kudasai...',
redirect: '/s',
- };
+ }
- stopped = false;
+ stopped = false
componentDidUnmount() {
- this.stopped = true;
+ this.stopped = true
}
async componentDidMount() {
// handle stuff in the url
- const sp = new URLSearchParams(this.props.location.search);
- const token = sp.get('code');
+ const sp = new URLSearchParams(this.props.location.search)
+ const token = sp.get('code')
if (token === '' || token == null) {
- this.setState({ message: 'token missing, what are you trying to do?!' });
- return;
+ this.setState({ message: 'token missing, what are you trying to do?!' })
+ return
}
- const stateToken = sp.get('state');
- const state = JSON.parse(window.sessionStorage.getItem('state') || 'null');
+ const stateToken = sp.get('state')
+ const state = JSON.parse(window.sessionStorage.getItem('state') || 'null')
if (state !== null && state.state === stateToken && state.redirect != null) {
- this.setState({ redirect: state.redirect });
+ this.setState({ redirect: state.redirect })
}
- this.props.history.replace(this.props.location.pathname);
+ this.props.history.replace(this.props.location.pathname)
- let counter = 0;
+ let counter = 0
const retry = async () => {
- if (this.stopped) return;
+ if (this.stopped) return
try {
- const rsp = await superagent.get('/api/auth/user');
+ const rsp = await superagent.get('/api/auth/user')
this.props.dispatch({
type: Symbol.for('set user'),
data: rsp.body,
- });
- this.props.dispatch(fetchServers);
- this.setState({ notReady: false });
+ })
+ this.props.dispatch(fetchServers)
+ this.setState({ notReady: false })
} catch (e) {
- counter++;
+ counter++
if (counter > 10) {
- this.setState({ message: "i couldn't log you in. :c" });
+ this.setState({ message: "i couldn't log you in. :c" })
} else {
setTimeout(() => {
- retry();
- }, 250);
+ retry()
+ }, 250)
}
}
- };
+ }
// pass token to backend, await it to finish it's business.
try {
- await superagent.post('/api/auth/token').send({ token });
+ await superagent.post('/api/auth/token').send({ token })
// this.props.onLogin(rsp.body)
- retry();
+ retry()
} catch (e) {
- console.error('token pass error', e);
- this.setState({ message: 'g-gomen nasai... i broke it...' });
- return;
+ console.error('token pass error', e)
+ this.setState({ message: 'g-gomen nasai... i broke it...' })
+ return
}
// update user stuff here
@@ -80,8 +80,8 @@ class OauthCallback extends Component {
this.state.message
) : (
- );
+ )
}
}
-export default OauthCallback;
+export default OauthCallback
diff --git a/UI/src/components/oauth-flow/index.js b/UI/src/components/oauth-flow/index.js
index ea0dd57..df212d5 100644
--- a/UI/src/components/oauth-flow/index.js
+++ b/UI/src/components/oauth-flow/index.js
@@ -1,9 +1,9 @@
-import React, { Component } from 'react';
-import { Redirect } from 'react-router-dom';
-import superagent from 'superagent';
-import { connect } from 'react-redux';
-import uuidv4 from 'uuid/v4';
-import { fetchServers } from '../../actions';
+import React, { Component } from 'react'
+import { Redirect } from 'react-router-dom'
+import superagent from 'superagent'
+import { connect } from 'react-redux'
+import uuidv4 from 'uuid/v4'
+import { fetchServers } from '../../actions'
@connect()
class OauthCallback extends Component {
@@ -12,60 +12,60 @@ class OauthCallback extends Component {
message: 'chotto matte kudasai...',
redirect: '/s',
url: null,
- };
+ }
async fetchUser() {
- const rsp = await superagent.get('/api/auth/user');
- sessionStorage.setItem('user', JSON.stringify(rsp.body));
- sessionStorage.setItem('user.update', JSON.stringify(Date.now()));
+ const rsp = await superagent.get('/api/auth/user')
+ sessionStorage.setItem('user', JSON.stringify(rsp.body))
+ sessionStorage.setItem('user.update', JSON.stringify(Date.now()))
this.props.dispatch({
type: Symbol.for('set user'),
data: rsp.body,
- });
+ })
}
setupUser() {
- const userUpdateTime = sessionStorage.getItem('user.update') || 0;
+ const userUpdateTime = sessionStorage.getItem('user.update') || 0
if (+userUpdateTime + 1000 * 60 * 10 > Date.now()) {
- const user = sessionStorage.getItem('user');
+ const user = sessionStorage.getItem('user')
if (user != null && user !== '') {
this.props.dispatch({
type: Symbol.for('set user'),
data: JSON.parse(user),
- });
+ })
}
}
- return this.fetchUser();
+ return this.fetchUser()
}
async componentDidMount() {
- const state = uuidv4();
+ const state = uuidv4()
- const oUrl = new URL(window.location.href);
+ const oUrl = new URL(window.location.href)
if (oUrl.searchParams.has('r')) {
- this.setState({ redirect: oUrl.searchParams.get('r') });
+ this.setState({ redirect: oUrl.searchParams.get('r') })
}
window.sessionStorage.setItem(
'state',
JSON.stringify({ state, redirect: oUrl.searchParams.get('r') })
- );
+ )
try {
- await this.setupUser();
+ await this.setupUser()
- this.props.dispatch(fetchServers);
- this.setState({ notReady: false });
+ this.props.dispatch(fetchServers)
+ this.setState({ notReady: false })
} catch (e) {
const {
body: { url },
- } = await superagent.get('/api/auth/redirect?url=✔️');
- const nUrl = new URL(url);
+ } = await superagent.get('/api/auth/redirect?url=✔️')
+ const nUrl = new URL(url)
- nUrl.searchParams.set('state', state);
- this.setState({ url: nUrl.toString() });
- window.location.href = nUrl.toString();
+ nUrl.searchParams.set('state', state)
+ this.setState({ url: nUrl.toString() })
+ window.location.href = nUrl.toString()
}
}
@@ -79,8 +79,8 @@ class OauthCallback extends Component {
Something oopsed, click me to get to where you meant.
>
- );
+ )
}
}
-export default OauthCallback;
+export default OauthCallback
diff --git a/UI/src/components/role-editor/Category.js b/UI/src/components/role-editor/Category.js
index 2e8172d..4328a9e 100644
--- a/UI/src/components/role-editor/Category.js
+++ b/UI/src/components/role-editor/Category.js
@@ -1,19 +1,19 @@
-import React, { Component } from 'react';
-import { DropTarget } from 'react-dnd';
+import React, { Component } from 'react'
+import { DropTarget } from 'react-dnd'
-import Role from '../role/draggable';
-import CategoryEditor from './CategoryEditor';
+import Role from '../role/draggable'
+import CategoryEditor from './CategoryEditor'
@DropTarget(
Symbol.for('dnd: role'),
{
drop(props, monitor, element) {
- props.onDrop(monitor.getItem());
+ props.onDrop(monitor.getItem())
},
canDrop(props, monitor) {
return (
props.mode !== Symbol.for('edit') && monitor.getItem().category !== props.name
- );
+ )
},
},
(connect, monitor) => ({
@@ -35,10 +35,10 @@ class Category extends Component {
mode,
onEditOpen,
...rest
- } = this.props;
+ } = this.props
if (mode === Symbol.for('edit')) {
- return ;
+ return
}
return connectDropTarget(
@@ -63,7 +63,7 @@ class Category extends Component {
.map((r, k) => )
.toArray()}
- );
+ )
}
}
-export default Category;
+export default Category
diff --git a/UI/src/components/role-editor/CategoryEditor.js b/UI/src/components/role-editor/CategoryEditor.js
index 1926cd9..0bc88e9 100644
--- a/UI/src/components/role-editor/CategoryEditor.js
+++ b/UI/src/components/role-editor/CategoryEditor.js
@@ -1,18 +1,18 @@
-import React, { Component } from 'react';
+import React, { Component } from 'react'
export default class CategoryEditor extends Component {
onKeyPress = e => {
- const { onSave } = this.props;
+ const { onSave } = this.props
switch (e.key) {
case 'Enter':
case 'Escape':
- return onSave();
+ return onSave()
}
- };
+ }
render() {
- const { category } = this.props;
+ const { category } = this.props
return (
@@ -104,6 +104,6 @@ export default class CategoryEditor extends Component {
- );
+ )
}
}
diff --git a/UI/src/components/role-editor/actions.js b/UI/src/components/role-editor/actions.js
index 1a1f414..f8f59a1 100644
--- a/UI/src/components/role-editor/actions.js
+++ b/UI/src/components/role-editor/actions.js
@@ -1,15 +1,15 @@
-import { Set } from 'immutable';
-import * as UIActions from '../../actions/ui';
-import { getViewMap, setup } from '../role-picker/actions';
-import uuidv4 from 'uuid/v4';
-import superagent from 'superagent';
+import { Set } from 'immutable'
+import * as UIActions from '../../actions/ui'
+import { getViewMap, setup } from '../role-picker/actions'
+import uuidv4 from 'uuid/v4'
+import superagent from 'superagent'
export const constructView = id => async (dispatch, getState) => {
- await setup(id)(dispatch);
- const server = getState().servers.get(id);
+ await setup(id)(dispatch)
+ const server = getState().servers.get(id)
- let { viewMap, hasSafeRoles } = getViewMap(server);
- viewMap = viewMap.map((c, idx) => c.set('mode', Symbol.for('drop')));
+ let { viewMap, hasSafeRoles } = getViewMap(server)
+ viewMap = viewMap.map((c, idx) => c.set('mode', Symbol.for('drop')))
dispatch({
type: Symbol.for('re: setup'),
@@ -18,10 +18,10 @@ export const constructView = id => async (dispatch, getState) => {
viewMap,
originalSnapshot: viewMap,
},
- });
+ })
- dispatch(UIActions.fadeIn);
-};
+ dispatch(UIActions.fadeIn)
+}
export const addRoleToCategory = (id, oldId, role, flip = true) => dispatch => {
dispatch({
@@ -30,12 +30,12 @@ export const addRoleToCategory = (id, oldId, role, flip = true) => dispatch => {
id,
role,
},
- });
+ })
if (flip) {
- dispatch(removeRoleFromCategory(oldId, id, role, false));
+ dispatch(removeRoleFromCategory(oldId, id, role, false))
}
-};
+}
export const removeRoleFromCategory = (id, oldId, role, flip = true) => dispatch => {
dispatch({
@@ -44,12 +44,12 @@ export const removeRoleFromCategory = (id, oldId, role, flip = true) => dispatch
id,
role,
},
- });
+ })
if (flip) {
- dispatch(addRoleToCategory(oldId, id, role, false));
+ dispatch(addRoleToCategory(oldId, id, role, false))
}
-};
+}
export const editCategory = ({ id, key, value }) => dispatch => {
dispatch({
@@ -59,12 +59,12 @@ export const editCategory = ({ id, key, value }) => dispatch => {
key,
value,
},
- });
-};
+ })
+}
export const saveCategory = (id, category) => dispatch => {
if (category.get('name') === '') {
- return;
+ return
}
dispatch({
@@ -73,8 +73,8 @@ export const saveCategory = (id, category) => dispatch => {
id,
mode: Symbol.for('drop'),
},
- });
-};
+ })
+}
export const openEditor = id => ({
type: Symbol.for('re: switch category mode'),
@@ -82,13 +82,13 @@ export const openEditor = id => ({
id,
mode: Symbol.for('edit'),
},
-});
+})
export const deleteCategory = (id, category) => (dispatch, getState) => {
- const roles = category.get('roles');
- const rolesMap = category.get('roles_map');
+ const roles = category.get('roles')
+ const rolesMap = category.get('roles_map')
- let uncategorized = getState().roleEditor.getIn(['viewMap', 'Uncategorized']);
+ let uncategorized = getState().roleEditor.getIn(['viewMap', 'Uncategorized'])
dispatch({
type: Symbol.for('re: set category'),
@@ -101,27 +101,27 @@ export const deleteCategory = (id, category) => (dispatch, getState) => {
type: 'multi',
mode: null,
},
- });
+ })
dispatch({
type: Symbol.for('re: delete category'),
data: id,
- });
-};
+ })
+}
export const createCategory = (dispatch, getState) => {
- const { roleEditor } = getState();
- const vm = roleEditor.get('viewMap');
+ const { roleEditor } = getState()
+ const vm = roleEditor.get('viewMap')
- let name = 'New Category';
- let idx = 1;
- const pred = c => c.get('name') === name;
+ let name = 'New Category'
+ let idx = 1
+ const pred = c => c.get('name') === name
while (vm.find(pred) !== undefined) {
- idx++;
- name = `New Category ${idx}`;
+ idx++
+ name = `New Category ${idx}`
}
- const id = uuidv4();
+ const id = uuidv4()
dispatch({
type: Symbol.for('re: set category'),
@@ -135,17 +135,17 @@ export const createCategory = (dispatch, getState) => {
position: idx,
mode: Symbol.for('edit'),
},
- });
-};
+ })
+}
export const bumpCategory = (category, name) => move => async (dispatch, getState) => {
- const { roleEditor } = getState();
- const vm = roleEditor.get('viewMap');
+ const { roleEditor } = getState()
+ const vm = roleEditor.get('viewMap')
- const position = category.get('position');
- const nextPos = position + move;
+ const position = category.get('position')
+ const nextPos = position + move
- const replaceThisOne = vm.findKey(category => category.get('position') === nextPos);
+ const replaceThisOne = vm.findKey(category => category.get('position') === nextPos)
dispatch({
type: Symbol.for('re: edit category'),
@@ -154,7 +154,7 @@ export const bumpCategory = (category, name) => move => async (dispatch, getStat
key: 'position',
value: nextPos,
},
- });
+ })
if (!!replaceThisOne) {
dispatch({
@@ -164,9 +164,9 @@ export const bumpCategory = (category, name) => move => async (dispatch, getStat
key: 'position',
value: position,
},
- });
+ })
}
-};
+}
export const saveServer = id => async (dispatch, getState) => {
const viewMap = getState()
@@ -177,21 +177,21 @@ export const saveServer = id => async (dispatch, getState) => {
.delete('roles_map')
.delete('mode')
.delete('id')
- );
+ )
viewMap.map((v, idx) => {
if (v.has('position')) {
- return v;
+ return v
}
console.warn('category position wasnt set, so fake ones are being made', {
cat: v.toJS(),
idx,
position: viewMap.count() + idx,
- });
- return v.set('position', viewMap.count() + idx);
- });
+ })
+ return v.set('position', viewMap.count() + idx)
+ })
- await superagent.patch(`/api/server/${id}`).send({ categories: viewMap.toJS() });
- dispatch({ type: Symbol.for('re: swap original state') });
-};
+ await superagent.patch(`/api/server/${id}`).send({ categories: viewMap.toJS() })
+ dispatch({ type: Symbol.for('re: swap original state') })
+}
diff --git a/UI/src/components/role-editor/index.js b/UI/src/components/role-editor/index.js
index 6c8d640..1d09677 100644
--- a/UI/src/components/role-editor/index.js
+++ b/UI/src/components/role-editor/index.js
@@ -1,33 +1,33 @@
-import React, { Component } from 'react';
-import { Set } from 'immutable';
-import { connect } from 'react-redux';
-import { DropTarget } from 'react-dnd';
-import { Link, Prompt, Redirect } from 'react-router-dom';
-import { Scrollbars } from 'react-custom-scrollbars';
-import * as Actions from './actions';
-import * as PickerActions from '../role-picker/actions';
-import * as UIActions from '../../actions/ui';
-import './RoleEditor.sass';
+import React, { Component } from 'react'
+import { Set } from 'immutable'
+import { connect } from 'react-redux'
+import { DropTarget } from 'react-dnd'
+import { Link, Prompt, Redirect } from 'react-router-dom'
+import { Scrollbars } from 'react-custom-scrollbars'
+import * as Actions from './actions'
+import * as PickerActions from '../role-picker/actions'
+import * as UIActions from '../../actions/ui'
+import './RoleEditor.sass'
-import Category from './Category';
-import CategoryEditor from './CategoryEditor';
-import Role from '../role/draggable';
+import Category from './Category'
+import CategoryEditor from './CategoryEditor'
+import Role from '../role/draggable'
const mapState = ({ rolePicker, roleEditor, servers }, ownProps) => ({
rp: rolePicker,
editor: roleEditor,
server: servers.get(ownProps.match.params.server),
-});
+})
@connect(mapState)
@DropTarget(
Symbol.for('dnd: role'),
{
drop(props, monitor, element) {
- element.dropRole({}, 'Uncategorized')(monitor.getItem());
+ element.dropRole({}, 'Uncategorized')(monitor.getItem())
},
canDrop(props, monitor) {
- return monitor.getItem().category !== 'Uncategorized';
+ return monitor.getItem().category !== 'Uncategorized'
},
},
(connect, monitor) => ({
@@ -45,75 +45,75 @@ class RoleEditor extends Component {
match: {
params: { server },
},
- } = this.props;
- dispatch(Actions.constructView(server));
+ } = this.props
+ dispatch(Actions.constructView(server))
}
componentWillReceiveProps(nextProps) {
if (this.props.match.params.server !== nextProps.match.params.server) {
- const { dispatch } = this.props;
+ const { dispatch } = this.props
dispatch(
UIActions.fadeOut(() =>
dispatch(Actions.constructView(nextProps.match.params.server))
)
- );
+ )
}
}
dropRole = (category, name) => ({ role, category }) => {
- const { dispatch } = this.props;
- console.log(role);
- dispatch(Actions.addRoleToCategory(name, category, role));
- };
+ const { dispatch } = this.props
+ console.log(role)
+ dispatch(Actions.addRoleToCategory(name, category, role))
+ }
createCategory = () => {
- const { dispatch } = this.props;
- dispatch(Actions.createCategory);
- };
+ const { dispatch } = this.props
+ dispatch(Actions.createCategory)
+ }
saveCategory = (category, name) => () => {
- const { dispatch } = this.props;
- dispatch(Actions.saveCategory(name, category));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.saveCategory(name, category))
+ }
deleteCategory = (category, id) => () => {
- const { dispatch } = this.props;
- dispatch(Actions.deleteCategory(id, category));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.deleteCategory(id, category))
+ }
openEditor = (category, name) => () => {
- const { dispatch } = this.props;
- dispatch(Actions.openEditor(name));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.openEditor(name))
+ }
editCategory = (category, id) => (key, type) => event => {
- const { dispatch } = this.props;
- let value;
+ const { dispatch } = this.props
+ let value
switch (type) {
case Symbol.for('edit: text'):
- value = event.target.value;
- break;
+ value = event.target.value
+ break
case Symbol.for('edit: bool'):
- value = event.target.checked;
- break;
+ value = event.target.checked
+ break
case Symbol.for('edit: select'):
- value = event.target.value;
- break;
+ value = event.target.value
+ break
default:
- value = null;
+ value = null
}
- dispatch(Actions.editCategory({ category, id, key, type, value }));
- };
+ dispatch(Actions.editCategory({ category, id, key, type, value }))
+ }
resetServer = () => {
- const { dispatch } = this.props;
- dispatch({ type: Symbol.for('re: reset') });
- };
+ const { dispatch } = this.props
+ dispatch({ type: Symbol.for('re: reset') })
+ }
saveServer = () => {
const {
@@ -121,32 +121,32 @@ class RoleEditor extends Component {
match: {
params: { server },
},
- } = this.props;
- dispatch(Actions.saveServer(server));
- };
+ } = this.props
+ dispatch(Actions.saveServer(server))
+ }
onBump = (category, name) => move => () =>
- this.props.dispatch(Actions.bumpCategory(category, name)(move));
+ this.props.dispatch(Actions.bumpCategory(category, name)(move))
get hasChanged() {
return (
this.props.editor.get('originalSnapshot').hashCode() !==
this.props.editor.get('viewMap').hashCode()
- );
+ )
}
render() {
- const { server } = this.props;
+ const { server } = this.props
if (server == null) {
- return null;
+ return null
}
if (server.getIn(['perms', 'canManageRoles']) !== true) {
- return ;
+ return
}
- const vm = this.props.editor.get('viewMap');
+ const vm = this.props.editor.get('viewMap')
return (
- );
+ )
}
}
-export default RoleEditor;
+export default RoleEditor
diff --git a/UI/src/components/role-picker/Category.js b/UI/src/components/role-picker/Category.js
index 5e403e4..62d9ce6 100644
--- a/UI/src/components/role-picker/Category.js
+++ b/UI/src/components/role-picker/Category.js
@@ -1,11 +1,11 @@
-import React, { Component } from 'react';
-import { Map } from 'immutable';
+import React, { Component } from 'react'
+import { Map } from 'immutable'
-import Role from '../role';
+import Role from '../role'
class Category extends Component {
toggleRoleMulti(id, next) {
- this.props.onChange(Map({ [id]: next }));
+ this.props.onChange(Map({ [id]: next }))
}
toggleRoleSingle(id, next) {
@@ -14,31 +14,31 @@ class Category extends Component {
.get('roles')
.reduce((acc, i) => acc.set(i, false), Map())
.set(id, next)
- );
+ )
}
onRoleToggle = id => (next, old) => {
- const type = this.props.category.get('type');
+ const type = this.props.category.get('type')
switch (type) {
case 'single':
- return this.toggleRoleSingle(id, next);
+ return this.toggleRoleSingle(id, next)
case 'multi':
- return this.toggleRoleMulti(id, next);
+ return this.toggleRoleMulti(id, next)
default:
- console.warn('DEFAULTING TO MULTI', id, next, old);
- return this.toggleRoleMulti(id, next);
+ console.warn('DEFAULTING TO MULTI', id, next, old)
+ return this.toggleRoleMulti(id, next)
}
- };
+ }
render() {
- const { category, name, isSelected } = this.props;
+ const { category, name, isSelected } = this.props
if (category.get('hidden')) {
- return null;
+ return null
}
if (category.get('roles').count() === 0) {
- return null;
+ return null
}
return (
@@ -49,7 +49,7 @@ class Category extends Component {
.sortBy(r => r.get('position'))
.reverse()
.map((r, k) => {
- const id = r.get('id');
+ const id = r.get('id')
return (
- );
+ )
})
.toArray()}
- );
+ )
}
}
-export default Category;
+export default Category
diff --git a/UI/src/components/role-picker/actions.js b/UI/src/components/role-picker/actions.js
index 24b8653..13d6c91 100644
--- a/UI/src/components/role-picker/actions.js
+++ b/UI/src/components/role-picker/actions.js
@@ -1,10 +1,10 @@
-import { Map, Set, fromJS } from 'immutable';
-import superagent from 'superagent';
-import * as UIActions from '../../actions/ui';
+import { Map, Set, fromJS } from 'immutable'
+import superagent from 'superagent'
+import * as UIActions from '../../actions/ui'
export const setup = id => async dispatch => {
- const rsp = await superagent.get(`/api/server/${id}`);
- const data = rsp.body;
+ const rsp = await superagent.get(`/api/server/${id}`)
+ const data = rsp.body
dispatch({
type: Symbol.for('server: set'),
@@ -12,25 +12,25 @@ export const setup = id => async dispatch => {
id,
...data,
},
- });
- dispatch(constructView(id));
-};
+ })
+ dispatch(constructView(id))
+}
export const getViewMap = server => {
- const roles = server.get('roles');
- const categories = server.get('categories');
- const categoriesIds = server.get('categories').keySeq();
+ const roles = server.get('roles')
+ const categories = server.get('categories')
+ const categoriesIds = server.get('categories').keySeq()
const allRoles = server
.get('roles')
.filter(v => v.get('safe'))
.map(r => r.get('id'))
- .toSet();
+ .toSet()
const accountedRoles = categories
.map(c => c.get('roles'))
.toSet()
- .flatten();
- const unaccountedRoles = allRoles.subtract(accountedRoles);
+ .flatten()
+ const unaccountedRoles = allRoles.subtract(accountedRoles)
// console.log('roles', allRoles.toJS(), accountedRoles.toJS(), unaccountedRoles.toJS())
@@ -61,29 +61,29 @@ export const getViewMap = server => {
.map(r => server.get('roles').find(sr => sr.get('id') === r))
.filter(r => r != null)
// sort by server position, backwards.
- .sort((a, b) => a.position > b.position);
+ .sort((a, b) => a.position > b.position)
// force data to sets
- return c.set('roles_map', Set(roles)).set('roles', Set(c.get('roles')));
- });
+ return c.set('roles_map', Set(roles)).set('roles', Set(c.get('roles')))
+ })
const selected = roles.reduce(
(acc, r) => acc.set(r.get('id'), r.get('selected')),
Map()
- );
+ )
- const hasSafeRoles = allRoles.size > 0;
+ const hasSafeRoles = allRoles.size > 0
return {
viewMap,
selected,
hasSafeRoles,
- };
-};
+ }
+}
export const constructView = id => (dispatch, getState) => {
- const server = getState().servers.get(id);
+ const server = getState().servers.get(id)
- const { viewMap, selected } = getViewMap(server);
+ const { viewMap, selected } = getViewMap(server)
dispatch({
type: Symbol.for('rp: setup role picker'),
@@ -95,77 +95,77 @@ export const constructView = id => (dispatch, getState) => {
isEditingMessage: false,
messageBuffer: '',
},
- });
+ })
- dispatch(UIActions.fadeIn);
-};
+ dispatch(UIActions.fadeIn)
+}
export const resetSelected = dispatch => {
dispatch({
type: Symbol.for('rp: reset selected'),
- });
-};
+ })
+}
export const submitSelected = serverId => async (dispatch, getState) => {
- const { rolePicker } = getState();
- const original = rolePicker.get('originalRolesSelected');
- const current = rolePicker.get('rolesSelected');
+ const { rolePicker } = getState()
+ const original = rolePicker.get('originalRolesSelected')
+ const current = rolePicker.get('rolesSelected')
const diff = original.reduce((acc, v, k) => {
if (current.get(k) !== v) {
// if original value is false, then we know we're adding, otherwise removing.
if (v !== true) {
- return acc.set('added', acc.get('added').add(k));
+ return acc.set('added', acc.get('added').add(k))
} else {
- return acc.set('removed', acc.get('removed').add(k));
+ return acc.set('removed', acc.get('removed').add(k))
}
}
- return acc;
- }, Map({ added: Set(), removed: Set() }));
+ return acc
+ }, Map({ added: Set(), removed: Set() }))
- await superagent.patch(`/api/servers/${serverId}/roles`).send(diff.toJS());
+ await superagent.patch(`/api/servers/${serverId}/roles`).send(diff.toJS())
dispatch({
type: Symbol.for('rp: sync selected roles'),
- });
-};
+ })
+}
export const updateRoles = roles => ({
type: Symbol.for('rp: update selected roles'),
data: roles,
-});
+})
export const openMessageEditor = id => (dispatch, getState) => {
- const message = getState().servers.getIn([id, 'message']);
- dispatch(editServerMessage(id, message));
+ const message = getState().servers.getIn([id, 'message'])
+ dispatch(editServerMessage(id, message))
dispatch({
type: Symbol.for('rp: set message editor state'),
data: true,
- });
-};
+ })
+}
export const saveServerMessage = id => async (dispatch, getState) => {
- const message = getState().rolePicker.get('messageBuffer');
+ const message = getState().rolePicker.get('messageBuffer')
- await superagent.patch(`/api/server/${id}`).send({ message });
+ await superagent.patch(`/api/server/${id}`).send({ message })
- dispatch(closeMessageEditor);
+ dispatch(closeMessageEditor)
dispatch({
type: Symbol.for('server: edit message'),
data: {
id,
message,
},
- });
-};
+ })
+}
export const editServerMessage = (id, message) => ({
type: Symbol.for('rp: edit message buffer'),
data: message,
-});
+})
export const closeMessageEditor = {
type: Symbol.for('rp: set message editor state'),
data: false,
-};
+}
diff --git a/UI/src/components/role-picker/index.js b/UI/src/components/role-picker/index.js
index 22852ff..2c91607 100644
--- a/UI/src/components/role-picker/index.js
+++ b/UI/src/components/role-picker/index.js
@@ -1,22 +1,22 @@
-import React, { Component, Fragment } from 'react';
-import { connect } from 'react-redux';
-import { Prompt } from 'react-router-dom';
-import superagent from 'superagent';
-import * as Actions from './actions';
-import * as UIActions from '../../actions/ui';
-import { msgToReal } from '../../utils';
-import './RolePicker.sass';
+import React, { Component, Fragment } from 'react'
+import { connect } from 'react-redux'
+import { Prompt } from 'react-router-dom'
+import superagent from 'superagent'
+import * as Actions from './actions'
+import * as UIActions from '../../actions/ui'
+import { msgToReal } from '../../utils'
+import './RolePicker.sass'
-import Category from './Category';
-import { Scrollbars } from 'react-custom-scrollbars';
-import { Link } from 'react-router-dom';
+import Category from './Category'
+import { Scrollbars } from 'react-custom-scrollbars'
+import { Link } from 'react-router-dom'
const mapState = ({ rolePicker, servers }, ownProps) => {
return {
data: rolePicker,
server: servers.get(ownProps.match.params.server),
- };
-};
+ }
+}
@connect(mapState)
class RolePicker extends Component {
@@ -26,59 +26,59 @@ class RolePicker extends Component {
match: {
params: { server },
},
- } = this.props;
- dispatch(Actions.setup(server));
+ } = this.props
+ dispatch(Actions.setup(server))
}
componentWillReceiveProps(nextProps) {
if (this.props.match.params.server !== nextProps.match.params.server) {
- const { dispatch } = this.props;
+ const { dispatch } = this.props
dispatch(
UIActions.fadeOut(() => dispatch(Actions.setup(nextProps.match.params.server)))
- );
+ )
}
}
get serverId() {
- return this.props.server.get('id');
+ return this.props.server.get('id')
}
isSelected = id => {
- return this.props.data.getIn(['rolesSelected', id]);
- };
+ return this.props.data.getIn(['rolesSelected', id])
+ }
get rolesHaveChanged() {
- const { data } = this.props;
- return !data.get('rolesSelected').equals(data.get('originalRolesSelected'));
+ const { data } = this.props
+ return !data.get('rolesSelected').equals(data.get('originalRolesSelected'))
}
editServerMessage = e => {
- const { dispatch } = this.props;
- dispatch(Actions.editServerMessage(this.serverId, e.target.value));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.editServerMessage(this.serverId, e.target.value))
+ }
saveServerMessage = e => {
- const { dispatch } = this.props;
- dispatch(Actions.saveServerMessage(this.serverId));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.saveServerMessage(this.serverId))
+ }
openMessageEditor = () => {
- const { dispatch } = this.props;
- dispatch(Actions.openMessageEditor(this.serverId));
- };
+ const { dispatch } = this.props
+ dispatch(Actions.openMessageEditor(this.serverId))
+ }
closeMessageEditor = () => {
- const { dispatch } = this.props;
- dispatch(Actions.closeMessageEditor);
- };
+ const { dispatch } = this.props
+ dispatch(Actions.closeMessageEditor)
+ }
renderServerMessage(server) {
- const isEditing = this.props.data.get('isEditingMessage');
- const roleManager = server.getIn(['perms', 'canManageRoles']);
- const msg = server.get('message');
- const msgBuffer = this.props.data.get('messageBuffer');
+ const isEditing = this.props.data.get('isEditingMessage')
+ const roleManager = server.getIn(['perms', 'canManageRoles'])
+ const msg = server.get('message')
+ const msgBuffer = this.props.data.get('messageBuffer')
- console.log(msg, roleManager, isEditing, this.props.data.toJS());
+ console.log(msg, roleManager, isEditing, this.props.data.toJS())
if (!roleManager && msg !== '') {
return (
@@ -86,7 +86,7 @@ class RolePicker extends Component {
Server Message
- );
+ )
}
if (roleManager && !isEditing) {
@@ -107,7 +107,7 @@ class RolePicker extends Component {
}}
>
- );
+ )
}
if (roleManager && isEditing) {
@@ -137,18 +137,18 @@ class RolePicker extends Component {
value={msgBuffer}
/>
- );
+ )
}
- return null;
+ return null
}
render() {
- const { data, server, dispatch } = this.props;
- const vm = data.get('viewMap');
+ const { data, server, dispatch } = this.props
+ const vm = data.get('viewMap')
if (server === undefined) {
- return null;
+ return null
}
return (
@@ -207,8 +207,8 @@ class RolePicker extends Component {
- );
+ )
}
}
-export default RolePicker;
+export default RolePicker
diff --git a/UI/src/components/role/demo.js b/UI/src/components/role/demo.js
index 782bc06..96c7a3c 100644
--- a/UI/src/components/role/demo.js
+++ b/UI/src/components/role/demo.js
@@ -1,16 +1,16 @@
-import React, { Component } from 'react';
-import { Map } from 'immutable';
+import React, { Component } from 'react'
+import { Map } from 'immutable'
-import Role from './index';
+import Role from './index'
export default class DemoRole extends Component {
state = {
isSelected: false,
- };
+ }
handleToggle = () => {
- this.setState({ isSelected: !this.state.isSelected });
- };
+ this.setState({ isSelected: !this.state.isSelected })
+ }
render() {
return (
@@ -20,6 +20,6 @@ export default class DemoRole extends Component {
onToggle={this.handleToggle}
type="button"
/>
- );
+ )
}
}
diff --git a/UI/src/components/role/draggable.js b/UI/src/components/role/draggable.js
index 6043768..8153363 100644
--- a/UI/src/components/role/draggable.js
+++ b/UI/src/components/role/draggable.js
@@ -1,7 +1,7 @@
-import React, { Component } from 'react';
-import { DragSource } from 'react-dnd';
+import React, { Component } from 'react'
+import { DragSource } from 'react-dnd'
-import Role from './index';
+import Role from './index'
// @DragSource(Symbol.for('dnd: role'), {
// beginDrag ({ role, categoryId }) {
@@ -17,7 +17,7 @@ export default
Symbol.for('dnd: role'),
{
beginDrag({ role, categoryId }) {
- return { role, category: categoryId };
+ return { role, category: categoryId }
},
},
(connect, monitor) => ({
@@ -27,6 +27,6 @@ export default
)
class DraggableRole extends Component {
render() {
- return ;
+ return
}
}
diff --git a/UI/src/components/role/index.js b/UI/src/components/role/index.js
index 89c6ddd..f0a231b 100644
--- a/UI/src/components/role/index.js
+++ b/UI/src/components/role/index.js
@@ -1,9 +1,9 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import Color from 'color';
-import './Role.sass';
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import Color from 'color'
+import './Role.sass'
-const whiteColor = Color('#efefef');
+const whiteColor = Color('#efefef')
class Role extends Component {
static propTypes = {
@@ -12,28 +12,28 @@ class Role extends Component {
type: PropTypes.string,
selected: PropTypes.bool,
disabled: PropTypes.bool,
- };
+ }
render() {
- let { role, selected, disabled, type, isDragging } = this.props;
- type = type || 'button';
+ let { role, selected, disabled, type, isDragging } = this.props
+ type = type || 'button'
// console.log(this.props)
- let color = Color(role.get('color'));
+ let color = Color(role.get('color'))
if (color.rgbNumber() === 0) {
- color = whiteColor;
+ color = whiteColor
}
- const c = color;
- let hc = color.lighten(0.1);
+ const c = color
+ let hc = color.lighten(0.1)
const out = (
{
if (!disabled && this.props.onToggle != null) {
- this.props.onToggle(!selected, selected);
+ this.props.onToggle(!selected, selected)
}
}}
{...(disabled
@@ -52,14 +52,14 @@ class Role extends Component {
{role.get('name')}
- );
+ )
if (type === 'drag' && this.props.connectDragSource != null) {
- return this.props.connectDragSource(out);
+ return this.props.connectDragSource(out)
}
- return out;
+ return out
}
}
-export default Role;
+export default Role
diff --git a/UI/src/components/servers/Navigation.js b/UI/src/components/servers/Navigation.js
index 7730da4..15278e0 100644
--- a/UI/src/components/servers/Navigation.js
+++ b/UI/src/components/servers/Navigation.js
@@ -1,17 +1,17 @@
-import React, { Component, Fragment } from 'react';
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import PropTypes from 'prop-types';
-import ServerCard from './ServerCard';
-import UserCard from './UserCard';
-import { Scrollbars } from 'react-custom-scrollbars';
-import { NavLink } from 'react-router-dom';
+import React, { Component, Fragment } from 'react'
+import ImmutablePropTypes from 'react-immutable-proptypes'
+import PropTypes from 'prop-types'
+import ServerCard from './ServerCard'
+import UserCard from './UserCard'
+import { Scrollbars } from 'react-custom-scrollbars'
+import { NavLink } from 'react-router-dom'
class ServersNavigation extends Component {
static propTypes = {
user: ImmutablePropTypes.map.isRequired,
servers: ImmutablePropTypes.orderedMapOf(ImmutablePropTypes.map).isRequired,
className: PropTypes.string,
- };
+ }
render() {
// console.log(this.props.servers)
@@ -21,8 +21,8 @@ class ServersNavigation extends Component {
{this.props.servers.reduce((acc, s, i) => {
- acc.push();
- return acc;
+ acc.push()
+ return acc
}, [])}
- );
+ )
}
}
-export default ServersNavigation;
+export default ServersNavigation
diff --git a/UI/src/components/servers/ServerCard.js b/UI/src/components/servers/ServerCard.js
index c572271..fd6e1cd 100644
--- a/UI/src/components/servers/ServerCard.js
+++ b/UI/src/components/servers/ServerCard.js
@@ -1,26 +1,26 @@
-import React, { Component } from 'react';
-import { connect } from 'react-redux';
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import { NavLink } from 'react-router-dom';
-import './ServerCard.sass';
-import { withRouter } from 'react-router';
+import React, { Component } from 'react'
+import { connect } from 'react-redux'
+import ImmutablePropTypes from 'react-immutable-proptypes'
+import { NavLink } from 'react-router-dom'
+import './ServerCard.sass'
+import { withRouter } from 'react-router'
class ServerCard extends Component {
static propTypes = {
user: ImmutablePropTypes.map.isRequired,
server: ImmutablePropTypes.map.isRequired,
- };
+ }
render() {
- const { server, user } = this.props;
+ const { server, user } = this.props
- let icon = '';
+ let icon = ''
- console.log(__filename, server);
+ console.log(__filename, server)
- const s = server.get('server');
- const gm = server.get('gm');
- const perms = server.get('perms');
+ const s = server.get('server')
+ const gm = server.get('gm')
+ const perms = server.get('perms')
if (perms.get('canManageRoles')) {
icon = (
@@ -32,7 +32,7 @@ class ServerCard extends Component {
className="server-list__item__tag"
uk-icon="icon: bolt; ratio: 0.7"
/>
- );
+ )
}
if (perms.get('isAdmin')) {
@@ -45,7 +45,7 @@ class ServerCard extends Component {
className="server-list__item__tag"
uk-icon="icon: star; ratio: 0.7"
/>
- );
+ )
}
return (
@@ -69,8 +69,8 @@ class ServerCard extends Component {
{icon}
- );
+ )
}
}
-export default ServerCard;
+export default ServerCard
diff --git a/UI/src/components/servers/ServerLanding.js b/UI/src/components/servers/ServerLanding.js
index 883a6b5..b4d99b8 100644
--- a/UI/src/components/servers/ServerLanding.js
+++ b/UI/src/components/servers/ServerLanding.js
@@ -1,35 +1,35 @@
-import React, { Component } from 'react';
-import { Link, Redirect } from 'react-router-dom';
-import superagent from 'superagent';
-import discordLogo from '../../pages/images/discord-logo.svg';
+import React, { Component } from 'react'
+import { Link, Redirect } from 'react-router-dom'
+import superagent from 'superagent'
+import discordLogo from '../../pages/images/discord-logo.svg'
export default class ServerLanding extends Component {
state = {
server: null,
exit: false,
- };
+ }
async componentWillMount() {
- console.log(this.props);
+ console.log(this.props)
try {
const rsp = await superagent.get(
`/api/server/${this.props.match.params.server}/slug`
- );
- this.setState({ server: rsp.body });
+ )
+ this.setState({ server: rsp.body })
} catch (e) {
- this.setState({ exit: true });
- return;
+ this.setState({ exit: true })
+ return
}
}
render() {
if (this.state.exit === true) {
- return ;
+ return
}
if (this.state.server === null) {
- return null; //SPINNER
+ return null //SPINNER
}
return (
@@ -54,6 +54,6 @@ export default class ServerLanding extends Component {
- );
+ )
}
}
diff --git a/UI/src/components/servers/UserCard.js b/UI/src/components/servers/UserCard.js
index 783f3e4..4539562 100644
--- a/UI/src/components/servers/UserCard.js
+++ b/UI/src/components/servers/UserCard.js
@@ -1,30 +1,30 @@
-import React, { Component } from 'react';
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import { NavLink } from 'react-router-dom';
-import { connect } from 'react-redux';
-import * as Actions from '../../actions';
-import './UserCard.sass';
+import React, { Component } from 'react'
+import ImmutablePropTypes from 'react-immutable-proptypes'
+import { NavLink } from 'react-router-dom'
+import { connect } from 'react-redux'
+import * as Actions from '../../actions'
+import './UserCard.sass'
@connect()
class UserCard extends Component {
static propTypes = {
user: ImmutablePropTypes.map,
- };
+ }
get avatar() {
- const { user } = this.props;
- const avatar = user.get('avatar');
+ const { user } = this.props
+ const avatar = user.get('avatar')
if (avatar === '' || avatar == null) {
return `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 9999) %
- 5}.png`;
+ 5}.png`
}
- return `https://cdn.discordapp.com/avatars/${user.get('id')}/${avatar}.png`;
+ return `https://cdn.discordapp.com/avatars/${user.get('id')}/${avatar}.png`
}
render() {
- const { user } = this.props;
+ const { user } = this.props
// console.log(this.props)
@@ -45,7 +45,7 @@ class UserCard extends Component {
title="Sign out"
uk-icon="icon: sign-out"
onClick={() => {
- this.props.dispatch(Actions.userLogout);
+ this.props.dispatch(Actions.userLogout)
}}
/>
@@ -63,8 +63,8 @@ class UserCard extends Component {
- );
+ )
}
}
-export default UserCard;
+export default UserCard
diff --git a/UI/src/components/servers/index.js b/UI/src/components/servers/index.js
index 0138485..79e838c 100644
--- a/UI/src/components/servers/index.js
+++ b/UI/src/components/servers/index.js
@@ -1,15 +1,15 @@
-import React, { Component } from 'react';
-import { Route, Switch } from 'react-router-dom';
-import { Scrollbars } from 'react-custom-scrollbars';
-import { connect } from 'react-redux';
-import { withRouter, Redirect } from 'react-router';
-import './index.sass';
+import React, { Component } from 'react'
+import { Route, Switch } from 'react-router-dom'
+import { Scrollbars } from 'react-custom-scrollbars'
+import { connect } from 'react-redux'
+import { withRouter, Redirect } from 'react-router'
+import './index.sass'
-import Navigation from './Navigation';
-import RolePicker from '../role-picker';
-import RoleEditor from '../role-editor';
-import AddServer from '../add-server';
-import Error404 from '../../pages/Error404';
+import Navigation from './Navigation'
+import RolePicker from '../role-picker'
+import RoleEditor from '../role-editor'
+import AddServer from '../add-server'
+import Error404 from '../../pages/Error404'
// import mockData from './mockData'
@@ -18,20 +18,20 @@ const mapState = ({ servers, user, appState }) => {
servers,
user,
fade: appState.fade,
- };
-};
+ }
+}
@connect(mapState)
class Servers extends Component {
get defaultPath() {
- console.log(this.props.servers.toJS());
+ console.log(this.props.servers.toJS())
- const first = this.props.servers.first();
+ const first = this.props.servers.first()
if (first != null) {
- return first.get('id');
+ return first.get('id')
}
- return 'add';
+ return 'add'
}
render() {
@@ -62,8 +62,8 @@ class Servers extends Component {
- );
+ )
}
}
-export default Servers;
+export default Servers
diff --git a/UI/src/components/wrapper/index.js b/UI/src/components/wrapper/index.js
index d7331c9..72ae470 100644
--- a/UI/src/components/wrapper/index.js
+++ b/UI/src/components/wrapper/index.js
@@ -1,9 +1,9 @@
-import React, { Component } from 'react';
-import { Link } from 'react-router-dom';
-import Scrollbars from 'react-custom-scrollbars';
-import Logotype from '../logotype';
-import './wrapper.sass';
-import discordLogo from '../../pages/images/discord-logo.svg';
+import React, { Component } from 'react'
+import { Link } from 'react-router-dom'
+import Scrollbars from 'react-custom-scrollbars'
+import Logotype from '../logotype'
+import './wrapper.sass'
+import discordLogo from '../../pages/images/discord-logo.svg'
class Wrapper extends Component {
render() {
@@ -45,8 +45,8 @@ class Wrapper extends Component {
- );
+ )
}
}
-export default Wrapper;
+export default Wrapper
diff --git a/UI/src/index.js b/UI/src/index.js
index c3babba..624708a 100644
--- a/UI/src/index.js
+++ b/UI/src/index.js
@@ -1,8 +1,8 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import './index.css';
-import App from './App';
-import { unregister } from './registerServiceWorker';
+import React from 'react'
+import ReactDOM from 'react-dom'
+import './index.css'
+import App from './App'
+import { unregister } from './registerServiceWorker'
-ReactDOM.render(, document.getElementById('root'));
-unregister();
+ReactDOM.render(, document.getElementById('root'))
+unregister()
diff --git a/UI/src/pages/Error404.js b/UI/src/pages/Error404.js
index 7c60c13..9c5b0eb 100644
--- a/UI/src/pages/Error404.js
+++ b/UI/src/pages/Error404.js
@@ -1,5 +1,5 @@
-import React from 'react';
-import './landing.sass';
+import React from 'react'
+import './landing.sass'
const Error404 = ({ root = false }) => (
@@ -14,6 +14,6 @@ const Error404 = ({ root = false }) => (
-);
+)
-export default Error404;
+export default Error404
diff --git a/UI/src/pages/Landing.js b/UI/src/pages/Landing.js
index ac0285b..b3aff27 100644
--- a/UI/src/pages/Landing.js
+++ b/UI/src/pages/Landing.js
@@ -1,12 +1,12 @@
-import React, { Component, Fragment } from 'react';
-import { Link } from 'react-router-dom';
-import Scrollbars from 'react-custom-scrollbars';
-import Typist from 'react-typist';
-import moment from 'moment';
-import './landing.sass';
-import discordLogo from './images/discord-logo.svg';
-import RoleypolyDemo from '../components/demos/roleypoly';
-import TypingDemo from '../components/demos/typing';
+import React, { Component, Fragment } from 'react'
+import { Link } from 'react-router-dom'
+import Scrollbars from 'react-custom-scrollbars'
+import Typist from 'react-typist'
+import moment from 'moment'
+import './landing.sass'
+import discordLogo from './images/discord-logo.svg'
+import RoleypolyDemo from '../components/demos/roleypoly'
+import TypingDemo from '../components/demos/typing'
const Landing = ({ root = false }) => (
@@ -34,5 +34,5 @@ const Landing = ({ root = false }) => (
-);
-export default Landing;
+)
+export default Landing
diff --git a/UI/src/pages/WhyNoRoles.js b/UI/src/pages/WhyNoRoles.js
index 9a0d2dd..ce75c87 100644
--- a/UI/src/pages/WhyNoRoles.js
+++ b/UI/src/pages/WhyNoRoles.js
@@ -1,7 +1,7 @@
-import React, { Fragment } from 'react';
+import React, { Fragment } from 'react'
-import goodImg from './images/whynoroles-good.png';
-import badImg from './images/whynoroles-bad.png';
+import goodImg from './images/whynoroles-good.png'
+import badImg from './images/whynoroles-bad.png'
const WhyNoRoles = props => {
return (
@@ -27,7 +27,7 @@ const WhyNoRoles = props => {
In this example, Roleypoly is above other roles, and will be able to assign them.
- );
-};
+ )
+}
-export default WhyNoRoles;
+export default WhyNoRoles
diff --git a/UI/src/pages/index.js b/UI/src/pages/index.js
index c588050..5c8f109 100644
--- a/UI/src/pages/index.js
+++ b/UI/src/pages/index.js
@@ -1,12 +1,12 @@
-import React from 'react';
-import { Route, Switch } from 'react-router-dom';
-import Scrollbars from 'react-custom-scrollbars';
-import './pages.sass';
+import React from 'react'
+import { Route, Switch } from 'react-router-dom'
+import Scrollbars from 'react-custom-scrollbars'
+import './pages.sass'
-import WhyNoRoles from './WhyNoRoles';
-import Error404 from './Error404';
-export { default as Landing } from './Landing';
-export { default as Error404 } from './Error404';
+import WhyNoRoles from './WhyNoRoles'
+import Error404 from './Error404'
+export { default as Landing } from './Landing'
+export { default as Error404 } from './Error404'
const Pages = props => {
return (
@@ -21,7 +21,7 @@ const Pages = props => {
- );
-};
+ )
+}
-export default Pages;
+export default Pages
diff --git a/UI/src/reducers/index.js b/UI/src/reducers/index.js
index 7470dcb..4a68f8a 100644
--- a/UI/src/reducers/index.js
+++ b/UI/src/reducers/index.js
@@ -1,16 +1,16 @@
-import { combineReducers } from 'redux';
+import { combineReducers } from 'redux'
-import servers from './servers';
-import user from './user';
-import rolePicker from './role-picker';
-import roleEditor from './role-editor';
-import { routerMiddleware } from 'react-router-redux';
+import servers from './servers'
+import user from './user'
+import rolePicker from './role-picker'
+import roleEditor from './role-editor'
+import { routerMiddleware } from 'react-router-redux'
// import roles from './roles'
const initialState = {
ready: false,
fade: true,
-};
+}
const appState = (state = initialState, { type, data }) => {
switch (type) {
@@ -19,18 +19,18 @@ const appState = (state = initialState, { type, data }) => {
...state,
ready: true,
fade: false,
- };
+ }
case Symbol.for('app fade'):
return {
...state,
fade: data,
- };
+ }
default:
- return state;
+ return state
}
-};
+}
const rootReducer = combineReducers({
appState,
@@ -40,6 +40,6 @@ const rootReducer = combineReducers({
// roles,
rolePicker,
roleEditor,
-});
+})
-export default rootReducer;
+export default rootReducer
diff --git a/UI/src/reducers/role-editor.js b/UI/src/reducers/role-editor.js
index acba558..0a8f772 100644
--- a/UI/src/reducers/role-editor.js
+++ b/UI/src/reducers/role-editor.js
@@ -1,44 +1,44 @@
-import { Map, OrderedMap, fromJS } from 'immutable';
+import { Map, OrderedMap, fromJS } from 'immutable'
const initialState = Map({
viewMap: OrderedMap({}),
originalSnapshot: OrderedMap({}),
hasAvailableRoles: true,
-});
+})
const reducer = (state = initialState, { type, data }) => {
switch (type) {
case Symbol.for('re: setup'):
- const { viewMap, originalSnapshot, ...rest } = data;
+ const { viewMap, originalSnapshot, ...rest } = data
return state.merge({
viewMap: OrderedMap(viewMap),
originalSnapshot: OrderedMap(originalSnapshot),
...rest,
- });
+ })
case Symbol.for('re: set category'):
- return state.setIn(['viewMap', data.id], Map(data));
+ return state.setIn(['viewMap', data.id], Map(data))
case Symbol.for('re: edit category'):
- return state.setIn(['viewMap', data.id, data.key], data.value);
+ return state.setIn(['viewMap', data.id, data.key], data.value)
case Symbol.for('re: delete category'):
- return state.deleteIn(['viewMap', data]);
+ return state.deleteIn(['viewMap', data])
case Symbol.for('re: switch category mode'):
- return state.setIn(['viewMap', data.id, 'mode'], data.mode);
+ return state.setIn(['viewMap', data.id, 'mode'], data.mode)
case Symbol.for('re: add role to category'):
- const category = state.getIn(['viewMap', data.id]);
+ const category = state.getIn(['viewMap', data.id])
return state.setIn(
['viewMap', data.id],
category
.set('roles', category.get('roles').add(data.role.get('id')))
.set('roles_map', category.get('roles_map').add(data.role))
- );
+ )
case Symbol.for('re: remove role from category'):
- const rmCat = state.getIn(['viewMap', data.id]);
+ const rmCat = state.getIn(['viewMap', data.id])
return state.setIn(
['viewMap', data.id],
rmCat
@@ -50,17 +50,17 @@ const reducer = (state = initialState, { type, data }) => {
'roles_map',
rmCat.get('roles_map').filterNot(r => r.get('id') === data.role.get('id'))
)
- );
+ )
case Symbol.for('re: reset'):
- return state.set('viewMap', state.get('originalSnapshot'));
+ return state.set('viewMap', state.get('originalSnapshot'))
case Symbol.for('re: swap original state'):
- return state.set('originalSnapshot', state.get('viewMap'));
+ return state.set('originalSnapshot', state.get('viewMap'))
default:
- return state;
+ return state
}
-};
+}
-export default reducer;
+export default reducer
diff --git a/UI/src/reducers/role-picker.js b/UI/src/reducers/role-picker.js
index f12b706..d969fa1 100644
--- a/UI/src/reducers/role-picker.js
+++ b/UI/src/reducers/role-picker.js
@@ -1,4 +1,4 @@
-import { Map, OrderedMap } from 'immutable';
+import { Map, OrderedMap } from 'immutable'
const initialState = Map({
hidden: true, // should the view be hidden?
@@ -8,37 +8,37 @@ const initialState = Map({
viewMap: OrderedMap({}), // roles in categories
originalRolesSelected: Map({}), // Map -- original roles for diffing against selected
rolesSelected: Map({}), // Map -- new roles for diffing
-});
+})
export default (state = initialState, { type, data }) => {
switch (type) {
case Symbol.for('rp: setup role picker'):
- return Map(data);
+ return Map(data)
case Symbol.for('rp: hide role picker ui'):
- return state.set('hidden', data);
+ return state.set('hidden', data)
case Symbol.for('rp: reset role picker ui'):
- return state.set('emptyRoles', data);
+ return state.set('emptyRoles', data)
case Symbol.for('rp: update selected roles'):
- return state.mergeIn(['rolesSelected'], data);
+ return state.mergeIn(['rolesSelected'], data)
case Symbol.for('rp: sync selected roles'):
- return state.set('originalRolesSelected', state.get('rolesSelected'));
+ return state.set('originalRolesSelected', state.get('rolesSelected'))
case Symbol.for('rp: reset selected'):
- return state.set('rolesSelected', state.get('originalRolesSelected'));
+ return state.set('rolesSelected', state.get('originalRolesSelected'))
case Symbol.for('rp: set message editor state'):
- return state.set('isEditingMessage', data);
+ return state.set('isEditingMessage', data)
case Symbol.for('rp: edit message buffer'):
- return state.set('messageBuffer', data);
+ return state.set('messageBuffer', data)
// case Symbol.for('rp: zero role picker'):
// return initialState
default:
- return state;
+ return state
}
-};
+}
diff --git a/UI/src/reducers/servers.js b/UI/src/reducers/servers.js
index 94bdfda..fc33e92 100644
--- a/UI/src/reducers/servers.js
+++ b/UI/src/reducers/servers.js
@@ -1,4 +1,4 @@
-import { Set, OrderedMap, Map, fromJS } from 'immutable';
+import { Set, OrderedMap, Map, fromJS } from 'immutable'
const blankServer = Map({
id: '386659935687147521',
@@ -19,14 +19,14 @@ const blankServer = Map({
isAdmin: true,
canManageRoles: true,
},
-});
+})
-const initialState = OrderedMap({});
+const initialState = OrderedMap({})
export default (state = initialState, { type, data }) => {
switch (type) {
case Symbol.for('update servers'):
- return data.reduce((acc, s) => acc.set(s.id, fromJS(s)), OrderedMap());
+ return data.reduce((acc, s) => acc.set(s.id, fromJS(s)), OrderedMap())
// case Symbol.for('update server roles'):
// return state.set(data.id,
@@ -34,15 +34,15 @@ export default (state = initialState, { type, data }) => {
// )
case Symbol.for('server: set'):
- return state.set(data.id, fromJS(data));
+ return state.set(data.id, fromJS(data))
case Symbol.for('server: edit message'):
- return state.setIn([data.id, 'message'], data.message);
+ return state.setIn([data.id, 'message'], data.message)
case Symbol.for('add debug server'):
- return state.set('0', blankServer);
+ return state.set('0', blankServer)
default:
- return state;
+ return state
}
-};
+}
diff --git a/UI/src/reducers/user.js b/UI/src/reducers/user.js
index 4e11007..83ade46 100644
--- a/UI/src/reducers/user.js
+++ b/UI/src/reducers/user.js
@@ -1,4 +1,4 @@
-import { Map } from 'immutable';
+import { Map } from 'immutable'
const initialState = Map({
isLoggedIn: false,
@@ -6,17 +6,17 @@ const initialState = Map({
discriminator: '0001',
id: '',
avatar: null,
-});
+})
export default (state = initialState, { type, data }) => {
switch (type) {
case Symbol.for('set user'):
- return Map({ ...data, isLoggedIn: true });
+ return Map({ ...data, isLoggedIn: true })
case Symbol.for('reset user'):
- return initialState;
+ return initialState
default:
- return state;
+ return state
}
-};
+}
diff --git a/UI/src/registerServiceWorker.js b/UI/src/registerServiceWorker.js
index b872898..b7980a9 100644
--- a/UI/src/registerServiceWorker.js
+++ b/UI/src/registerServiceWorker.js
@@ -16,30 +16,30 @@ const isLocalhost = Boolean(
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
-);
+)
export default function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
+ const publicUrl = new URL(process.env.PUBLIC_URL, window.location)
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374
- return;
+ return
}
window.addEventListener('load', () => {
- const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+ const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`
if (isLocalhost) {
// This is running on localhost. Lets check if a service worker still exists or not.
- checkValidServiceWorker(swUrl);
+ checkValidServiceWorker(swUrl)
} else {
// Is not local host. Just register service worker
- registerValidSW(swUrl);
+ registerValidSW(swUrl)
}
- });
+ })
}
}
@@ -48,7 +48,7 @@ function registerValidSW(swUrl) {
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
- const installingWorker = registration.installing;
+ const installingWorker = registration.installing
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
@@ -56,20 +56,20 @@ function registerValidSW(swUrl) {
// the fresh content will have been added to the cache.
// It's the perfect time to display a "New content is
// available; please refresh." message in your web app.
- console.log('New content is available; please refresh.');
+ console.log('New content is available; please refresh.')
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
- console.log('Content is cached for offline use.');
+ console.log('Content is cached for offline use.')
}
}
- };
- };
+ }
+ }
})
.catch(error => {
- console.error('Error during service worker registration:', error);
- });
+ console.error('Error during service worker registration:', error)
+ })
}
function checkValidServiceWorker(swUrl) {
@@ -84,23 +84,23 @@ function checkValidServiceWorker(swUrl) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
- window.location.reload();
- });
- });
+ window.location.reload()
+ })
+ })
} else {
// Service worker found. Proceed as normal.
- registerValidSW(swUrl);
+ registerValidSW(swUrl)
}
})
.catch(() => {
- console.log('No internet connection found. App is running in offline mode.');
- });
+ console.log('No internet connection found. App is running in offline mode.')
+ })
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
- registration.unregister();
- });
+ registration.unregister()
+ })
}
}
diff --git a/UI/src/router/index.js b/UI/src/router/index.js
index b81445b..1a8d279 100644
--- a/UI/src/router/index.js
+++ b/UI/src/router/index.js
@@ -1,26 +1,26 @@
-import React, { Component, Fragment } from 'react';
-import { Route, Switch, Redirect } from 'react-router-dom';
-import { connect } from 'react-redux';
-import { withRouter } from 'react-router';
+import React, { Component, Fragment } from 'react'
+import { Route, Switch, Redirect } from 'react-router-dom'
+import { connect } from 'react-redux'
+import { withRouter } from 'react-router'
-import Servers from '../components/servers';
-import OauthCallback from '../components/oauth-callback';
-import OauthFlow from '../components/oauth-flow';
-import OauthBotFlow from '../components/oauth-bot-flow';
-import Pages, { Landing, Error404 } from '../pages';
-import ServerLanding from '../components/servers/ServerLanding';
+import Servers from '../components/servers'
+import OauthCallback from '../components/oauth-callback'
+import OauthFlow from '../components/oauth-flow'
+import OauthBotFlow from '../components/oauth-bot-flow'
+import Pages, { Landing, Error404 } from '../pages'
+import ServerLanding from '../components/servers/ServerLanding'
-const aaa = props => {JSON.stringify(props)}
;
+const aaa = props => {JSON.stringify(props)}
export default
@withRouter
@connect(({ appState, user }) => ({ ready: appState.ready, user }))
class AppRouter extends Component {
render() {
- const isLoggedIn = this.props.user.get('isLoggedIn');
+ const isLoggedIn = this.props.user.get('isLoggedIn')
if (!this.props.ready) {
- return null;
+ return null
}
return (
@@ -52,6 +52,6 @@ class AppRouter extends Component {
- );
+ )
}
}
diff --git a/UI/src/store/configureStore.dev.js b/UI/src/store/configureStore.dev.js
index 8d93f80..87cc6f8 100644
--- a/UI/src/store/configureStore.dev.js
+++ b/UI/src/store/configureStore.dev.js
@@ -1,10 +1,10 @@
-import { createStore, applyMiddleware, compose } from 'redux';
-import thunk from 'redux-thunk';
-import { createLogger } from 'redux-logger';
+import { createStore, applyMiddleware, compose } from 'redux'
+import thunk from 'redux-thunk'
+import { createLogger } from 'redux-logger'
// import api from '../middleware/api'
-import rootReducer from '../reducers';
-import DevTools from '../components/dev-tools';
-import { routerMiddleware } from 'react-router-redux';
+import rootReducer from '../reducers'
+import DevTools from '../components/dev-tools'
+import { routerMiddleware } from 'react-router-redux'
const configureStore = (preloadedState, history) => {
const store = createStore(
@@ -14,16 +14,16 @@ const configureStore = (preloadedState, history) => {
applyMiddleware(thunk, routerMiddleware(history), createLogger())
// DevTools.instrument()
)
- );
+ )
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
- store.replaceReducer(rootReducer);
- });
+ store.replaceReducer(rootReducer)
+ })
}
- return store;
-};
+ return store
+}
-export default configureStore;
+export default configureStore
diff --git a/UI/src/store/configureStore.js b/UI/src/store/configureStore.js
index 78c9ea1..a4c9e7a 100644
--- a/UI/src/store/configureStore.js
+++ b/UI/src/store/configureStore.js
@@ -1,5 +1,5 @@
if (process.env.NODE_ENV === 'production') {
- module.exports = require('./configureStore.prod');
+ module.exports = require('./configureStore.prod')
} else {
- module.exports = require('./configureStore.dev');
+ module.exports = require('./configureStore.dev')
}
diff --git a/UI/src/store/configureStore.prod.js b/UI/src/store/configureStore.prod.js
index 304684d..f86ec9d 100644
--- a/UI/src/store/configureStore.prod.js
+++ b/UI/src/store/configureStore.prod.js
@@ -1,15 +1,15 @@
-import { createStore, applyMiddleware } from 'redux';
-import { routerMiddleware } from 'react-router-redux';
+import { createStore, applyMiddleware } from 'redux'
+import { routerMiddleware } from 'react-router-redux'
-import thunk from 'redux-thunk';
+import thunk from 'redux-thunk'
// import api from '../middleware/api'
-import rootReducer from '../reducers';
+import rootReducer from '../reducers'
const configureStore = (preloadedState, history) =>
createStore(
rootReducer,
preloadedState,
applyMiddleware(thunk, routerMiddleware(history))
- );
+ )
-export default configureStore;
+export default configureStore
diff --git a/UI/src/utils.js b/UI/src/utils.js
index 616f5d8..60712e4 100644
--- a/UI/src/utils.js
+++ b/UI/src/utils.js
@@ -1 +1 @@
-export const msgToReal = msg => msg.replace(/');
+export const msgToReal = msg => msg.replace(/')