Compare commits
No commits in common. "42c6524c27cdefa474cf0544f28009e12f74437f" and "daee21ab4d02ff65f346e1b377073fe4f7eaa9a0" have entirely different histories.
42c6524c27
...
daee21ab4d
|
@ -7,7 +7,4 @@ WORKDIR /opt/code
|
||||||
RUN rm -rf node_modules package_lock.json && \
|
RUN rm -rf node_modules package_lock.json && \
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
# global deps
|
|
||||||
RUN npm i -g gulp-cli
|
|
||||||
|
|
||||||
CMD [ "/bin/sh", "-c", "/opt/code/run_instance.sh" ]
|
CMD [ "/bin/sh", "-c", "/opt/code/run_instance.sh" ]
|
|
@ -9,6 +9,3 @@ services:
|
||||||
- '${APP_PORT:-8080}:${APP_PORT:-8080}'
|
- '${APP_PORT:-8080}:${APP_PORT:-8080}'
|
||||||
volumes:
|
volumes:
|
||||||
- './usercontent:/opt/code/usercontent'
|
- './usercontent:/opt/code/usercontent'
|
||||||
# uncomment this for debug mode
|
|
||||||
#- './:/opt/code'
|
|
||||||
restart: always
|
|
36
gulpfile.js
36
gulpfile.js
|
@ -1,36 +0,0 @@
|
||||||
const gulp = require('gulp');
|
|
||||||
const { spawn } = require('child_process');
|
|
||||||
const log = require('fancy-log');
|
|
||||||
|
|
||||||
const spawn_dev = () => {
|
|
||||||
return spawn('node', ['--inspect=0.0.0.0', 'index.js'], {stdio: 'inherit'});
|
|
||||||
}
|
|
||||||
|
|
||||||
let node;
|
|
||||||
let shutdown = false;
|
|
||||||
|
|
||||||
gulp.task('run_dev', (cb) => {
|
|
||||||
|
|
||||||
log('Running application in development mode...');
|
|
||||||
node = spawn_dev();
|
|
||||||
|
|
||||||
function watch(cb) {
|
|
||||||
if (shutdown == true) return cb();
|
|
||||||
log('Files changed, restarting node...');
|
|
||||||
node.kill('SIGTERM');
|
|
||||||
node = spawn_dev();
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.watch('.', { events: 'all' }, watch);
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
function shutdown_f() {
|
|
||||||
shutdown = true;
|
|
||||||
node.kill('SIGINT');
|
|
||||||
node.kill('SIGTERM');
|
|
||||||
}
|
|
||||||
|
|
||||||
process.on('SIGINT', shutdown_f);
|
|
||||||
process.on('SIGTERM', shutdown_f);
|
|
|
@ -6,7 +6,8 @@ const glob = require('glob');
|
||||||
const root = path.join(process.cwd(), '/usercontent');
|
const root = path.join(process.cwd(), '/usercontent');
|
||||||
const { MAXFILES } = process.env;
|
const { MAXFILES } = process.env;
|
||||||
|
|
||||||
// console.log(root);
|
console.log(root);
|
||||||
|
|
||||||
|
|
||||||
let initalized = false;
|
let initalized = false;
|
||||||
|
|
||||||
|
@ -14,17 +15,21 @@ let submitted = 0;
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
if (initalized) return;
|
if (initalized) return;
|
||||||
|
glob(root + '/**', undefined, (err, files) => {
|
||||||
let files = await glob(root + '/*');
|
if (err) {
|
||||||
files.filter(file => {return !file.startsWith('.')})
|
console.error(err);
|
||||||
.forEach(file => {
|
|
||||||
submitted++;
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
files.filter(file => {
|
||||||
|
return !file.startsWith('.');
|
||||||
|
}).forEach(file => {
|
||||||
|
submitted++;
|
||||||
});
|
});
|
||||||
|
initalized = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
init();
|
|
||||||
|
|
||||||
function get_submitted() {return submitted;}
|
function submitted() {return submitted;}
|
||||||
|
|
||||||
const make_id = () => {
|
const make_id = () => {
|
||||||
return crypto.randomBytes(8).toString('hex');
|
return crypto.randomBytes(8).toString('hex');
|
||||||
|
@ -48,4 +53,4 @@ async function create(data) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { get, write, create, make_id, submitted: get_submitted, init };
|
module.exports = { get, write, create, make_id, submitted };
|
|
@ -15,11 +15,7 @@
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"express-async-handler": "^1.2.0",
|
"express-async-handler": "^1.2.0",
|
||||||
"fancy-log": "^2.0.0",
|
|
||||||
"glob": "^9.2.1",
|
"glob": "^9.2.1",
|
||||||
"pug": "^3.0.2"
|
"pug": "^3.0.2"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"gulp": "^4.0.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ block content
|
||||||
if (!exceeded)
|
if (!exceeded)
|
||||||
input(type='submit' value='Upload!')
|
input(type='submit' value='Upload!')
|
||||||
if (exceeded)
|
if (exceeded)
|
||||||
p(style='color:darkred;font-weight:bold;font-size:9pt' align='center')
|
p(style='color:darkred;font-weight:bold;font-size:9pt')
|
||||||
| Max uploads limit exceeded. No more uploads would be accepted.
|
| Max uploads limit exceeded. No more uploads would be accepted.
|
||||||
br
|
br
|
||||||
| Contact site administrator so they would increase the limit or delete some upload.
|
| Contact site administrator so they would increase the limit or delete some uploads.
|
Loading…
Reference in New Issue