diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa32e82..59b9990 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,14 @@
本项目按 `v主版本.次版本.修订版本` 标记应用版本;按需创建 Git tag。下列内容以对应提交和已发布功能为准。
+## v1.28.0 — 2026-10-14
+
+- 今日工作台新增专注计时器,可关联当前待办并选择 25 或 50 分钟。
+- 支持暂停、继续和重置;计时依据结束时间计算,刷新页面或短暂离开后仍能恢复准确进度。
+- 完成的专注轮次保留最近 100 条,并显示当天完成数量;旧任务完成后仍保留本轮名称。
+- 专注计时状态仅保存在当前设备,重置 Life OS 数据时一并清除。
+- 增加计时器开始、暂停、恢复、重置、过期结算及重复结算防护测试。
+
## v1.27.0 — 2026-10-13
- 今日页面新增工作台,集中展示今天到期和逾期数量、最多六条当前待办及三个近期目标。
diff --git a/README.md b/README.md
index 8c9bc0b..d5ba510 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
以桌面操作系统为交互方式的个人记录网站。用 App 记录日常、管理目标与待办,并沿时间线回看已经留下的内容。
-在线站点:[Life OS](https://life-os-personal-desktop.biss0.chatgpt.site) · 当前应用版本:**v1.27.0** · [更新日志](CHANGELOG.md)
+在线站点:[Life OS](https://life-os-personal-desktop.biss0.chatgpt.site) · 当前应用版本:**v1.28.0** · [更新日志](CHANGELOG.md)
## 功能
diff --git a/package.json b/package.json
index cfaf321..63998a9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "life-os",
- "version": "1.27.0",
+ "version": "1.28.0",
"private": true,
"type": "module",
"scripts": {
diff --git a/public/addons.js b/public/addons.js
index 82c0e97..31502b9 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.27.0';
+ const APP_VERSION = '1.28.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);
diff --git a/public/backup.js b/public/backup.js
index 6ab4694..17baf69 100644
--- a/public/backup.js
+++ b/public/backup.js
@@ -22,7 +22,7 @@
const stored = records();
return {
app: 'Life OS',
- version: window.LifeOSVersion || '1.27.0',
+ version: window.LifeOSVersion || '1.28.0',
schemaVersion: BACKUP_SCHEMA,
exportedAt: new Date().toISOString(),
profile: json('lifeos_profile', {}),
diff --git a/public/i18n-renderers.js b/public/i18n-renderers.js
index 270fd21..ad9950e 100644
--- a/public/i18n-renderers.js
+++ b/public/i18n-renderers.js
@@ -73,9 +73,30 @@
const goals=board.goals.filter(item=>!item.done && item.targetDate).sort((a,b)=>a.targetDate.localeCompare(b.targetDate)).slice(0,3);
return {date,due,overdue,focus,goals};
};
+ const FOCUS_TIMER_KEY='lifeos_focus_timer_v1';
+ let focusTimerInterval=null;
+ const focusTimerDefault=()=>({mode:'idle',taskId:'',taskTitle:'',durationSec:1500,remainingSec:1500,endsAt:0,completed:[]});
+ const focusTimerRead=()=>{try{const value=JSON.parse(localStorage.getItem(FOCUS_TIMER_KEY)||'{}'),duration=[1500,3000].includes(Number(value.durationSec))?Number(value.durationSec):1500,mode=['idle','running','paused'].includes(value.mode)?value.mode:'idle';return{...focusTimerDefault(),...value,mode,durationSec:duration,remainingSec:Math.max(0,Math.min(Number(value.remainingSec)||duration,duration)),endsAt:Number(value.endsAt)||0,completed:Array.isArray(value.completed)?value.completed.slice(-100):[]};}catch{return focusTimerDefault();}};
+ const focusTimerSave=state=>localStorage.setItem(FOCUS_TIMER_KEY,JSON.stringify(state));
+ const focusTimerRemaining=(state,now=Date.now())=>state.mode==='running'?Math.max(0,Math.ceil((state.endsAt-now)/1000)):state.remainingSec;
+ const focusTimerClock=seconds=>`${String(Math.floor(seconds/60)).padStart(2,'0')}:${String(seconds%60).padStart(2,'0')}`;
+ const focusTimerFinish=state=>{const finished={...state,mode:'idle',remainingSec:state.durationSec,endsAt:0,completed:[...state.completed,{id:`focus_${crypto.randomUUID()}`,date:day(),taskId:state.taskId,taskTitle:state.taskTitle,durationSec:state.durationSec,completedAt:new Date().toISOString()}].slice(-100)};focusTimerSave(finished);toast(t('focus.done'));return finished;};
+ const focusTimerMarkup=tasks=>{
+ let state=focusTimerRead(),remaining=focusTimerRemaining(state);if(state.mode==='running'&&!remaining){state=focusTimerFinish(state);remaining=state.remainingSec;}
+ const known=tasks.some(task=>task.id===state.taskId),todayRounds=state.completed.filter(item=>item.date===day()).length,progress=Math.round((1-remaining/state.durationSec)*100);
+ const options=[``,...tasks.map(task=>``),...(!known&&state.taskId?[``]:[])];
+ return `${t('focus.label')}
${t('focus.title')} ${t('focus.rounds',{count:todayRounds})}${focusTimerClock(remaining)}
${state.mode==='idle'?``:state.mode==='running'?``:``}
`;
+ };
+ const focusTimerRefresh=()=>{const card=document.querySelector('.focus-timer');if(!card)return;card.outerHTML=focusTimerMarkup(workbenchData().focus);focusTimerMount();};
+ const focusTimerTick=()=>{const state=focusTimerRead();if(state.mode!=='running')return;const remaining=focusTimerRemaining(state);if(!remaining){focusTimerFinish(state);focusTimerRefresh();return;}const clock=document.querySelector('#focus-timer-clock'),progress=document.querySelector('#focus-timer-progress');if(clock)clock.textContent=focusTimerClock(remaining);if(progress)progress.style.width=`${Math.round((1-remaining/state.durationSec)*100)}%`;};
+ const focusTimerMount=()=>{if(focusTimerInterval){clearInterval(focusTimerInterval);focusTimerInterval=null;}const state=focusTimerRead();if(state.mode==='running'){focusTimerTick();focusTimerInterval=setInterval(focusTimerTick,1000);}};
+ window.startFocusTimer=()=>{const task=document.querySelector('#focus-timer-task'),length=document.querySelector('#focus-timer-length'),duration=Number(length?.value)||1500,selected=task?.selectedOptions?.[0];focusTimerSave({...focusTimerDefault(),mode:'running',taskId:task?.value||'',taskTitle:task?.value?(selected?.textContent||''):'',durationSec:duration,remainingSec:duration,endsAt:Date.now()+duration*1000,completed:focusTimerRead().completed});focusTimerRefresh();};
+ window.pauseFocusTimer=()=>{const state=focusTimerRead();if(state.mode!=='running')return;focusTimerSave({...state,mode:'paused',remainingSec:focusTimerRemaining(state),endsAt:0});focusTimerRefresh();};
+ window.resumeFocusTimer=()=>{const state=focusTimerRead();if(state.mode!=='paused')return;focusTimerSave({...state,mode:'running',endsAt:Date.now()+state.remainingSec*1000});focusTimerRefresh();};
+ window.resetFocusTimer=()=>{const state=focusTimerRead();focusTimerSave({...state,mode:'idle',remainingSec:state.durationSec,endsAt:0});focusTimerRefresh();};
const workbenchMarkup = () => {
const data=workbenchData();
- return `${t('workbench.title')}
${data.due.length}${t('workbench.dueToday')}
${data.overdue.length}${t('workbench.overdue')}
${data.focus.length ? data.focus.map(task=>`
`).join('') : `
${t('workbench.empty')}
`}
${data.goals.length ? `${t('workbench.goals')}
${data.goals.map(goal=>`
`).join('')}
` : ''}`;
+ return `${t('workbench.title')}
${data.due.length}${t('workbench.dueToday')}
${data.overdue.length}${t('workbench.overdue')}
${focusTimerMarkup(data.focus)}${data.focus.length ? data.focus.map(task=>`
`).join('') : `
${t('workbench.empty')}
`}
${data.goals.length ? `${t('workbench.goals')}
${data.goals.map(goal=>`
`).join('')}
` : ''}`;
};
const captureWorkbenchDraft = () => {
const container=document.querySelector('#content-today');
@@ -106,7 +127,7 @@
originalToday(container);
const date = todayTargetDate || day(), moments = mems().filter(item => item.date === date && item.kind === 'moment');
if(todayMetadataDraft?.date===date)todayMetadataDraft.values.forEach(([id,value])=>{const node=container.querySelector?.('#'+id);if(node)node.value=value;});
- if(date===day())container.insertAdjacentHTML('afterbegin',workbenchMarkup());
+ if(date===day()){container.insertAdjacentHTML('afterbegin',workbenchMarkup());focusTimerMount();}
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');
@@ -120,6 +141,9 @@
const workbenchStyle=document.createElement('style');
workbenchStyle.textContent=`.today-workbench{padding-bottom:22px;margin-bottom:22px;border-bottom:1px solid var(--line)}.today-workbench header{display:flex;align-items:center;justify-content:space-between;gap:12px}.today-workbench h2{font-size:22px;letter-spacing:-.02em;margin:0}.today-workbench .text-link{font-size:14px}.workbench-counts{display:flex;gap:28px;margin:15px 0}.workbench-counts>div{display:flex;align-items:center;gap:9px}.workbench-counts strong{font-size:26px;color:var(--accent)}.workbench-counts span{font-size:14px;color:var(--muted)}.workbench-add{display:flex;gap:8px}.workbench-add input{flex:1;min-width:0;padding:10px;border:1px solid var(--line);border-radius:9px;background:var(--panel2);font-size:16px}.workbench-add button{font-size:14px;letter-spacing:0;flex:none}.workbench-list{display:grid;gap:6px;margin-top:12px}.workbench-task{display:flex;gap:10px;align-items:center;padding:10px;border:1px solid var(--line);border-radius:9px;background:var(--panel2)}.workbench-check{width:36px;height:36px;border:1px solid var(--line);border-radius:8px;background:transparent;font-size:24px;flex:none}.workbench-task-copy{flex:1;min-width:0;border:0;background:transparent;text-align:start;display:grid;gap:5px}.workbench-task-copy strong{font-size:14px;overflow-wrap:anywhere}.workbench-task-copy small{font-size:12px;color:var(--muted)}.workbench-goals{margin-top:16px;display:grid;gap:7px}.workbench-goals button{display:flex;justify-content:space-between;gap:14px;padding:10px;border:1px solid var(--line);border-radius:9px;background:transparent;text-align:start}.workbench-goals strong{font-size:14px;overflow-wrap:anywhere}.workbench-goals small{font-size:12px;color:var(--muted);flex:none}#workbench-error{color:#eea27d;font-size:14px;margin:7px 0 0}@media(max-width:650px){.workbench-counts{gap:18px}.today-workbench h2{font-size:20px}}`;
document.head.append(workbenchStyle);
+ const focusStyle=document.createElement('style');
+ focusStyle.textContent=`.focus-timer{margin:4px 0 18px;padding:15px;border:1px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--accent) 8%,var(--panel2))}.focus-timer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.focus-timer-head .eyebrow{margin-bottom:4px}.focus-timer-head>div>strong{font-size:16px}.focus-timer-head>span{color:var(--muted);font-size:12px}.focus-timer-clock{margin:14px 0 7px;font:600 38px 'DM Mono';letter-spacing:-.06em}.focus-timer-progress{height:5px;border-radius:9px;background:var(--line);overflow:hidden}.focus-timer-progress i{display:block;height:100%;border-radius:inherit;background:var(--accent);transition:width .3s linear}.focus-timer-controls{display:grid;grid-template-columns:minmax(0,1fr) 140px;gap:8px;margin-top:13px}.focus-timer-controls label{display:grid;gap:5px;color:var(--muted);font-size:11px}.focus-timer-controls select{width:100%;min-width:0;padding:9px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--ink)}.focus-timer-controls select:disabled{opacity:.72}.focus-timer-actions{display:flex;gap:8px;margin-top:11px}.focus-timer-actions button{font-size:12px;letter-spacing:.04em}@media(max-width:650px){.focus-timer-controls{grid-template-columns:1fr}.focus-timer-clock{font-size:34px}}`;
+ document.head.append(focusStyle);
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 || '';
@@ -243,7 +267,7 @@
}
rootModal().innerHTML = ''; toast('feedback.restoring'); setTimeout(() => { renderAll(); toast('feedback.restored'); }, 500);
};
- window.resetConfirm = () => { rootModal().innerHTML = `
${t('system.reset')}
${t('dialog.resetQuestion')}
${t('dialog.resetWarning')}
`; };
+ window.resetConfirm = () => { rootModal().innerHTML = `${t('system.reset')}
${t('dialog.resetQuestion')}
${t('dialog.resetWarning')}
`; };
window.toast = key => { const message = key.includes('.') ? t(key) : key; const node = document.createElement('div'); node.className = 'toast'; node.textContent = message; document.body.append(node); setTimeout(() => node.remove(), 2000); };
window.minWin = id => { const windowNode = windows[id]; if (!windowNode) return; windowNode.classList.add('min'); if (activeWindow === id) { activeWindow = Object.keys(windows).find(key => key !== id && !windows[key].classList.contains('min')) || null; if (activeWindow) focus(windows[activeWindow]); } renderTaskbar(); toast('feedback.minimized'); };
const memoryStyle = document.createElement('style');
diff --git a/public/index.html b/public/index.html
index 19acb77..40fd5c1 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;
-