mirror of https://github.com/dirtbags/moth.git
Fix for *pattern
This commit is contained in:
parent
be448eadc5
commit
989bc2978e
|
@ -3,6 +3,7 @@ Summary: Static puzzle resource files
|
||||||
File: salad.jpg s.jpg
|
File: salad.jpg s.jpg
|
||||||
File: salad2.jpg s2.jpg hidden
|
File: salad2.jpg s2.jpg hidden
|
||||||
Answer: salad
|
Answer: salad
|
||||||
|
X-Answer-Pattern: *pong
|
||||||
|
|
||||||
You can include additional resources in a static puzzle,
|
You can include additional resources in a static puzzle,
|
||||||
by dropping them in the directory and listing them in a `File:` header field.
|
by dropping them in the directory and listing them in a `File:` header field.
|
||||||
|
|
|
@ -83,15 +83,15 @@ async function possiblyCorrect(answer) {
|
||||||
if (djb2hash(answer) == correctHash) {
|
if (djb2hash(answer) == correctHash) {
|
||||||
return answer
|
return answer
|
||||||
}
|
}
|
||||||
for (let len = 0; len <= answer.length; len += 1) {
|
for (let end = 0; end <= answer.length; end += 1) {
|
||||||
if (window.puzzle.xAnchors.includes("end") && (len != answer.length)) {
|
if (window.puzzle.xAnchors.includes("end") && (end != answer.length)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for (let pos = 0; pos < answer.length - len + 1; pos += 1) {
|
for (let beg = 0; beg < answer.length; beg += 1) {
|
||||||
if (window.puzzle.xAnchors.includes("begin") && (pos > 0)) {
|
if (window.puzzle.xAnchors.includes("begin") && (beg != 0)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let sub = answer.substring(pos, pos+len)
|
let sub = answer.substring(beg, end)
|
||||||
let digest = await sha256Hash(sub)
|
let digest = await sha256Hash(sub)
|
||||||
|
|
||||||
if (digest == correctHash) {
|
if (digest == correctHash) {
|
||||||
|
|
Loading…
Reference in New Issue