-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenhanced-recovery-check.js
More file actions
104 lines (94 loc) · 3.52 KB
/
enhanced-recovery-check.js
File metadata and controls
104 lines (94 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Enhanced localStorage Recovery Check
// Copy and paste this entire script into the browser console
console.log("🔍 TimeTrackerPro Enhanced Data Recovery");
console.log("========================================");
// First, let's see ALL localStorage keys
console.log("\n🗂️ ALL LOCALSTORAGE KEYS:");
console.log("========================");
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
const value = localStorage.getItem(key);
console.log(`${key}: ${value ? value.length + ' chars' : 'null'}`);
}
// Check each possible TimeTracker key
const keysToCheck = [
'archivedDays',
'tasks',
'projects',
'categories',
'timeTrackerData',
'timeTracker_archivedDays',
'timeTracker_tasks',
'user_data',
'archived_tasks'
];
console.log("\n📊 TIMETRACKER-SPECIFIC DATA:");
console.log("=============================");
keysToCheck.forEach(key => {
const data = localStorage.getItem(key);
if (data) {
try {
const parsed = JSON.parse(data);
console.log(`✅ ${key}:`);
if (Array.isArray(parsed)) {
console.log(` 📋 Array with ${parsed.length} items`);
if (key === 'archivedDays' && parsed.length > 0) {
parsed.forEach((day, i) => {
console.log(` Day ${i+1}: ${day.date} - ${day.tasks?.length || 0} tasks`);
if (day.tasks && day.tasks.length > 0) {
day.tasks.forEach((task, j) => {
console.log(` 📌 ${task.title} (${Math.round(task.duration/1000)}s)`);
});
}
});
}
} else if (typeof parsed === 'object') {
console.log(` 📦 Object with keys: ${Object.keys(parsed).join(', ')}`);
} else {
console.log(` 📄 Value: ${parsed}`);
}
} catch (e) {
console.log(`❌ ${key}: Invalid JSON - ${data.substring(0, 100)}...`);
}
} else {
console.log(`❌ ${key}: Not found`);
}
});
// Check if app is using Supabase and what the auth state is
console.log("\n🔐 AUTH & SUPABASE STATUS:");
console.log("=========================");
try {
// Check if supabase client exists
if (window.supabase || window._supabaseClient) {
console.log("✅ Supabase client detected");
} else {
console.log("❌ No Supabase client found");
}
// Check auth state from various possible locations
const authKeys = ['supabase.auth.token', 'sb-auth-token', 'auth', 'user'];
authKeys.forEach(key => {
const authData = localStorage.getItem(key);
if (authData) {
console.log(`✅ Auth data found in ${key}`);
}
});
} catch (e) {
console.log("❌ Error checking auth:", e.message);
}
console.log("\n📈 SUMMARY:");
console.log("===========");
console.log("If you see any archivedDays with tasks above, those might be recoverable!");
console.log("If localStorage is completely empty, the missing data was likely lost during archiving.");
// Save results to window for inspection
window.localStorageData = {};
keysToCheck.forEach(key => {
const data = localStorage.getItem(key);
if (data) {
try {
window.localStorageData[key] = JSON.parse(data);
} catch (e) {
window.localStorageData[key] = data;
}
}
});
console.log("\n💾 Data saved to window.localStorageData for inspection");