diff options
Diffstat (limited to 'src/main/resources/META-INF')
| -rw-r--r-- | src/main/resources/META-INF/resources/.eslintrc.js | 12 | ||||
| -rw-r--r-- | src/main/resources/META-INF/resources/posts/commentBox.js | 9 | 
2 files changed, 13 insertions, 8 deletions
| diff --git a/src/main/resources/META-INF/resources/.eslintrc.js b/src/main/resources/META-INF/resources/.eslintrc.js index 44b9041..2d7f0df 100644 --- a/src/main/resources/META-INF/resources/.eslintrc.js +++ b/src/main/resources/META-INF/resources/.eslintrc.js @@ -94,7 +94,7 @@ module.exports = {          "max-lines": "error",          "max-lines-per-function": "error",          "max-nested-callbacks": "error", -        "max-params": "error", +        "max-params": "off",          "max-statements": "off",          "max-statements-per-line": "error",          "multiline-comment-style": [ @@ -145,7 +145,13 @@ module.exports = {          "no-lone-blocks": "error",          "no-lonely-if": "error",          "no-loop-func": "error", -        "no-magic-numbers": "error", +        "no-magic-numbers": [ +          "error", +          { +            ignore: [0], +            ignoreArrayIndexes: true +          } +        ],          "no-mixed-operators": "error",          "no-mixed-requires": "error",          "no-multi-assign": "error", @@ -164,7 +170,7 @@ module.exports = {          "no-octal-escape": "error",          "no-param-reassign": "error",          "no-path-concat": "error", -        "no-plusplus": "error", +        "no-plusplus": "off",          "no-process-env": "error",          "no-process-exit": "error",          "no-proto": "error", diff --git a/src/main/resources/META-INF/resources/posts/commentBox.js b/src/main/resources/META-INF/resources/posts/commentBox.js index d802a63..96605f9 100644 --- a/src/main/resources/META-INF/resources/posts/commentBox.js +++ b/src/main/resources/META-INF/resources/posts/commentBox.js @@ -1,9 +1,8 @@  document.addEventListener('DOMContentLoaded', () => {    const messageEncoder = new TextEncoder(); +  const hashcashAttemptBatchSize = 1000; -  const acceptableHash = (hash) => -      hash[0] === 0 && -      hash[1] === 0; +  const acceptableHash = (hash) => hash[0] === 0 && hash[1] === 0;    const checkSalt = (message, salt, thenC, elseC) => {      const saltedMessage = `Hashcash-Salt: ${salt}\n\n${message}`; @@ -33,8 +32,8 @@ document.addEventListener('DOMContentLoaded', () => {          commentForm.submit();        }, () => {          ++salt; -        if (salt % 1000 === 0) { -          console.log(`hashcash fail ${salt}, retrying`) +        if (salt % hashcashAttemptBatchSize === 0) { +          console.log(`hashcash fail ${salt}, retrying`);          }          setTimeout(tryHashcash, 0);        }); | 
