Skip to content

Commit

Permalink
Merge pull request #322 from webkom/maintenance
Browse files Browse the repository at this point in the history
Maintenance and Upgrade
  • Loading branch information
SmithPeder committed Feb 4, 2020
2 parents 5f42e15 + 4a372db commit 7fb7eef
Show file tree
Hide file tree
Showing 11 changed files with 1,883 additions and 1,851 deletions.
10 changes: 5 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pipeline:
setup:
image: node:11
image: node:13
when:
event:
- push
- pull_request
commands:
- yarn
integration-tests:
image: circleci/node:11-browsers
image: circleci/node:13-browsers
when:
event:
- push
Expand All @@ -23,7 +23,7 @@ pipeline:
- sudo su -c "chown -R circleci:circleci /root/"
- MONGO_URL=mongodb://mongodb:27017/vote-integration-test REDIS_URL=redis HEADLESS=true yarn protractor
lint:
image: node:11
image: node:13
when:
event:
- push
Expand All @@ -32,7 +32,7 @@ pipeline:
commands:
- yarn lint
test:
image: node:11
image: node:13
when:
event:
- push
Expand All @@ -41,7 +41,7 @@ pipeline:
commands:
- MONGO_URL=mongodb://mongodb:27017/vote-test REDIS_URL=redis yarn mocha
build:
image: node:11
image: node:13
when:
event:
- push
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:11
FROM node:13
MAINTAINER Abakus Webkom <[email protected]>

# Create app directory
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018-2019 Abakus Webkom
Copyright (c) 2018-2020 Abakus Webkom

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 6 additions & 16 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,16 @@ app.set('views', `${__dirname}/app/views`);
app.set('mongourl', env.MONGO_URL);

mongoose.Promise = Bluebird;
mongoose.connect(
app.get('mongourl'),
{ useNewUrlParser: true }
);
mongoose.set('useCreateIndex', true);
mongoose.connect(app.get('mongourl'), {
useCreateIndex: true,
useUnifiedTopology: true,
useNewUrlParser: true
});

raven.config(env.RAVEN_DSN).install();

app.use(raven.requestHandler());

const store = new MongoStore({
url: app.get('mongourl')
// TODO: re-enable this when
// https://github.com/jdesboeufs/connect-mongo/issues/277 is fixed:
// mongooseConnection: mongoose.connection
});

// TODO: This can also be removed when the above is fixed:
mongoose.connection.on('disconnected', store.close.bind(store));

if (['development', 'protractor'].includes(env.NODE_ENV)) {
const webpack = require('webpack');
const webpackMiddleware = require('webpack-dev-middleware');
Expand Down Expand Up @@ -71,7 +61,7 @@ app.use(
session({
cookie: { maxAge: 1000 * 3600 * 24 * 30 * 3 }, // Three months
secret: env.COOKIE_SECRET || 'localsecret',
store,
store: new MongoStore({ mongooseConnection: mongoose.connection }), //re-use existing connection
saveUninitialized: true,
resave: false
})
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const _ = require('lodash');
const Bluebird = require('bluebird');
const bcrypt = require('bcrypt');
const bcrypt = require('bcryptjs');
const mongoose = require('mongoose');
const errors = require('../errors');

Expand Down
8 changes: 7 additions & 1 deletion bin/users
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ function validator(value) {
return value;
}

const options = {
useCreateIndex: true,
useUnifiedTopology: true,
useNewUrlParser: true
};

program
.version('1.0.0')
.command('create-user <username> <cardKey>')
Expand All @@ -38,7 +44,7 @@ program
'Usermode: \n [1] for User \n [2] for Moderator \n [3] for Admin \n Enter mode: ',
{ validator, retry: true },
(modeErr, mode) => {
mongoose.connect(mongoURL, connectErr => {
mongoose.connect(mongoURL, options, connectErr => {
if (connectErr) return done(connectErr);

promptly.password('Enter password: ', (pwErr, password) => {
Expand Down
4 changes: 2 additions & 2 deletions electron-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vote-client",
"version": "1.1.0",
"version": "1.2.0",
"description": "Admin client with support for card reader",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -31,7 +31,7 @@
},
"license": "MIT",
"dependencies": {
"card-scanner": "1.0.1"
"card-scanner": "1.0.2"
},
"devDependencies": {
"electron": "4.0.1",
Expand Down
5 changes: 1 addition & 4 deletions electron-app/rfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ const handleConnectButton = () => {
return connectToDevice(devicePath);
};
const connectToDevice = devicePath =>
connect(
devicePath,
onData
)
connect(devicePath, onData)
.then(() => {
$('#overlay').classList.add('hidden');
})
Expand Down
Loading

0 comments on commit 7fb7eef

Please sign in to comment.