Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

WebHost: render setup guides and game info pages to html on server

Open Berserker66 opened this issue 1 year ago • 1 comments

What is this fixing or adding?

Removes remaining CDN use, which means people with default uMatrix config can use the sites now, and in fact JS in general is not needed, allowing noscript users to also view the pages. As a result, I consider this a bugfix.

How was this tested?

locally

If this makes graphical changes, please attach screenshots.

Hopefully not, I didn't notice anything at least.

Berserker66 avatar Oct 20 '24 18:10 Berserker66

I would honestly prefer to not merge/deploy this for 0.5.1 because this change might "break" apworlds and that would possibly either delay 0.5.1 further or leave apworld devs in a bad spot.

black-sliver avatar Oct 23 '24 21:10 black-sliver

Huh, the unittests pass just fine for me locally.

Berserker66 avatar Apr 06 '25 16:04 Berserker66

tests are still failing due to what looks like a similar initialization issue which from some local testing (read: deleting /WebHostLib/static/generated) the entire /tutorial page no longer resolves until i switched back and forth to main to recreate the folder

qwint avatar Apr 06 '25 17:04 qwint

http://localhost/tutorial/ still does not resolve correctly after deleting and reverting webhostlib so i'm not sure that really was an outdated test (even if it wasn't testing correctly anymore)

qwint avatar Apr 07 '25 03:04 qwint

http://localhost/tutorial/ still does not resolve correctly after deleting and reverting webhostlib so i'm not sure that really was an outdated test (even if it wasn't testing correctly anymore)

should be fixed now

Berserker66 avatar Apr 17 '25 20:04 Berserker66

with my commented bugfix and the (now linked) whitespace fixes to the hk docs I'm fine from a non-code review and from a world maintainer perspective with this change,

One big gripe i have though is this removes the possibility to click on headers to get anchored links, but even if that's an intentional change we are willing to make, the fact that the headers still look clickable is going to cause bug reports instead of an acknowledgement that the feature was removed

qwint avatar Apr 17 '25 21:04 qwint

new problem, the anchor links to the relevant setup guides that the Supported Games create are not aligned with the ids the tutorial page gives them, the Supported Games page sends you to http://localhost/tutorial/#Adventure while the anchor that works is http://localhost/tutorial/#adventure

similarly with spaces http://localhost/tutorial/#Hollow%20Knight vs http://localhost/tutorial/#hollow-knight

qwint avatar Apr 18 '25 01:04 qwint

Fixed the anchors, it was as simple as telling markdown to load the extension we tried to configure. I feel like trying to set options for an extension that isn't loaded should at least raise a KeyError, but it is what is -.-

Berserker66 avatar May 03 '25 10:05 Berserker66

Screenshot 2025-05-05 091402 Screenshot 2025-05-05 091411

Messenger guide before/after.

Screenshot 2025-05-05 092705

Messenger guide with four-space indentations after.

Exempt-Medic avatar May 05 '25 13:05 Exempt-Medic

Here is my mistune version: https://github.com/ArchipelagoMW/Archipelago/commit/829dac5fe91b1e98e379de686524046912c946a3 so it doesn't get lost in Discord.

As far as I can see there is only 1 issue remaining: <a> inside <h?> changes the style applied from CSS.

A noteworthy change to both the current PR and the current JS code is that the way the fragments/IDs are generated in the mistune hook would be compatible to GitHub, so if you look at a "relative link" (e.g. TOC) on GitHub it should behave the same once deployed.

Why mistune? It seems to ship with sane features that mostly match GitHub, can be extended and is being maintained. The plugins I selected are the default, but I had to explicitly list them because we need raw HTML in some documents, which is disabled by default.

Feel free to merge or copy-paste the changes or ask for a PR against this branch.

black-sliver avatar May 05 '25 21:05 black-sliver