Games tab on admin page working
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.mattrixwv.raidbuilder.controller;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.mattrixwv.raidbuilder.annotation.AccountAuthorization;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/icons")
|
||||
public class IconController{
|
||||
@Value("${uploadFileDirectory}")
|
||||
private String uploadFileDirectory;
|
||||
|
||||
|
||||
@GetMapping("/gameIcons/{gameIconName}")
|
||||
@AccountAuthorization(permissions = {})
|
||||
public ResponseEntity<byte[]> getGameClassIcons(@PathVariable("gameIconName") String gameIconName) throws IOException{
|
||||
log.info("Getting game icon {}", gameIconName);
|
||||
|
||||
|
||||
byte[] resource = Files.readAllBytes(Path.of(uploadFileDirectory + "/gameIcons/" + gameIconName));
|
||||
|
||||
|
||||
return ResponseEntity.ok().body(resource);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user