dlareau / puzzlehunt_server

Server for Puzzle hunts run by Puzzlehunt CMU, but can be repurposed for other hunts.
MIT License
19 stars 16 forks source link

Move to web-based puzzles as default #142

Closed samuel-yeom closed 3 years ago

samuel-yeom commented 4 years ago

The staff have decided to move to web-based puzzles, rather than pdfs, as the default. I would like to see a few changes to facilitate this switch:

  1. Web-based puzzles should by default be presented on the puzzle page instead of giving a link to a different page.
  2. On the staff side, when a puzzle is created, there should be three options:
    • Web-based puzzle on the puzzle page (default)
    • Embedded pdf on the puzzle page (previous default)
    • Link to a different page (previous default for web-based puzzles)
  3. I'm not sure if this is already possible, but there should be a way to create a global CSS file that affects all puzzle pages (but not the hunt page).

If there are any other changes that you see fit, feel free to suggest them as well.

dlareau commented 4 years ago

Sounds like it's time to start on puzzlehunt dev work again. :)

None of that sounds like it will be an issue, and it should all be pretty easy. I'll try to knock that out in the next week or so.

samuel-yeom commented 3 years ago

Any updates on this?

dlareau commented 3 years ago

Sorry, without going to much into personal details I've had a bit of a rough time the past few weeks and have been unable to find the free time required to get back into the swing of puzzlehunt dev. Things are looking better though and I sincerely hope that I'll be able to poke at this issue this weekend.

dlareau commented 3 years ago

I'm sorry for such the long delay on this, I've finally gotten over a bit of my slump and started writing the code for this, one of the things that immediately came up was weather the new type of web puzzle presented on the page should have any of the default aspects of other site pages? Should I basically embed the html I get such that there is still a header bar at the top linking back to places or should that be left for the staffer to do? The staff provided files will likely be run through the templating engine, so it wouldn't be hard for a page to add it back in, but if your plan is to have it 99% of the time, I could just include it there by default and save every web puzzle a lot of boilerplate.

samuel-yeom commented 3 years ago

Yes, please include the header. Basically, I want the puzzle content to simply replace the text "This puzzle is a web-based puzzle: Click here to go to the puzzle."

dlareau commented 3 years ago

Now in v4.1.0, to be deployed very soon.

samuel-yeom commented 3 years ago

Has the third item in the original comment been implemented? It's not clear to me how we can create a global CSS file that affects all HTML puzzle pages, rather than having to include them in every ZIP file.

dlareau commented 3 years ago

Oh, sorry, I glossed over that part because I couldn't think of anything better than the hack that currently exists, but I also didn't describe the hack, so thats on me.

In brief: It is much faster to serve and deal with HTML puzzles if we don't run them through the templating engine. This means though that the puzzle source code can't use stuff like {{HUNT_STATIC}}/my_stylesheet.css. There is always and has always been the option of uploading a file in your hunt resources zip and referencing its raw URL. Like so: <link type="text/css" rel="stylesheet" href="/media/hunt/13/puzzles_style2.css">

This is fragile for obvious reasons (not during the hunt specifically, but makes it likely to break old hunts on future modifications to how we serve media files). I just can't think of any dynamic way to reference a file across puzzles without either this fragile solution or running all the puzzles through the renderer at great cost to speed and security.

samuel-yeom commented 3 years ago

The hunt resource approach is good enough for me. I probably should have thought of that.