Fix Backend

This commit is contained in:
2025-06-29 11:22:41 +02:00
parent 1bb15d9551
commit bd9451f2aa
2 changed files with 8 additions and 7 deletions
@@ -110,7 +110,7 @@ fun Route.configureEventFightRoutes() {
fight.spectatePort fight.spectatePort
) )
if (fight.group != null) { if (fight.group != null) {
eventFight.groupId = fight.group eventFight.setGroup(fight.group)
} }
call.respond(HttpStatusCode.Created, ResponseEventFight(eventFight)) call.respond(HttpStatusCode.Created, ResponseEventFight(eventFight))
} }
@@ -158,7 +158,6 @@ fun Route.configurePage() {
}) })
} }
post { post {
val req = call.receive<CreatePageRequest>() val req = call.receive<CreatePageRequest>()
if(req.path.startsWith("src/content/")) { if(req.path.startsWith("src/content/")) {
call.respond(HttpStatusCode.BadRequest, "Invalid path") call.respond(HttpStatusCode.BadRequest, "Invalid path")
@@ -168,18 +167,20 @@ fun Route.configurePage() {
contentType(ContentType.Application.Json) contentType(ContentType.Application.Json)
setBody(CreateGiteaPageRequest( setBody(CreateGiteaPageRequest(
"Create page ${req.path}", "Create page ${req.path}",
Base64.getEncoder().encodeToString(""" Base64.getEncoder().encodeToString((
if (req.path.endsWith(".md")) """
--- ---
title: ${req.title ?: "[Enter Title]"} title: ${req.title?.removeSuffix(".md") ?: "Enter Title"}
description: [Enter Description] description: Enter Description
key: ${req.slug ?: "[Enter Slug]"} key: ${req.slug?.lowercase()?.removeSuffix(".md") ?: "Enter Slug"}
created: ${LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)} created: ${LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)}
tags: tags:
- test - test
--- ---
# ${req.path} # ${req.path}
""".trimIndent().toByteArray()), """ else "{}"
).trimIndent().toByteArray()),
call.request.queryParameters["branch"] ?: "master", call.request.queryParameters["branch"] ?: "master",
Identity(call.principal<SWAuthPrincipal>()!!.user.userName, "admin-tool@steamwar.de" Identity(call.principal<SWAuthPrincipal>()!!.user.userName, "admin-tool@steamwar.de"
))) )))