summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-05-15 01:16:25 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-05-15 01:16:25 +0000
commit71f4dd76b57e77676d8886ac0a8b0bd0a7f24e62 (patch)
tree5b9ad9e4233181f12b632ab7797512ea0609105c
parentf9135c774b72cf4185a52f18ec021f0b7d8098e9 (diff)
(김준회) DRM - PQ 기준 엑셀 임포트
-rw-r--r--lib/items-tech/table/import-excel-button.tsx16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/items-tech/table/import-excel-button.tsx b/lib/items-tech/table/import-excel-button.tsx
index 8c4a9e16..a5f63ff7 100644
--- a/lib/items-tech/table/import-excel-button.tsx
+++ b/lib/items-tech/table/import-excel-button.tsx
@@ -19,6 +19,7 @@ import { Progress } from "@/components/ui/progress"
import { processFileImport } from "./ship/import-item-handler"
import { processTopFileImport } from "./top/import-item-handler"
import { processHullFileImport } from "./hull/import-item-handler"
+import { decryptWithServerAction } from "@/components/drm/drmUtils"
// 선박 아이템 타입
@@ -71,8 +72,19 @@ export function ImportItemButton({ itemType, onSuccess }: ImportItemButtonProps)
setProgress(0);
setError(null);
- // 파일을 ArrayBuffer로 읽기
- const arrayBuffer = await file.arrayBuffer();
+ // DRM 복호화 처리 - 서버 액션 직접 호출
+ let arrayBuffer: ArrayBuffer;
+ try {
+ setProgress(10);
+ toast.info("파일 복호화 중...");
+ arrayBuffer = await decryptWithServerAction(file);
+ setProgress(30);
+ } catch (decryptError) {
+ console.error("파일 복호화 실패, 원본 파일 사용:", decryptError);
+ toast.warning("파일 복호화에 실패하여 원본 파일을 사용합니다.");
+ // 복호화 실패 시 원본 파일 사용
+ arrayBuffer = await file.arrayBuffer();
+ }
// ExcelJS 워크북 로드
const workbook = new ExcelJS.Workbook();