diff --git a/src/lib/sync.js b/src/lib/sync.js index 9785714..c5f8792 100644 --- a/src/lib/sync.js +++ b/src/lib/sync.js @@ -901,7 +901,7 @@ const SilentSendSync = { const result = await api.storage.local.get('ss_lastModified'); return { version: '1', - lastModified: result.ss_lastModified || Date.now(), + lastModified: result.ss_lastModified || 0, identity: identity || {}, mappings: mappings || [], settings: settings || {}, @@ -924,9 +924,12 @@ const SilentSendSync = { } // Metadata stays plaintext + const now = Date.now(); await api.storage.local.set({ ss_lastModified: data.lastModified, - ss_sync_notification: { source, time: Date.now() }, + ss_sync_notification: { source, time: now }, + ss_last_pull_time: now, + ss_last_pull_source: source, }); }, diff --git a/src/options/options.js b/src/options/options.js index 78d0d4d..8d81e9e 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -161,9 +161,13 @@ document.addEventListener('DOMContentLoaded', async () => { // --- GitHub Gist sync --- // Restore saved token (session only — never persisted to storage) { - const stored = await api.storage.local.get('ss_gist_id'); + const stored = await api.storage.local.get(['ss_gist_id', 'ss_last_pull_time', 'ss_last_pull_source']); if (stored.ss_gist_id) { - setGistSyncStatus(`Gist ID: ${stored.ss_gist_id.slice(0, 12)}…`, 'ok'); + let status = `Gist ID: ${stored.ss_gist_id.slice(0, 12)}…`; + if (stored.ss_last_pull_time && stored.ss_last_pull_source === 'gist') { + status += ` · Last pulled: ${new Date(stored.ss_last_pull_time).toLocaleString()}`; + } + setGistSyncStatus(status, 'ok'); } }