forked from MinecraftUtilities/Backend
update hostnameAndPort to be hostname
This commit is contained in:
parent
2ba9651161
commit
11079ea572
@ -30,21 +30,21 @@ public class ServerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/{platform}/{hostnameAndPort}", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/{platform}/{hostname}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public CachedMinecraftServer getServer(
|
public CachedMinecraftServer getServer(
|
||||||
@Parameter(description = "The platform of the server", example = "java") @PathVariable String platform,
|
@Parameter(description = "The platform of the server", example = "java") @PathVariable String platform,
|
||||||
@Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostnameAndPort) {
|
@Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostname) {
|
||||||
Tuple<String, Integer> host = ServerUtils.getHostnameAndPort(hostnameAndPort);
|
Tuple<String, Integer> host = ServerUtils.getHostnameAndPort(hostname);
|
||||||
return serverService.getServer(platform, host.getLeft(), host.getRight());
|
return serverService.getServer(platform, host.getLeft(), host.getRight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@GetMapping(value = "/icon/{hostnameAndPort}", produces = MediaType.IMAGE_PNG_VALUE)
|
@GetMapping(value = "/icon/{hostname}", produces = MediaType.IMAGE_PNG_VALUE)
|
||||||
public ResponseEntity<?> getServerIcon(
|
public ResponseEntity<?> getServerIcon(
|
||||||
@Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostnameAndPort,
|
@Parameter(description = "The hostname and port of the server", example = "play.hypixel.net") @PathVariable String hostname,
|
||||||
@Parameter(description = "Whether to download the image") @RequestParam(required = false, defaultValue = "false") boolean download) {
|
@Parameter(description = "Whether to download the image") @RequestParam(required = false, defaultValue = "false") boolean download) {
|
||||||
Tuple<String, Integer> host = ServerUtils.getHostnameAndPort(hostnameAndPort);
|
Tuple<String, Integer> host = ServerUtils.getHostnameAndPort(hostname);
|
||||||
String hostname = host.getLeft();
|
hostname = host.getLeft();
|
||||||
int port = host.getRight();
|
int port = host.getRight();
|
||||||
String dispositionHeader = download ? "attachment; filename=%s.png" : "inline; filename=%s.png";
|
String dispositionHeader = download ? "attachment; filename=%s.png" : "inline; filename=%s.png";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user