Compare commits

...

13 commits

Author SHA1 Message Date
Chiara
350fe68bf7 changed nav back
All checks were successful
Build and Deploy Backend / build_and_deploy (push) Successful in 25s
Build and Deploy Astro App / build_and_deploy (push) Successful in 38s
2026-10-06 09:37:34 +02:00
5abed41dd6 better styling
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 19:14:55 +02:00
cb7a6fa891 fixed styling 2026-10-05 19:07:54 +02:00
af6decdc5f fix columns
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 18:05:53 +02:00
5c26f7e8da add .env
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 08:07:08 -07:00
8098a90d6a test
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 30s
2026-10-05 07:58:08 -07:00
300c6b3ff9 CSP angepasst
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 07:47:07 -07:00
155d22a9f3 fix?
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 07:43:38 -07:00
dc24968674 fixed stuff?
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 30s
2026-10-05 07:38:35 -07:00
a037a19abd dsd 2026-10-05 07:27:34 -07:00
64a0499911 test
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 30s
2026-10-05 16:22:39 +02:00
bc34802cd8 fixed blog centered
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 30s
2026-10-05 16:18:33 +02:00
58b8d8e18e deleted faulty file
All checks were successful
Build and Deploy Astro App / build_and_deploy (push) Successful in 31s
2026-10-05 16:11:27 +02:00
21 changed files with 91 additions and 97 deletions

View file

@ -1,10 +1,6 @@
from backend.main import app
from fastapi.middleware.cors import CORSMiddleware
origins = [
"http://localhost",
]
app.add_middleware(
CORSMiddleware,
allow_origins=[

1
blog/.env.production Normal file
View file

@ -0,0 +1 @@
PUBLIC_API_URL="https://api.blauwasser-mausis.de"

1
blog/.gitignore vendored
View file

@ -15,7 +15,6 @@ pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

13
blog/package-lock.json generated
View file

@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "blog",
"version": "0.0.1",
"dependencies": {
"@astrojs/mdx": "^7.0.8",
@ -6361,9 +6362,9 @@
"license": "MIT"
},
"node_modules/smol-toml": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.8.0.tgz",
"integrity": "sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ==",
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.9.0.tgz",
"integrity": "sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==",
"license": "BSD-3-Clause",
"engines": {
"node": ">= 18"
@ -6382,9 +6383,9 @@
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"

View file

@ -9,11 +9,7 @@ const { posts } = Astro.props;
---
<div class="post-grid">
{
posts.map((post_file: any) => (
<PostPreviewSmall post={post_file.data} />
))
}
{posts.map((post_file: any) => <PostPreviewSmall post={post_file.data} />)}
</div>
<style>
@ -21,6 +17,6 @@ const { posts } = Astro.props;
display: grid;
gap: 64px;
width: 100%;
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
</style>

View file

@ -1,8 +1,7 @@
import { useState } from "preact/hooks";
import { api } from "../lib/api";
import { logout } from "./Util";
import { handleBackAndReload, logout } from "./Util";
import type { JSX } from "preact/jsx-runtime";
import { navigate } from "astro/virtual-modules/transitions-router.js";
export default function DeleteUser() {
const [error, setError] = useState('');
@ -21,7 +20,7 @@ export default function DeleteUser() {
} finally {
if (!hasError) {
logout()
navigate("/")
handleBackAndReload()
}
}
};

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from 'preact/hooks';
import { api, AUTH_TOKEN_KEY, USER_KEY, type User } from '../lib/api';
import { saveUser } from './Util';
import { api, AUTH_TOKEN_KEY } from '../lib/api';
import { handleBackAndReload, saveUser } from './Util';
export default function LoginForm() {
const [userCode, setUserCode] = useState('');
@ -33,7 +33,7 @@ export default function LoginForm() {
}
hasError = true
} finally {
if (!hasError) navigation.back()
if (!hasError) handleBackAndReload()
}
}
};

View file

@ -1,10 +1,8 @@
import { handleBackAndReload } from "./Util";
export default function NavBack() {
function take_me_to_the_moon() {
navigation.back();
}
return (
<button class="back-btn" onClick={take_me_to_the_moon}>Zurück</button>
<button class="back-btn" onClick={handleBackAndReload}>Zurück</button>
);
}

View file

@ -1,7 +1,7 @@
import { useEffect, useState } from 'preact/hooks';
import { api, type User } from '../lib/api';
import React from 'preact/compat';
import { isEmailValid } from './Util';
import { handleBackAndReload, isEmailValid } from './Util';
export default function RegisterForm() {
const [user, setUser] = React.useState<User>({ 'email': '', 'name': '', 'subscription': true });
@ -31,7 +31,7 @@ export default function RegisterForm() {
}
hasError = true
} finally {
if (!hasError) navigation.back()
if (!hasError) handleBackAndReload()
}
};

View file

@ -0,0 +1,20 @@
type SubmitProps = {
eventString: string;
text: string;
};
export default function Submit({ eventString, text }: SubmitProps) {
function handleClick() {
window.dispatchEvent(new Event(`submit-${eventString}`));
}
return (
<button
type="button"
onClick={handleClick}
className="submit-btn"
>
⚓︎ {text}
</button>
);
}

View file

@ -1,5 +1,6 @@
import { jwtDecode } from "jwt-decode"
import { AUTH_TOKEN_KEY, USER_KEY, type User } from "../lib/api"
import { navigate } from "astro:transitions/client"
export function saveUser(user: User) {
localStorage.setItem(USER_KEY, JSON.stringify(user))
@ -40,3 +41,12 @@ export function isTokenExpired(token: string): boolean {
return true
}
}
export const handleBackAndReload = () => {
if (document.referrer) {
navigate(document.referrer, { history: 'replace' });
setTimeout(() => window.location.reload(), 50);
} else {
navigate('/');
}
};

View file

@ -1,13 +0,0 @@
import jwt from 'jsonwebtoken';
const isTokenExpired = (token: string): boolean => {
try {
const { exp } = jwt.decode(token) as { exp: number };
const expirationDatetimeInSeconds = exp * 1000;
return Date.now() >= expirationDatetimeInSeconds;
} catch {
return true;
}
};
export { isTokenExpired };

View file

@ -34,7 +34,7 @@ const localeDate = formatLocalizedDateString(postData.date);
</div>
<article class="markdown-content">
<slot />
<NavBack client:visible />
<NavBack client:load />
<p class="disclaimer">
Disclaimer: Dieser Artikel ist ausschließlich privat und wird nicht
durch Produktplatzierung, Affiliate-Links oder ähnliches Unterstützt.
@ -52,6 +52,9 @@ const localeDate = formatLocalizedDateString(postData.date);
<style>
#background {
display: flex;
align-items: center;
flex-direction: column;
background-image: linear-gradient(
to bottom,
var(--primary-dark),
@ -63,9 +66,10 @@ const localeDate = formatLocalizedDateString(postData.date);
}
#hr-knast {
padding: 16px 64px 0 64px ;
padding: 16px 64px 0 64px;
background-color: white;
max-width: 900px;
width: 100%;
}
hr {
@ -104,16 +108,6 @@ const localeDate = formatLocalizedDateString(postData.date);
line-height: 1.6;
}
#header #title {
font-size: 2.5rem;
padding: 0 64px;
}
#header #subtitle {
font-size: 1.8rem;
padding: 0 64px;
}
.info {
padding: 32px 64px 0 64px;
font-size: medium;
@ -123,12 +117,16 @@ const localeDate = formatLocalizedDateString(postData.date);
#title {
margin-bottom: 0;
order: 3;
font-size: 2.5rem;
padding: 0 64px;
}
#subtitle {
margin-top: 0;
font-weight: lighter;
order: 4;
font-size: 1.8rem;
padding: 0 64px;
}
#introduction {
@ -202,8 +200,9 @@ const localeDate = formatLocalizedDateString(postData.date);
.info {
order: 1;
font-size: 1rem !important;
padding-top: 16px;
padding-top: 16px !important;
padding-bottom: 16px;
padding: 0 24px;
}
#title-img {
@ -213,15 +212,22 @@ const localeDate = formatLocalizedDateString(postData.date);
#title {
margin: 0;
order: 2;
padding: 0 24px;
}
#subtitle {
order: 3;
padding: 0 24px;
}
#introduction {
font-size: 1.25rem !important;
order: 5;
padding: 32px 24px 0 24px;
}
article {
padding: 0 24px;
}
}
</style>

View file

@ -1,5 +1,6 @@
---
import NavBack from "../islands/NavBack";
import Submit from "../islands/Submit";
import Main from "../layouts/Main.astro";
const { title, subtitle, text, buttonText, eventString } = Astro.props;
@ -16,12 +17,7 @@ const { title, subtitle, text, buttonText, eventString } = Astro.props;
<slot />
<div id="buttons">
<NavBack client:load />
<button
onclick={`window.dispatchEvent(new Event("${eventString}"))`}
class="submit-btn"
>
⚓︎ {buttonText}
</button>
<Submit eventString={eventString} text={buttonText} client:load />
</div>
</div>
</div>

View file

@ -5,7 +5,9 @@ import "../styles/global.css";
<html lang="de">
<head>
<meta charset="utf-8" />
<meta
charset="utf-8"
/>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link
rel="alternate"

View file

@ -1,3 +1,4 @@
export function formatLocalizedDateString(date: Date): string {
return date.toLocaleDateString('de-DE')
var options: Intl.DateTimeFormatOptions = { weekday: undefined, year: '2-digit', month: '2-digit', day: '2-digit' };
return date.toLocaleDateString('de-DE', options)
}

View file

@ -1,18 +0,0 @@
---
import { api } from '../../../lib/api';
const { secret } = Astro.props;
export async function getStaticPaths() {
const response = await api.approveNewsletter(secret);
return response.map(product => ({
params: { id: product.id },
props: { product }
}));
}
---
<h1>{product.name}</h1>

View file

@ -10,7 +10,7 @@ import Form from "../layouts/Form.astro";
Code ein, denn du nach dem registrieren via E-Mail erhalten
hast."
buttonText="Anmelden"
eventString="submit-login"
eventString="login"
>
<LoginForm client:load />
<a href="/register">Noch keinen Account? Hier registrieren</a>

View file

@ -8,7 +8,7 @@ import Form from "../layouts/Form.astro";
subtitle="E-Mail Erinnerung für neue Artikel"
text="Endlich könnt E-Mail Erinnerungen erhalten, wenn wir neue Artikel veröffentlichen. Für die spätere Kommentarfunktion fragen wir gleich den Namen mit ab."
buttonText="Registrieren"
eventString="submit-register"
eventString="register"
>
<RegisterForm client:load/>
</Form>

View file

@ -11,7 +11,7 @@ import Form from "../layouts/Form.astro";
subtitle="Hier kannst du dein Konto verwalten."
text=""
buttonText="Speichern"
eventString="submit-toggle-subscription"
eventString="toggle-subscription"
>
<UserDetails client:load />
<ToggleSubscription client:load />

View file

@ -30,7 +30,7 @@ body {
flex-direction: column;
flex: 1;
padding: 0;
min-width: 380px;
min-width: 350px;
}
.nav-link {