From 6e4b23e849a784cf33502b012424332ae550bf47 Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Mon, 31 Aug 2026 12:50:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=97=B0=EA=B2=B0=20=EC=A0=84=20OAuth?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hlab/yanalyst/domain/upload/YoutubeOAuthController.java | 4 ++-- .../yanalyst/domain/upload/YoutubeOAuthLocalSettings.java | 3 --- .../com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java | 5 +++++ src/main/resources/templates/upload-studio.html | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthController.java b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthController.java index 30318c2..2ef6c24 100644 --- a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthController.java +++ b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthController.java @@ -67,8 +67,8 @@ public class YoutubeOAuthController { @PostMapping("/settings") @ResponseBody public ApiResponse saveSettings(@RequestBody SettingsRequest body) { - if (localSettings.status().configured()) { - throw new IllegalArgumentException("YouTube OAuth 설정이 이미 완료되었습니다."); + if (service.hasConnections()) { + throw new IllegalArgumentException("연결된 채널이 있어 OAuth 설정을 변경할 수 없습니다."); } localSettings.save(body.clientId(), body.clientSecret(), body.redirectUri()); return ApiResponse.ok(localSettings.status()); diff --git a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthLocalSettings.java b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthLocalSettings.java index cf4768e..ea28313 100644 --- a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthLocalSettings.java +++ b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthLocalSettings.java @@ -42,9 +42,6 @@ public class YoutubeOAuthLocalSettings { } public synchronized void save(String clientId, String clientSecret, String redirectUri) { - if (Files.exists(path)) { - throw new IllegalArgumentException("YouTube OAuth 설정이 이미 완료되었습니다."); - } if (clientId == null || clientId.isBlank() || clientSecret == null || clientSecret.isBlank()) { throw new IllegalArgumentException("Client ID와 Client Secret을 모두 입력해 주세요."); } diff --git a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java index 78f1567..f44ef9a 100644 --- a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java +++ b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java @@ -96,6 +96,11 @@ public class YoutubeOAuthService { return repository.findAllByOrderByIdAsc().stream().map(ConnectionDto::from).toList(); } + @Transactional(readOnly = true) + public boolean hasConnections() { + return repository.count() > 0; + } + @Transactional public void disconnect(Long id) { repository.deleteById(id); diff --git a/src/main/resources/templates/upload-studio.html b/src/main/resources/templates/upload-studio.html index 4b3d730..31416b7 100644 --- a/src/main/resources/templates/upload-studio.html +++ b/src/main/resources/templates/upload-studio.html @@ -90,7 +90,7 @@
YouTube operations desk

업로드 스튜디오

로컬 내보내기 영상과 채널 발행 기록을 맞춰 보고, 업로드와 예약을 한 흐름에서 관리합니다.

-
+
@@ -134,7 +134,7 @@
-
키는 브라우저나 Git에 보관하지 않습니다. 최초 설정 후에는 화면/API에서 값을 읽거나 덮어쓸 수 없으며, 저장 직후 Google 로그인으로 이동합니다.
+
키는 브라우저나 Git에 보관하지 않습니다. 채널 연결 전에는 리디렉션 URI 오타를 수정할 수 있으며, 저장 직후 Google 로그인으로 이동합니다.