This commit is contained in:
Neale Pickett 2018-05-17 21:16:02 +00:00
commit b17e4b54b8
7 changed files with 1416 additions and 38 deletions

File diff suppressed because it is too large Load Diff

4
tools/maint.md Normal file
View File

@ -0,0 +1,4 @@
# Maintainer notes
Update `answer_words.txt` using `./update-words.sh`.

19
tools/update-words.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set +e
url='https://rawgit.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt'
getter="curl -sL"
fn="answer_words.txt"
filterer() {
grep '......*'
}
if ! curl -h >/dev/null 2>/dev/null; then
getter="wget -q -O -"
elif ! wget -h >/dev/null 2>/dev/null; then
echo "[!] I don't know how to download. I need curl or wget."
fi
$getter "${url}" | filterer > ${fn}.tmp \
&& mv -f ${fn}.tmp ${fn}

View File

@ -10,7 +10,7 @@ local token = cgi.fields['k'] or ""
-- Check answer -- Check answer
local needle = token local needle = token
local haystack = koth.path("tokens.txt") local haystack = koth.path("state/tokens.txt")
local found, err = koth.anchored_search(haystack, needle) local found, err = koth.anchored_search(haystack, needle)
if (not found) then if (not found) then

21
www/puzzles-notoken.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Open Puzzles</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="res/style.css">
<link rel="icon" href="res/luna-moth.svg" type="image/svg+xml">
<link rel="icon" href="res/luna-moth.png" type="image/png">
<script src="res/common.js"></script>
<script src="res/terminal.js"></script>
<script src="res/puzzles.js"></script>
</head>
<body>
<h1>Open Puzzles</h1>
<div class="readme">
<div id="puzzles"></div>
</div>
</body>
</html>

View File

@ -23,8 +23,8 @@
<form action='cgi-bin/token.cgi'> <form action='cgi-bin/token.cgi'>
Team Hash: <input name='t'><br> Team Hash: <input name='t'><br>
Token: <input name='k'><input type='submit'> Token: <input name='k'><input type='submit'>
</form>\n" </form>
</fieldset>\n" </fieldset>
</section> </section>
</body> </body>
</html> </html>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Open Puzzles</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="res/style.css">
<link rel="icon" href="res/luna-moth.svg" type="image/svg+xml">
<link rel="icon" href="res/luna-moth.png" type="image/png">
<script src="res/common.js"></script>
<script src="res/terminal.js"></script>
<script src="res/puzzles.js"></script>
</head>
<body>
<h1>Open Puzzles</h1>
<div class="readme">
<div id="puzzles"></div>
</div>
</body>
</html>

1
www/puzzles.html Symbolic link
View File

@ -0,0 +1 @@
puzzles-notoken.html