added dockerfile for docs

This commit is contained in:
PxlLoewe
2025-06-24 20:07:54 -07:00
parent 0607b93ade
commit f8389383f8
8 changed files with 105 additions and 31 deletions

View File

@@ -61,14 +61,15 @@ export const ContextMenu = () => {
`https://overpass-api.de/api/interpreter?data=${encodeURIComponent(` `https://overpass-api.de/api/interpreter?data=${encodeURIComponent(`
[out:json]; [out:json];
( (
way["building"](around:100, ${contextMenu.lat}, ${contextMenu.lng}); way["leisure"~"pitch|sports_centre"](around:2000, ${contextMenu.lat}, ${contextMenu.lng});
relation["building"](around:100, ${contextMenu.lat}, ${contextMenu.lng}); relation["leisure"~"pitch|sports_centre"](around:2000, ${contextMenu.lat}, ${contextMenu.lng});
); );
out body; out body;
>; >;
out skel qt; out skel qt;
`)}`, `)}`,
); );
const data = await res.json(); const data = await res.json();
const parsed: OSMWay[] = data.elements const parsed: OSMWay[] = data.elements
.filter((e: any) => e.type === "way") .filter((e: any) => e.type === "way")

2
apps/docs/.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
node_modules
dist

32
apps/docs/Dockerfile Normal file
View File

@@ -0,0 +1,32 @@
# --- Build stage ---
FROM node:24-alpine3.21 AS builder
# Consider using the latest patch version for security updates
RUN apk update && apk upgrade
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
RUN apk add --no-cache git
# Set workdir
WORKDIR /app
# Copy project files
COPY ./apps/docs .
# Install dependencies
RUN pnpm install
# Build VitePress site
RUN pnpm build
# --- Serve stage ---
FROM nginx:alpine
# Copy built site to nginx public folder
COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
# Expose port
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,46 +1,55 @@
import { getPublicUser, prisma } from "@repo/db"; import { getPublicUser, prisma } from "@repo/db";
import { TriangleAlert } from "lucide-react"; import { TriangleAlert } from "lucide-react";
import { getServerSession } from "next-auth";
import { PenaltyCountdown } from "./PenaltyCountdown"; import { PenaltyCountdown } from "./PenaltyCountdown";
import { getServerSession } from "api/auth/[...nextauth]/auth";
export const Penalty = async () => { export const Penalty = async () => {
const session = await getServerSession(); const session = await getServerSession();
const openPenaltys = await prisma.penalty.findMany({ const openTimeban = await prisma.penalty.findMany({
where: { where: {
userId: session?.user.id, userId: session?.user.id,
until: { until: {
gte: new Date(), gte: new Date(),
}, },
suspended: false, suspended: false,
type: { in: ["TIME_BAN"] },
type: { in: ["TIME_BAN", "BAN"] },
}, },
include: { include: {
CreatedUser: true, CreatedUser: true,
}, },
}); });
if (!openPenaltys[0]) {
return null; const openBans = await prisma.penalty.findMany({
} where: {
userId: session?.user.id,
suspended: false,
type: { in: ["BAN"] },
},
include: {
CreatedUser: true,
},
});
console.log("Open Penaltys:", session);
return ( return (
<div className="card bg-error shadow-xl mb-4 col-span-6 xl:col-span-3"> <div className="card bg-error shadow-xl mb-4 col-span-6 xl:col-span-3">
{openPenaltys[0].type === "TIME_BAN" && ( {openTimeban[0] && openTimeban[0].type === "TIME_BAN" && (
<div className="card-body text-base-300"> <div className="card-body text-base-300">
<h2 className="card-title text-3xl"> <h2 className="card-title text-3xl">
<TriangleAlert /> <TriangleAlert />
Aktive Strafe - <PenaltyCountdown until={openPenaltys[0].until ?? new Date()} />{" "} Aktive Strafe - <PenaltyCountdown until={openTimeban[0].until ?? new Date()} />{" "}
verbleibend verbleibend
</h2> </h2>
<p className="text-left font-bold"> <p className="text-left font-bold">
Du hast eine aktive Strafe und kannst dich deshalb nicht mit dem Netzwerk verbinden. Du hast eine aktive Strafe und kannst dich deshalb nicht mit dem Netzwerk verbinden.
</p> </p>
<p className="text-left"> <p className="text-left">
<span className="font-bold">Grund:</span> {openPenaltys[0].reason} <span className="font-bold">Grund:</span> {openTimeban[0].reason}
</p> </p>
<p className="text-left"> <p className="text-left">
<span className="font-bold">Admin:</span>{" "} <span className="font-bold">Admin:</span>{" "}
{getPublicUser(openPenaltys[0].CreatedUser).fullName} {getPublicUser(openTimeban[0].CreatedUser).fullName}
</p> </p>
</div> </div>
)} )}
@@ -54,11 +63,17 @@ export const Penalty = async () => {
Dein Fehlverhalten war so schwerwiegend, dass du dauerhaft von VirtualAirRescue Dein Fehlverhalten war so schwerwiegend, dass du dauerhaft von VirtualAirRescue
ausgeschlossen wurdest. Du kannst dich nicht mehr mit dem Netzwerk verbinden. ausgeschlossen wurdest. Du kannst dich nicht mehr mit dem Netzwerk verbinden.
</p> </p>
<p className="text-left font-bold">Grund: {openPenaltys[0].reason}</p> {openBans[0] && (
<>
<p className="text-left font-bold">
Grund: {openBans[0].reason || "Keine Begründung gefunden"}
</p>
<p className="text-left"> <p className="text-left">
<span className="font-bold">Admin:</span>{" "} <span className="font-bold">Admin:</span>{" "}
{getPublicUser(openPenaltys[0].CreatedUser).fullName} {getPublicUser(openBans[0].CreatedUser).fullName || "Keine Admin gefunden"}
</p> </p>
</>
)}
</div> </div>
)} )}
</div> </div>

View File

@@ -18,3 +18,13 @@ export const editPenalty = async (id: number, data: Prisma.PenaltyUpdateInput) =
data, data,
}); });
}; };
export const editPenaltys = async (
data: Prisma.PenaltyUpdateInput,
where: Prisma.PenaltyWhereInput,
) => {
return await prisma.penalty.updateMany({
where,
data,
});
};

View File

@@ -50,7 +50,7 @@ import { useSession } from "next-auth/react";
import { setStandardName } from "../../../../../../helper/discord"; import { setStandardName } from "../../../../../../helper/discord";
import { penaltyColumns } from "(app)/admin/penalty/columns"; import { penaltyColumns } from "(app)/admin/penalty/columns";
import { PenaltyDropdown } from "(app)/admin/user/[id]/_components/AddPenaltyDropdown"; import { PenaltyDropdown } from "(app)/admin/user/[id]/_components/AddPenaltyDropdown";
import { addPenalty } from "(app)/admin/penalty/actions"; import { addPenalty, editPenalty, editPenaltys } from "(app)/admin/penalty/actions";
interface ProfileFormProps { interface ProfileFormProps {
user: User; user: User;
@@ -357,7 +357,7 @@ export const UserPenalties = ({ user }: { user: User }) => {
userId: user.id, userId: user.id,
createdUserId: createdUser.id, createdUserId: createdUser.id,
}); });
await editUser(user.id, { isBanned: true, permissions: [] }); await editUser(user.id, { isBanned: true });
penaltyTable.current?.refresh(); penaltyTable.current?.refresh();
toast.success("Ban wurde hinzugefügt!"); toast.success("Ban wurde hinzugefügt!");
}} }}
@@ -506,6 +506,7 @@ export const AdminForm = ({
<Button <Button
onClick={async () => { onClick={async () => {
await editUser(user.id, { isBanned: false }); await editUser(user.id, { isBanned: false });
await editPenaltys({ suspended: true }, { userId: user.id, type: "BAN" });
toast.success("Nutzer wurde entsperrt!", { toast.success("Nutzer wurde entsperrt!", {
style: { style: {
background: "var(--color-base-100)", background: "var(--color-base-100)",

View File

@@ -120,7 +120,6 @@ services:
- postgres_network - postgres_network
- discord_network - discord_network
# Hub Service
hub: hub:
build: build:
context: . context: .
@@ -189,6 +188,20 @@ services:
networks: networks:
- postgres_network - postgres_network
docs:
build:
context: .
dockerfile: ./apps/docs/Dockerfile
labels:
- "traefik.enable=true"
- "traefik.http.routers.hub.rule=Host(`docs.premiumag.de`)"
- "traefik.http.routers.hub.entrypoints=websecure"
- "traefik.http.routers.hub.tls.certresolver=le"
- "traefik.http.services.hub.loadbalancer.server.port=80"
- "traefik.docker.network=var-monorepo_traefik_network"
networks:
- traefik_network
redis: redis:
container_name: redis container_name: redis
image: redis/redis-stack:latest image: redis/redis-stack:latest

View File

@@ -21,9 +21,9 @@ model Mission {
missionLog Json[] @default([]) missionLog Json[] @default([])
hpgMissionString String? hpgMissionString String?
hpgSelectedMissionString String? hpgSelectedMissionString String?
hpgAmbulanceState HpgState? hpgAmbulanceState HpgState? @default(NOT_REQUESTED)
hpgFireEngineState HpgState? hpgFireEngineState HpgState? @default(NOT_REQUESTED)
hpgPoliceState HpgState? hpgPoliceState HpgState? @default(NOT_REQUESTED)
hpgLocationLat Float? @default(0) hpgLocationLat Float? @default(0)
hpgLocationLng Float? @default(0) hpgLocationLng Float? @default(0)
hpgValidationState HpgValidationState @default(NOT_VALIDATED) hpgValidationState HpgValidationState @default(NOT_VALIDATED)