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
)
if (fight.group != null) {
eventFight.groupId = fight.group
eventFight.setGroup(fight.group)
}
call.respond(HttpStatusCode.Created, ResponseEventFight(eventFight))
}
@@ -158,7 +158,6 @@ fun Route.configurePage() {
})
}
post {
val req = call.receive<CreatePageRequest>()
if(req.path.startsWith("src/content/")) {
call.respond(HttpStatusCode.BadRequest, "Invalid path")
@@ -168,18 +167,20 @@ fun Route.configurePage() {
contentType(ContentType.Application.Json)
setBody(CreateGiteaPageRequest(
"Create page ${req.path}",
Base64.getEncoder().encodeToString("""
Base64.getEncoder().encodeToString((
if (req.path.endsWith(".md")) """
---
title: ${req.title ?: "[Enter Title]"}
description: [Enter Description]
key: ${req.slug ?: "[Enter Slug]"}
title: ${req.title?.removeSuffix(".md") ?: "Enter Title"}
description: Enter Description
key: ${req.slug?.lowercase()?.removeSuffix(".md") ?: "Enter Slug"}
created: ${LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)}
tags:
- test
---
# ${req.path}
""".trimIndent().toByteArray()),
""" else "{}"
).trimIndent().toByteArray()),
call.request.queryParameters["branch"] ?: "master",
Identity(call.principal<SWAuthPrincipal>()!!.user.userName, "admin-tool@steamwar.de"
)))