Temporarily removed cookie consent banner + maintenance

This commit is contained in:
Evert Prants 2020-07-06 21:33:00 +03:00
parent 70551ed482
commit 0350659b6c
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
12 changed files with 1432 additions and 966 deletions

2228
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,42 +30,42 @@
}, },
"homepage": "https://icynet.eu", "homepage": "https://icynet.eu",
"dependencies": { "dependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.10.1", "@babel/plugin-transform-modules-commonjs": "^7.10.4",
"@babel/register": "^7.10.1", "@babel/register": "^7.10.4",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"connect-redis": "^4.0.4", "connect-redis": "^4.0.4",
"connect-session-knex": "^1.6.0", "connect-session-knex": "^1.7.3",
"email-templates": "^7.0.5", "email-templates": "^7.0.5",
"express": "^4.17.1", "express": "^4.17.1",
"express-rate-limit": "^5.1.3", "express-rate-limit": "^5.1.3",
"express-session": "^1.17.1", "express-session": "^1.17.1",
"feed": "^4.2.0", "feed": "^4.2.1",
"fs-extra": "^9.0.0", "fs-extra": "^9.0.1",
"gm": "^1.23.1", "gm": "^1.23.1",
"knex": "^0.21.1", "knex": "^0.21.1",
"multiparty": "^4.2.1", "multiparty": "^4.2.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"nodemailer": "^6.4.8", "nodemailer": "^6.4.10",
"notp": "^2.0.3", "notp": "^2.0.3",
"oauth-libre": "^0.9.17", "oauth-libre": "^0.9.17",
"objection": "^2.1.5", "objection": "^2.2.1",
"redis": "^3.0.2", "redis": "^3.0.2",
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",
"stylus": "^0.54.7", "stylus": "^0.54.7",
"thirty-two": "^1.0.2", "thirty-two": "^1.0.2",
"toml": "^3.0.0", "toml": "^3.0.0",
"uuid": "^8.1.0", "uuid": "^8.2.0",
"vue": "^2.6.11" "vue": "^2.6.11"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.10.1", "@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.1", "@babel/preset-env": "^7.10.4",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"bootstrap": "^4.5.0", "bootstrap": "^4.5.0",
"concurrently": "^5.2.0", "concurrently": "^5.2.0",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.22.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"mustache": "^4.0.1", "mustache": "^4.0.1",
@ -73,16 +73,16 @@
"pug": "^3.0.0", "pug": "^3.0.0",
"pug-plain-loader": "^1.0.0", "pug-plain-loader": "^1.0.0",
"standard": "^14.3.4", "standard": "^14.3.4",
"terser-webpack-plugin": "^3.0.2", "terser-webpack-plugin": "^3.0.6",
"vue-clickaway": "^2.2.2", "vue-clickaway": "^2.2.2",
"vue-loader": "^15.9.2", "vue-loader": "^15.9.3",
"vue-resource": "^1.5.1", "vue-resource": "^1.5.1",
"vue-router": "^3.3.1", "vue-router": "^3.3.4",
"vue-template-compiler": "^2.6.11", "vue-template-compiler": "^2.6.11",
"watch": "^1.0.2", "watch": "^1.0.2",
"webpack": "^4.43.0", "webpack": "^4.43.0",
"webpack-cli": "^3.3.11", "webpack-cli": "^3.3.12",
"webpack-merge": "^4.2.2" "webpack-merge": "^5.0.7"
}, },
"standard": { "standard": {
"env": { "env": {

View File

@ -5,12 +5,7 @@ import fs from 'fs-extra'
let lfs let lfs
function pz (z) { const pz = z => z < 10 ? '0' + z : z
if (z < 10) {
return '0' + z
}
return z
}
// Time stamp constructor // Time stamp constructor
function dateFormat (date) { function dateFormat (date) {
@ -72,20 +67,10 @@ async function initializeLogger () {
} }
} }
module.exports = function () { module.exports = {
this.logProcess = (pid, msg) => { initialize: function () {
if (msg.indexOf('warn') === 0) {
msg = msg.substring(5)
console.warn('[%s] %s', pid, msg)
} else if (msg.indexOf('error') === 0) {
msg = msg.substring(6)
console.error('[%s] %s', pid, msg)
} else {
console.log('[%s] %s', pid, msg)
}
}
// Create log file write stream // Create log file write stream
if (!config.logger || !config.logger.write) return if (!config.logger || !config.logger.write) return
initializeLogger().catch((e) => console.error(e)) initializeLogger().catch((e) => console.error(e))
} }
}

View File

@ -110,7 +110,7 @@ async function uploadImage (identifier, fields, files) {
// Get file info, generate a file name // Get file info, generate a file name
const fileHash = uuid() const fileHash = uuid()
const contentType = file.headers['content-type'] const contentType = file.headers['content-type']
if (!contentType) return bailOut(file.path, 'Invalid of missing content-type header') if (!contentType) return bailOut(file.path, 'Invalid or missing content-type header')
file = file.path file = file.path

View File

@ -1,9 +1,5 @@
import response from './response' import response from './response'
module.exports = function (fn, redir) { module.exports = (fn, redir) => (req, res, next) =>
return function (req, res, next) { fn(req, res, next).catch(e =>
fn(req, res, next).catch(e => { response.error(req, res, e, redir ? req.query.redirect_uri : null))
return response.error(req, res, e, redir ? req.query.redirect_uri : null)
})
}
}

View File

@ -6,7 +6,9 @@ import path from 'path'
const cpuCount = require('os').cpus().length const cpuCount = require('os').cpus().length
const workers = [] const workers = []
const logger = new Logger()
// Initialize the logger
Logger.initialize()
const args = { const args = {
dev: process.env.NODE_ENV !== 'production', dev: process.env.NODE_ENV !== 'production',
@ -63,24 +65,17 @@ function watchFileTree () {
function spawnWorker (oldWorker) { function spawnWorker (oldWorker) {
const w = cluster.fork() const w = cluster.fork()
w.process.stdout.on('data', (data) => { w.process.stdout.on('data', (data) => {
console.log(w.process.pid, data.toString().trim()) console.log('[%s]', w.process.pid, data.toString().trim())
}) })
w.process.stderr.on('data', (data) => { w.process.stderr.on('data', (data) => {
console.log(w.process.pid, data.toString().trim()) console.error('[%s]', w.process.pid, data.toString().trim())
}) })
args.verbose && console.log('Starting worker process %d...', w.process.pid)
w.on('message', (message) => { w.on('message', (message) => {
if (message === 'started') { if (message !== 'started') return
workers.push(w) workers.push(w)
args.verbose && console.log('Started worker process', w.process.pid) if (oldWorker) oldWorker.send('stop')
if (oldWorker) {
args.verbose && console.log('Stopping worker process', oldWorker.process.pid)
oldWorker.send('stop')
}
} else {
logger.logProcess(w.process.pid, message)
}
}) })
args.id = w.process.pid args.id = w.process.pid
@ -106,9 +101,7 @@ cluster.on('exit', (worker, code, signal) => {
if (index !== -1) workers.splice(index, 1) if (index !== -1) workers.splice(index, 1)
if (code === 0) return if (code === 0) return
setTimeout(() => { setTimeout(spawnWorker, 10 * 1000)
spawnWorker()
}, 10 * 1000)
}) })
initialize() initialize()

View File

@ -1,35 +1,13 @@
'use strict' 'use strict'
const path = require('path') const path = require('path')
const util = require('util')
require('@babel/register')({ require('@babel/register')({
plugins: ['@babel/plugin-transform-modules-commonjs'] plugins: ['@babel/plugin-transform-modules-commonjs']
}) })
process.once('message', (args) => { process.once('message', (args) => {
if (args.dev) { process.env.NODE_ENV = args.dev ? 'development' : 'production'
process.env.NODE_ENV = 'development'
} else {
process.env.NODE_ENV = 'production'
}
console.log = function () {
process.send(util.format.apply(this, arguments))
}
console.debug = function () {
if (!args.dev) return
process.send('[DEBUG] ' + util.format.apply(this, arguments))
}
console.warn = function () {
process.send('warn ' + util.format.apply(this, arguments))
}
console.error = function () {
process.send('error ' + util.format.apply(this, arguments))
}
try { try {
require(path.join(__dirname, 'server'))(args) require(path.join(__dirname, 'server'))(args)
@ -39,14 +17,11 @@ process.once('message', (args) => {
} }
process.on('message', (message) => { process.on('message', (message) => {
if (message === 'stop') { if (message !== 'stop') return
console.log('Recieved stop signal') console.log('Recieved stop signal')
const knex = require(path.join(__dirname, '../scripts/load-database')).knex const knex = require(path.join(__dirname, '../scripts/load-database')).knex
knex.destroy(() => { knex.destroy(() => process.exit(0))
process.exit(0)
})
}
}) })
process.send('started') process.send('started')

View File

@ -20,8 +20,8 @@ html
block navigation block navigation
nav.navbar.navbar-expand-lg.navbar-light.bg-light.sticky-top nav.navbar.navbar-expand-lg.navbar-light.bg-light.sticky-top
a.navbar-brand(href="/") a.navbar-brand(href="/")
img(src="/static/image/icynet-icon.svg" width="30" heigth="30") img(src="/static/image/icynet-icon.png" width="30" heigth="30")
|Administration |&nbsp;Administration
button.navbar-toggler(type="button" data-toggle="collapse" data-target="#navCollapse" aria-controls="navCollapse" aria-expanded="false" aria-label="Toggle navigation") button.navbar-toggler(type="button" data-toggle="collapse" data-target="#navCollapse" aria-controls="navCollapse" aria-expanded="false" aria-label="Toggle navigation")
span.navbar-toggler-icon span.navbar-toggler-icon

View File

@ -31,31 +31,14 @@ html
link(rel="stylesheet", type="text/css", href="/style/main.css") link(rel="stylesheet", type="text/css", href="/style/main.css")
link(rel="stylesheet", type="text/css", href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css") link(rel="stylesheet", type="text/css", href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css")
script(src="/script/main.js") script(src="/script/main.js")
block cookieconsent
link(rel="stylesheet", type="text/css", href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.4/cookieconsent.min.css")
script(src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.4/cookieconsent.min.js")
script(type="text/javascript").
window.addEventListener('load', function () {
window.cookieconsent.initialise({
container: document.body,
palette:{
popup: {background: "#00dbf7"},
button: {background: "#0074d0"},
},
revokable: false,
law: {
regionalLaw: false,
},
location: true,
});
});
title title
block title block title
body body
noscript noscript
h2 This site requires JavaScript to work properly! Some features may be limited or missing entirely. h2 This site requires JavaScript to work properly! Some features may be limited or missing entirely.
p Please consider enabling JavaScript for the full experience. We respect your browser's privacy settings. p Please consider enabling JavaScript for the full experience. We respect your browser's privacy settings.
p This site is entirely free and open source:
a(href="https://gitlab.icynet.eu/IcyNetwork/IcyNet.eu" target="_blank") Browse the repository
if matomo if matomo
img.d-inline-block.align-top(src="#{matomo.track_url}piwik.php?idsite=1&rec=1" style="border:0;" alt="") img.d-inline-block.align-top(src="#{matomo.track_url}piwik.php?idsite=1&rec=1" style="border:0;" alt="")
@ -63,7 +46,7 @@ html
nav.navbar.navbar-expand-lg.navbar-light.bg-light.sticky-top nav.navbar.navbar-expand-lg.navbar-light.bg-light.sticky-top
a.navbar-brand(href="/") a.navbar-brand(href="/")
img(src="/static/image/icynet-icon.png" width="30" heigth="30") img(src="/static/image/icynet-icon.png" width="30" heigth="30")
|Icy Network |&nbsp;Icy Network
button.navbar-toggler(type="button" data-toggle="collapse" data-target="#navCollapse" aria-controls="navCollapse" aria-expanded="false" aria-label="Toggle navigation") button.navbar-toggler(type="button" data-toggle="collapse" data-target="#navCollapse" aria-controls="navCollapse" aria-expanded="false" aria-label="Toggle navigation")
span.navbar-toggler-icon span.navbar-toggler-icon

View File

@ -5,8 +5,8 @@ block title
block body block body
.container.mb-4.mt-4.pt-4 .container.mb-4.mt-4.pt-4
.row .row
.col .col.d-none.d-sm-block
.col-6 .col-sm-auto
h1.mt-1.mb-5.text-center Log in to Icy Network h1.mt-1.mb-5.text-center Log in to Icy Network
if message.text if message.text
if message.error if message.error
@ -35,4 +35,4 @@ block body
if !registrations if !registrations
.alert.alert-warning These links can only be used to log in to existing accounts. .alert.alert-warning These links can only be used to log in to existing accounts.
include ../includes/external.pug include ../includes/external.pug
.col .col.d-none.d-sm-block

View File

@ -1,4 +1,4 @@
const merge = require('webpack-merge') const { merge } = require('webpack-merge')
const common = require('./webpack.common.js') const common = require('./webpack.common.js')
module.exports = merge(common, { module.exports = merge(common, {

View File

@ -1,5 +1,5 @@
const webpack = require('webpack') const webpack = require('webpack')
const merge = require('webpack-merge') const { merge } = require('webpack-merge')
const common = require('./webpack.common.js') const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin')