Veritabanı bağlantı ve favicon hataları düzeltildi

- init-db script'indeki veritabanı bağlantı sıralaması düzeltildi
- SQLite veritabanı dizin oluşturulmadan bağlantı deneniyor hatası giderildi
- Favicon 404 hatası için akaryakıt temasına uygun SVG favicon eklendi
- Database bağlantı başarısız olduğunda daha açıklayıcı hata mesajları

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-05 17:53:39 +03:00
parent 4205a8d387
commit 54779eec79
2 changed files with 21 additions and 3 deletions

View File

@@ -54,8 +54,23 @@ async function ensureDbDirectory() {
}
}
// Veritabanı bağlantısı
const db = new sqlite3.Database(dbPath);
// Veritabanı değişkeni (başlangıçta null)
let db;
// Veritabanı bağlantısını oluştur
async function createDatabaseConnection() {
return new Promise((resolve, reject) => {
db = new sqlite3.Database(dbPath, (err) => {
if (err) {
console.error('❌ Database connection error:', err);
reject(err);
} else {
console.log('✅ Database connection established');
resolve();
}
});
});
}
// Veritabanı tablolarını oluştur
async function initializeDatabase() {
@@ -214,6 +229,9 @@ async function startServer() {
await ensureDbDirectory();
console.log(`📄 Database file path: ${dbPath}`);
// Create database connection
await createDatabaseConnection();
// Initialize database and tables
await initializeDatabase();