diff --git a/controllers/pages.js b/controllers/pages.js index e862b216..24905675 100644 --- a/controllers/pages.js +++ b/controllers/pages.js @@ -29,8 +29,8 @@ router.get('/news.html', news); router.get('/boards.html', sessionRefresh, calcPerms, boardlist); //board pages -router.get('/:board/:page(1[0-9]{0,}|[2-9]{1,}|index).html', Boards.exists, paramConverter, board); //index -router.get('/:board/thread/:id(\\d+).html', Boards.exists, paramConverter, Posts.exists, thread); //thread view +router.get('/:board/:page(1[0-9]{1,}|[2-9][0-9]{0,}|index).html', Boards.exists, paramConverter, board); //index +router.get('/:board/thread/:id([1-9][0-9]{0,}).html', Boards.exists, paramConverter, Posts.exists, thread); //thread view router.get('/:board/catalog.html', Boards.exists, catalog); //catalog router.get('/:board/logs.html', Boards.exists, modloglist);//modlog list router.get('/:board/logs/:date(\\d{2}-\\d{2}-\\d{4}).html', Boards.exists, paramConverter, modlog); //daily log @@ -44,8 +44,8 @@ router.get('/:board/manage/bans.html', sessionRefresh, isLoggedIn, Boards.exists router.get('/:board/manage/settings.html', sessionRefresh, isLoggedIn, Boards.exists, calcPerms, hasPerms(2), csrf, manageSettings); router.get('/:board/manage/banners.html', sessionRefresh, isLoggedIn, Boards.exists, calcPerms, hasPerms(2), csrf, manageBanners); // if (mod view enabled) { -router.get('/:board/manage/:page(1[0-9]{0,}|[2-9]{1,}|index).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, manageBoard); -router.get('/:board/manage/thread/:id(\\d+).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, Posts.exists, manageThread); +router.get('/:board/manage/:page(1[0-9]{1,}|[2-9][0-9]{0,}|index).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, manageBoard); +router.get('/:board/manage/thread/:id([1-9][0-9]{0,}).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, Posts.exists, manageThread); //global manage pages router.get('/globalmanage/reports.html', sessionRefresh, isLoggedIn, calcPerms, hasPerms(1), csrf, globalManageReports); diff --git a/gulp/res/css/themes/clear.css b/gulp/res/css/themes/clear.css index e075ce88..6ed2c56f 100644 --- a/gulp/res/css/themes/clear.css +++ b/gulp/res/css/themes/clear.css @@ -25,7 +25,7 @@ --input-borders: #d2d2d2; --input-color: #333; --input-background: #f5f5f5; - --dice-color: darkorange; + --dice-color: maroon; --title-color: #d70000; --greentext-color: #789922; --pinktext-color:#E0727F; diff --git a/helpers/posting/diceroll.js b/helpers/posting/diceroll.js index 6bfd758d..66d964f4 100644 --- a/helpers/posting/diceroll.js +++ b/helpers/posting/diceroll.js @@ -2,22 +2,8 @@ module.exports = (match, numdice, numsides, operator, modifier) => { numdice = parseInt(numdice); - if (numdice > 100) { - numdice = 100; - } else if (numdice <= 0) { - numdice = 1; - } numsides = parseInt(numsides); - if (numsides > 100) { - numsides = 100; - } else if (numsides <= 0) { - numsides = 1; - } - let sum = 0; - for (let i = 0; i < numdice; i++) { - const roll = Math.floor(Math.random() * numsides)+1; - sum += roll; - } + let sum = (Math.floor(Math.random() * numsides) + 1) * numdice; if (modifier && operator) { modifier = parseInt(modifier); //do i need to make sure it doesnt go negative or maybe give absolute value? @@ -27,5 +13,5 @@ module.exports = (match, numdice, numsides, operator, modifier) => { sum -= modifier; } } - return `\n(${match}) Rolled ${numdice} dice with ${numsides} sides${modifier ? ' and modifier '+operator+modifier : '' } = ${sum}\n`; + return `(${match}) Rolled ${numdice} dice with ${numsides} sides${modifier ? ' and modifier '+operator+modifier : '' } = ${sum}`; } diff --git a/helpers/posting/markdown.js b/helpers/posting/markdown.js index 4438bfc9..778462e8 100644 --- a/helpers/posting/markdown.js +++ b/helpers/posting/markdown.js @@ -14,7 +14,7 @@ const greentextRegex = /^>((?!>\d+|>>/\w+(/\d*)?).*)/gm , codeRegex = /(?:(?[a-z+]{1,10})\r?\n)?(?[\s\S]+)/i , splitRegex = /```([\s\S]+?)```/gm , trimNewlineRegex = /^\s*(\r?\n)*|(\r?\n)*$/g - , diceRegex = /##(?\d+)d(?\d+)(?:(?[+-])(?\d+))?/gmi + , diceRegex = /##(?[1-9][0-9]{0,8})d(?[2-9][0-9]{0,8})(?:(?[+-])(?[1-9][0-9]{0,8}))?/gmi , getDomain = (string) => string.split(/\/\/|\//)[1] //unused atm , escape = require(__dirname+'/escape.js') , { highlight, highlightAuto } = require('highlight.js') diff --git a/helpers/posting/quotes.js b/helpers/posting/quotes.js index 9252b95d..4f7fd9d9 100644 --- a/helpers/posting/quotes.js +++ b/helpers/posting/quotes.js @@ -101,19 +101,15 @@ module.exports = async (board, text, thread) => { } return `>>${quotenum}${postThreadIdMap[board][quotenum].postId == thread ? ' (OP) ' : ''}`; } - return match;//`>>${quotenum}`; + return `>>${quotenum}`; }); } if (crossQuotes) { text = text.replace(crossQuoteRegex, (match, quoteboard, quotenum) => { - if (postThreadIdMap[quoteboard]) { - if (!isNaN(quotenum) && quotenum > 0 && postThreadIdMap[quoteboard][quotenum]) { - return `>>>/${quoteboard}/${quotenum}`; - } else { - return `>>>/${quoteboard}/`; - } + if (postThreadIdMap[quoteboard] && !isNaN(quotenum) && quotenum > 0 && postThreadIdMap[quoteboard][quotenum]) { + return `>>>/${quoteboard}/${quotenum}`; } - return match;// `>>>/${quoteboard}/`; + return `>>>/${quoteboard}/${quotenum || ''}`; }); }