[api] tus 주소 부터 일단변경
This commit is contained in:
@@ -45,7 +45,7 @@ public class OpenApiConfig {
|
||||
"/admin/**"
|
||||
, "/cors/**"
|
||||
, "/file/**"
|
||||
, "/tusFiles/**"
|
||||
, "/tus/file/**"
|
||||
, "/error"
|
||||
, "/actuator/**"
|
||||
)
|
||||
@@ -67,7 +67,7 @@ public class OpenApiConfig {
|
||||
.pathsToMatch(
|
||||
"/cors/**"
|
||||
, "/file/**"
|
||||
, "/tusFiles/**"
|
||||
, "/tus/file/**"
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ public class SecurityConfig {
|
||||
, "/auth/**"
|
||||
, "/user/add"
|
||||
, "/user/migration/list"
|
||||
, "/tusFiles/tusHook"
|
||||
, "/tusFiles/uploadAuth"
|
||||
, "/tus/file/hook"
|
||||
, "/tus/file/upload/auth"
|
||||
, "/file/**"
|
||||
).permitAll()
|
||||
.anyRequest().authenticated()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
try {
|
||||
String requestUri = request.getRequestURI();
|
||||
boolean adminRequest = requestUri.startsWith("/admin/");
|
||||
boolean sharedRequest = requestUri.startsWith("/tusFiles/") || requestUri.startsWith("/file/") || requestUri.startsWith("/cors/");
|
||||
boolean sharedRequest = requestUri.startsWith("/tus/file/") || requestUri.startsWith("/file/") || requestUri.startsWith("/cors/");
|
||||
String token = resolveToken(request, adminRequest, sharedRequest);
|
||||
|
||||
if (token != null && jwtTokenProvider.validateToken(token)) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.nio.file.Path;
|
||||
, description = "TUS 기반 파일 업로드 초기화, 권한 검증, 상태 조회, 훅 처리, 취소 API"
|
||||
)
|
||||
@RestController
|
||||
@RequestMapping("/tusFiles")
|
||||
@RequestMapping("/tus/file")
|
||||
public class TusFileController {
|
||||
private final TusFileService tusFileService;
|
||||
|
||||
@@ -42,8 +42,8 @@ public class TusFileController {
|
||||
summary = "파일 업로드 초기화"
|
||||
, description = "업로드 대상 파일 정보를 DB에 등록하고 fileUuid/uploadToken을 발급합니다."
|
||||
)
|
||||
@PostMapping("/uploadInit")
|
||||
public ResponseEntity<ApiResponse<FileUploadDto>> uploadInit(
|
||||
@PostMapping("/upload/init")
|
||||
public ResponseEntity<ApiResponse<FileUploadDto>> tusFileUploadInit(
|
||||
@Valid @RequestBody FileUploadForm fileUploadForm
|
||||
) {
|
||||
FileUploadDto fileUploadDto = fileUploadForm.toFileUploadDto();
|
||||
@@ -72,8 +72,8 @@ public class TusFileController {
|
||||
summary = "업로드 권한 검증"
|
||||
, description = "Bearer 업로드 토큰과 fileUuid(및 TUS 메타데이터)를 검증해 업로드 가능 여부를 확인합니다."
|
||||
)
|
||||
@GetMapping("/uploadAuth")
|
||||
public ResponseEntity<ApiResponse<String>> uploadAuth(
|
||||
@GetMapping("/upload/auth")
|
||||
public ResponseEntity<ApiResponse<String>> tusFileUploadAuth(
|
||||
@RequestHeader(value = "Authorization", required = false) String uploadToken
|
||||
, @RequestHeader(value = "x-File-Uuid", required = false) String fileUuid
|
||||
, @RequestHeader(value = "Upload-Metadata", required = false) String uploadMetadata
|
||||
@@ -107,8 +107,8 @@ public class TusFileController {
|
||||
summary = "업로드 상태 조회"
|
||||
, description = "fileUuid 기준으로 Redis/DB 업로드 상태(진행률, 상태값)를 조회합니다."
|
||||
)
|
||||
@PostMapping("/uploadStatus")
|
||||
public ResponseEntity<ApiResponse<UploadStatusDto>> uploadStatus(
|
||||
@PostMapping("/upload/status")
|
||||
public ResponseEntity<ApiResponse<UploadStatusDto>> tusFileUploadStatus(
|
||||
@Valid @RequestBody UploadStatusForm uploadStatusForm
|
||||
) {
|
||||
UploadStatusDto status = tusFileService.getUploadStatus(uploadStatusForm.toUploadStatusDto());
|
||||
@@ -122,8 +122,8 @@ public class TusFileController {
|
||||
summary = "TUS 훅 수신"
|
||||
, description = "tusd에서 전달되는 pre-create/post-receive/post-finish/post-terminate 이벤트를 반영합니다."
|
||||
)
|
||||
@PostMapping("/tusHook")
|
||||
public ResponseEntity<ApiResponse<String>> tusHook(@RequestBody TusHookForm tusHookForm) {
|
||||
@PostMapping("/hook")
|
||||
public ResponseEntity<ApiResponse<String>> tusFileHook(@RequestBody TusHookForm tusHookForm) {
|
||||
boolean accepted = tusFileService.updateFileUploadStatus(tusHookForm.toTusHookDto());
|
||||
|
||||
if (accepted) {
|
||||
@@ -137,8 +137,8 @@ public class TusFileController {
|
||||
summary = "업로드 취소"
|
||||
, description = "현재 로그인 사용자의 fileUuid 업로드를 취소(CANCELED) 처리합니다."
|
||||
)
|
||||
@PostMapping("/uploadCancel")
|
||||
public ResponseEntity<ApiResponse<String>> uploadCancel(
|
||||
@PostMapping("/upload/cancel")
|
||||
public ResponseEntity<ApiResponse<String>> tusFileUploadCancel(
|
||||
@Valid @RequestBody UploadCancelForm uploadCancelForm
|
||||
) {
|
||||
Integer userTokenIdx = SecurityUtil.getLoginUserTokenIdx();
|
||||
@@ -165,7 +165,7 @@ public class TusFileController {
|
||||
summary = "파일 목록 조회"
|
||||
, description = "FILE_MASTER_IDX 기준으로 완료된 파일 목록을 조회합니다.")
|
||||
@GetMapping("/list/{fileMasterIdx}")
|
||||
public ResponseEntity<ApiResponse<FileDownloadListDto>> fileListByFileMasterIdx(
|
||||
public ResponseEntity<ApiResponse<FileDownloadListDto>> tusFileList(
|
||||
@PathVariable Long fileMasterIdx
|
||||
) {
|
||||
|
||||
@@ -185,7 +185,7 @@ public class TusFileController {
|
||||
summary = "파일 보기"
|
||||
, description = "권한 확인 후 Nginx X-Accel-Redirect로 파일을 inline 조회합니다.")
|
||||
@GetMapping("/view/{fileUuid}")
|
||||
public ResponseEntity<Resource> fileView(
|
||||
public ResponseEntity<Resource> tusFileView(
|
||||
@PathVariable String fileUuid
|
||||
, HttpServletRequest request
|
||||
) throws IOException {
|
||||
@@ -228,7 +228,7 @@ public class TusFileController {
|
||||
summary = "파일 다운로드"
|
||||
, description = "권한 확인 후 파일 다운로드 로그를 남기고 redirect 또는 Nginx X-Accel-Redirect로 파일 다운로드 합니다.")
|
||||
@GetMapping("/download/{fileUuid}")
|
||||
public ResponseEntity<Resource> fileDownload(
|
||||
public ResponseEntity<Resource> tusFileDownload(
|
||||
@PathVariable String fileUuid
|
||||
, HttpServletRequest request
|
||||
) throws IOException {
|
||||
@@ -272,7 +272,7 @@ public class TusFileController {
|
||||
description = "fileUuid 기준으로 완료된 파일(STATUS = 3)을 논리 삭제 처리합니다. 실제 파일은 삭제하지 않고 DEL_YN = 'Y'만 반영합니다."
|
||||
)
|
||||
@PostMapping("/delete")
|
||||
public ResponseEntity<ApiResponse<String>> fileDelete(
|
||||
public ResponseEntity<ApiResponse<String>> tusFileDelete(
|
||||
@Valid @RequestBody FileDeleteForm fileDeleteForm
|
||||
) {
|
||||
boolean deleted = tusFileService.updateFileDelete(fileDeleteForm.toFileDeleteDto());
|
||||
|
||||
@@ -14,7 +14,7 @@ public class FileUploadDto {
|
||||
@Schema(description = "파일 마스터 PK", example = "1")
|
||||
private Long fileMasterIdx;
|
||||
|
||||
@Schema(description = "TUS 업로드 엔드포인트", example = "/tusFiles/upload")
|
||||
@Schema(description = "TUS 업로드 엔드포인트", example = "/tus/file/upload")
|
||||
private String tusEndpoint;
|
||||
|
||||
@JsonIgnore
|
||||
|
||||
@@ -603,8 +603,8 @@ public class TusFileService {
|
||||
List<FileDownloadItemDto> itemList = tusFileMapper.selectFileDownloadListByFileMasterIdx(fileDownloadDto);
|
||||
|
||||
for (FileDownloadItemDto item : itemList) {
|
||||
item.setViewUrl("/tusFiles/view/" + item.getFileUuid());
|
||||
item.setDownloadUrl("/tusFiles/download/" + item.getFileUuid());
|
||||
item.setViewUrl("/tus/file/view/" + item.getFileUuid());
|
||||
item.setDownloadUrl("/tus/file/download/" + item.getFileUuid());
|
||||
}
|
||||
|
||||
fileDownloadList.setItemList(itemList);
|
||||
|
||||
@@ -61,7 +61,7 @@ swagger:
|
||||
|
||||
tus-file:
|
||||
upload:
|
||||
tus-endpoint: https://file-alist.pjt.kr/tus/files/
|
||||
tus-endpoint: https://file-alist.pjt.kr/tus/file/
|
||||
public-base-url: https://file-alist.pjt.kr
|
||||
tmp-root: /srv/project/alist/uploads/tmp
|
||||
final-root: /srv/project/alist/uploads
|
||||
|
||||
@@ -63,7 +63,7 @@ swagger:
|
||||
|
||||
tus-file:
|
||||
upload:
|
||||
tus-endpoint: https://file-alist.pjt.kr/tus/files/
|
||||
tus-endpoint: https://file-alist.pjt.kr/tus/file/
|
||||
public-base-url: https://file-alist.pjt.kr
|
||||
tmp-root: /srv/project/alist/uploads/tmp
|
||||
final-root: /srv/project/alist/uploads
|
||||
|
||||
Reference in New Issue
Block a user