diff --git a/chatgpt-suno-tampermonkey.user.js b/chatgpt-suno-tampermonkey.user.js index 00eebc6..ddcf3dd 100644 --- a/chatgpt-suno-tampermonkey.user.js +++ b/chatgpt-suno-tampermonkey.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name ChatGPT to Suno Prompt Copier // @namespace local.suno-helper -// @version 0.7.3 +// @version 0.7.4 // @description Copy structured ChatGPT song prompt versions into Suno fields. // @author local // @match https://chatgpt.com/* @@ -27,6 +27,7 @@ (function () { "use strict"; + const SCRIPT_VERSION = "0.7.4"; const STORAGE_KEY = "chatgptSunoPromptSlots"; const SLOT_COUNT = 2; const isChatGPT = location.hostname.includes("chatgpt.com") || location.hostname.includes("chat.openai.com"); @@ -205,7 +206,7 @@ if (mode) panel.classList.add(mode); panel.innerHTML = `
- ${escapeHtml(title)} + ${escapeHtml(title)} v${SCRIPT_VERSION}
@@ -1077,6 +1078,18 @@ } } + async function readCompanionHealth() { + const response = await fetch("http://127.0.0.1:17873/health", { + method: "GET", + cache: "no-store", + }); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${response.status} ${response.statusText}: ${text.slice(0, 160)}`); + } + return tryParseJson(text) || {}; + } + async function bootSuno() { const body = createPanel("Suno Prompt Paste"); const slots = await readSlots(); @@ -1103,6 +1116,9 @@
+
+ +
@@ -1211,6 +1227,40 @@ body.querySelector("[data-cgs-test-companion]").addEventListener("click", async () => { await testCompanion(body); }); + + body.querySelector("[data-cgs-copy-diagnostics]").addEventListener("click", async () => { + if (!libraryTracks.length) { + libraryTracks = scanSunoLibraryTracks(); + renderLibraryTrackSelect(); + } + const selectedIndex = Number(libraryTrackSelect.value || 0); + const selectedTrack = libraryTracks[selectedIndex]; + let health = {}; + let healthError = ""; + try { + health = await readCompanionHealth(); + } catch (error) { + healthError = error.message || String(error); + } + const payload = { + scriptVersion: SCRIPT_VERSION, + location: location.href, + detectedTracks: libraryTracks.length, + visibleRows: getVisibleLibraryRows().length, + selectedIndex, + selectedTrack: selectedTrack ? { + id: selectedTrack.id || "", + title: selectedTrack.title || "", + hasWavUrl: Boolean(selectedTrack.wavUrl), + hasImageUrl: Boolean(selectedTrack.imageUrl), + hasLyrics: Boolean(selectedTrack.lyrics), + } : null, + capturedSunoResponses: capturedSunoResponses.length, + companion: healthError ? { ok: false, error: healthError } : health, + }; + GM_setClipboard(JSON.stringify(payload, null, 2), "text"); + setStatus(body, `진단 복사 완료: v${SCRIPT_VERSION}, 감지 ${libraryTracks.length}곡, 로컬 ${healthError ? "실패" : "OK"}`); + }); } function safeBootSuno() {