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:
@@ -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