]> git.cworth.org Git - turbot-web/log
turbot-web
15 months agoAdd code to auto-refresh each HTML page main
Avram Gottschlich [Thu, 12 Jan 2023 05:58:23 +0000 (21:58 -0800)]
Add code to auto-refresh each HTML page

This is a simple http-equiv attribute on a meta tag telling the browser
to reload the page every 15 seconds. That should at least get the job
done.

Also add a link to the turbot documentation to the generated pages.

2 years agoUse relative links for internal links
Carl Worth [Thu, 13 Jan 2022 01:08:07 +0000 (17:08 -0800)]
Use relative links for internal links

Which are as simple as could be---just the filenames.

2 years agoSecond attempt at fixing internal links
Avram Gottschlich [Wed, 12 Jan 2022 23:26:39 +0000 (18:26 -0500)]
Second attempt at fixing internal links

2 years agochanged indentation for generating puzzle pages in generate_for_hunt_id
Avram Gottschlich [Wed, 12 Jan 2022 21:33:42 +0000 (16:33 -0500)]
changed indentation for generating puzzle pages in generate_for_hunt_id

2 years agoWidened the expanded view boxes on the main board. Changed the answers display to...
Avram Gottschlich [Wed, 12 Jan 2022 17:23:22 +0000 (12:23 -0500)]
Widened the expanded view boxes on the main board. Changed the answers display to a comma-separated string rather than a list. Spaced out the tags with commas. Moved the various lists of puzzles out of an interior loop (in generate_for_hunt_id) since it seemed unnecessary to generate those over and over again.

2 years agoWrite all files to temporary files, renaming afterwards
Carl Worth [Wed, 12 Jan 2022 09:43:19 +0000 (01:43 -0800)]
Write all files to temporary files, renaming afterwards

This ensures that the webserver will only ever serve a complete file,
and never one that the generator is in the process of creating.

2 years agoAccept the name(s) of hunt_ids which should be generated on the command line
Carl Worth [Wed, 12 Jan 2022 09:38:45 +0000 (01:38 -0800)]
Accept the name(s) of hunt_ids which should be generated on the command line

With this, this script can now be used to generate files for mutliple
hunts in a single run.

2 years agoFix two bugs referencing a bogus 'rnd' variable that doesn't exist
Carl Worth [Wed, 12 Jan 2022 09:37:44 +0000 (01:37 -0800)]
Fix two bugs referencing a bogus 'rnd' variable that doesn't exist

Clearly what was intended in each case was: puzzle['rounds'][0] instead.

2 years agoGenerate all files in a hunt-specific directory under a target WEBROOT
Carl Worth [Wed, 12 Jan 2022 09:06:27 +0000 (01:06 -0800)]
Generate all files in a hunt-specific directory under a target WEBROOT

Allowing the program to be configured to target some directory to be served
by the web server, and also allowing the program to generate files for
multiple hunts, (putting each hunt into its own directory).

2 years agoExpect all dependencies to be found from /
Carl Worth [Wed, 12 Jan 2022 08:42:03 +0000 (00:42 -0800)]
Expect all dependencies to be found from /

Specifically, the .css and .js files needed by the files being generated here.

By expecting these from '/' we can serve them statically from that
single location, even if all of the files we generate end up at some
lower-level directory (such as when we soon isolate the web pages for
each hunt from each other).

2 years agoAbstract out the filename_from_name function
Carl Worth [Wed, 12 Jan 2022 08:20:40 +0000 (00:20 -0800)]
Abstract out the filename_from_name function

Previously, there were many, many places i nthe code performing a
calculation of:

"_".join(name.split())

in order to replace all spaces with underscores before using a name as
a filename.

But as we determined recently, this is insufficient as we at least
need to also replaces all '/' with an '_' as well (to ensure that the
filename looks like a filename and not a directory plus a filename).

The previous fix for the '/' in one place, (immediately before writing
the file), meant that all the other places that were emitting links to
that file were now wrong.

We can ensure everything is consistent by having a single function for
all instances of this filename generation which we do here with the
new filename_from_name() function.

2 years agoMake the code robust against a puzzle without some fields
Carl Worth [Wed, 12 Jan 2022 08:12:58 +0000 (00:12 -0800)]
Make the code robust against a puzzle without some fields

Specifically, some puzzles may be missing any of the 'rounds', 'tags',
or 'url' keys. Previousl, the code was crashing whenever this was the case.

With this commit, empty strings or empty lists are used as the values
for any missing keys as appropriate.

2 years agoReplace slashes in puzzle name to create a filename
Carl Worth [Wed, 12 Jan 2022 08:11:31 +0000 (00:11 -0800)]
Replace slashes in puzzle name to create a filename

Otherwise, the open will fail with a "directory does not exist" error message.

Thanks to MH 2021 for including a puzzle with a '/' in its name to
exercise this bug.

2 years agoAdd missing import of boto3
Carl Worth [Wed, 12 Jan 2022 08:07:18 +0000 (00:07 -0800)]
Add missing import of boto3

Otherwise, this code wasn't going to work at all.

2 years agoDrop the top-level "turb" data structure
Carl Worth [Wed, 12 Jan 2022 08:05:06 +0000 (00:05 -0800)]
Drop the top-level "turb" data structure

In the original turbot code, this was a simple structure to hold on to
all the things necessary for turbot. Specifically, it had a boto
connection to the database, a handle for the Google sheets API, and a
handle for the Slack client API.

In this code, the only one of those things we talk to is the DynamoDB
table so that's all we need here.

2 years agoCopy in the channel_url function
Carl Worth [Wed, 12 Jan 2022 07:59:35 +0000 (23:59 -0800)]
Copy in the channel_url function

To make turbot-web a little more self-contained.

2 years agoDelete trailing whitespace
Carl Worth [Wed, 12 Jan 2022 07:56:07 +0000 (23:56 -0800)]
Delete trailing whitespace

Just to keep my editor happy.

2 years agoConvert all files from DOS to Unix text file format
Carl Worth [Wed, 12 Jan 2022 07:54:46 +0000 (23:54 -0800)]
Convert all files from DOS to Unix text file format

Since otherwise I'm going to be strufflign when editing these files.

2 years agoInitial import of turbot-web code
Carl Worth [Wed, 12 Jan 2022 07:52:31 +0000 (23:52 -0800)]
Initial import of turbot-web code

Thanks to Avram Gottschlich for writing all of this code.

This is as it was delivered to Slack as "big board.zip" on 2022-01-09.