Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: 0.1.8 (#17)
Browse files Browse the repository at this point in the history
devxb authored Apr 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 9fe3506 + 253a717 commit 2ff8fc6
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

##
<a href="https://github.com/devxb/gitanimals">
<img src="https://render.gitanimals.org/lines/devxb" width="2000" height="60"/>
<img src="https://render.gitanimals.org/lines/devxb?pet-id=126" width="2000" height="100"/>
</a>

<div align = "center">
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ class AnimationController(
response: HttpServletResponse
): String {
response.cacheControl(3600)
return animationFacade.getFarmAnimation(username)
return animationFacade.getFarmAnimation(deleteBrackets(username))
}

@GetMapping(value = ["/lines/{username}"], produces = ["image/svg+xml"])
@@ -29,7 +29,21 @@ class AnimationController(
response: HttpServletResponse,
): String {
response.cacheControl(3600)
return animationFacade.getLineAnimation(username, personaId)
return animationFacade.getLineAnimation(deleteBrackets(username), personaId)
}

private fun deleteBrackets(username: String): String {
val start = when (username[0]) {
'{' -> 1
else -> 0
}

val end = when (username.last()) {
'}' -> username.length - 1
else -> username.length
}

return username.substring(start, end)
}

fun HttpServletResponse.cacheControl(maxAgeSeconds: Int): HttpServletResponse {

0 comments on commit 2ff8fc6

Please sign in to comment.