Merge branch 'master' of http://gitea.panda/wisecolt/ytp-glm
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<html lang="tr">
|
<html lang="tr">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<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" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>Yakıt Takip Modülü</title>
|
<title>Yakıt Takip Modülü</title>
|
||||||
<!-- Font Awesome CDN -->
|
<!-- Font Awesome CDN -->
|
||||||
|
|||||||
@@ -54,8 +54,23 @@ async function ensureDbDirectory() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Veritabanı bağlantısı
|
// Veritabanı değişkeni (başlangıçta null)
|
||||||
const db = new sqlite3.Database(dbPath);
|
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
|
// Veritabanı tablolarını oluştur
|
||||||
async function initializeDatabase() {
|
async function initializeDatabase() {
|
||||||
@@ -214,6 +229,9 @@ async function startServer() {
|
|||||||
await ensureDbDirectory();
|
await ensureDbDirectory();
|
||||||
console.log(`📄 Database file path: ${dbPath}`);
|
console.log(`📄 Database file path: ${dbPath}`);
|
||||||
|
|
||||||
|
// Create database connection
|
||||||
|
await createDatabaseConnection();
|
||||||
|
|
||||||
// Initialize database and tables
|
// Initialize database and tables
|
||||||
await initializeDatabase();
|
await initializeDatabase();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user