2018-01-23 20:06:30 +00:00
|
|
|
const bodyParser = require('body-parser')
|
2018-09-04 15:48:24 +00:00
|
|
|
const clamd = require('clamdjs')
|
2019-08-26 17:02:06 +00:00
|
|
|
const express = require('express')
|
2018-04-18 21:00:36 +00:00
|
|
|
const helmet = require('helmet')
|
|
|
|
const nunjucks = require('nunjucks')
|
2019-09-08 01:56:29 +00:00
|
|
|
const path = require('path')
|
2018-04-18 21:00:36 +00:00
|
|
|
const RateLimit = require('express-rate-limit')
|
2018-12-03 09:18:52 +00:00
|
|
|
const readline = require('readline')
|
Updates (very important to read)
Client-side CSS & JS files will now be processed with Gulp.
Gulp tasks are configured in gulpfile.js file.
CSS files will be optimized with postcss-preset-env, which will
auto-add vendor prefixes and convert any parts necessary for browsers
compatibility.
Afterwards they will be minified with cssnano.
JS files will be optimized with bublé,
likewise for browsers compatibility.
Afterwards they will be minified with terser.
Unprocessed CSS & JS files will now be located at src directory, while
the processed results will be located at dist directory.
Due to bublé, the JS files should now be compatible up to IE 11
at the minimum.
Previously the safe would not work in IE 11 due to extensive usage of
template literals.
Due to that as well, JS files in src directory will now extensively use
arrow functions for my personal comfort (as they will be converted too).
The server will use the processed files at dist directory by default.
If you want to rebuild the files by your own, you can run "yarn build".
Gulp is a development dependency, so make sure you have installed all
development dependencies (e.i. NOT using "yarn install --production").
---
yarn lint -> gulp lint
yarn build -> gulp default
yarn watch -> gulp watch
yarn develop -> env NODE_ENV=development yarn watch
---
Fixed not being able to demote staff into normal users.
/api/token/verify will no longer respond with 401 HTTP error code,
unless an error occurred (which will be 500 HTTP error code).
Fixed /nojs route not displaying file's original name when a duplicate
is found on the server.
Removed is-breeze CSS class name, in favor of Bulma's is-info.
Removed custom styling from auth page, in favor of global styling.
Removed all usage of style HTML attribute in favor of CSS classes.
Renamed js/s/ to js/misc/.
Use loading spinners on dashboard's sidebar menus.
Disable all other sidebar menus when something is loading.
Changed title HTML attribute of disabled control buttons in
uploads & users list.
Hid checkboxes and WIP controls from users list.
Better error messages handling.
Especially homepage will now support CF's HTTP error codes.
Updated various icons.
Also, added fontello config file at public/libs/fontello/config.json.
This should let you edit them more easily with fontello.
Use Gatsby icon for my blog's link in homepage's footer.
A bunch of other improvements here & there.
2019-09-15 06:20:11 +00:00
|
|
|
const config = require('./config')
|
|
|
|
const logger = require('./logger')
|
2019-09-19 12:10:37 +00:00
|
|
|
const versions = require('./src/versions')
|
2018-01-23 20:06:30 +00:00
|
|
|
const safe = express()
|
|
|
|
|
2018-09-20 11:41:17 +00:00
|
|
|
process.on('uncaughtException', error => {
|
2019-08-26 17:02:06 +00:00
|
|
|
logger.error(error, { prefix: 'Uncaught Exception: ' })
|
2018-09-20 11:41:17 +00:00
|
|
|
})
|
|
|
|
process.on('unhandledRejection', error => {
|
2019-08-26 17:02:06 +00:00
|
|
|
logger.error(error, { prefix: 'Unhandled Rejection (Promise): ' })
|
2018-09-20 11:41:17 +00:00
|
|
|
})
|
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
const paths = require('./controllers/pathsController')
|
2019-08-26 17:02:06 +00:00
|
|
|
const utils = require('./controllers/utilsController')
|
|
|
|
|
|
|
|
const album = require('./routes/album')
|
|
|
|
const api = require('./routes/api')
|
|
|
|
const nojs = require('./routes/nojs')
|
|
|
|
|
|
|
|
const db = require('knex')(config.database)
|
2018-01-23 20:06:30 +00:00
|
|
|
require('./database/db.js')(db)
|
|
|
|
|
|
|
|
safe.use(helmet())
|
2018-12-20 11:53:37 +00:00
|
|
|
if (config.trustProxy) safe.set('trust proxy', 1)
|
2018-01-23 20:06:30 +00:00
|
|
|
|
2018-10-09 19:52:41 +00:00
|
|
|
// https://mozilla.github.io/nunjucks/api.html#configure
|
2018-04-18 21:00:36 +00:00
|
|
|
nunjucks.configure('views', {
|
|
|
|
autoescape: true,
|
2018-10-09 19:52:41 +00:00
|
|
|
express: safe,
|
2019-01-01 05:34:16 +00:00
|
|
|
noCache: process.env.NODE_ENV === 'development'
|
2018-04-18 21:00:36 +00:00
|
|
|
})
|
|
|
|
safe.set('view engine', 'njk')
|
2018-01-23 20:06:30 +00:00
|
|
|
safe.enable('view cache')
|
|
|
|
|
2019-06-03 19:40:24 +00:00
|
|
|
// Configure rate limits
|
|
|
|
if (Array.isArray(config.rateLimits) && config.rateLimits.length)
|
|
|
|
for (const rateLimit of config.rateLimits) {
|
|
|
|
const limiter = new RateLimit(rateLimit.config)
|
|
|
|
for (const route of rateLimit.routes)
|
|
|
|
safe.use(route, limiter)
|
|
|
|
}
|
2018-01-23 20:06:30 +00:00
|
|
|
|
|
|
|
safe.use(bodyParser.urlencoded({ extended: true }))
|
|
|
|
safe.use(bodyParser.json())
|
2017-01-19 05:37:35 +00:00
|
|
|
|
Updates (very important to read)
Client-side CSS & JS files will now be processed with Gulp.
Gulp tasks are configured in gulpfile.js file.
CSS files will be optimized with postcss-preset-env, which will
auto-add vendor prefixes and convert any parts necessary for browsers
compatibility.
Afterwards they will be minified with cssnano.
JS files will be optimized with bublé,
likewise for browsers compatibility.
Afterwards they will be minified with terser.
Unprocessed CSS & JS files will now be located at src directory, while
the processed results will be located at dist directory.
Due to bublé, the JS files should now be compatible up to IE 11
at the minimum.
Previously the safe would not work in IE 11 due to extensive usage of
template literals.
Due to that as well, JS files in src directory will now extensively use
arrow functions for my personal comfort (as they will be converted too).
The server will use the processed files at dist directory by default.
If you want to rebuild the files by your own, you can run "yarn build".
Gulp is a development dependency, so make sure you have installed all
development dependencies (e.i. NOT using "yarn install --production").
---
yarn lint -> gulp lint
yarn build -> gulp default
yarn watch -> gulp watch
yarn develop -> env NODE_ENV=development yarn watch
---
Fixed not being able to demote staff into normal users.
/api/token/verify will no longer respond with 401 HTTP error code,
unless an error occurred (which will be 500 HTTP error code).
Fixed /nojs route not displaying file's original name when a duplicate
is found on the server.
Removed is-breeze CSS class name, in favor of Bulma's is-info.
Removed custom styling from auth page, in favor of global styling.
Removed all usage of style HTML attribute in favor of CSS classes.
Renamed js/s/ to js/misc/.
Use loading spinners on dashboard's sidebar menus.
Disable all other sidebar menus when something is loading.
Changed title HTML attribute of disabled control buttons in
uploads & users list.
Hid checkboxes and WIP controls from users list.
Better error messages handling.
Especially homepage will now support CF's HTTP error codes.
Updated various icons.
Also, added fontello config file at public/libs/fontello/config.json.
This should let you edit them more easily with fontello.
Use Gatsby icon for my blog's link in homepage's footer.
A bunch of other improvements here & there.
2019-09-15 06:20:11 +00:00
|
|
|
let setHeaders
|
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Cache control (safe.fiery.me)
|
2019-01-05 21:09:47 +00:00
|
|
|
if (config.cacheControl) {
|
2019-01-09 10:11:45 +00:00
|
|
|
const cacheControls = {
|
|
|
|
// max-age: 30 days
|
|
|
|
default: 'public, max-age=2592000, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800',
|
2019-01-06 08:26:43 +00:00
|
|
|
// s-max-age: 30 days (only cache in proxy server)
|
|
|
|
// Obviously we have to purge proxy cache on every update
|
2019-09-15 07:43:56 +00:00
|
|
|
proxyOnly: 's-max-age=2592000, proxy-revalidate, stale-while-revalidate=86400, stale-if-error=604800',
|
2019-01-09 10:11:45 +00:00
|
|
|
disable: 'no-store'
|
|
|
|
}
|
|
|
|
|
|
|
|
safe.use('/', (req, res, next) => {
|
|
|
|
res.set('Cache-Control', cacheControls.proxyOnly)
|
2019-01-05 21:09:47 +00:00
|
|
|
next()
|
|
|
|
})
|
|
|
|
|
2019-01-09 10:11:45 +00:00
|
|
|
// Do NOT cache these dynamic routes
|
2019-01-05 21:16:19 +00:00
|
|
|
safe.use(['/a', '/api', '/nojs'], (req, res, next) => {
|
2019-01-09 10:11:45 +00:00
|
|
|
res.set('Cache-Control', cacheControls.disable)
|
2019-01-05 21:09:47 +00:00
|
|
|
next()
|
|
|
|
})
|
2019-01-05 21:14:33 +00:00
|
|
|
|
2019-01-09 10:11:45 +00:00
|
|
|
// Cache these in proxy server though
|
|
|
|
safe.use(['/api/check'], (req, res, next) => {
|
|
|
|
res.set('Cache-Control', cacheControls.proxyOnly)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
|
|
|
|
// Cache album ZIPs
|
|
|
|
safe.use(['/api/album/zip'], (req, res, next) => {
|
2019-01-05 21:14:33 +00:00
|
|
|
setHeaders(res)
|
|
|
|
next()
|
|
|
|
})
|
2019-01-05 21:09:47 +00:00
|
|
|
|
Updates (very important to read)
Client-side CSS & JS files will now be processed with Gulp.
Gulp tasks are configured in gulpfile.js file.
CSS files will be optimized with postcss-preset-env, which will
auto-add vendor prefixes and convert any parts necessary for browsers
compatibility.
Afterwards they will be minified with cssnano.
JS files will be optimized with bublé,
likewise for browsers compatibility.
Afterwards they will be minified with terser.
Unprocessed CSS & JS files will now be located at src directory, while
the processed results will be located at dist directory.
Due to bublé, the JS files should now be compatible up to IE 11
at the minimum.
Previously the safe would not work in IE 11 due to extensive usage of
template literals.
Due to that as well, JS files in src directory will now extensively use
arrow functions for my personal comfort (as they will be converted too).
The server will use the processed files at dist directory by default.
If you want to rebuild the files by your own, you can run "yarn build".
Gulp is a development dependency, so make sure you have installed all
development dependencies (e.i. NOT using "yarn install --production").
---
yarn lint -> gulp lint
yarn build -> gulp default
yarn watch -> gulp watch
yarn develop -> env NODE_ENV=development yarn watch
---
Fixed not being able to demote staff into normal users.
/api/token/verify will no longer respond with 401 HTTP error code,
unless an error occurred (which will be 500 HTTP error code).
Fixed /nojs route not displaying file's original name when a duplicate
is found on the server.
Removed is-breeze CSS class name, in favor of Bulma's is-info.
Removed custom styling from auth page, in favor of global styling.
Removed all usage of style HTML attribute in favor of CSS classes.
Renamed js/s/ to js/misc/.
Use loading spinners on dashboard's sidebar menus.
Disable all other sidebar menus when something is loading.
Changed title HTML attribute of disabled control buttons in
uploads & users list.
Hid checkboxes and WIP controls from users list.
Better error messages handling.
Especially homepage will now support CF's HTTP error codes.
Updated various icons.
Also, added fontello config file at public/libs/fontello/config.json.
This should let you edit them more easily with fontello.
Use Gatsby icon for my blog's link in homepage's footer.
A bunch of other improvements here & there.
2019-09-15 06:20:11 +00:00
|
|
|
setHeaders = res => {
|
|
|
|
res.set('Access-Control-Allow-Origin', '*')
|
|
|
|
res.set('Cache-Control', cacheControls.default)
|
|
|
|
}
|
2019-01-05 21:09:47 +00:00
|
|
|
}
|
2017-09-20 06:03:31 +00:00
|
|
|
|
Updates (very important to read)
Client-side CSS & JS files will now be processed with Gulp.
Gulp tasks are configured in gulpfile.js file.
CSS files will be optimized with postcss-preset-env, which will
auto-add vendor prefixes and convert any parts necessary for browsers
compatibility.
Afterwards they will be minified with cssnano.
JS files will be optimized with bublé,
likewise for browsers compatibility.
Afterwards they will be minified with terser.
Unprocessed CSS & JS files will now be located at src directory, while
the processed results will be located at dist directory.
Due to bublé, the JS files should now be compatible up to IE 11
at the minimum.
Previously the safe would not work in IE 11 due to extensive usage of
template literals.
Due to that as well, JS files in src directory will now extensively use
arrow functions for my personal comfort (as they will be converted too).
The server will use the processed files at dist directory by default.
If you want to rebuild the files by your own, you can run "yarn build".
Gulp is a development dependency, so make sure you have installed all
development dependencies (e.i. NOT using "yarn install --production").
---
yarn lint -> gulp lint
yarn build -> gulp default
yarn watch -> gulp watch
yarn develop -> env NODE_ENV=development yarn watch
---
Fixed not being able to demote staff into normal users.
/api/token/verify will no longer respond with 401 HTTP error code,
unless an error occurred (which will be 500 HTTP error code).
Fixed /nojs route not displaying file's original name when a duplicate
is found on the server.
Removed is-breeze CSS class name, in favor of Bulma's is-info.
Removed custom styling from auth page, in favor of global styling.
Removed all usage of style HTML attribute in favor of CSS classes.
Renamed js/s/ to js/misc/.
Use loading spinners on dashboard's sidebar menus.
Disable all other sidebar menus when something is loading.
Changed title HTML attribute of disabled control buttons in
uploads & users list.
Hid checkboxes and WIP controls from users list.
Better error messages handling.
Especially homepage will now support CF's HTTP error codes.
Updated various icons.
Also, added fontello config file at public/libs/fontello/config.json.
This should let you edit them more easily with fontello.
Use Gatsby icon for my blog's link in homepage's footer.
A bunch of other improvements here & there.
2019-09-15 06:20:11 +00:00
|
|
|
if (config.serveFilesWithNode)
|
|
|
|
safe.use('/', express.static(paths.uploads, { setHeaders }))
|
|
|
|
|
|
|
|
safe.use('/', express.static(paths.public, { setHeaders }))
|
|
|
|
safe.use('/', express.static(paths.dist, { setHeaders }))
|
|
|
|
|
2018-01-23 20:06:30 +00:00
|
|
|
safe.use('/', album)
|
2018-04-12 14:37:42 +00:00
|
|
|
safe.use('/', nojs)
|
2018-01-23 20:06:30 +00:00
|
|
|
safe.use('/api', api)
|
2017-01-14 06:01:23 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
;(async () => {
|
|
|
|
try {
|
|
|
|
// Verify paths, create missing ones, clean up temp ones
|
|
|
|
await paths.init()
|
2017-02-06 03:06:33 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
if (!Array.isArray(config.pages) || !config.pages.length) {
|
|
|
|
logger.error('Config file does not have any frontend pages enabled')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
2018-12-20 12:25:41 +00:00
|
|
|
|
2019-09-19 12:10:37 +00:00
|
|
|
// Re-map version strings if cache control is enabled (safe.fiery.me)
|
|
|
|
utils.versionStrings = {}
|
|
|
|
if (config.cacheControl)
|
|
|
|
for (const type in versions)
|
|
|
|
utils.versionStrings[type] = `?_=${versions[type]}`
|
|
|
|
|
|
|
|
// Check for custom pages, otherwise fallback to Nunjucks templates
|
2019-09-08 01:56:29 +00:00
|
|
|
for (const page of config.pages) {
|
|
|
|
const customPage = path.join(paths.customPages, `${page}.html`)
|
|
|
|
if (!await paths.access(customPage).catch(() => true))
|
|
|
|
safe.get(`/${page === 'home' ? '' : page}`, (req, res, next) => res.sendFile(customPage))
|
|
|
|
else if (page === 'home')
|
2019-09-19 12:10:37 +00:00
|
|
|
safe.get('/', (req, res, next) => res.render(page, {
|
|
|
|
config,
|
|
|
|
versions: utils.versionStrings,
|
|
|
|
gitHash: utils.gitHash
|
|
|
|
}))
|
2019-09-08 01:56:29 +00:00
|
|
|
else
|
2019-09-19 12:10:37 +00:00
|
|
|
safe.get(`/${page}`, (req, res, next) => res.render(page, {
|
|
|
|
config,
|
|
|
|
versions: utils.versionStrings
|
|
|
|
}))
|
2019-09-08 01:56:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Error pages
|
|
|
|
safe.use((req, res, next) => {
|
|
|
|
res.status(404).sendFile(path.join(paths.errorRoot, config.errorPages[404]))
|
|
|
|
})
|
|
|
|
|
|
|
|
safe.use((error, req, res, next) => {
|
|
|
|
logger.error(error)
|
|
|
|
res.status(500).sendFile(path.join(paths.errorRoot, config.errorPages[500]))
|
|
|
|
})
|
2018-09-01 20:37:26 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Git hash
|
|
|
|
if (config.showGitHash) {
|
|
|
|
utils.gitHash = await new Promise((resolve, reject) => {
|
|
|
|
require('child_process').exec('git rev-parse HEAD', (error, stdout) => {
|
|
|
|
if (error) return reject(error)
|
|
|
|
resolve(stdout.replace(/\n$/, ''))
|
|
|
|
})
|
2018-09-20 11:41:17 +00:00
|
|
|
})
|
2019-09-08 01:56:29 +00:00
|
|
|
logger.log(`Git commit: ${utils.gitHash}`)
|
|
|
|
}
|
2018-09-20 11:41:17 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Clamd scanner
|
|
|
|
if (config.uploads.scan && config.uploads.scan.enabled) {
|
|
|
|
const { ip, port } = config.uploads.scan
|
|
|
|
const version = await clamd.version(ip, port)
|
|
|
|
logger.log(`${ip}:${port} ${version}`)
|
2019-08-20 02:16:34 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
utils.clamd.scanner = clamd.createScanner(ip, port)
|
|
|
|
if (!utils.clamd.scanner)
|
|
|
|
throw 'Could not create clamd scanner'
|
|
|
|
}
|
2019-08-20 02:16:34 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Cache file identifiers
|
|
|
|
if (config.uploads.cacheFileIdentifiers) {
|
|
|
|
utils.idSet = await db.table('files')
|
|
|
|
.select('name')
|
|
|
|
.then(rows => {
|
|
|
|
return new Set(rows.map(row => row.name.split('.')[0]))
|
|
|
|
})
|
|
|
|
logger.log(`Cached ${utils.idSet.size} file identifiers`)
|
2019-08-20 02:16:34 +00:00
|
|
|
}
|
2018-09-01 20:37:26 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Binds Express to port
|
|
|
|
await new Promise((resolve, reject) => {
|
|
|
|
try {
|
|
|
|
safe.listen(config.port, () => resolve())
|
|
|
|
} catch (error) {
|
|
|
|
reject(error)
|
|
|
|
}
|
|
|
|
})
|
2018-12-03 09:18:52 +00:00
|
|
|
|
2019-08-26 17:02:06 +00:00
|
|
|
logger.log(`lolisafe started on port ${config.port}`)
|
2019-01-09 10:11:45 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Cache control (safe.fiery.me)
|
2019-09-19 12:10:37 +00:00
|
|
|
// Also only if explicitly using Cloudflare
|
|
|
|
if (config.cacheControl)
|
|
|
|
if (config.cloudflare.purgeCache) {
|
|
|
|
logger.log('Cache control enabled, purging Cloudflare\'s cache...')
|
|
|
|
const routes = config.pages.concat(['api/check'])
|
|
|
|
const results = await utils.purgeCloudflareCache(routes)
|
|
|
|
let errored = false
|
|
|
|
let succeeded = 0
|
|
|
|
for (const result of results) {
|
|
|
|
if (result.errors.length) {
|
|
|
|
if (!errored) errored = true
|
|
|
|
result.errors.forEach(error => logger.log(`[CF]: ${error}`))
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
succeeded += result.files.length
|
2019-01-31 09:36:16 +00:00
|
|
|
}
|
2019-09-19 12:10:37 +00:00
|
|
|
if (!errored)
|
|
|
|
logger.log(`Successfully purged ${succeeded} cache`)
|
|
|
|
} else {
|
|
|
|
logger.log('Cache control enabled without Cloudflare\'s cache purging')
|
2019-01-31 09:36:16 +00:00
|
|
|
}
|
2019-01-09 10:11:45 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
// Temporary uploads
|
|
|
|
if (Array.isArray(config.uploads.temporaryUploadAges) && config.uploads.temporaryUploadAges.length) {
|
|
|
|
let temporaryUploadsInProgress = false
|
|
|
|
const temporaryUploadCheck = async () => {
|
|
|
|
if (temporaryUploadsInProgress)
|
|
|
|
return
|
|
|
|
|
|
|
|
temporaryUploadsInProgress = true
|
|
|
|
const result = await utils.bulkDeleteExpired()
|
|
|
|
|
|
|
|
if (result.expired.length) {
|
|
|
|
let logMessage = `Deleted ${result.expired.length} expired upload(s)`
|
|
|
|
if (result.failed.length)
|
|
|
|
logMessage += ` but unable to delete ${result.failed.length}`
|
|
|
|
|
|
|
|
logger.log(logMessage)
|
|
|
|
}
|
|
|
|
|
|
|
|
temporaryUploadsInProgress = false
|
|
|
|
}
|
|
|
|
temporaryUploadCheck()
|
|
|
|
|
|
|
|
if (config.uploads.temporaryUploadsInterval)
|
|
|
|
setInterval(temporaryUploadCheck, config.uploads.temporaryUploadsInterval)
|
|
|
|
}
|
|
|
|
|
2019-01-01 05:34:16 +00:00
|
|
|
// NODE_ENV=development yarn start
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
2018-12-18 17:41:42 +00:00
|
|
|
// Add readline interface to allow evaluating arbitrary JavaScript from console
|
|
|
|
readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout,
|
|
|
|
prompt: ''
|
|
|
|
}).on('line', line => {
|
|
|
|
try {
|
Updates (very important to read)
Client-side CSS & JS files will now be processed with Gulp.
Gulp tasks are configured in gulpfile.js file.
CSS files will be optimized with postcss-preset-env, which will
auto-add vendor prefixes and convert any parts necessary for browsers
compatibility.
Afterwards they will be minified with cssnano.
JS files will be optimized with bublé,
likewise for browsers compatibility.
Afterwards they will be minified with terser.
Unprocessed CSS & JS files will now be located at src directory, while
the processed results will be located at dist directory.
Due to bublé, the JS files should now be compatible up to IE 11
at the minimum.
Previously the safe would not work in IE 11 due to extensive usage of
template literals.
Due to that as well, JS files in src directory will now extensively use
arrow functions for my personal comfort (as they will be converted too).
The server will use the processed files at dist directory by default.
If you want to rebuild the files by your own, you can run "yarn build".
Gulp is a development dependency, so make sure you have installed all
development dependencies (e.i. NOT using "yarn install --production").
---
yarn lint -> gulp lint
yarn build -> gulp default
yarn watch -> gulp watch
yarn develop -> env NODE_ENV=development yarn watch
---
Fixed not being able to demote staff into normal users.
/api/token/verify will no longer respond with 401 HTTP error code,
unless an error occurred (which will be 500 HTTP error code).
Fixed /nojs route not displaying file's original name when a duplicate
is found on the server.
Removed is-breeze CSS class name, in favor of Bulma's is-info.
Removed custom styling from auth page, in favor of global styling.
Removed all usage of style HTML attribute in favor of CSS classes.
Renamed js/s/ to js/misc/.
Use loading spinners on dashboard's sidebar menus.
Disable all other sidebar menus when something is loading.
Changed title HTML attribute of disabled control buttons in
uploads & users list.
Hid checkboxes and WIP controls from users list.
Better error messages handling.
Especially homepage will now support CF's HTTP error codes.
Updated various icons.
Also, added fontello config file at public/libs/fontello/config.json.
This should let you edit them more easily with fontello.
Use Gatsby icon for my blog's link in homepage's footer.
A bunch of other improvements here & there.
2019-09-15 06:20:11 +00:00
|
|
|
if (line === 'rs')
|
|
|
|
return
|
|
|
|
if (line === '.exit')
|
|
|
|
return process.exit(0)
|
2018-12-18 17:41:42 +00:00
|
|
|
// eslint-disable-next-line no-eval
|
2019-08-26 17:02:06 +00:00
|
|
|
logger.log(eval(line))
|
2018-12-18 17:41:42 +00:00
|
|
|
} catch (error) {
|
2019-08-26 17:02:06 +00:00
|
|
|
logger.error(error.toString())
|
2018-12-18 17:41:42 +00:00
|
|
|
}
|
|
|
|
}).on('SIGINT', () => {
|
|
|
|
process.exit(0)
|
|
|
|
})
|
2019-09-08 01:56:29 +00:00
|
|
|
logger.log('Development mode (disabled nunjucks caching & enabled readline interface)')
|
2018-10-09 19:52:41 +00:00
|
|
|
}
|
2019-09-08 01:56:29 +00:00
|
|
|
} catch (error) {
|
|
|
|
logger.error(error)
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
})()
|