fix
This commit is contained in:
96
README.md
96
README.md
@@ -1,15 +1,36 @@
|
|||||||
# 🎵 Quixotic - YouTube to MP3 Telegram MiniApp
|
# 🎵 Quixotic - Music Search Telegram MiniApp
|
||||||
|
|
||||||
Telegram miniapp для поиска музыки на YouTube и конвертации в MP3.
|
Telegram miniapp для поиска и скачивания музыки (в разработке).
|
||||||
|
|
||||||
## Возможности
|
## ⚠️ Current Status: UNDER DEVELOPMENT
|
||||||
|
|
||||||
- 🔍 Поиск видео на YouTube
|
**The app is currently non-functional** due to the following issues:
|
||||||
|
|
||||||
|
- ❌ **YouTube integration abandoned** - Bot detection blocks all anonymous access
|
||||||
|
- ❌ **SoundCloud integration failed** - API restrictions and ID mismatch between frontend/backend
|
||||||
|
- 🔄 **TypeScript migration completed** - All code converted from JavaScript to TypeScript
|
||||||
|
- 🔄 **Alternative sources being evaluated** - Archive.org, Jamendo, Bandcamp under consideration
|
||||||
|
|
||||||
|
### What Works:
|
||||||
|
- ✅ Telegram Bot setup and Web App integration
|
||||||
|
- ✅ Frontend interface (search/UI)
|
||||||
|
- ✅ SQLite database functionality
|
||||||
|
- ✅ Docker deployment setup with Traefik SSL
|
||||||
|
- ✅ Full TypeScript support with proper typing
|
||||||
|
|
||||||
|
### What's Broken:
|
||||||
|
- ❌ Music search (no working backend service)
|
||||||
|
- ❌ MP3 conversion (depends on working search)
|
||||||
|
- ❌ Download functionality
|
||||||
|
|
||||||
|
## Планируемые возможности
|
||||||
|
|
||||||
|
- 🔍 Поиск музыки (источник определяется)
|
||||||
- 🎵 Конвертация в MP3 с помощью FFmpeg
|
- 🎵 Конвертация в MP3 с помощью FFmpeg
|
||||||
- 📱 Telegram Web App интерфейс
|
- 📱 Telegram Web App интерфейс (✅ готов)
|
||||||
- 💾 SQLite база данных
|
- 💾 SQLite база данных (✅ готова)
|
||||||
- 📊 История поиска
|
- 📊 История поиска (✅ готова)
|
||||||
- 🤖 Telegram Bot интеграция
|
- 🤖 Telegram Bot интеграция (✅ готова)
|
||||||
|
|
||||||
## Установка
|
## Установка
|
||||||
|
|
||||||
@@ -21,7 +42,18 @@ cd quixotic
|
|||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Установка FFmpeg
|
### 2. Сборка TypeScript проекта
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Сборка всего проекта (backend + frontend)
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
# Или раздельно:
|
||||||
|
yarn build:backend # компилирует src/*.ts в dist/
|
||||||
|
yarn build:frontend # компилирует public/script.ts в public/dist/
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Установка FFmpeg
|
||||||
|
|
||||||
**macOS:**
|
**macOS:**
|
||||||
|
|
||||||
@@ -39,14 +71,14 @@ sudo apt install ffmpeg
|
|||||||
**Windows:**
|
**Windows:**
|
||||||
Скачайте с [ffmpeg.org](https://ffmpeg.org/download.html)
|
Скачайте с [ffmpeg.org](https://ffmpeg.org/download.html)
|
||||||
|
|
||||||
### 3. Создание Telegram бота
|
### 4. Создание Telegram бота
|
||||||
|
|
||||||
1. Напишите [@BotFather](https://t.me/BotFather) в Telegram
|
1. Напишите [@BotFather](https://t.me/BotFather) в Telegram
|
||||||
2. Создайте нового бота: `/newbot`
|
2. Создайте нового бота: `/newbot`
|
||||||
3. Получите токен бота
|
3. Получите токен бота
|
||||||
4. Настройте Web App: `/newapp`
|
4. Настройте Web App: `/newapp`
|
||||||
|
|
||||||
### 4. Настройка окружения
|
### 5. Настройка окружения
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
@@ -62,33 +94,61 @@ PORT=3000
|
|||||||
|
|
||||||
## Запуск
|
## Запуск
|
||||||
|
|
||||||
|
⚠️ **Внимание**: Приложение сейчас не работает из-за проблем с интеграцией музыкальных сервисов
|
||||||
|
|
||||||
### Разработка
|
### Разработка
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# TypeScript разработка с hot reload
|
||||||
yarn dev
|
yarn dev
|
||||||
|
|
||||||
|
# Ручная сборка при необходимости
|
||||||
|
yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
### Продакшн
|
### Продакшн
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Сборка проекта
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
# Запуск скомпилированного кода
|
||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker (рекомендуется)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# С Traefik и SSL
|
||||||
|
docker-compose --env-file .env.docker up -d
|
||||||
|
|
||||||
|
# Простой запуск
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
## Структура проекта
|
## Структура проекта
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
quixotic/
|
quixotic/
|
||||||
├── src/
|
├── src/ # TypeScript исходники
|
||||||
│ ├── server.js # Express сервер
|
│ ├── server.ts # Express сервер (главный)
|
||||||
│ ├── bot.js # Telegram бот
|
│ ├── bot.ts # Telegram бот
|
||||||
│ ├── youtube.js # YouTube API
|
│ ├── soundcloud.ts # SoundCloud API (не работает)
|
||||||
│ └── database.js # SQLite база данных
|
│ └── database.ts # SQLite база данных
|
||||||
|
├── dist/ # Скомпилированный JavaScript
|
||||||
|
│ ├── server.js # Готовый к запуску сервер
|
||||||
|
│ └── ...
|
||||||
├── public/
|
├── public/
|
||||||
│ ├── index.html # Web App интерфейс
|
│ ├── index.html # Web App интерфейс
|
||||||
│ ├── style.css # Стили
|
│ ├── style.css # Стили
|
||||||
│ └── script.js # JavaScript
|
│ ├── script.ts # TypeScript исходник
|
||||||
|
│ └── dist/
|
||||||
|
│ ├── script.js # Скомпилированный frontend
|
||||||
|
│ └── script.js.map
|
||||||
├── database/ # SQLite файлы
|
├── database/ # SQLite файлы
|
||||||
├── downloads/ # MP3 файлы
|
├── .serena/memories/ # AI память проекта
|
||||||
|
├── tsconfig.json # TypeScript конфиг (backend)
|
||||||
|
├── tsconfig.frontend.json # TypeScript конфиг (frontend)
|
||||||
└── package.json
|
└── package.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
51
WORKLOG.md
51
WORKLOG.md
@@ -45,7 +45,50 @@
|
|||||||
- Configuration and documentation files
|
- Configuration and documentation files
|
||||||
|
|
||||||
### Next Steps for Deployment
|
### Next Steps for Deployment
|
||||||
- [ ] Install FFmpeg on target server
|
- [x] Install FFmpeg on target server
|
||||||
- [ ] Set up environment variables
|
- [x] Set up environment variables
|
||||||
- [ ] Configure Telegram bot with BotFather
|
- [x] Configure Telegram bot with BotFather
|
||||||
- [ ] Deploy to hosting platform (Heroku/VPS)
|
- [x] Deploy to hosting platform (Docker with Traefik SSL)
|
||||||
|
|
||||||
|
## 2025-08-26
|
||||||
|
|
||||||
|
### TypeScript Migration
|
||||||
|
- [x] Migrated entire project from JavaScript to TypeScript
|
||||||
|
- [x] Added type definitions for all dependencies
|
||||||
|
- [x] Created separate TypeScript configs for backend/frontend
|
||||||
|
- [x] Updated build process and package.json scripts
|
||||||
|
- [x] All files converted: server.ts, bot.ts, database.ts, soundcloud.ts, script.ts
|
||||||
|
|
||||||
|
### Docker & Production Setup
|
||||||
|
- [x] Complete Docker setup with multi-stage builds
|
||||||
|
- [x] Traefik reverse proxy with automatic SSL (Let's Encrypt)
|
||||||
|
- [x] GitHub Actions CI/CD with security scanning
|
||||||
|
- [x] Production deployment configuration
|
||||||
|
|
||||||
|
## 2025-08-27
|
||||||
|
|
||||||
|
### Critical Issues Discovered
|
||||||
|
- [x] YouTube integration completely blocked by bot detection
|
||||||
|
- [x] Attempted multiple YouTube packages (play-dl, ytdl-core, youtube-dl-exec)
|
||||||
|
- [x] All anonymous methods return 403 errors from YouTube
|
||||||
|
- [x] SoundCloud integration attempted as replacement
|
||||||
|
|
||||||
|
### SoundCloud Integration Failure
|
||||||
|
- [x] Installed soundcloud-downloader package
|
||||||
|
- [x] Created SoundCloudService class with proper error handling
|
||||||
|
- [x] **CRITICAL BUG FOUND**: Frontend sends YouTube video IDs, backend expects SoundCloud IDs
|
||||||
|
- [x] This architectural mismatch breaks the entire conversion flow
|
||||||
|
|
||||||
|
### Current Status: BROKEN
|
||||||
|
- ❌ **Music search**: No working backend service
|
||||||
|
- ❌ **MP3 conversion**: Depends on working search
|
||||||
|
- ❌ **Download functionality**: Cannot find tracks
|
||||||
|
- ✅ **Infrastructure**: Telegram bot, database, Docker all working
|
||||||
|
- ✅ **Frontend UI**: Search interface functional
|
||||||
|
- ✅ **TypeScript**: Full type safety implemented
|
||||||
|
|
||||||
|
### Alternative Sources Analysis
|
||||||
|
- [x] Evaluated Archive.org, Jamendo, Bandcamp, Spotify
|
||||||
|
- [x] Archive.org identified as most promising (largest free collection)
|
||||||
|
- [ ] **NEXT**: Implement Archive.org integration
|
||||||
|
- [ ] **NEXT**: Fix frontend-backend service mismatch
|
||||||
@@ -13,11 +13,13 @@ interface TelegramWebApp {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
Telegram?: {
|
Telegram?: {
|
||||||
WebApp: TelegramWebApp;
|
WebApp: TelegramWebApp;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface VideoResult {
|
interface VideoResult {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ app.post('/api/convert', async (req: Request, res: Response) => {
|
|||||||
// Test ffmpeg with simple command first
|
// Test ffmpeg with simple command first
|
||||||
try {
|
try {
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
const result = execSync(`ffmpeg -i "${tempInputPath}" -t 1 -f null -`, { encoding: 'utf8', stdio: 'pipe' });
|
execSync(`ffmpeg -i "${tempInputPath}" -t 1 -f null -`, { encoding: 'utf8', stdio: 'pipe' });
|
||||||
console.log('FFmpeg file test passed');
|
console.log('FFmpeg file test passed');
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error('FFmpeg file test failed:', e.stderr || e.message);
|
console.error('FFmpeg file test failed:', e.stderr || e.message);
|
||||||
@@ -197,7 +197,7 @@ app.get('/health', (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Error handler
|
// Error handler
|
||||||
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
app.use((err: Error, req: Request, res: Response, _next: NextFunction) => {
|
||||||
console.error(err.stack);
|
console.error(err.stack);
|
||||||
res.status(500).json({ error: 'Something went wrong!' });
|
res.status(500).json({ error: 'Something went wrong!' });
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export class SoundCloudService {
|
|||||||
console.log('Audio stream obtained with track ID method');
|
console.log('Audio stream obtained with track ID method');
|
||||||
return stream;
|
return stream;
|
||||||
|
|
||||||
} catch (fallbackError: any) {
|
} catch (_fallbackError: any) {
|
||||||
console.error('Track ID method failed, trying URL construction...');
|
console.error('Track ID method failed, trying URL construction...');
|
||||||
|
|
||||||
// Final fallback - try constructing different URL formats
|
// Final fallback - try constructing different URL formats
|
||||||
|
|||||||
Reference in New Issue
Block a user