Browse Source

refactor: cleanup

pull/621/head
NGPixel 6 years ago
parent
commit
30ce9c8670
6 changed files with 20 additions and 17 deletions
  1. 5
      client/js/components/navigator.vue
  2. 12
      dev/webpack/webpack.prod.js
  3. 2
      server/controllers/auth.js
  4. 16
      server/setup.js
  5. 0
      server/views/pages/login.pug
  6. 2
      server/views/pages/setup.pug

5
client/js/components/navigator.vue

@ -81,12 +81,11 @@
</template>
<script>
/* global CONSTANTS, graphQL, siteConfig */
/* global siteConfig */
import { mapState } from 'vuex'
export default {
name: 'navigator',
data() {
return {
sdShown: false,
@ -151,8 +150,6 @@ export default {
logout() {
window.location.assign(this.$helpers.resolvePath('logout'))
}
},
mounted() {
}
}
</script>

12
dev/webpack/webpack.prod.js

@ -9,14 +9,20 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
const common = require('./webpack.common.js')
console.info(process.cwd())
module.exports = merge(common, {
module: {
rules: []
},
plugins: [
new CleanWebpackPlugin(['assets'], { root: process.cwd() }),
new CleanWebpackPlugin([
'assets/js/*.*',
'assets/css/*.*',
'assets/*.js',
'assets/*.json'
], {
root: process.cwd(),
verbose: false
}),
new UglifyJSPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')

2
server/controllers/auth.js

@ -34,7 +34,7 @@ const bruteforce = new ExpressBrute(EBstore, {
* Login form
*/
router.get('/login', function (req, res, next) {
res.render('auth/login')
res.render('pages/login')
})
router.post('/login', bruteforce.prevent, function (req, res, next) {

16
server/setup.js

@ -77,7 +77,7 @@ module.exports = () => {
app.get('*', async (req, res) => {
let packageObj = await fs.readJson(path.join(wiki.ROOTPATH, 'package.json'))
res.render('setup', {
res.render('pages/setup', {
packageObj,
telemetryClientID: wiki.telemetry.cid
})
@ -375,12 +375,12 @@ module.exports = () => {
wiki.logger.info(`HTTP Server on port: ${wiki.config.port}`)
app.set('port', wiki.config.port)
server = http.createServer(app)
server.listen(wiki.config.port)
wiki.server = http.createServer(app)
wiki.server.listen(wiki.config.port)
var openConnections = []
server.on('connection', (conn) => {
wiki.server.on('connection', (conn) => {
let key = conn.remoteAddress + ':' + conn.remotePort
openConnections[key] = conn
conn.on('close', () => {
@ -388,14 +388,14 @@ module.exports = () => {
})
})
server.destroy = (cb) => {
server.close(cb)
wiki.server.destroy = (cb) => {
wiki.server.close(cb)
for (let key in openConnections) {
openConnections[key].destroy()
}
}
server.on('error', (error) => {
wiki.server.on('error', (error) => {
if (error.syscall !== 'listen') {
throw error
}
@ -412,7 +412,7 @@ module.exports = () => {
}
})
server.on('listening', () => {
wiki.server.on('listening', () => {
wiki.logger.info('HTTP Server: RUNNING')
})
}

server/views/auth/login.pug → server/views/pages/login.pug

server/views/setup.pug → server/views/pages/setup.pug

@ -1,4 +1,4 @@
extends master.pug
extends ../master.pug
block body
body
Loading…
Cancel
Save