Fix hashing
continuous-integration/drone/push Build is passing Details

This commit is contained in:
DutchEllie 2022-07-13 18:11:21 +02:00
parent 75f3777b46
commit 1038602d5b
Signed by: DutchEllie
SSH Key Fingerprint: SHA256:dKq6ZSgN5E3Viqrw/+xAdf2VdR6hdRGNyrYqXXwfjTY
1 changed files with 7 additions and 2 deletions

View File

@ -32,6 +32,11 @@
let DisplayComments: Comment[];
let commentPage = 0;
let pageSize = 10;
const escapeHtml = (unsafe) => {
return unsafe.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;').replaceAll('"', '&quot;').replaceAll("'", '&#039;');
}
async function onSubmit(event: SubmitEvent) {
// Validation
if (name === '' || message === '') {
@ -86,7 +91,7 @@
// Check if in localstorage already
let commentLS = localStorage.getItem('comments');
let comments: Comment[];
if (commentLS === null) {
if (commentLS == null) {
// Not yet in storage
comments = await updateComments();
DisplayComments = comments;
@ -99,7 +104,7 @@
return t;
});
let oldHash = localStorage.getItem('commenthash');
if (oldHash != newHash) {
if (oldHash?.trim() !== newHash.trim()) {
DisplayComments = await updateComments();
return;
}