From 441056cabc67be5d75b947beded234c83c005260 Mon Sep 17 00:00:00 2001 From: badbl0cks <4161747+badbl0cks@users.noreply.github.com> Date: Sat, 11 Jul 2026 11:06:10 -0700 Subject: [PATCH] more dev work --- Dockerfile | 2 ++ astro.config.mjs | 11 +++----- compose.yaml | 12 ++++----- package.json | 1 + public/theme.css | 2 +- src/layouts/BaseLayout.astro | 31 ++++++++++++++++++----- src/lib/Otp.ts | 9 ++++--- src/pages/ai.astro | 8 ------ src/pages/contact.astro | 7 +++++- src/pages/health.ts | 1 + src/thirty-two.d.ts | 8 ++++++ utils/generate-env-example.sh | 47 ----------------------------------- 12 files changed, 59 insertions(+), 80 deletions(-) delete mode 100644 src/pages/ai.astro create mode 100644 src/thirty-two.d.ts delete mode 100755 utils/generate-env-example.sh diff --git a/Dockerfile b/Dockerfile index d50b2d7..572d206 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,8 @@ COPY --from=install /temp/prod/node_modules node_modules COPY --from=prerelease /usr/src/app/dist ./dist COPY --from=prerelease /usr/src/app/package.json ./ +ENV HOST=0.0.0.0 + USER node EXPOSE 4321 ENTRYPOINT ["node", "./dist/server/entry.mjs"] diff --git a/astro.config.mjs b/astro.config.mjs index 1d64c19..55f9366 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -10,11 +10,12 @@ export default defineConfig({ site: "https://badblocks.dev", trailingSlash: "never", // bun adapter is not official, also a little wonky, so use node adapter for now - adapter: node({ - mode: "standalone", - }), // adapter: bun(), // output: "static", + adapter: node({ + mode: "standalone", + staticHeaders: true, + }), compressHTML: false, devToolbar: { enabled: false }, prefetch: { @@ -29,7 +30,6 @@ export default defineConfig({ }), }, server: { - host: true, port: 4321, }, env: { @@ -57,7 +57,4 @@ export default defineConfig({ }, }, integrations: [alpinejs(), sitemap()], - experimental: { - chromeDevtoolsWorkspace: true, - }, }); diff --git a/compose.yaml b/compose.yaml index eeab30a..39328bd 100644 --- a/compose.yaml +++ b/compose.yaml @@ -6,12 +6,12 @@ services: volumes: - ./db:/db environment: - ANDROID_SMS_GATEWAY_IP: ${ANDROID_SMS_GATEWAY_IP:-192.168.0.1} - ANDROID_SMS_GATEWAY_URL: ${ANDROID_SMS_GATEWAY_URL:-http://192.168.0.1:8080} - ANDROID_SMS_GATEWAY_LOGIN: ${ANDROID_SMS_GATEWAY_LOGIN:-sms} - ANDROID_SMS_GATEWAY_PASSWORD: ${ANDROID_SMS_GATEWAY_PASSWORD:-super-secret-password} - ANDROID_SMS_GATEWAY_RECIPIENT_PHONE: ${ANDROID_SMS_GATEWAY_RECIPIENT_PHONE:-555-555-1234} - OTP_SUPER_SECRET_SALT: ${OTP_SUPER_SECRET_SALT:-super-secret-salt} + ANDROID_SMS_GATEWAY_IP: ${ANDROID_SMS_GATEWAY_IP:?ANDROID_SMS_GATEWAY_IP is required} + ANDROID_SMS_GATEWAY_URL: ${ANDROID_SMS_GATEWAY_URL:? ANDROID_SMS_GATEWAY_URL is required} + ANDROID_SMS_GATEWAY_LOGIN: ${ANDROID_SMS_GATEWAY_LOGIN:? ANDROID_SMS_GATEWAY_LOGIN is required} + ANDROID_SMS_GATEWAY_PASSWORD: ${ANDROID_SMS_GATEWAY_PASSWORD:?ANDROID_SMS_GATEWAY_PASSWORD is required} + ANDROID_SMS_GATEWAY_RECIPIENT_PHONE: ${ANDROID_SMS_GATEWAY_RECIPIENT_PHONE:? ANDROID_SMS_GATEWAY_RECIPIENT_PHONE is required} + OTP_SUPER_SECRET_SALT: ${OTP_SUPER_SECRET_SALT:?OTP_SUPER_SECRET_SALT is required} healthcheck: test: [ diff --git a/package.json b/package.json index 0f7e869..b1569f3 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "iconify-icon": "^3.0.2", "ofetch": "^1.5.1", "otplib": "12.0.1", + "thirty-two": "^1.0.2", "typescript": "^6.0.3", "validator": "^13.15.35" }, diff --git a/public/theme.css b/public/theme.css index 29ff08d..311b2a4 100644 --- a/public/theme.css +++ b/public/theme.css @@ -42,12 +42,12 @@ body { var(--color-accent-transparent), black 120% ); + background-attachment: fixed; color: var(--color-fg); column-gap: var(--gutter-large); display: grid; font-size: var(--pt-pica); grid-template-rows: auto 1fr auto; - height: 100dvb; left: 0; overflow-x: hidden; padding-inline: var(--page-padding-inline); diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index a675fce..c567e96 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -1,19 +1,31 @@ - - + - + - + @@ -34,9 +46,16 @@ diff --git a/src/lib/Otp.ts b/src/lib/Otp.ts index ce7d5b4..37303d6 100644 --- a/src/lib/Otp.ts +++ b/src/lib/Otp.ts @@ -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(); const otpRequestTimestamps = new Map(); @@ -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) { diff --git a/src/pages/ai.astro b/src/pages/ai.astro deleted file mode 100644 index 4122804..0000000 --- a/src/pages/ai.astro +++ /dev/null @@ -1,8 +0,0 @@ ---- -import Layout from "@layouts/BaseLayout.astro"; ---- - - - AI Policy - - diff --git a/src/pages/contact.astro b/src/pages/contact.astro index e57c4c5..c886b85 100644 --- a/src/pages/contact.astro +++ b/src/pages/contact.astro @@ -157,7 +157,12 @@ const msgValue = pickValue("msg") || (await Astro.session?.get("msg")); {result?.error.message} Please correct any errors and try again.

- )) ||

Use this form to shoot me a quick text!

} + )) || ( +

+ Inquiries, opportunities, or comments? Shoot me a quick text + here! +

+ )}