potential fix for dumb palememe

merge-requests/208/head
fatchan 4 years ago
parent 0dd997a029
commit d17670c857
  1. 57
      gulp/res/js/forms.js
  2. 3
      models/forms/makepost.js
  3. 2
      package.json

@ -4,32 +4,39 @@ function removeModal() {
}
function doModal(data, postcallback) {
const modalHtml = modal({ modal: data });
let checkInterval;
document.body.insertAdjacentHTML('afterbegin', modalHtml);
document.getElementById('modalclose').onclick = () => {
removeModal();
clearInterval(checkInterval);
};
document.getElementsByClassName('modal-bg')[0].onclick = () => {
removeModal();
clearInterval(checkInterval);
};
const modalframe = document.getElementById('modalframe');
modalframe.onload = () => {
if (localStorage.getItem('theme') === 'default') {
const currentTheme = document.head.querySelector('#theme').href;
modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme;
}
}
if (modalframe && postcallback) {
checkInterval = setInterval(() => {
if (modalframe && modalframe.contentDocument.title == 'Success') {
clearInterval(checkInterval);
removeModal();
postcallback();
try {
const modalHtml = modal({ modal: data });
let checkInterval;
document.body.insertAdjacentHTML('afterbegin', modalHtml);
document.getElementById('modalclose').onclick = () => {
removeModal();
clearInterval(checkInterval);
};
document.getElementsByClassName('modal-bg')[0].onclick = () => {
removeModal();
clearInterval(checkInterval);
};
const modalframe = document.getElementById('modalframe');
if (modalframe) {
//if theres a modal frame and user has default theme, style it
if (localStorage.getItem('theme') === 'default') {
modalframe.onload = () => {
const currentTheme = document.head.querySelector('#theme').href;
modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme;
}
}
}, 100);
if (postcallback) {
checkInterval = setInterval(() => {
if (modalframe && modalframe.contentDocument.title == 'Success') {
clearInterval(checkInterval);
removeModal();
postcallback();
}
}, 100);
}
}
} catch(e) {
console.error(e)
}
}

@ -48,7 +48,8 @@ module.exports = async (req, res, next) => {
maxFiles, forceAnon, replyLimit, disableReplySubject,
threadLimit, ids, userPostSpoiler, pphTrigger, tphTrigger, triggerAction,
captchaMode, lockMode, allowedFileTypes, flags } = res.locals.board.settings;
if ((lockMode === 0 || (lockMode === 1 && !req.body.thread)) && res.locals.permLevel >= 4) {
if ((lockMode === 2 || (lockMode === 1 && !req.body.thread)) //if board lock, or thread lock and its a new thread
&& res.locals.permLevel >= 4) { //and not staff
await deleteTempFiles(req).catch(e => console.error);
return dynamicResponse(req, res, 400, 'message', {
'title': 'Bad request',

@ -1,7 +1,7 @@
{
"name": "jschan",
"version": "0.0.1",
"migrateVersion": "0.0.3",
"migrateVersion": "0.0.4",
"description": "",
"main": "server.js",
"dependencies": {

Loading…
Cancel
Save