feat(rclone): mount başlatma durumu ve log sunumunu geliştir
Mount işlemi için "Başlatılıyor" ara durumu eklenerek kullanıcı geri bildirimi iyileştirildi. Sunucu tarafında log seviyeleri ayrıştırılarak gerçek hatalar bilgi mesajlarından ayırt edildi ve arayüze yansıtıldı.
This commit is contained in:
@@ -198,7 +198,24 @@
|
||||
if (!resp.ok || !data?.ok) {
|
||||
throw new Error(data?.error || `HTTP ${resp.status}`);
|
||||
}
|
||||
success = "Rclone mount başlatıldı.";
|
||||
|
||||
// Mount başlatıldı, birkaç saniye bekleyip tekrar kontrol et
|
||||
success = "Rclone mount başlatılıyor...";
|
||||
|
||||
// 2 saniye sonra status güncelle
|
||||
setTimeout(async () => {
|
||||
await loadRcloneStatus();
|
||||
// Status yüklendikten sonra mesajı güncelle
|
||||
if (rcloneStatus?.mounted) {
|
||||
success = "Rclone mount başarıyla başlatıldı.";
|
||||
} else if (rcloneStatus?.running) {
|
||||
success = "Rclone mount başlatıldı, mount tamamlanıyor...";
|
||||
} else {
|
||||
error = "Rclone mount başlatılamadı.";
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
// İlk status güncellemesi
|
||||
await loadRcloneStatus();
|
||||
} catch (err) {
|
||||
error = err?.message || "Rclone mount başlatılamadı.";
|
||||
@@ -468,7 +485,17 @@
|
||||
<div class="card muted" style="margin-top:10px;">
|
||||
<div><strong>Durum:</strong></div>
|
||||
<div>Enabled: {rcloneStatus.enabled ? "Evet" : "Hayır"}</div>
|
||||
<div>Mounted: {rcloneStatus.mounted ? "Evet" : "Hayır"}</div>
|
||||
<div>
|
||||
Mounted:
|
||||
{#if rcloneStatus.mountStatus === "starting"}
|
||||
<span style="color: #f57c00;">Başlatılıyor...</span>
|
||||
{:else if rcloneStatus.mounted}
|
||||
<span style="color: #388e3c;">Evet</span>
|
||||
{:else}
|
||||
Hayır
|
||||
{/if}
|
||||
</div>
|
||||
<div>Running: {rcloneStatus.running ? "Evet" : "Hayır"}</div>
|
||||
<div>Remote: {rcloneStatus.remoteConfigured ? "Hazır" : "Eksik"}</div>
|
||||
{#if rcloneStatus.vfsCacheMode}
|
||||
<div>VFS Cache Mode: <code>{rcloneStatus.vfsCacheMode}</code></div>
|
||||
@@ -489,7 +516,14 @@
|
||||
</div>
|
||||
{/if}
|
||||
{#if rcloneStatus.lastError}
|
||||
<div style="margin-top: 8px; color: #d32f2f;">Son hata: {rcloneStatus.lastError}</div>
|
||||
<div style="margin-top: 8px; color: #d32f2f;">
|
||||
<i class="fa-solid fa-circle-exclamation"></i> Son hata: {rcloneStatus.lastError}
|
||||
</div>
|
||||
{/if}
|
||||
{#if rcloneStatus.lastLog && !rcloneStatus.lastError}
|
||||
<div style="margin-top: 8px; font-size: 11px; color: #666;">
|
||||
<i class="fa-solid fa-circle-info"></i> Son log: {rcloneStatus.lastLog}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -780,6 +780,7 @@ function resolveRootDir(rootFolder) {
|
||||
|
||||
let rcloneProcess = null;
|
||||
let rcloneLastError = null;
|
||||
let rcloneLastLogMessage = null; // Tüm log mesajları için (NOTICE dahil)
|
||||
const rcloneAuthSessions = new Map();
|
||||
let rcloneCacheCleanTimer = null;
|
||||
// Auto-restart sayaçları
|
||||
@@ -1276,12 +1277,34 @@ function startRcloneMount(settings) {
|
||||
|
||||
rcloneProcess.stdout.on("data", (data) => {
|
||||
const msg = data.toString().trim();
|
||||
if (msg) console.log(`🌀 rclone: ${msg}`);
|
||||
if (msg) {
|
||||
rcloneLastLogMessage = msg;
|
||||
// NOTICE mesajları için farklı ikon, diğerleri için normal
|
||||
if (msg.toUpperCase().includes("NOTICE")) {
|
||||
console.log(`📡 rclone: ${msg}`);
|
||||
} else {
|
||||
console.log(`🌀 rclone: ${msg}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
rcloneProcess.stderr.on("data", (data) => {
|
||||
const msg = data.toString().trim();
|
||||
if (msg) {
|
||||
rcloneLastError = msg;
|
||||
rcloneLastLogMessage = msg;
|
||||
// NOTICE ve INFO seviyesindeki loglar hata değil
|
||||
// Sadece ERROR, FATAL, CRITICAL seviyesindekileri "son hata" olarak işaretle
|
||||
const upperMsg = msg.toUpperCase();
|
||||
if (upperMsg.includes("ERROR") ||
|
||||
upperMsg.includes("FATAL") ||
|
||||
upperMsg.includes("CRITICAL") ||
|
||||
upperMsg.includes("FAILED") ||
|
||||
upperMsg.includes("COULDN'T") ||
|
||||
upperMsg.includes("CANNOT") ||
|
||||
upperMsg.includes("REFUSED") ||
|
||||
upperMsg.includes("TIMEOUT") ||
|
||||
upperMsg.includes("CONNECTION")) {
|
||||
rcloneLastError = msg;
|
||||
}
|
||||
console.warn(`⚠️ rclone: ${msg}`);
|
||||
}
|
||||
});
|
||||
@@ -9210,6 +9233,10 @@ app.get("/api/rclone/status", requireAuth, async (req, res) => {
|
||||
enabled: RCLONE_ENABLED,
|
||||
mounted,
|
||||
running: Boolean(rcloneProcess),
|
||||
// Mount durumu hakkında daha fazla bilgi
|
||||
mountStatus: !rcloneProcess ? "stopped" :
|
||||
mounted ? "mounted" :
|
||||
"starting", // Process çalışıyor ama mount henüz tamamlanmadı
|
||||
mountDir: settings.mountDir,
|
||||
remoteName: settings.remoteName,
|
||||
remotePath: settings.remotePath,
|
||||
@@ -9219,7 +9246,8 @@ app.get("/api/rclone/status", requireAuth, async (req, res) => {
|
||||
cacheCleanMinutes: settings.cacheCleanMinutes || 0,
|
||||
configExists: fs.existsSync(settings.configPath),
|
||||
remoteConfigured: rcloneConfigHasRemote(settings.remoteName),
|
||||
lastError: rcloneLastError || null,
|
||||
lastError: rcloneLastError || null, // Sadece gerçek hatalar
|
||||
lastLog: rcloneLastLogMessage || null, // Son log mesajı (NOTICE dahil)
|
||||
// Performans ayarları
|
||||
vfsCacheMode: RCLONE_VFS_CACHE_MODE,
|
||||
bufferSize: RCLONE_BUFFER_SIZE,
|
||||
|
||||
Reference in New Issue
Block a user