diff --git a/index.js b/index.js index bfc9436..6b42c4f 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,4 @@ -const fastify = require('fastify')({ - logger: true, - bodyLimit: 10485760 -}) +const fastify = require('fastify')({ logger: true }) const fs = require('fs'); const path = require('path') const CryptoJS = require("crypto-js"); @@ -28,7 +25,8 @@ let MaxAmountCrepe = 10; let Supplements = ["nature", "sucre", "nutella", "confiture"]; fastify.addContentTypeParser('application/json', { - parseAs: 'string' + parseAs: 'string', + bodyLimit: 10485760 }, function(req, body, done) { try { var json = JSON.parse(body) diff --git a/static/js/main.js b/static/js/main.js index b609081..9fdb06c 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -300,7 +300,7 @@ function get_admin(type) { } activityData.sort((a, b) => new Date(a.start) - new Date(b.start)); for (entry in activityData) { - if (activityData[entry].type = "event") { + if (activityData[entry].type == "event") { $("#admin-content").append(`
Event:
@@ -317,7 +317,7 @@ function get_admin(type) {
`) - } else if (activityData[entry].type = "treasure") { + } else if (activityData[entry].type == "treasure") { $("#admin-content").prepend(`
Trésor:
@@ -642,7 +642,7 @@ $('#treasure-popup-button').click((e) => { var tuid = $('#treasure-popup-uid').val(); if(tuid != '') { indata.treasureUid = tuid; - } + } fr.addEventListener('load', () => { indata.image = fr.result; @@ -652,7 +652,7 @@ $('#treasure-popup-button').click((e) => { data: JSON.stringify(indata), contentType: "application/json; charset=utf-8", dataType: "json", - + success: function(data) { if(data.success) { updateDemandes(); @@ -664,7 +664,7 @@ $('#treasure-popup-button').click((e) => { }); }); - + fr.readAsDataURL(f); }); @@ -830,7 +830,7 @@ function updateDemandes() { else $elem.addClass('treasure-submitted'); $elem.find(".treasure-btn-submit").text('Editer la soumission'); - + $(`
Image: Lien
`).insertAfter($elem.find('.treasure-desc')) $(`
${td[td_uid].desc}
`).insertAfter($elem.find('.treasure-desc')) $(`

Votre soumission :

`).insertAfter($elem.find('.treasure-desc')) @@ -845,7 +845,7 @@ function updateDemandes() { console.error(data.why); } } - + }); } }