fix
This commit is contained in:
104
README.md
104
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
|
||||
- 🎵 Конвертация в MP3 с помощью FFmpeg
|
||||
- 📱 Telegram Web App интерфейс
|
||||
- 💾 SQLite база данных
|
||||
- 📊 История поиска
|
||||
- 🤖 Telegram Bot интеграция
|
||||
**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
|
||||
- 📱 Telegram Web App интерфейс (✅ готов)
|
||||
- 💾 SQLite база данных (✅ готова)
|
||||
- 📊 История поиска (✅ готова)
|
||||
- 🤖 Telegram Bot интеграция (✅ готова)
|
||||
|
||||
## Установка
|
||||
|
||||
@@ -21,7 +42,18 @@ cd quixotic
|
||||
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:**
|
||||
|
||||
@@ -39,14 +71,14 @@ sudo apt install ffmpeg
|
||||
**Windows:**
|
||||
Скачайте с [ffmpeg.org](https://ffmpeg.org/download.html)
|
||||
|
||||
### 3. Создание Telegram бота
|
||||
### 4. Создание Telegram бота
|
||||
|
||||
1. Напишите [@BotFather](https://t.me/BotFather) в Telegram
|
||||
2. Создайте нового бота: `/newbot`
|
||||
3. Получите токен бота
|
||||
4. Настройте Web App: `/newapp`
|
||||
|
||||
### 4. Настройка окружения
|
||||
### 5. Настройка окружения
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
@@ -62,33 +94,61 @@ PORT=3000
|
||||
|
||||
## Запуск
|
||||
|
||||
⚠️ **Внимание**: Приложение сейчас не работает из-за проблем с интеграцией музыкальных сервисов
|
||||
|
||||
### Разработка
|
||||
|
||||
```bash
|
||||
# TypeScript разработка с hot reload
|
||||
yarn dev
|
||||
|
||||
# Ручная сборка при необходимости
|
||||
yarn build
|
||||
```
|
||||
|
||||
### Продакшн
|
||||
|
||||
```bash
|
||||
# Сборка проекта
|
||||
yarn build
|
||||
|
||||
# Запуск скомпилированного кода
|
||||
yarn start
|
||||
```
|
||||
|
||||
### Docker (рекомендуется)
|
||||
|
||||
```bash
|
||||
# С Traefik и SSL
|
||||
docker-compose --env-file .env.docker up -d
|
||||
|
||||
# Простой запуск
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Структура проекта
|
||||
|
||||
```bash
|
||||
quixotic/
|
||||
├── src/
|
||||
│ ├── server.js # Express сервер
|
||||
│ ├── bot.js # Telegram бот
|
||||
│ ├── youtube.js # YouTube API
|
||||
│ └── database.js # SQLite база данных
|
||||
├── src/ # TypeScript исходники
|
||||
│ ├── server.ts # Express сервер (главный)
|
||||
│ ├── bot.ts # Telegram бот
|
||||
│ ├── soundcloud.ts # SoundCloud API (не работает)
|
||||
│ └── database.ts # SQLite база данных
|
||||
├── dist/ # Скомпилированный JavaScript
|
||||
│ ├── server.js # Готовый к запуску сервер
|
||||
│ └── ...
|
||||
├── public/
|
||||
│ ├── index.html # Web App интерфейс
|
||||
│ ├── style.css # Стили
|
||||
│ └── script.js # JavaScript
|
||||
├── database/ # SQLite файлы
|
||||
├── downloads/ # MP3 файлы
|
||||
│ ├── index.html # Web App интерфейс
|
||||
│ ├── style.css # Стили
|
||||
│ ├── script.ts # TypeScript исходник
|
||||
│ └── dist/
|
||||
│ ├── script.js # Скомпилированный frontend
|
||||
│ └── script.js.map
|
||||
├── database/ # SQLite файлы
|
||||
├── .serena/memories/ # AI память проекта
|
||||
├── tsconfig.json # TypeScript конфиг (backend)
|
||||
├── tsconfig.frontend.json # TypeScript конфиг (frontend)
|
||||
└── package.json
|
||||
```
|
||||
|
||||
|
||||
51
WORKLOG.md
51
WORKLOG.md
@@ -45,7 +45,50 @@
|
||||
- Configuration and documentation files
|
||||
|
||||
### Next Steps for Deployment
|
||||
- [ ] Install FFmpeg on target server
|
||||
- [ ] Set up environment variables
|
||||
- [ ] Configure Telegram bot with BotFather
|
||||
- [ ] Deploy to hosting platform (Heroku/VPS)
|
||||
- [x] Install FFmpeg on target server
|
||||
- [x] Set up environment variables
|
||||
- [x] Configure Telegram bot with BotFather
|
||||
- [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,10 +13,12 @@ interface TelegramWebApp {
|
||||
};
|
||||
}
|
||||
|
||||
interface Window {
|
||||
Telegram?: {
|
||||
WebApp: TelegramWebApp;
|
||||
};
|
||||
declare global {
|
||||
interface Window {
|
||||
Telegram?: {
|
||||
WebApp: TelegramWebApp;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
interface VideoResult {
|
||||
|
||||
@@ -112,7 +112,7 @@ app.post('/api/convert', async (req: Request, res: Response) => {
|
||||
// Test ffmpeg with simple command first
|
||||
try {
|
||||
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');
|
||||
} catch (e: any) {
|
||||
console.error('FFmpeg file test failed:', e.stderr || e.message);
|
||||
@@ -197,7 +197,7 @@ app.get('/health', (req: Request, res: Response) => {
|
||||
});
|
||||
|
||||
// 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);
|
||||
res.status(500).json({ error: 'Something went wrong!' });
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ export class SoundCloudService {
|
||||
console.log('Audio stream obtained with track ID method');
|
||||
return stream;
|
||||
|
||||
} catch (fallbackError: any) {
|
||||
} catch (_fallbackError: any) {
|
||||
console.error('Track ID method failed, trying URL construction...');
|
||||
|
||||
// Final fallback - try constructing different URL formats
|
||||
|
||||
Reference in New Issue
Block a user