Add license page, update LICENSE file, and link license page on the base

layout instead of ext. MIT license.
This commit is contained in:
badblocks 2026-07-11 00:16:01 -07:00
parent 8aa67df5c7
commit 84261c9537
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
3 changed files with 64 additions and 7 deletions

35
src/pages/license.astro Normal file
View file

@ -0,0 +1,35 @@
---
import Layout from "@layouts/BaseLayout.astro";
import fs from "node:fs";
const txtToHtml = (string: string) => {
return string
.replace(/[^\x0A\x20-\x7E]/g, "") //remove non-printable ascii chars, except newline
.replaceAll("&", "&")
.replaceAll("<", "&lt;")
.replaceAll(">", "&gt;")
.replaceAll('"', "&quot;")
.replaceAll("'", "&#039;")
.replaceAll("\n\n", "<br><br>");
};
const license_file_contents = txtToHtml(
fs.readFileSync("./LICENSE", {
encoding: "utf8",
}),
);
---
<Layout>
<title slot="head">LICENSE</title>
<Fragment slot="main">
<header>
<h1>
<a href="https://opensource.org/license/mit" target="_blank"
>MIT License</a
>
</h1>
</header>
<p set:html={license_file_contents} />
</Fragment>
</Layout>