From f050160682bc20fe71b223a73f59f9f2859484c8 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sat, 4 Feb 2023 12:51:45 +1100 Subject: [PATCH 1/3] move theme and codetheme assets into themes/assets and codethemes/assets folders, instead of lumping them all in one disorganised folder --- gulp/res/css/themes/56chan.css | 2 +- gulp/res/css/themes/{ => assets}/56chan-bg.png | Bin gulp/res/css/themes/{ => assets}/iwakura-bg.gif | Bin gulp/res/css/themes/{ => assets}/mushroom.png | Bin gulp/res/css/themes/{ => assets}/tchan-bg.png | Bin .../css/themes/{ => assets}/tchan-capcode.png | Bin gulp/res/css/themes/{ => assets}/tchan-star.png | Bin gulp/res/css/themes/{ => assets}/win95home.png | Bin gulp/res/css/themes/iwakura.css | 4 ++-- gulp/res/css/themes/mushroom.css | 4 ++-- gulp/res/css/themes/tchan.css | 6 +++--- gulp/res/css/themes/win95.css | 2 +- gulpfile.js | 15 ++++++++------- 13 files changed, 17 insertions(+), 16 deletions(-) rename gulp/res/css/themes/{ => assets}/56chan-bg.png (100%) rename gulp/res/css/themes/{ => assets}/iwakura-bg.gif (100%) rename gulp/res/css/themes/{ => assets}/mushroom.png (100%) rename gulp/res/css/themes/{ => assets}/tchan-bg.png (100%) rename gulp/res/css/themes/{ => assets}/tchan-capcode.png (100%) rename gulp/res/css/themes/{ => assets}/tchan-star.png (100%) rename gulp/res/css/themes/{ => assets}/win95home.png (100%) diff --git a/gulp/res/css/themes/56chan.css b/gulp/res/css/themes/56chan.css index 323bb165..ef7c71a6 100644 --- a/gulp/res/css/themes/56chan.css +++ b/gulp/res/css/themes/56chan.css @@ -31,7 +31,7 @@ } body { - background: linear-gradient(#f9e272,rgba(255,255,255,0) 400px calc(100% - 200px),#f9e272),url(/css/themes/56chan-bg.png),hsl(178 40% 80%) + background: linear-gradient(#f9e272,rgba(255,255,255,0) 400px calc(100% - 200px),#f9e272),url(/css/themes/assets/56chan-bg.png),hsl(178 40% 80%) } .board-title { diff --git a/gulp/res/css/themes/56chan-bg.png b/gulp/res/css/themes/assets/56chan-bg.png similarity index 100% rename from gulp/res/css/themes/56chan-bg.png rename to gulp/res/css/themes/assets/56chan-bg.png diff --git a/gulp/res/css/themes/iwakura-bg.gif b/gulp/res/css/themes/assets/iwakura-bg.gif similarity index 100% rename from gulp/res/css/themes/iwakura-bg.gif rename to gulp/res/css/themes/assets/iwakura-bg.gif diff --git a/gulp/res/css/themes/mushroom.png b/gulp/res/css/themes/assets/mushroom.png similarity index 100% rename from gulp/res/css/themes/mushroom.png rename to gulp/res/css/themes/assets/mushroom.png diff --git a/gulp/res/css/themes/tchan-bg.png b/gulp/res/css/themes/assets/tchan-bg.png similarity index 100% rename from gulp/res/css/themes/tchan-bg.png rename to gulp/res/css/themes/assets/tchan-bg.png diff --git a/gulp/res/css/themes/tchan-capcode.png b/gulp/res/css/themes/assets/tchan-capcode.png similarity index 100% rename from gulp/res/css/themes/tchan-capcode.png rename to gulp/res/css/themes/assets/tchan-capcode.png diff --git a/gulp/res/css/themes/tchan-star.png b/gulp/res/css/themes/assets/tchan-star.png similarity index 100% rename from gulp/res/css/themes/tchan-star.png rename to gulp/res/css/themes/assets/tchan-star.png diff --git a/gulp/res/css/themes/win95home.png b/gulp/res/css/themes/assets/win95home.png similarity index 100% rename from gulp/res/css/themes/win95home.png rename to gulp/res/css/themes/assets/win95home.png diff --git a/gulp/res/css/themes/iwakura.css b/gulp/res/css/themes/iwakura.css index 5a7bb602..0d077100 100644 --- a/gulp/res/css/themes/iwakura.css +++ b/gulp/res/css/themes/iwakura.css @@ -31,7 +31,7 @@ } body { - background: linear-gradient(#6d99BA50,#1c1c1c75 400px calc(100% - 200px),#d2738A90),url(/css/themes/iwakura-bg.gif),#0d0d0d none repeat scroll 0 0 + background: linear-gradient(#6d99BA50,#1c1c1c75 400px calc(100% - 200px),#d2738A90),url(/css/themes/assets/iwakura-bg.gif),#0d0d0d none repeat scroll 0 0 } a.quote { @@ -43,7 +43,7 @@ table { } tr { - background: var(--background-rest) url(/css/themes/iwakura-bg.gif) + background: var(--background-rest) url(/css/themes/assets/iwakura-bg.gif) } .captcha { diff --git a/gulp/res/css/themes/mushroom.css b/gulp/res/css/themes/mushroom.css index 1a7939cb..a678485f 100644 --- a/gulp/res/css/themes/mushroom.css +++ b/gulp/res/css/themes/mushroom.css @@ -30,7 +30,7 @@ --pinktext-color: #e0727f; } body { - background: var(--background-rest) url(/css/themes/mushroom.png); + background: var(--background-rest) url(/css/themes/assets/mushroom.png); } a.post-name { color: #a0ffff; @@ -42,7 +42,7 @@ table { border: 1px solid var(--box-border-color); } tr { - background: var(--background-rest) url(/css/themes/mushroom.png); + background: var(--background-rest) url(/css/themes/assets/mushroom.png); } .captcha { filter: invert(90%); diff --git a/gulp/res/css/themes/tchan.css b/gulp/res/css/themes/tchan.css index ed11bcbd..4ed257ae 100644 --- a/gulp/res/css/themes/tchan.css +++ b/gulp/res/css/themes/tchan.css @@ -31,14 +31,14 @@ } body { - background: #140e10 url(/css/themes/tchan-bg.png); + background: #140e10 url(/css/themes/assets/tchan-bg.png); font-family: trebuchet ms,Tahoma,Verdana,Arial,sans-serif; font-size: 13.3333px!important } .postmenu { border: none; - background: url(/css/themes/tchan-star.png) no-repeat; + background: url(/css/themes/assets/tchan-star.png) no-repeat; display: inline-block; height: 19px; width: 17px; @@ -95,7 +95,7 @@ a.post-name:before { font-weight: 700!important; text-shadow: none; content: ''; - background: url(/css/themes/tchan-capcode.png) 0 0 no-repeat; + background: url(/css/themes/assets/tchan-capcode.png) 0 0 no-repeat; background-size: cover; width: 15px!important; height: 16px!important; diff --git a/gulp/res/css/themes/win95.css b/gulp/res/css/themes/win95.css index d711fe29..fe21e354 100644 --- a/gulp/res/css/themes/win95.css +++ b/gulp/res/css/themes/win95.css @@ -79,7 +79,7 @@ textarea, .navbar a:first-of-type::before { content:''; position:absolute; - background: url(/css/themes/win95home.png); + background: url(/css/themes/assets/win95home.png); background-size: contain; height: 1.75em; width: 1.75em; diff --git a/gulpfile.js b/gulpfile.js index c401d778..1046cf5d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -340,22 +340,23 @@ async function css() { await gulp.src([ `${paths.styles.src}/codethemes/*.css`, ]) - .pipe(replace('url(./', 'url(/css/codethemes/')) + .pipe(replace('url(./', 'url(/css/codethemes/assets/')) .pipe(less()) .pipe(cleanCSS()) .pipe(gulp.dest(`${paths.styles.dest}/codethemes/`)); - //move any non-css (images) for code themes to codetheme folder + + //move assets for code codethemes/assets folder await gulp.src([ `${paths.styles.src}/codethemes/*`, `!${paths.styles.src}/codethemes/*.css`, ]) - .pipe(gulp.dest(`${paths.styles.dest}/codethemes/`)); - //move any non-css (images) for themes to theme folder + .pipe(gulp.dest(`${paths.styles.dest}/codethemes/assets/`)); + //move assets for themes to theme/assets folder await gulp.src([ - `${paths.styles.src}/themes/*`, - `!${paths.styles.src}/themes/*.css`, + `${paths.styles.src}/themes/assets/*`, ]) - .pipe(gulp.dest(`${paths.styles.dest}/themes/`)); + .pipe(gulp.dest(`${paths.styles.dest}/themes/assets/`)); + await gulp.src([ `${paths.styles.src}/locals.css`, `${paths.styles.src}/nscaptcha.css`, From 8f9ecb9de2f68aea167d8d93b9816e1d43e2ec82 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sun, 5 Feb 2023 20:50:47 +1100 Subject: [PATCH 2/3] Fix mac instead of total for asset/banner/flag count checking in controllers --- controllers/forms/addassets.js | 2 +- controllers/forms/addflags.js | 2 +- controllers/forms/uploadbanners.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/forms/addassets.js b/controllers/forms/addassets.js index 05d01509..a9819f06 100644 --- a/controllers/forms/addassets.js +++ b/controllers/forms/addassets.js @@ -17,7 +17,7 @@ module.exports = { const errors = await checkSchema([ { result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' }, { result: numberBody(res.locals.numFiles, 0, globalLimits.assetFiles.max), expected: true, error: `Exceeded max asset uploads in one request of ${globalLimits.assetFiles.max}` }, - { result: numberBody(res.locals.board.assets.length+res.locals.numFiles, 0, globalLimits.assetFiles.max), expected: true, error: `Total number of assets would exceed global limit of ${globalLimits.assetFiles.total}` }, + { result: numberBody(res.locals.board.assets.length+res.locals.numFiles, 0, globalLimits.assetFiles.total), expected: true, error: `Total number of assets would exceed global limit of ${globalLimits.assetFiles.total}` }, ]); if (errors.length > 0) { diff --git a/controllers/forms/addflags.js b/controllers/forms/addflags.js index fcb803d0..54b9dec0 100644 --- a/controllers/forms/addflags.js +++ b/controllers/forms/addflags.js @@ -17,7 +17,7 @@ module.exports = { const errors = await checkSchema([ { result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' }, { result: numberBody(res.locals.numFiles, 0, globalLimits.flagFiles.max), expected: true, error: `Exceeded max flag uploads in one request of ${globalLimits.flagFiles.max}` }, - { result: numberBody(Object.keys(res.locals.board.flags).length+res.locals.numFiles, 0, globalLimits.flagFiles.max), expected: true, error: `Total number of flags would exceed global limit of ${globalLimits.flagFiles.total}` }, + { result: numberBody(Object.keys(res.locals.board.flags).length+res.locals.numFiles, 0, globalLimits.flagFiles.total), expected: true, error: `Total number of flags would exceed global limit of ${globalLimits.flagFiles.total}` }, ]); if (errors.length > 0) { diff --git a/controllers/forms/uploadbanners.js b/controllers/forms/uploadbanners.js index d2fee63b..6c18953d 100644 --- a/controllers/forms/uploadbanners.js +++ b/controllers/forms/uploadbanners.js @@ -17,7 +17,7 @@ module.exports = { const errors = await checkSchema([ { result: res.locals.numFiles === 0, expected: false, blocking: true, error: 'Must provide a file' }, { result: numberBody(res.locals.numFiles, 0, globalLimits.bannerFiles.max), expected: true, error: `Exceeded max banner uploads in one request of ${globalLimits.bannerFiles.max}` }, - { result: numberBody(res.locals.board.banners.length+res.locals.numFiles, 0, globalLimits.bannerFiles.max), expected: true, error: `Total number of banners would exceed global limit of ${globalLimits.bannerFiles.total}` }, + { result: numberBody(res.locals.board.banners.length+res.locals.numFiles, 0, globalLimits.bannerFiles.total), expected: true, error: `Total number of banners would exceed global limit of ${globalLimits.bannerFiles.total}` }, ]); if (errors.length > 0) { From 174ecb25dcd1eb26d4b127fee0c87a96fd59e128 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sun, 5 Feb 2023 20:54:24 +1100 Subject: [PATCH 3/3] update CHANGELOG for 0.11.3 patch --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95166d43..61c97a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### 0.11.3 + - Fix max vs total upload count in controller for uploading board assets, flags and banners. + - Move css theme assets to themes/assets instead of all lumped in one folder. + - Adjust the letter spacing and line spacing of the 2FA QR code. + ### 0.11.2 - Convert the assets page form handling to the newer checkSchema code. - Don't show the "Edit" option in the post dropdowns for public pages. diff --git a/package-lock.json b/package-lock.json index e4310f36..602ec16d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jschan", - "version": "0.11.2", + "version": "0.11.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "jschan", - "version": "0.11.2", + "version": "0.11.3", "license": "AGPL-3.0-only", "dependencies": { "@fatchan/express-fileupload": "^1.4.2", diff --git a/package.json b/package.json index 3f05f7e4..983cc2f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jschan", - "version": "0.11.2", + "version": "0.11.3", "migrateVersion": "0.11.0", "description": "", "main": "server.js",