diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c67b51..378b5dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
本项目按 `v主版本.次版本.修订版本` 标记应用版本;按需创建 Git tag。下列内容以对应提交和已发布功能为准。
+## v1.23.0 — 2026-10-13
+
+- 新增桌面快速记录入口和今日瞬间列表;同一天可保存多条文字瞬间,支持标题、日期、标签、草稿恢复和后续编辑。
+- 每日总结与瞬间独立保存,旧记忆按每日总结兼容,更新每日总结不会覆盖当天瞬间。
+- 瞬间沿用记忆的时间线、日历、搜索、收藏、SQLite 持久化、记录级云同步和 JSON 备份;合并导入保留同日多条瞬间。
+- 连续记录天数按日期去重;快速记录未填写天气或能量时不纳入相应统计。
+- 增加同日记录共存、旧日记更新、删除隔离、合并幂等性和云端同日记录测试。
+
## v1.22.1 — 2026-10-13
- 修复同步状态观察器重复改写自身 DOM 的刷新循环;同步中心状态变化时实时更新,支持 Esc 关闭。
diff --git a/README.md b/README.md
index e9acb5d..e89be54 100644
--- a/README.md
+++ b/README.md
@@ -2,13 +2,13 @@
以桌面操作系统为交互方式的个人记录网站。用 App 记录日常、管理目标与待办,并沿时间线回看已经留下的内容。
-在线站点:[Life OS](https://life-os-personal-desktop.biss0.chatgpt.site) · 当前应用版本:**v1.22.1** · [更新日志](CHANGELOG.md)
+在线站点:[Life OS](https://life-os-personal-desktop.biss0.chatgpt.site) · 当前应用版本:**v1.23.0** · [更新日志](CHANGELOG.md)
## 功能
| App | 用途 |
| --- | --- |
-| 今日 | 为选定日期写记忆,记录天气、1–5 能量、标题、标签、地点和关联任务;每日电影是写作提示,不会替代记忆标题。 |
+| 今日 | 为选定日期写每日总结,并查看当日瞬间;快速记录支持一天多条文字、标题和标签,独立于每日总结。总结可记录天气、1–5 能量、地点和关联任务;每日电影是写作提示。 |
| 时间线 | 按日期浏览记忆,使用关键词或标签筛选,编辑、删除和收藏。 |
| 博物馆 | 回看收藏的记忆。 |
| 目标与待办 | 创建和编辑目标、待办,调整日期、优先级、关联目标与完成状态;目标倒计时可选择显示在桌面。 |
diff --git a/package.json b/package.json
index 24d2361..4f0bf90 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,14 @@
{
"name": "life-os",
- "version": "1.22.1",
+ "version": "1.23.0",
"private": true,
"type": "module",
"scripts": {
"build": "node scripts/build.mjs",
"validate": "node scripts/validate.mjs",
"test:cloud": "node scripts/test-cloud.mjs",
- "test:reliability": "node scripts/test-reliability.mjs"
+ "test:reliability": "node scripts/test-reliability.mjs",
+ "test:moments": "node scripts/test-moments.mjs"
},
"dependencies": {
"@sqlite.org/sqlite-wasm": "3.53.4-build1"
diff --git a/public/addons.js b/public/addons.js
index bab13c1..5dd7837 100644
--- a/public/addons.js
+++ b/public/addons.js
@@ -3,7 +3,7 @@
const DRAFT_KEY = 'lifeos_today_draft_v1';
const localDay = () => { const d = new Date(); return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`; };
const escapeHtml = value => String(value || '').replace(/[&<>"']/g, char => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[char]));
- const APP_VERSION = '1.22.1';
+ const APP_VERSION = '1.23.0';
window.LifeOSVersion = APP_VERSION;
const appIds = ['today', 'timeline', 'museum', 'insights', 'profile', 'tasks', 'calendar', 'system', 'browser', 'terminal', 'database'];
const t = (key, values) => LifeI18n.t(key, values);
@@ -34,7 +34,7 @@
setTimeout(() => {
const today = (typeof todayTargetDate !== 'undefined' && todayTargetDate) || localDay();
try {
- const saved = JSON.parse(localStorage.getItem('lifeos_memories') || '[]').some(m => m.date === today);
+ const saved = JSON.parse(localStorage.getItem('lifeos_memories') || '[]').some(m => m.date === today && m.kind !== 'moment');
if (saved) localStorage.removeItem(DRAFT_KEY);
} catch {}
}, 700);
diff --git a/public/backup.js b/public/backup.js
index 706b8a8..3a8b589 100644
--- a/public/backup.js
+++ b/public/backup.js
@@ -22,7 +22,7 @@
const stored = records();
return {
app: 'Life OS',
- version: window.LifeOSVersion || '1.22.1',
+ version: window.LifeOSVersion || '1.23.0',
schemaVersion: BACKUP_SCHEMA,
exportedAt: new Date().toISOString(),
profile: json('lifeos_profile', {}),
diff --git a/public/calendar.js b/public/calendar.js
index 2f64b68..85bd39c 100644
--- a/public/calendar.js
+++ b/public/calendar.js
@@ -65,7 +65,7 @@
function eventsFor(key) {
const events = [];
- for (const memory of mems()) if (memory.date === key) events.push({ kind: 'memory', rank: 0, title: memory.title || memory.text?.trim().split('\n')[0].slice(0, 64) || t('timeline.untitled'), detail: memory.text || LifeI18n.t('timeline.noNote'), time: '', id: memory.id, mood: memory.mood, energy: memory.energy });
+ for (const memory of mems()) if (memory.date === key) events.push({ kind: 'memory', rank: 0, title: memory.title || memory.text?.trim().split('\n')[0].slice(0, 64) || t('timeline.untitled'), detail: memory.text || LifeI18n.t('timeline.noNote'), time: '', id: memory.id, mood: memory.contextRecorded === false ? '' : memory.mood, energy: memory.contextRecorded === false ? null : memory.energy });
const board = system().tasksBoard || { goals: [], tasks: [] };
for (const task of board.tasks || []) {
const due = task.dueDate === key, completed = localDatePart(task.completedAt) === key;
diff --git a/public/data-actions.js b/public/data-actions.js
index c36e6bd..46b4166 100644
--- a/public/data-actions.js
+++ b/public/data-actions.js
@@ -72,17 +72,20 @@
data.tasks.forEach(task => { if (task.goalId === id) task.goalId = ''; });
persistBoard(data); return goal;
},
- createMemory({ date = day(), title, text = '', mood = 'cloudy', energy = 3, tags = [], location = '', taskId = '', replace = false }) {
+ createMemory({ date = day(), title, text = '', mood = 'cloudy', energy = 3, tags = [], location = '', taskId = '', replace = false, kind = 'daily' }) {
title = String(title || '').trim();
if (title.length > 120) throw new Error('invalidTitle');
if (!validDate(date) || !date) throw new Error('invalidDate');
if (!['clear', 'light', 'cloudy', 'rain', 'storm'].includes(mood) || !Number.isInteger(Number(energy)) || Number(energy) < 1 || Number(energy) > 5) throw new Error('invalidValue');
if (taskId && !board().tasks.some(task => task.id === taskId)) throw new Error('notFound');
- const all = mems(), old = all.find(item => item.date === date);
+ if (!['daily', 'moment'].includes(kind)) throw new Error('invalidValue');
+ if (kind === 'moment' && !String(text).trim() && !title) throw new Error('invalidTitle');
+ const all = mems(), old = kind === 'daily' ? all.find(item => item.date === date && item.kind !== 'moment') : null;
if (old && !replace) throw new Error('memoryExists');
const film = filmFor(mood, Number(energy)), now = new Date().toISOString();
- const memory = { ...old, id: old?.id || `memory_${crypto.randomUUID()}`, date, title, text: String(text).trim(), mood, energy: Number(energy), tags: [...new Set(tags.map(tag => String(tag).trim()).filter(Boolean))].slice(0, 12), location: String(location).trim().slice(0, 100), taskId, filmTitle: film.filmTitle, filmSubtitle: film.filmSubtitle, filmLine: film.filmLine, createdAt: old?.createdAt || now, updatedAt: now };
- save('lifeos_memories', [...all.filter(item => item.date !== date), memory].sort((a, b) => b.date.localeCompare(a.date))); renderAll(); return memory;
+ const memory = { ...old, id: old?.id || `memory_${crypto.randomUUID()}`, kind, date, title, text: String(text).trim(), mood, energy: Number(energy), tags: [...new Set(tags.map(tag => String(tag).trim()).filter(Boolean))].slice(0, 12), location: String(location).trim().slice(0, 100), taskId, filmTitle: film.filmTitle, filmSubtitle: film.filmSubtitle, filmLine: film.filmLine, createdAt: old?.createdAt || now, updatedAt: now };
+ if (kind === 'moment') memory.contextRecorded = false;
+ save('lifeos_memories', [...all.filter(item => item.id !== memory.id), memory].sort((a, b) => b.date.localeCompare(a.date) || String(b.createdAt || '').localeCompare(String(a.createdAt || '')))); renderAll(); return memory;
},
deleteMemory(id) {
const all = mems(), memory = all.find(item => item.id === id);
diff --git a/public/i18n-renderers.js b/public/i18n-renderers.js
index 1db99c7..76c5cd3 100644
--- a/public/i18n-renderers.js
+++ b/public/i18n-renderers.js
@@ -18,12 +18,22 @@
window.moodName = weather;
window.fmtDate = uiDate;
window.shortDate = short;
- window.addMemoryForDate = date => { todayTargetDate = date; todayDraft = null; todayTitleDraft = null; openApp('today'); };
+ window.longest = records => {
+ const dates = [...new Set(records.map(item => item.date))].sort(); let best = 0, run = 0, previous = '';
+ for (const date of dates) { run = previous && (new Date(date) - new Date(previous)) / 864e5 === 1 ? run + 1 : 1; best = Math.max(best, run); previous = date; }
+ return best;
+ };
+ window.streak = records => {
+ const dates = new Set(records.map(item => item.date)); let count = 0, date = new Date();
+ while (dates.has(`${date.getFullYear()}-${String(date.getMonth()+1).padStart(2,'0')}-${String(date.getDate()).padStart(2,'0')}`)) { count++; date.setDate(date.getDate()-1); }
+ return count;
+ };
+ window.addMemoryForDate = date => { todayTargetDate = date; todayDraft = null; todayTitleDraft = null; openApp('today'); const container = document.querySelector('#content-today'); if (container) window.today(container); };
window.closeModal = () => { rootModal().innerHTML = ''; };
window.applyLanguage = () => { document.documentElement.lang = LifeI18n.locale(); document.documentElement.dir = lang() === 'ar' ? 'rtl' : 'ltr'; document.title = t('shell.pageTitle'); const brand = document.querySelector('#desktop-brand'), launcher = document.querySelector('#life-launcher'), boot = document.querySelector('#boot span'); if (brand) brand.textContent = t('shell.brand'); if (launcher) launcher.textContent = t('shell.life'); if (boot) boot.textContent = t('shell.initializing'); if (settings().wallpaper) applyWallpaper(settings().wallpaper); };
window.applyWallpaper = wallpaper => { if (!wallpaper?.url) return; const desktop = document.querySelector('#desktop'); desktop.style.backgroundImage = `linear-gradient(120deg,color-mix(in srgb,var(--bg) 68%,transparent),color-mix(in srgb,var(--bg) 36%,transparent)),url('${wallpaper.url}')`; desktop.style.backgroundSize = 'cover'; desktop.style.backgroundPosition = 'center'; desktop.title = t('shell.wallpaperTitle', { title: wallpaper.title || t('wallpaper.dailyImage') }); };
window.today = container => {
- const entryDate = todayTargetDate || day(), memory = mems().find(item => item.date === entryDate);
+ const entryDate = todayTargetDate || day(), memory = mems().find(item => item.date === entryDate && item.kind !== 'moment');
if (todayDraft === null) { selectedMood = memory?.mood || 'cloudy'; selectedEnergy = memory?.energy || 3; }
const film = filmFor(selectedMood, selectedEnergy), text = todayDraft === null ? (memory?.text || '') : todayDraft;
container.innerHTML = `
${weekday(entryDate).toUpperCase()}
${uiDate(entryDate)}
${t('today.prompt')} ${entryDate !== day() ? `` : ''}
`;
@@ -34,6 +44,39 @@
status.textContent = t('today.archiving');
setTimeout(() => { todayDraft = null; todayTitleDraft = null; window.LifeOSActions.createMemory(draft); }, 360);
};
+ // Moments share record-level sync, search, favorites and backup with daily summaries.
+ const MOMENT_DRAFT = 'lifeos_moment_draft_v1';
+ const readMomentDraft = () => { try { return JSON.parse(localStorage.getItem(MOMENT_DRAFT) || '{}'); } catch { return {}; } };
+ window.openQuickMemory = (date = day()) => {
+ const draft = readMomentDraft();
+ rootModal().innerHTML = ``;
+ rootModal().querySelector('textarea')?.focus();
+ };
+ window.saveQuickDraft = form => {
+ const field = name => form.elements.namedItem(name).value;
+ localStorage.setItem(MOMENT_DRAFT, JSON.stringify({ text:field('text'), title:field('title'), date:field('date'), tags:field('tags') }));
+ };
+ window.saveQuickMemory = event => {
+ event.preventDefault(); const form = event.currentTarget, field = name => form.elements.namedItem(name).value;
+ try {
+ window.LifeOSActions.createMemory({ kind:'moment', date:field('date'), title:field('title'), text:field('text'), tags:tagList(field('tags')) });
+ localStorage.removeItem(MOMENT_DRAFT); closeModal(); toast(t('moments.saved'));
+ } catch { form.querySelector('.moment-error').textContent = t('moments.invalid'); }
+ };
+ const originalToday = window.today;
+ window.today = container => {
+ originalToday(container);
+ const date = todayTargetDate || day(), moments = mems().filter(item => item.date === date && item.kind === 'moment');
+ container.insertAdjacentHTML('beforeend', `${t('moments.label')}
${t('moments.count', { count:moments.length })}
${moments.length ? `${moments.map(item => `
`).join('')}
` : `${t('moments.empty')}
`}`);
+ };
+ const quickButton = document.createElement('button');
+ quickButton.type = 'button'; quickButton.className = 'moment-desktop-button'; quickButton.addEventListener('click', () => window.openQuickMemory());
+ document.querySelector('#desktop')?.append(quickButton);
+ const previousLanguage = window.applyLanguage;
+ window.applyLanguage = () => { previousLanguage(); quickButton.textContent = `+ ${t('moments.title')}`; };
+ const momentStyle = document.createElement('style');
+ momentStyle.textContent = `.moment-desktop-button{position:absolute;top:20px;left:150px;z-index:2;border:1px solid var(--line);border-radius:9px;padding:8px 12px;background:var(--panel);color:var(--ink);font-size:14px}.moment-form{width:min(520px,calc(100vw - 28px));max-height:calc(100dvh - 28px);overflow:auto;display:grid;gap:12px}.moment-form h2{font-size:24px;letter-spacing:-.03em}.moment-form label{display:grid;gap:6px;font-size:14px}.moment-form input,.moment-form textarea{width:100%;min-width:0;background:var(--panel2);border:1px solid var(--line);border-radius:9px;padding:10px;font-size:16px}.moment-form textarea{resize:vertical}.moment-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.moment-draft-note{font-size:12px;color:var(--muted);margin:0}.moment-error{color:#eea27d;margin:0;font-size:14px}.moment-day{margin-top:24px;border-top:1px solid var(--line);padding-top:20px}.moment-day header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.moment-day h2{font-size:18px;letter-spacing:0;margin:0}.moment-list{display:grid;gap:8px}.moment-item{text-align:start;display:grid;gap:5px;padding:14px;background:var(--panel2);border:1px solid var(--line);border-radius:10px}.moment-item>span{font-size:12px;color:var(--muted)}.moment-item>strong{font-size:16px;overflow-wrap:anywhere}.moment-item>p{font-size:14px;color:var(--muted);margin:0;white-space:pre-wrap;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}@media(max-width:650px){.moment-desktop-button{top:14px;left:140px}.moment-fields{grid-template-columns:1fr}}`;
+ document.head.append(momentStyle);
window.timeline = container => {
const all = mems(), tags = [...new Set(all.flatMap(item => item.tags || []))].sort((a,b) => a.localeCompare(b));
const query = window.timelineQuery || '', selectedTag = window.timelineTag || '';
@@ -43,7 +86,7 @@
return (!query || haystack.includes(query.toLocaleLowerCase())) && (!selectedTag || (memory.tags || []).includes(selectedTag));
});
const isSaved = memory => museum().some(item => item.memoryId === memory.id);
- container.innerHTML = `${t('timeline.eyebrow')}
${t('timeline.heading',{count:filtered.length,total:all.length})}
${filtered.length ? `${filtered.map(memory => { const task = linkedTasks().find(item => item.id === memory.taskId); return `
`; }).join('')}
` : `${all.length ? t('timeline.noMatches') : `${t('timeline.emptyTitle')}
${t('timeline.emptyBody')}`}
`}`;
+ container.innerHTML = `${t('timeline.eyebrow')}
${t('timeline.heading',{count:filtered.length,total:all.length})}
${filtered.length ? `${filtered.map(memory => { const task = linkedTasks().find(item => item.id === memory.taskId); return `
`; }).join('')}
` : `${all.length ? t('timeline.noMatches') : `${t('timeline.emptyTitle')}
${t('timeline.emptyBody')}`}
`}`;
};
window.museumApp = container => {
const saved = museum(), memories = mems();
@@ -54,7 +97,7 @@
window.detail = id => {
const memory = mems().find(item => item.id === id); if (!memory) return;
const task = linkedTasks().find(item => item.id === memory.taskId), favorite = museum().some(item => item.memoryId === memory.id);
- rootModal().innerHTML = `${t('timeline.detail')}
${esc(titleOf(memory))}
${uiDate(memory.date)} · ${weather(memory.mood)} · ${t('common.energy')} ${memory.energy}
${esc(memory.text || t('timeline.noNote')).replace(/\n/g,'
')}
${memory.location ? `
⌖ ${esc(memory.location)}
` : ''}${task ? `
↗ ${esc(t('memory.relatedTask'))}:
` : ''}${(memory.tags || []).length ? `
${memory.tags.map(tag => `# ${esc(tag)}`).join('')}
` : ''}
${t('today.film')}: ${esc(localizedFilmField(memory,'filmTitle'))}
${esc(localizedFilmField(memory,'filmSubtitle'))}
`;
+ rootModal().innerHTML = `${t('timeline.detail')}
${esc(titleOf(memory))}
${uiDate(memory.date)} · ${memory.kind === 'moment' ? t('moments.label') : `${weather(memory.mood)} · ${t('common.energy')} ${memory.energy}`}
${esc(memory.text || t('timeline.noNote')).replace(/\n/g,'
')}
${memory.location ? `
⌖ ${esc(memory.location)}
` : ''}${task ? `
↗ ${esc(t('memory.relatedTask'))}:
` : ''}${(memory.tags || []).length ? `
${memory.tags.map(tag => `# ${esc(tag)}`).join('')}
` : ''}${memory.kind !== 'moment' ? `
${t('today.film')}: ${esc(localizedFilmField(memory,'filmTitle'))}
${esc(localizedFilmField(memory,'filmSubtitle'))}
` : ''}
`;
};
window.editMemory = id => { const memory = mems().find(item => item.id === id); if (!memory) return; rootModal().innerHTML = ``; };
window.saveMemoryEdit = (event,id) => { event.preventDefault(); const all=mems(), memory=all.find(item=>item.id===id); if(!memory)return; memory.title=document.querySelector('#memory-edit-title').value.trim(); memory.text=document.querySelector('#memory-edit-note').value.trim(); memory.tags=tagList(document.querySelector('#memory-tags').value); memory.location=document.querySelector('#memory-place').value.trim(); memory.taskId=document.querySelector('#memory-task').value||''; memory.updatedAt=new Date().toISOString(); save('lifeos_memories',all); closeModal(); renderAll(); detail(id); };
@@ -86,9 +129,9 @@
const tasksCompleted = tasks.filter(item => item.done && inPeriod(reportEventDate(item.completedAt))).length;
const goalsCompleted = goals.filter(item => item.done && inPeriod(reportEventDate(item.completedAt))).length;
const weatherCounts = { clear: 0, light: 0, cloudy: 0, rain: 0, storm: 0 };
- records.forEach(item => { if (Object.hasOwn(weatherCounts, item.mood)) weatherCounts[item.mood]++; });
+ records.forEach(item => { if (item.contextRecorded !== false && Object.hasOwn(weatherCounts, item.mood)) weatherCounts[item.mood]++; });
const commonWeather = Object.entries(weatherCounts).filter(([, count]) => count).sort((a, b) => b[1] - a[1]).slice(0, 3);
- const energies = records.map(item => ({ date: item.date, value: Number(item.energy) })).filter(item => Number.isFinite(item.value) && item.value >= 1 && item.value <= 5);
+ const energies = records.filter(item => item.contextRecorded !== false).map(item => ({ date: item.date, value: Number(item.energy) })).filter(item => Number.isFinite(item.value) && item.value >= 1 && item.value <= 5);
const energyAverage = energies.length ? (energies.reduce((sum, item) => sum + item.value, 0) / energies.length).toFixed(1) : '—';
const favorites = new Set(museum().map(item => item.memoryId));
const hasHighlightTag = item => (Array.isArray(item.tags) ? item.tags : []).some(tag => ['高光', 'highlight'].includes(String(tag).replace(/^#/, '').trim().toLowerCase()));
@@ -104,7 +147,7 @@
${t('insights.note')}
`;
};
window.profileApp = container => {
- const profileData = profile(), all = mems(), common = Object.entries(all.reduce((out, item) => (out[item.mood] = (out[item.mood] || 0) + 1, out), {})).sort((a,b) => b[1] - a[1])[0]?.[0] || '—', average = all.length ? (all.reduce((sum,item) => sum + item.energy,0) / all.length).toFixed(1) : '—', started = Math.max(1, Math.floor((Date.now() - new Date(profileData.startDate)) / 864e5));
+ const profileData = profile(), all = mems(), tracked = all.filter(item => item.contextRecorded !== false), common = Object.entries(tracked.reduce((out, item) => (out[item.mood] = (out[item.mood] || 0) + 1, out), {})).sort((a,b) => b[1] - a[1])[0]?.[0] || '—', average = tracked.length ? (tracked.reduce((sum,item) => sum + item.energy,0) / tracked.length).toFixed(1) : '—', started = Math.max(1, Math.floor((Date.now() - new Date(profileData.startDate)) / 864e5));
container.innerHTML = `${t('profile.eyebrow')}
${profileData.name ? esc(profileData.name) + ' · ' : ''}${t('profile.online')}
${started}${t('profile.daysOnline')}
${all.length}${t('profile.memories')}
${museum().length}${t('profile.museumItems')}
${streak(all)}${t('profile.streak')}
${longest(all)}${t('profile.longest')}
${common === '—' ? common : weather(common)}${t('profile.commonWeather')}
${t('profile.personal')}
${t('profile.average',{value:average})}
`;
};
window.saveProfile = () => { save('lifeos_profile', { name: pname.value, birthday: pbday.value, startDate: pstart.value || day(), motto: pmotto.value }); renderAll(); toast(t('profile.saved')); };
@@ -121,8 +164,9 @@
if (Array.isArray(data.desktopLayout?.entries)) localStorage.setItem('lifeos_window_layout_v1', JSON.stringify({ entries: data.desktopLayout.entries }));
if (data.widgetLayout && typeof data.widgetLayout === 'object' && !Array.isArray(data.widgetLayout)) localStorage.setItem('lifeos_widget_layout_v1', JSON.stringify(data.widgetLayout));
} else {
- const memories = mems(), ids = new Set(memories.map(item => item.id)), dates = new Set(memories.map(item => item.date));
- save('lifeos_memories', [...memories, ...data.memories.filter(item => !ids.has(item.id) && !dates.has(item.date))]);
+ const memories = mems(), ids = new Set(memories.map(item => item.id)), dates = new Set(memories.filter(item => item.kind !== 'moment').map(item => item.date));
+ const additions = data.memories.filter(item => { if (ids.has(item.id) || (item.kind !== 'moment' && dates.has(item.date))) return false; ids.add(item.id); if (item.kind !== 'moment') dates.add(item.date); return true; });
+ save('lifeos_memories', [...memories, ...additions].sort((a,b) => b.date.localeCompare(a.date) || String(b.createdAt || '').localeCompare(String(a.createdAt || ''))));
const artifacts = museum(), artifactIds = new Set(artifacts.map(item => item.id));
save('lifeos_museum', [...artifacts, ...data.museum.filter(item => !artifactIds.has(item.id))]);
const current = sys(), importedBoard = data.system?.tasksBoard;
diff --git a/public/index.html b/public/index.html
index 91acc30..40e1349 100644
--- a/public/index.html
+++ b/public/index.html
@@ -25,4 +25,4 @@ function profileApp(c){let p=profile(),a=mems(),common=Object.entries(a.reduce((
function today(c){let m=mems().find(x=>x.date===day());if(todayDraft===null){selectedMood=m?.mood||'cloudy';selectedEnergy=m?.energy||3}let f=m||filmFor(selectedMood,selectedEnergy),text=todayDraft===null?(m?.text||''):todayDraft,cWeek=new Date().toLocaleDateString(LifeI18n.locale(),{weekday:'long'}).toUpperCase();c.innerHTML=`${cWeek}
${fmtDate(day()).replace(/^[^,]+, /,'')}
${i18n('How was your day?')}
`}function rerenderToday(){let old=document.querySelector('#entry');todayDraft=old?old.value:todayDraft||'';window.today(document.querySelector('#content-today'));let entry=document.querySelector('#entry');entry?.focus();entry?.setSelectionRange(entry.value.length,entry.value.length)}
function systemApp(c){let s=settings(),bytes=new Blob([JSON.stringify({mems:mems(),museum:museum(),profile:profile()})]).size;let rec=s.lastBackup&&(Date.now()-new Date(s.lastBackup)>12096e5);c.innerHTML=`SYSTEM SETTINGS
System, local and yours.
APPEARANCE
${['dark','light','auto'].map(x=>``).join('')}
STORAGE
Local Storage
${mems().length} memories · ${museum().length} museum items · Approx. ${Math.ceil(bytes/1024)} KB
DATA STORAGE
Your data is stored locally in this browser.
Create regular backups to prevent data loss.
${s.lastBackup?'LAST BACKUP · '+fmtDate(s.lastBackup.slice(0,10)):'LAST BACKUP · NEVER'} ${rec?'
BACKUP RECOMMENDED':''}
VERSION
Life OS
Version ${window.LifeOSVersion||'1.18.1'} · Schema v2
`}function theme(x){let s=settings();s.theme=x;save('lifeos_settings',s);init();renderAll()}function exportData(){let data={app:'Life OS',version:window.LifeOSVersion||'1.18.1',schemaVersion:1,exportedAt:new Date().toISOString(),profile:profile(),memories:mems(),museum:museum(),settings:settings()};let a=document.createElement('a');a.href=URL.createObjectURL(new Blob([JSON.stringify(data,null,2)],{type:'application/json'}));a.download='life-os-backup-'+day()+'.json';a.click();let s=settings();s.lastBackup=new Date().toISOString();save('lifeos_settings',s);renderAll();toast('BACKUP CREATED')}function readImport(el){let f=el.files[0];if(!f)return;let r=new FileReader;r.onload=()=>{try{let d=JSON.parse(r.result);if(d.app!=='Life OS'||![1,2,3].includes(d.schemaVersion)||!Array.isArray(d.memories)||!Array.isArray(d.museum))throw 0;importData=d;importPreview()}catch{toast('INVALID BACKUP FILE')}};r.readAsText(f)}function importPreview(){let d=importData;modal.innerHTML=`LIFE OS BACKUP
Ready to restore
Exported: ${fmtDate(d.exportedAt.slice(0,10))}
Memories: ${d.memories.length}
Museum Items: ${d.museum.length}
`}function replaceConfirm(){modal.innerHTML=`FINAL CONFIRMATION
Replace all Life OS data?
This will replace all current Life OS data.
`}function applyImport(mode){let d=importData;if(mode==='replace'){save('lifeos_memories',d.memories);save('lifeos_museum',d.museum);save('lifeos_profile',d.profile||{});save('lifeos_settings',d.settings||{})}else{let a=mems(), ids=new Set(a.map(x=>x.id)),dates=new Set(a.map(x=>x.date));save('lifeos_memories',[...a,...d.memories.filter(x=>!ids.has(x.id)&&!dates.has(x.date))]);let mu=museum(),mi=new Set(mu.map(x=>x.id));save('lifeos_museum',[...mu,...d.museum.filter(x=>!mi.has(x.id))])}modal.innerHTML='';toast('RESTORING SYSTEM...');setTimeout(()=>{renderAll();toast('SYSTEM RESTORED')},500)}function resetConfirm(){modal.innerHTML=`RESET LIFE OS
Reset all local data?
Export a backup first if you want to keep it.
`}function toast(t){let x=document.createElement('div');x.className='toast';x.textContent=t;document.body.append(x);setTimeout(()=>x.remove(),2000)}
window.renderIcons=renderIcons;window.renderAll=renderAll;window.toast=toast;
-