various fixes for the blog including prismjs highlighting, colour schemes and embedding media
Some checks failed
🚀 Deploy website on push / 🎉 Deploy (push) Failing after 25s

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
Rohit Pai 2024-06-22 17:46:17 +01:00
parent 646cfa6561
commit 558ac03fbb
11 changed files with 29 additions and 22 deletions

View File

@ -18,7 +18,8 @@
"ext-libxml": "*", "ext-libxml": "*",
"donatello-za/rake-php-plus": "^1.0", "donatello-za/rake-php-plus": "^1.0",
"phpmailer/phpmailer": "^6.9", "phpmailer/phpmailer": "^6.9",
"onelogin/php-saml": "^4.1" "onelogin/php-saml": "^4.1",
"ext-mbstring": "*"
}, },
"repositories": [ "repositories": [
{ {

View File

@ -674,6 +674,7 @@ EOD;
public function changeHTMLSrc(string $body, string $to, string $from): string public function changeHTMLSrc(string $body, string $to, string $from): string
{ {
$htmlDoc = new DOMDocument(); $htmlDoc = new DOMDocument();
$body = mb_convert_encoding($body, "HTML-ENTITIES", "UTF-8");
$htmlDoc->loadHTML($body, LIBXML_NOERROR); $htmlDoc->loadHTML($body, LIBXML_NOERROR);
$doc = $htmlDoc->getElementsByTagName('body')->item(0); $doc = $htmlDoc->getElementsByTagName('body')->item(0);
$imgs = $doc->getElementsByTagName('img'); $imgs = $doc->getElementsByTagName('img');
@ -708,7 +709,8 @@ EOD;
$newBody = ''; $newBody = '';
foreach ($doc->childNodes as $node) foreach ($doc->childNodes as $node)
{ {
$newBody .= $htmlDoc->saveHTML($node); $newHTML = $htmlDoc->saveHTML($node);
$newBody .= mb_convert_encoding($newHTML, "UTF-8", mb_detect_encoding($newHTML));
} }
return $newBody; return $newBody;
} }

View File

@ -181,7 +181,7 @@ class userRoutes implements routesInterface
$inactive = 60 * 60 * 48; // 2 days $inactive = 60 * 60 * 48; // 2 days
$_SESSION["timeout"] = time() + $inactive; $_SESSION["timeout"] = time() + $inactive;
return $response->withHeader("Location", "https://rohitpai.co.uk/editor/editor.html")->withStatus(302); return $response->withHeader("Location", "https://rohitpai.co.uk/editor/")->withStatus(302);
} }
$response->getBody()->write(json_encode(array("error" => "Unauthorised"))); $response->getBody()->write(json_encode(array("error" => "Unauthorised")));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/index.html vendored

File diff suppressed because one or more lines are too long

View File

@ -674,6 +674,7 @@ EOD;
public function changeHTMLSrc(string $body, string $to, string $from): string public function changeHTMLSrc(string $body, string $to, string $from): string
{ {
$htmlDoc = new DOMDocument(); $htmlDoc = new DOMDocument();
$body = mb_convert_encoding($body, "HTML-ENTITIES", "UTF-8");
$htmlDoc->loadHTML($body, LIBXML_NOERROR); $htmlDoc->loadHTML($body, LIBXML_NOERROR);
$doc = $htmlDoc->getElementsByTagName('body')->item(0); $doc = $htmlDoc->getElementsByTagName('body')->item(0);
$imgs = $doc->getElementsByTagName('img'); $imgs = $doc->getElementsByTagName('img');
@ -708,7 +709,8 @@ EOD;
$newBody = ''; $newBody = '';
foreach ($doc->childNodes as $node) foreach ($doc->childNodes as $node)
{ {
$newBody .= $htmlDoc->saveHTML($node); $newHTML = $htmlDoc->saveHTML($node);
$newBody .= mb_convert_encoding($newHTML, "UTF-8", mb_detect_encoding($newHTML));
} }
return $newBody; return $newBody;
} }

View File

@ -181,7 +181,7 @@ class userRoutes implements routesInterface
$inactive = 60 * 60 * 48; // 2 days $inactive = 60 * 60 * 48; // 2 days
$_SESSION["timeout"] = time() + $inactive; $_SESSION["timeout"] = time() + $inactive;
return $response->withHeader("Location", "https://rohitpai.co.uk/editor/editor.html")->withStatus(302); return $response->withHeader("Location", "https://rohitpai.co.uk/editor/")->withStatus(302);
} }
$response->getBody()->write(json_encode(array("error" => "Unauthorised"))); $response->getBody()->write(json_encode(array("error" => "Unauthorised")));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,7 @@
<li><a href="/blog" class="textShadow link">blog</a></li> <li><a href="/blog" class="textShadow link">blog</a></li>
</ul> </ul>
</nav> </nav>
<header> <header>
<div> <div>
<h1>full stack developer</h1> <h1>full stack developer</h1>
@ -108,7 +109,7 @@
</a> </a>
</div> </div>
<div> <div>
<a href="#"> <a href="https://rohitpai.co.uk/blog">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M15.5 14.625c0 .484-.387.875-.864.875h-5.273c-.477 0-.863-.392-.863-.875s.387-.875.863-.875h5.272c.478 0 .865.391.865.875zm-6.191-4.375h2.466c.448 0 .809-.392.809-.875s-.361-.875-.81-.875h-2.465c-.447 0-.809.392-.809.875s.362.875.809.875zm14.691 1.75c0 6.627-5.373 12-12 12s-12-5.373-12-12 5.373-12 12-12 12 5.373 12 12zm-5-1.039c0-.383-.311-.692-.691-.692h-1.138c-.583 0-.69-.446-.69-.996-.001-2.36-1.91-4.273-4.265-4.273h-2.952c-2.355 0-4.264 1.913-4.264 4.272v5.455c0 2.36 1.909 4.273 4.264 4.273h5.474c2.353 0 4.262-1.913 4.262-4.272v-3.767z"/> <path d="M15.5 14.625c0 .484-.387.875-.864.875h-5.273c-.477 0-.863-.392-.863-.875s.387-.875.863-.875h5.272c.478 0 .865.391.865.875zm-6.191-4.375h2.466c.448 0 .809-.392.809-.875s-.361-.875-.81-.875h-2.465c-.447 0-.809.392-.809.875s.362.875.809.875zm14.691 1.75c0 6.627-5.373 12-12 12s-12-5.373-12-12 5.373-12 12-12 12 5.373 12 12zm-5-1.039c0-.383-.311-.692-.691-.692h-1.138c-.583 0-.69-.446-.69-.996-.001-2.36-1.91-4.273-4.265-4.273h-2.952c-2.355 0-4.264 1.913-4.264 4.272v5.455c0 2.36 1.909 4.273 4.264 4.273h5.474c2.353 0 4.262-1.913 4.262-4.272v-3.767z"/>
</svg> </svg>
@ -173,6 +174,7 @@
</form> </form>
</div> </div>
</section> </section>
</main>
<footer class="flexRow"> <footer class="flexRow">
<div class="spacer"></div> <div class="spacer"></div>
@ -181,7 +183,7 @@
<button id="goBackToTop"><i class="fa-solid fa-chevron-up"></i></button> <button id="goBackToTop"><i class="fa-solid fa-chevron-up"></i></button>
</div> </div>
</footer> </footer>
</main>
<script src="js/index.js"></script> <script src="js/index.js"></script>
<script src="js/typewriter.js"></script> <script src="js/typewriter.js"></script>
</body> </body>