From 88507ee893db9c1f86b0d7cba9e00b70825dd07c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 22 Apr 2025 14:16:56 +0100 Subject: [PATCH] nojs: add an explanation page --- html/explainNoJs.html | 118 ++++++++++++++++++++++++++++++++++++++++++ html/index.html | 9 ++++ html/index.min.html | 2 +- src/core/Handler.cpp | 7 ++- 4 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 html/explainNoJs.html diff --git a/html/explainNoJs.html b/html/explainNoJs.html new file mode 100644 index 0000000..82124f9 --- /dev/null +++ b/html/explainNoJs.html @@ -0,0 +1,118 @@ + + + + + Perl script - Checkpoint + + + + + + +
+

+ If you have disabled javascript, you will be presented with a perl script to run. + Here is a short explanation of what it does. + + A sample script looks like this: +

+

+ perl -MDigest::SHA=sha256_hex -e + '$n="58c80c8c2271cb295b47cc553736efea3633c5653365947c12cdcafd67085c585613208637ea9c680a121d2d1fda260c42ba620c47a6ddae406233b827986b5e689796e82f559de773fba4b257faffd5574a8aab0357831c32e8f62d6e72a9296add515f70c05b370c0092c941492ebc277449c1388b42c32153430c4cfa9525";$d=4;for($i=0;;$i++){$h=sha256_hex($n.$i);if(substr($h,0,$d) + eq "0"x$d){print "$i\n";last }}' +

+ +

+ Let's break it down a bit: +

+ +

+ perl
+ -MDigest::SHA=sha256_hex
+ -e
+
+ '
+ $n="58c80c8c2271cb295b47cc553736efea3633c5653365947c12cdcafd67085c585613208637ea9c680a121d2d1fda260c42ba620c47a6ddae406233b827986b5e689796e82f559de773fba4b257faffd5574a8aab0357831c32e8f62d6e72a9296add515f70c05b370c0092c941492ebc277449c1388b42c32153430c4cfa9525";
+ $d=4;
+ for($i=0;;$i++){
+ $h=sha256_hex($n.$i);
+ if(substr($h,0,$d) eq "0"x$d){
+ print "$i\n";last
+ }
+ }
+ ' +

+ +

+ Line by line: +

+

+

+ Please note that if ANYTHING but the string in $n and number in $d are different, the script is + forged and not genuine! +

+ +
+ + + + \ No newline at end of file diff --git a/html/index.html b/html/index.html index 401b4c5..d4fd2be 100644 --- a/html/index.html +++ b/html/index.html @@ -242,6 +242,11 @@ +

+ Never trust random scripts from the internet! Make sure you understand the perl script above. + If you don't, click here for an explanation. +

+

🛑

STOP!


Verifying that you are not a bot. This might take a short moment.

You do not need to do anything.

Why am I seeing this?


This website protects itself from AI bots and scrapers by asking you to complete a cryptographic challenge before allowing you entry.

Difficulty {{ tl:text challengeDifficulty }}, elapsed 0ms, 0h, 0h/s

Powered by checkpoint v{{ tl:text checkpointVersion }}
+STOP! - Checkpoint

🛑

STOP!


Verifying that you are not a bot. This might take a short moment.

You do not need to do anything.

Why am I seeing this?


This website protects itself from AI bots and scrapers by asking you to complete a cryptographic challenge before allowing you entry.

Difficulty {{ tl:text challengeDifficulty }}, elapsed 0ms, 0h, 0h/s

Powered by checkpoint v{{ tl:text checkpointVersion }}
\ No newline at end of file diff --git a/src/core/Handler.cpp b/src/core/Handler.cpp index 5f3ec5a..3f16d13 100644 --- a/src/core/Handler.cpp +++ b/src/core/Handler.cpp @@ -295,7 +295,12 @@ void CServerHandler::onRequest(const Pistache::Http::Request& req, Pistache::Htt const auto PATH_RAW = NFsUtils::htmlPath(RESOURCE_PATH); std::error_code ec; - const auto PATH_ABSOLUTE = std::filesystem::canonical(PATH_RAW, ec); + auto PATH_ABSOLUTE = std::filesystem::canonical(PATH_RAW, ec); + + if (ec) { + // bad resource, try .html + PATH_ABSOLUTE = std::filesystem::canonical(PATH_RAW + ".html", ec); + } if (ec) { // bad resource