more dev work

This commit is contained in:
badblocks 2026-07-11 11:06:10 -07:00
parent 84261c9537
commit 441056cabc
Signed by: badblocks
SSH key fingerprint: SHA256:hEcM6BP4hKm9F7WsomNuXSBpPn2BSDnFzPSl3y1NerQ
12 changed files with 59 additions and 80 deletions

View file

@ -1,19 +1,31 @@
<!doctype html>
<!--prettier-ignore-->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preload" href="/unscii-16.woff" as="font" crossorigin="anonymous" />
<link
rel="preload"
href="/unscii-16.woff"
as="font"
crossorigin="anonymous"
/>
<link rel="preload" href="reset.css" as="style" />
<link rel="preload" href="theme.css" as="style" />
<link rel="stylesheet" type="text/css" href="/style.css" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100px' height='100px'><rect x='0' y='0' width='100' height='100' rx='15' ry='15' style='fill: rgb(0,0,0);'/><foreignObject width='100' height='100'><div xmlns='http://www.w3.org/1999/xhtml' style='width:100px;height:100px;line-height:100px;text-align:center;vertical-align:middle;color:transparent;text-shadow: 0 0 rgb(0 255 0);font-size:80px;'>👾</div></foreignObject></svg>"/>
<link
rel="icon"
type="image/svg+xml"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100px' height='100px'><rect x='0' y='0' width='100' height='100' rx='15' ry='15' style='fill: rgb(0,0,0);'/><foreignObject width='100' height='100'><div xmlns='http://www.w3.org/1999/xhtml' style='width:100px;height:100px;line-height:100px;text-align:center;vertical-align:middle;color:transparent;text-shadow: 0 0 rgb(0 255 0);font-size:80px;'>👾</div></foreignObject></svg>"
/>
<meta name="generator" content={Astro.generator} />
<meta name="darkreader-lock" />
<link rel="sitemap" href="/sitemap-index.xml" />
<script is:inline src="/htmz.js"></script>
<script is:inline async src="/goat.js" data-goatcounter="https://badblocks.goatcounter.com/count"></script>
<script
is:inline
async
src="/goat.js"
data-goatcounter="https://badblocks.goatcounter.com/count"></script>
<slot name="head" />
</head>
<body>
@ -34,9 +46,16 @@
<footer>
<p>
<a href="/license">
<img src="/mit.svg" title="MIT Licensed" alt="MIT License Logo" width="24" height="24" role="img">
<img
src="/mit.svg"
title="MIT Licensed"
alt="MIT License Logo"
width="24"
height="24"
role="img"
/>
</a>
<br>
<br />
Made from scratch with BAHz: Bun, Astro, and Htmz!
</p>
</footer>

View file

@ -1,5 +1,6 @@
import { authenticator } from "otplib";
import { createHash } from "crypto";
import { createHmac } from "crypto";
import base32 from "thirty-two";
const submissionTimestamps = new Map<string, number[]>();
const otpRequestTimestamps = new Map<string, number[]>();
@ -52,9 +53,9 @@ function getUserSecret(phoneNumber: string, salt: string): string {
"Phone number and salt are required to generate a user secret.",
);
}
return createHash("sha256")
.update(phoneNumber + salt)
.digest("hex");
const digest = createHmac("sha256", salt).update(phoneNumber).digest("hex");
return base32.encode(digest).toString().replace(/=/g, "");
}
export function normalizePhone(phone: string) {

View file

@ -1,8 +0,0 @@
---
import Layout from "@layouts/BaseLayout.astro";
---
<Layout>
<title slot="head">AI Policy</title>
<Fragment slot="main"> </Fragment>
</Layout>

View file

@ -157,7 +157,12 @@ const msgValue = pickValue("msg") || (await Astro.session?.get("msg"));
{result?.error.message}
Please correct any errors and try again.
</p>
)) || <p>Use this form to shoot me a quick text!</p>}
)) || (
<p>
Inquiries, opportunities, or comments? Shoot me a quick text
here!
</p>
)}
</div>
<fieldset id="send_otp_fields" disabled={nextAction != "send_otp"}>
<label for="name">

View file

@ -2,6 +2,7 @@ import type { APIRoute } from "astro";
export const prerender = false;
export const GET: APIRoute = async () => {
// flesh out later if needed
try {
return new Response(
JSON.stringify({

8
src/thirty-two.d.ts vendored Normal file
View file

@ -0,0 +1,8 @@
declare module "thirty-two" {
interface Base32 {
encode(input: string | Buffer): Buffer;
decode(input: string | Buffer): Buffer;
}
const base32: Base32;
export = base32;
}