Merge branch 'master' of http://gitea.panda/wisecolt/ytp-glm
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="tr">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⛽</text></svg>" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>Yakıt Takip Modülü</title>
|
||||
<!-- Font Awesome CDN -->
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user