133 lines
4.5 KiB
JavaScript

const fs = require('fs');
const path = require('path');
console.log('=== Streamingle 플러그인 디버깅 도구 ===');
// 1. 플러그인 파일 확인
console.log('\n1. 플러그인 파일 확인:');
const pluginDir = __dirname;
const requiredFiles = [
'manifest.json',
'plugin.js',
'package.json',
'propertyinspector.html'
];
requiredFiles.forEach(file => {
const filePath = path.join(pluginDir, file);
if (fs.existsSync(filePath)) {
const stats = fs.statSync(filePath);
console.log(`${file} - ${stats.size} bytes`);
} else {
console.log(`${file} - 파일 없음`);
}
});
// 2. manifest.json 내용 확인
console.log('\n2. manifest.json 내용:');
try {
const manifestPath = path.join(pluginDir, 'manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
console.log('✅ manifest.json 파싱 성공');
console.log(` SDK 버전: ${manifest.SDKVersion}`);
console.log(` 코드 경로: ${manifest.CodePath}`);
console.log(` 플러그인 이름: ${manifest.Name}`);
console.log(` 액션 UUID: ${manifest.Actions[0].UUID}`);
} catch (error) {
console.log(`❌ manifest.json 파싱 실패: ${error.message}`);
}
// 3. package.json 내용 확인
console.log('\n3. package.json 내용:');
try {
const packagePath = path.join(pluginDir, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
console.log('✅ package.json 파싱 성공');
console.log(` 이름: ${packageJson.name}`);
console.log(` 버전: ${packageJson.version}`);
console.log(` 메인 파일: ${packageJson.main}`);
console.log(` 의존성: ${Object.keys(packageJson.dependencies || {}).join(', ')}`);
} catch (error) {
console.log(`❌ package.json 파싱 실패: ${error.message}`);
}
// 4. WebSocket 연결 테스트
console.log('\n4. WebSocket 연결 테스트:');
const WebSocket = require('ws');
function testWebSocketConnection() {
return new Promise((resolve) => {
console.log(' 연결 시도 중...');
const ws = new WebSocket('ws://127.0.0.1:10701/');
const timeout = setTimeout(() => {
console.log(' ❌ 연결 타임아웃 (5초)');
ws.close();
resolve(false);
}, 5000);
ws.on('open', () => {
console.log(' ✅ WebSocket 연결 성공!');
clearTimeout(timeout);
ws.close();
resolve(true);
});
ws.on('error', (error) => {
console.log(` ❌ WebSocket 연결 실패: ${error.message}`);
clearTimeout(timeout);
resolve(false);
});
ws.on('close', (code, reason) => {
console.log(` 🔌 연결 종료 - 코드: ${code}, 이유: ${reason || '알 수 없음'}`);
});
});
}
testWebSocketConnection().then((connected) => {
console.log(`\n결과: ${connected ? '✅ 연결 가능' : '❌ 연결 불가'}`);
// 5. 포트 상태 확인
console.log('\n5. 포트 상태 확인:');
const { exec } = require('child_process');
exec('netstat -an | findstr :10701', (error, stdout, stderr) => {
if (error) {
console.log(` ❌ netstat 실행 실패: ${error.message}`);
return;
}
if (stdout.trim()) {
console.log(' ✅ 포트 10701 사용 중:');
stdout.split('\n').forEach(line => {
if (line.trim()) {
console.log(` ${line.trim()}`);
}
});
} else {
console.log(' ❌ 포트 10701에서 서비스 없음');
}
});
});
// 6. StreamDock 플러그인 경로 확인
console.log('\n6. StreamDock 플러그인 경로:');
const streamDockPath = 'C:\\Users\\qscft\\AppData\\Roaming\\HotSpot\\StreamDock\\plugins\\com.mirabox.streamingle.sdPlugin';
if (fs.existsSync(streamDockPath)) {
console.log(` ✅ StreamDock 플러그인 폴더 존재: ${streamDockPath}`);
const files = fs.readdirSync(streamDockPath);
console.log(` 📁 파일 개수: ${files.length}`);
files.forEach(file => {
const filePath = path.join(streamDockPath, file);
const stats = fs.statSync(filePath);
const type = stats.isDirectory() ? '📁' : '📄';
console.log(` ${type} ${file} - ${stats.size} bytes`);
});
} else {
console.log(` ❌ StreamDock 플러그인 폴더 없음: ${streamDockPath}`);
}
console.log('\n=== 디버깅 완료 ===');