fix shit
Some checks failed
Deployment / Install (push) Failing after 55s

This commit is contained in:
Benjamin Palko 2025-04-30 16:59:55 -04:00
parent cee5001890
commit 9dfbdcc554
7 changed files with 48 additions and 44 deletions

View file

@ -2,3 +2,9 @@
package-lock.json
pnpm-lock.yaml
yarn.lock
# Dont even try lol
.svelte-kit
build
node_modules

View file

@ -1,10 +1,10 @@
services:
postgres:
container_name: postgres
container_name: postgres:alpine
image: postgres
ports:
- 5432:5432
environment:
POSTGRES_DB: ${DATABASE_NAME}
POSTGRES_USER: ${DATABASE_USERNAME}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
volumes:
- ./data:/var/lib/postgresql/data

View file

@ -1,5 +1,5 @@
export default {
plugins: {
autoprefixer: {},
},
autoprefixer: {}
}
};

View file

@ -1,4 +1,4 @@
@import "tailwindcss";
@import 'tailwindcss';
@plugin "daisyui";
:root {

View file

@ -2,86 +2,84 @@ import {
MAIL_TRANSPORT_HOST,
MAIL_TRANSPORT_PASS,
MAIL_TRANSPORT_PORT,
MAIL_TRANSPORT_USER,
} from "$env/static/private";
import { fail } from "@sveltejs/kit";
import { createTransport } from "nodemailer";
import type { Actions } from "./$types";
MAIL_TRANSPORT_USER
} from '$env/static/private';
import { fail } from '@sveltejs/kit';
import { createTransport } from 'nodemailer';
import type { Actions } from './$types';
export const actions = {
default: async ({ request }) => {
const form = await request.formData();
if (!form.has("name")) {
if (!form.has('name')) {
return fail(400, { name: null, missing: true });
}
if (!form.has("email")) {
if (!form.has('email')) {
return fail(400, { email: null, missing: true });
}
if (!form.has("subject")) {
if (!form.has('subject')) {
return fail(400, { subject: null, missing: true });
}
if (!form.has("message")) {
if (!form.has('message')) {
return fail(400, { message: null, missing: true });
}
const name = form.get("name");
if (typeof name !== "string") {
const name = form.get('name');
if (typeof name !== 'string') {
return fail(400, { name, incorrect: true });
}
const email = form.get("email");
if (typeof email !== "string") {
const email = form.get('email');
if (typeof email !== 'string') {
return fail(400, { email, incorrect: true });
}
const subject = form.get("subject");
if (typeof subject !== "string") {
const subject = form.get('subject');
if (typeof subject !== 'string') {
return fail(400, { subject, incorrect: true });
}
const message = form.get("message");
if (typeof message !== "string") {
const message = form.get('message');
if (typeof message !== 'string') {
return fail(400, { message, incorrect: true });
}
const transport = createTransport({
host: MAIL_TRANSPORT_HOST,
port: isNaN(Number(MAIL_TRANSPORT_PORT))
? 587
: Number(MAIL_TRANSPORT_PORT),
port: isNaN(Number(MAIL_TRANSPORT_PORT)) ? 587 : Number(MAIL_TRANSPORT_PORT),
auth: {
user: MAIL_TRANSPORT_USER,
pass: MAIL_TRANSPORT_PASS,
},
pass: MAIL_TRANSPORT_PASS
}
});
try {
const info1 = await transport.sendMail({
from: "no-reply@benjaminpalko.ca",
from: 'no-reply@benjaminpalko.ca',
to: email,
subject: `Thank you for reaching out`,
text: `Hello ${name}!\n\nThank you for reaching out! I will be sure to get back to you ASAP.\n\nCheers,\nBenjamin`,
text: `Hello ${name}!\n\nThank you for reaching out! I will be sure to get back to you ASAP.\n\nCheers,\nBenjamin`
});
const info2 = await transport.sendMail({
from: email,
to: "contact@benjaminpalko.ca",
to: 'contact@benjaminpalko.ca',
subject: subject,
text: message,
text: message
});
return {
response: {
accepted: [...info1.accepted, ...info2.accepted],
rejected: [...info1.rejected, ...info2.rejected],
},
rejected: [...info1.rejected, ...info2.rejected]
}
};
} catch (error) {
console.error(error);
}
},
}
} satisfies Actions;

View file

@ -1,9 +1,9 @@
import type { Config } from "tailwindcss";
import type { Config } from 'tailwindcss';
export default {
content: ["./src/**/*.{html,js,svelte,ts}"],
content: ['./src/**/*.{html,js,svelte,ts}'],
theme: {
extend: {},
},
extend: {}
}
} satisfies Config;

View file

@ -1,11 +1,11 @@
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vitest/config";
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [tailwindcss(), sveltekit()],
test: {
include: ["src/**/*.{test,spec}.{js,ts}"],
},
include: ['src/**/*.{test,spec}.{js,ts}']
}
});