Skip to content

Commit c02b18b

Browse files
committed
update gulp
1 parent 3e8834c commit c02b18b

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

gulpfile.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const del = require('del');
66
const imagemin = require('gulp-imagemin');
77

88
const pageSetting = require('./src/_data/settings')
9-
109
const imageList = require('./plugins/images-list');
10+
1111
const baseDirPath = 'src/images/gallery';
1212

1313
function getFolders(dir) {
@@ -64,25 +64,7 @@ gulp.task('prepare-img', gulp.series('minify-img', 'image-list'));
6464

6565
gulp.task('compile:11ty', () => {
6666
return gulp
67-
.src('./public/**/*')
68-
.pipe(gulp.dest('./dist/public'))
69-
})
70-
71-
gulp.task('compile:11ty-scripts', () => {
72-
return gulp
73-
.src('./public/scripts/*')
74-
.pipe(gulp.dest('./dist/public/scripts'))
75-
})
76-
77-
gulp.task('compile:11ty-styles', () => {
78-
return gulp
79-
.src('./public/styles/*')
80-
.pipe(gulp.dest('./dist/public/styles'))
81-
})
82-
83-
gulp.task('compile:11ty-html', () => {
84-
return gulp
85-
.src('./public/index.html')
67+
.src(['./public/**/*', '!./public/images/**/*'])
8668
.pipe(gulp.dest('./dist/public'))
8769
})
8870

@@ -93,10 +75,6 @@ gulp.task('compile:server', (cb) => {
9375

9476
})
9577

96-
gulp.task('clean:images', function(cb){
97-
return del('./dist/public/images', {force:true});
98-
});
99-
10078
gulp.task('compile:images', (cb) => {
10179
return gulp
10280
.src('./src/images/**/*')
@@ -121,5 +99,5 @@ gulp.task('copy-rest', (cb) => {
12199
cb()
122100
})
123101

124-
gulp.task('build', gulp.series('clean', 'compile:11ty', 'clean:images', 'compile:server', 'compile:images', 'copy-rest'));
125-
gulp.task('update-build', gulp.series('compile:11ty-html', 'compile:11ty-scripts', 'compile:11ty-styles', 'compile:server', 'copy-rest'));
102+
gulp.task('build', gulp.series('clean', 'compile:11ty', 'compile:server', 'compile:images', 'copy-rest'));
103+
gulp.task('update-build', gulp.series('compile:11ty', 'compile:server', 'copy-rest'));

server/server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const TelegramBot = require('node-telegram-bot-api');
88
require('dotenv').config();
99

1010
const allowedMimes = ['image/bmp', 'image/jpeg', 'image/jpg', 'image/png', 'image/bmp'];
11-
11+
const maxFileSizeBytes = 15000000;
1212
const tgToken = process.env.TGTOKEN;
1313
const chatId = process.env.chatId;
1414

@@ -45,6 +45,10 @@ app.post('/order', upload.single('file'), async (req, res) => {
4545
sendBadRequest(res);
4646
return;
4747
}
48+
if(file.size > maxFileSizeBytes) {
49+
sendBadRequest(res);
50+
return;
51+
}
4852
const caption = getCaption(req.body);
4953
const buffer = fs.readFileSync(file.path);
5054
await bot.sendPhoto(chatId, buffer, { caption });

0 commit comments

Comments
 (0)