mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-11 20:15:32 +08:00
Align public messaging and add news banners
This commit is contained in:
39
app/pages/logout.vue
Normal file
39
app/pages/logout.vue
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<div class="min-h-screen bg-[#0b1020] text-white">
|
||||||
|
<div class="mx-auto flex min-h-screen max-w-xl flex-col items-center justify-center gap-6 px-6 text-center">
|
||||||
|
<div class="space-y-3">
|
||||||
|
<p class="text-xs uppercase tracking-[0.3em] text-cyan-300/80">OpenSquawk</p>
|
||||||
|
<h1 class="text-3xl font-semibold">Du wirst abgemeldet…</h1>
|
||||||
|
<p class="text-sm text-white/70">
|
||||||
|
Wir melden dich vom Alpha-Dienst ab und leiten dich gleich weiter.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<v-progress-circular indeterminate size="40" width="3" color="cyan" />
|
||||||
|
<NuxtLink to="/login" class="text-sm text-cyan-300 underline">Zum Login</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import { useHead } from '#imports'
|
||||||
|
import { useAuthStore } from '~/stores/auth'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const auth = useAuthStore()
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Logout – OpenSquawk',
|
||||||
|
meta: [
|
||||||
|
{ name: 'robots', content: 'noindex' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await auth.logout()
|
||||||
|
router.replace('/login')
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p class="text-xs uppercase tracking-[0.35em] text-cyan-400/80">OpenSquawk</p>
|
<p class="text-xs uppercase tracking-[0.35em] text-cyan-400/80">OpenSquawk</p>
|
||||||
<h1 class="text-2xl font-semibold">Pilot Monitoring</h1>
|
<h1 class="text-2xl font-semibold">Pilot Monitoring</h1>
|
||||||
<p class="mt-1 text-sm text-white/70">Decision Tree • Enhanced LLM • VATSIM</p>
|
<p class="mt-1 text-sm text-white/70">Alpha Build • Decision Tree • VATSIM</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<v-chip size="small" :color="currentState?.phase === 'Interrupt' ? 'red' : 'cyan'" variant="flat" class="mb-1">
|
<v-chip size="small" :color="currentState?.phase === 'Interrupt' ? 'red' : 'cyan'" variant="flat" class="mb-1">
|
||||||
|
|||||||
@@ -54,4 +54,4 @@ export default defineNuxtConfig({
|
|||||||
css: [
|
css: [
|
||||||
'~/assets/css/global.css', '~/assets/css/opensquawk-glass.css'
|
'~/assets/css/global.css', '~/assets/css/opensquawk-glass.css'
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"nuxt": "^4.1.1",
|
"nuxt": "^4.1.1",
|
||||||
"nuxt-aos": "1.2.5",
|
"nuxt-aos": "1.2.5",
|
||||||
"nuxt-mongoose": "1.0.6",
|
"nuxt-mongoose": "1.0.6",
|
||||||
|
"nodemailer": "^6.9.13",
|
||||||
"openai": "^4.66.0",
|
"openai": "^4.66.0",
|
||||||
"pinia": "^3.0.3",
|
"pinia": "^3.0.3",
|
||||||
"vue": "^3.5.21",
|
"vue": "^3.5.21",
|
||||||
|
|||||||
56
public/img/news/alpha-prototype.svg
Normal file
56
public/img/news/alpha-prototype.svg
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="720" viewBox="0 0 1600 720" preserveAspectRatio="xMidYMid slice">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="#041026" />
|
||||||
|
<stop offset="50%" stop-color="#0a223f" />
|
||||||
|
<stop offset="100%" stop-color="#134b5f" />
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="glow" cx="75%" cy="25%" r="70%">
|
||||||
|
<stop offset="0%" stop-color="#2dd4bf" stop-opacity="0.85" />
|
||||||
|
<stop offset="55%" stop-color="#22d3ee" stop-opacity="0.25" />
|
||||||
|
<stop offset="100%" stop-color="#0b1020" stop-opacity="0" />
|
||||||
|
</radialGradient>
|
||||||
|
<radialGradient id="glow2" cx="20%" cy="80%" r="65%">
|
||||||
|
<stop offset="0%" stop-color="#38bdf8" stop-opacity="0.75" />
|
||||||
|
<stop offset="60%" stop-color="#0ea5e9" stop-opacity="0.18" />
|
||||||
|
<stop offset="100%" stop-color="#0a0f1c" stop-opacity="0" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient id="grid" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||||
|
<stop offset="0%" stop-color="#22d3ee" stop-opacity="0.1" />
|
||||||
|
<stop offset="100%" stop-color="#22d3ee" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
<filter id="soft" x="-10%" y="-10%" width="120%" height="120%">
|
||||||
|
<feGaussianBlur in="SourceGraphic" stdDeviation="3" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
<rect width="1600" height="720" fill="url(#bg)" />
|
||||||
|
<circle cx="1150" cy="180" r="520" fill="url(#glow)" />
|
||||||
|
<circle cx="360" cy="620" r="460" fill="url(#glow2)" />
|
||||||
|
<g stroke="url(#grid)" stroke-width="1" fill="none" opacity="0.5">
|
||||||
|
<path d="M-200 640 L1800 120" />
|
||||||
|
<path d="M-120 700 L1760 180" />
|
||||||
|
<path d="M-60 760 L1700 240" />
|
||||||
|
<path d="M40 760 L1620 320" />
|
||||||
|
</g>
|
||||||
|
<g opacity="0.45" filter="url(#soft)">
|
||||||
|
<circle cx="230" cy="210" r="90" fill="#38bdf8" />
|
||||||
|
<circle cx="290" cy="210" r="60" fill="#22d3ee" />
|
||||||
|
<circle cx="350" cy="210" r="30" fill="#0ea5e9" />
|
||||||
|
</g>
|
||||||
|
<g transform="translate(180 500) rotate(-6)" opacity="0.3">
|
||||||
|
<rect x="0" y="0" width="460" height="110" rx="28" ry="28" fill="#0f172a" stroke="#1f2937" stroke-width="2" />
|
||||||
|
<text x="230" y="68" font-family="'Space Grotesk', 'Segoe UI', sans-serif" font-size="48" fill="#e0f2fe" text-anchor="middle">Alpha Prototype</text>
|
||||||
|
</g>
|
||||||
|
<g opacity="0.65">
|
||||||
|
<text x="150" y="180" font-family="'Space Grotesk', 'Segoe UI', sans-serif" font-size="120" fill="#e0f2fe" letter-spacing="8">OPEN</text>
|
||||||
|
<text x="150" y="300" font-family="'Space Grotesk', 'Segoe UI', sans-serif" font-size="140" fill="#22d3ee" letter-spacing="10">SQUAWK</text>
|
||||||
|
</g>
|
||||||
|
<g transform="translate(980 470)" opacity="0.55">
|
||||||
|
<circle cx="0" cy="0" r="8" fill="#22d3ee" />
|
||||||
|
<circle cx="60" cy="-40" r="6" fill="#38bdf8" />
|
||||||
|
<circle cx="120" cy="-10" r="5" fill="#0ea5e9" />
|
||||||
|
<circle cx="180" cy="-60" r="4" fill="#38bdf8" />
|
||||||
|
<circle cx="240" cy="-20" r="6" fill="#22d3ee" />
|
||||||
|
<polyline points="0,0 60,-40 120,-10 180,-60 240,-20" fill="none" stroke="#bae6fd" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -1,7 +1,5 @@
|
|||||||
const ADMIN_EMAIL_FALLBACK = 'info@opensquawk.de'
|
const ADMIN_EMAIL_FALLBACK = 'info@opensquawk.de'
|
||||||
|
|
||||||
const RESEND_ENDPOINT = 'https://api.resend.com/emails'
|
|
||||||
|
|
||||||
interface MailOptions {
|
interface MailOptions {
|
||||||
to: string
|
to: string
|
||||||
subject: string
|
subject: string
|
||||||
@@ -13,72 +11,58 @@ interface MailPayload extends MailOptions {
|
|||||||
from: string
|
from: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface SmtpConfig {
|
||||||
|
host: string
|
||||||
|
port: number
|
||||||
|
secure: boolean
|
||||||
|
user: string
|
||||||
|
pass: string
|
||||||
|
}
|
||||||
|
|
||||||
function resolveFrom(from?: string) {
|
function resolveFrom(from?: string) {
|
||||||
return from || process.env.NOTIFY_EMAIL_FROM || 'OpenSquawk <no-reply@opensquawk.dev>'
|
return from || process.env.NOTIFY_EMAIL_FROM || 'OpenSquawk <no-reply@opensquawk.dev>'
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendViaResend(payload: MailPayload) {
|
function resolveSmtpConfig(): SmtpConfig | null {
|
||||||
const apiKey = process.env.NOTIFY_RESEND_API_KEY
|
const host = process.env.NOTIFY_SMTP_HOST?.trim()
|
||||||
if (!apiKey) {
|
const user = process.env.NOTIFY_SMTP_USER?.trim()
|
||||||
return false
|
const pass = process.env.NOTIFY_SMTP_PASS?.trim()
|
||||||
|
|
||||||
|
if (!host || !user || !pass) {
|
||||||
|
console.warn('SMTP notification is not fully configured. Please set NOTIFY_SMTP_HOST, NOTIFY_SMTP_USER and NOTIFY_SMTP_PASS.')
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const secure = (process.env.NOTIFY_SMTP_SECURE || '').toLowerCase() === 'true'
|
||||||
const response = await fetch(RESEND_ENDPOINT, {
|
const parsedPort = Number.parseInt(process.env.NOTIFY_SMTP_PORT || '', 10)
|
||||||
method: 'POST',
|
const port = Number.isNaN(parsedPort) ? (secure ? 465 : 587) : parsedPort
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${apiKey}`,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify(payload),
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!response.ok) {
|
return { host, user, pass, secure, port }
|
||||||
const errorText = await response.text().catch(() => '')
|
|
||||||
console.error('Failed to send email via Resend API', response.status, errorText)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error while sending email via Resend API', error)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendViaSmtp(payload: MailPayload) {
|
async function sendViaSmtp(payload: MailPayload) {
|
||||||
const host = process.env.NOTIFY_SMTP_HOST
|
const config = resolveSmtpConfig()
|
||||||
if (!host) {
|
if (!config) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const user = process.env.NOTIFY_SMTP_USER
|
|
||||||
const pass = process.env.NOTIFY_SMTP_PASS
|
|
||||||
if (!user || !pass) {
|
|
||||||
console.warn('SMTP notification is configured without credentials – skipping send.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
const port = Number.parseInt(process.env.NOTIFY_SMTP_PORT || '', 10)
|
|
||||||
const secure = process.env.NOTIFY_SMTP_SECURE === 'true'
|
|
||||||
|
|
||||||
let nodemailer: any = null
|
let nodemailer: any = null
|
||||||
try {
|
try {
|
||||||
const module = await import('nodemailer')
|
const module = await import('nodemailer')
|
||||||
nodemailer = module.default ?? module
|
nodemailer = module.default ?? module
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('nodemailer is not available. Skipping SMTP notification.', error)
|
console.error('nodemailer is not available. Install the dependency to send SMTP emails.', error)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host,
|
host: config.host,
|
||||||
port: Number.isNaN(port) ? (secure ? 465 : 587) : port,
|
port: config.port,
|
||||||
secure,
|
secure: config.secure,
|
||||||
auth: {
|
auth: {
|
||||||
user,
|
user: config.user,
|
||||||
pass,
|
pass: config.pass,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -95,27 +79,13 @@ async function sendViaSmtp(payload: MailPayload) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendMailInternal(options: MailOptions) {
|
export async function sendMail(options: MailOptions) {
|
||||||
const payload: MailPayload = {
|
const payload: MailPayload = {
|
||||||
...options,
|
...options,
|
||||||
from: resolveFrom(options.from),
|
from: resolveFrom(options.from),
|
||||||
}
|
}
|
||||||
|
|
||||||
const sentViaResend = await sendViaResend(payload)
|
const success = await sendViaSmtp(payload)
|
||||||
if (sentViaResend) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const sentViaSmtp = await sendViaSmtp(payload)
|
|
||||||
if (sentViaSmtp) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sendMail(options: MailOptions) {
|
|
||||||
const success = await sendMailInternal(options)
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
console.info(`[mail:fallback] ${options.subject}\nEmpfänger: ${options.to}\n${options.text}`)
|
console.info(`[mail:fallback] ${options.subject}\nEmpfänger: ${options.to}\n${options.text}`)
|
||||||
}
|
}
|
||||||
@@ -124,7 +94,7 @@ export async function sendMail(options: MailOptions) {
|
|||||||
|
|
||||||
export async function sendAdminNotification(subject: string, text: string) {
|
export async function sendAdminNotification(subject: string, text: string) {
|
||||||
const to = process.env.NOTIFY_EMAIL_TO || ADMIN_EMAIL_FALLBACK
|
const to = process.env.NOTIFY_EMAIL_TO || ADMIN_EMAIL_FALLBACK
|
||||||
const success = await sendMailInternal({ to, subject, text })
|
const success = await sendMail({ to, subject, text })
|
||||||
if (!success) {
|
if (!success) {
|
||||||
console.info(`[notify:fallback] ${subject}\nEmpfänger: ${to}\n${text}`)
|
console.info(`[notify:fallback] ${subject}\nEmpfänger: ${to}\n${text}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user