mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-12 09:37:27 +08:00
[F] Wacca: Fix handle
This commit is contained in:
@@ -60,7 +60,8 @@ class WaccaServer(val rp: WaccaRepos, val cardRepo: CardRepository) {
|
|||||||
|
|
||||||
/** Handle all requests */
|
/** Handle all requests */
|
||||||
@API("/api/**")
|
@API("/api/**")
|
||||||
fun handle(req: HttpServletRequest, @RB body: String) = try {
|
fun handle(req: HttpServletRequest, @RB body: String): Any {
|
||||||
|
return try {
|
||||||
val path = req.requestURI.removePrefix("/g/wacca").removePrefix("/api").removePrefix("/").lowercase()
|
val path = req.requestURI.removePrefix("/g/wacca").removePrefix("/api").removePrefix("/").lowercase()
|
||||||
if (path in cacheMap) return resp(cacheMap[path]!!)
|
if (path in cacheMap) return resp(cacheMap[path]!!)
|
||||||
if (path !in handlerMap) return resp("[]", 1, "Not Found")
|
if (path !in handlerMap) return resp("[]", 1, "Not Found")
|
||||||
@@ -79,6 +80,7 @@ class WaccaServer(val rp: WaccaRepos, val cardRepo: CardRepository) {
|
|||||||
log.error("Wacca > Error", e)
|
log.error("Wacca > Error", e)
|
||||||
resp("[]", 500, e.message ?: "")
|
resp("[]", 500, e.message ?: "")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
|||||||
Reference in New Issue
Block a user