mirror of
https://github.com/ProjectSegfault/website.git
synced 2024-12-22 13:09:49 +05:30
fix build
This commit is contained in:
parent
7847267ec8
commit
92753b1e35
@ -1 +1,8 @@
|
|||||||
AUTH_SECRET=myauthsecret # generate with https://generate-secret.vercel.app/32 or openssl rand -hex 32 on unix-like
|
AUTH_SECRET=myauthsecret # generate with https://generate-secret.vercel.app/32 or openssl rand -hex 32 on unix-like
|
||||||
|
DB_URL=postgres://user:pass@localhost:5432/website
|
||||||
|
AUTH_CLIENT_ID=your-authentik-client-id
|
||||||
|
AUTH_CLIENT_SECRET=your-authentik-client-secret
|
||||||
|
AUTH_ISSUER=https://authentik-domain/application/o/app-name/
|
||||||
|
HCAPTCHA_SECRET=your-hcaptcha-secret
|
||||||
|
HCAPTCHA_SITEKEY=your-hcaptcha-sitekey
|
||||||
|
WEBHOOK=your-discord-webhook
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,5 +6,4 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
config/config.yml
|
|
||||||
package-lock.json
|
package-lock.json
|
@ -6,8 +6,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
environment:
|
|
||||||
AUTH_SECRET: ${AUTH_SECRET}
|
|
||||||
ports:
|
ports:
|
||||||
- 1337:4173
|
- 1337:4173
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
db:
|
|
||||||
url: "postgres://user:password@host:5432/database"
|
|
||||||
|
|
||||||
app:
|
|
||||||
auth:
|
|
||||||
clientId: "authentik-client-id"
|
|
||||||
clientSecret: "authentik-client-secret"
|
|
||||||
issuer: "https://yourdomain.com/application/o/app-name/"
|
|
||||||
hcaptcha:
|
|
||||||
secret: "your-hcaptcha-secret"
|
|
||||||
sitekey: "your-hcaptcha-sitekey"
|
|
||||||
webhook: "your-discord-webhook-url"
|
|
@ -1,14 +1,14 @@
|
|||||||
import { SvelteKitAuth } from "@auth/sveltekit"
|
import { SvelteKitAuth } from "@auth/sveltekit"
|
||||||
import Authentik from '@auth/core/providers/authentik';
|
import Authentik from '@auth/core/providers/authentik';
|
||||||
import config from "$lib/config";
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
export const handle = SvelteKitAuth({
|
export const handle = SvelteKitAuth({
|
||||||
providers: [
|
providers: [
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
Authentik({
|
Authentik({
|
||||||
clientId: config.app.auth.clientId,
|
clientId: env.AUTH_CLIENT_ID,
|
||||||
clientSecret: config.app.auth.clientSecret,
|
clientSecret: env.AUTH_CLIENT_SECRET,
|
||||||
issuer: config.app.auth.issuer
|
issuer: env.AUTH_ISSUER
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
@ -1,13 +1,14 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import HCaptcha from "svelte-hcaptcha";
|
import HCaptcha from "svelte-hcaptcha";
|
||||||
import { Note } from "$lib/Form";
|
import { Note } from "$lib/Form";
|
||||||
import config from "$lib/config";
|
|
||||||
|
|
||||||
let submit = false;
|
let submit = false;
|
||||||
|
|
||||||
const showSubmitButton = () => {
|
const showSubmitButton = () => {
|
||||||
submit = !submit;
|
submit = !submit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export let sitekey: string;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Note
|
<Note
|
||||||
@ -15,7 +16,7 @@
|
|||||||
icon="i-fa6-solid:circle-info"
|
icon="i-fa6-solid:circle-info"
|
||||||
/>
|
/>
|
||||||
<HCaptcha
|
<HCaptcha
|
||||||
sitekey={config.app.hcaptcha.sitekey}
|
{sitekey}
|
||||||
on:success={showSubmitButton}
|
on:success={showSubmitButton}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<svelte:window bind:innerWidth />
|
<svelte:window bind:innerWidth />
|
||||||
|
|
||||||
<nav
|
<nav
|
||||||
class="bg-primary border-b-1 border-b-grey flex p-2 flex-col justify-between nav:(flex-row items-center)"
|
class="bg-primary border-b-1 border-b-solid border-b-grey flex p-2 flex-col justify-between nav:(flex-row items-center)"
|
||||||
>
|
>
|
||||||
<div class="flex flex-row items-center justify-between">
|
<div class="flex flex-row items-center justify-between">
|
||||||
<a
|
<a
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import { parse } from "yaml";
|
|
||||||
import fs from "fs";
|
|
||||||
|
|
||||||
interface Config {
|
|
||||||
db: {
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
app: {
|
|
||||||
auth: {
|
|
||||||
clientId: string;
|
|
||||||
clientSecret: string;
|
|
||||||
issuer: string;
|
|
||||||
}
|
|
||||||
hcaptcha: {
|
|
||||||
secret: string;
|
|
||||||
sitekey: string;
|
|
||||||
};
|
|
||||||
webhook: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const config: Config = parse(fs.readFileSync("./config/config.yml", "utf8"));
|
|
||||||
|
|
||||||
export default config;
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Sequelize, DataTypes } from "sequelize";
|
import { Sequelize, DataTypes } from "sequelize";
|
||||||
import config from "$lib/config";
|
|
||||||
import consola from "consola";
|
import consola from "consola";
|
||||||
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
const sequelize = new Sequelize(config.db.url);
|
const sequelize = new Sequelize(env.DB_URL);
|
||||||
|
|
||||||
sequelize.define("Announcements", {
|
sequelize.define("Announcements", {
|
||||||
title: {
|
title: {
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
import type { Actions } from "./$types";
|
import type { Actions, PageServerLoad } from "./$types";
|
||||||
import { Webhook, MessageBuilder } from "discord-webhook-node";
|
import { Webhook, MessageBuilder } from "discord-webhook-node";
|
||||||
import Joi from "joi";
|
import Joi from "joi";
|
||||||
import { fail } from "@sveltejs/kit";
|
import { fail } from "@sveltejs/kit";
|
||||||
import config from "$lib/config";
|
import { env } from "$env/dynamic/private";
|
||||||
|
|
||||||
|
export const load = (() => {
|
||||||
|
return {
|
||||||
|
hcaptchaSitekey: env.HCAPTCHA_SITEKEY
|
||||||
|
}
|
||||||
|
}) satisfies PageServerLoad
|
||||||
|
|
||||||
export const actions: Actions = {
|
export const actions: Actions = {
|
||||||
form: async ({ request, getClientAddress, fetch }) => {
|
form: async ({ request, getClientAddress, fetch }) => {
|
||||||
@ -27,14 +33,14 @@ export const actions: Actions = {
|
|||||||
"Content-Type": "application/x-www-form-urlencoded"
|
"Content-Type": "application/x-www-form-urlencoded"
|
||||||
},
|
},
|
||||||
body: new URLSearchParams({
|
body: new URLSearchParams({
|
||||||
secret: config.app.hcaptcha.secret,
|
secret: env.HCAPTCHA_SECRET,
|
||||||
response: String(formData.get("h-captcha-response")),
|
response: String(formData.get("h-captcha-response")),
|
||||||
remoteip: ip
|
remoteip: ip
|
||||||
})
|
})
|
||||||
}).then((res) => res.json())
|
}).then((res) => res.json())
|
||||||
|
|
||||||
|
|
||||||
const hook = new Webhook(config.app.webhook);
|
const hook = new Webhook(env.WEBHOOK);
|
||||||
|
|
||||||
const data = await verify;
|
const data = await verify;
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Note, Captcha, Meta, TextArea } from "$lib/Form";
|
import { Note, Captcha, Meta, TextArea } from "$lib/Form";
|
||||||
import type { ActionData } from "./$types";
|
import type { ActionData, PageServerData } from "./$types";
|
||||||
|
|
||||||
export let form: ActionData;
|
export let form: ActionData;
|
||||||
|
export let data: PageServerData;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -43,7 +44,7 @@
|
|||||||
name="message"
|
name="message"
|
||||||
placeholder="Your message"
|
placeholder="Your message"
|
||||||
/>
|
/>
|
||||||
<Captcha>
|
<Captcha sitekey={data.hcaptchaSitekey}>
|
||||||
{#if form?.success}
|
{#if form?.success}
|
||||||
{form.message}
|
{form.message}
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user