feat(feeds): add templated capture paths and inline modal
Build and publish container images / images (push) Successful in 11m2s

This commit is contained in:
Anya Tokugawa committed 2026-11-08 13:44:20 +09:00
1 parent 78da33d549
commit a5f90f933d
12 files changed
+138 -11

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
.feeds-page{height:100dvh;overflow:hidden;display:flex;flex-direction:column;background:var(--bg);color:var(--fg)}
.feed-help{display:flex;align-items:center;gap:.5rem;padding:.25rem 0;font-size:.78rem;flex-shrink:0}.feed-help[hidden]{display:none}.feed-help span{flex:1;min-width:0;overflow-wrap:anywhere}.feed-help button{flex-shrink:0}
.feed-capture{width:min(42rem,calc(100vw - 2rem));max-height:calc(100dvh - 2rem);box-sizing:border-box;overflow:auto;background:var(--panel,var(--bg));color:var(--fg);border:1px solid var(--border,#8885);border-radius:.6rem;padding:1rem;box-shadow:0 1rem 4rem #0007}.feed-capture::backdrop{background:#0008}.feed-capture-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem}.feed-capture h2{font-size:1.05rem;margin:0}.feed-capture-heading,.feed-capture-field,.feed-capture-tokens,.feed-capture-destination,.feed-capture-actions,.feed-capture .feed-warning{grid-column:1/-1}#feeds-app .feed-capture form{grid-template-columns:1fr 1fr;gap:.65rem}#feeds-app .feed-capture .feed-capture-check{display:flex;align-items:center;gap:.4rem}#feeds-app .feed-capture input[type=checkbox]{width:1rem;min-height:1rem;flex-shrink:0}.feed-capture-check:has([name=confirm]){grid-column:1/-1}.feed-capture-tokens,.feed-capture-actions{display:flex;gap:.35rem;flex-wrap:wrap}.feed-capture-actions{justify-content:flex-end}.feed-capture-destination{font-size:.75rem;overflow-wrap:anywhere;opacity:.8}.feed-capture .feed-warning:empty{display:none}.feed-capture-field:has([name=prefix]){position:relative}.feed-capture-field:has([name=prefix]) a{position:absolute;right:.1rem;top:0;text-decoration:none}@media(max-width:600px){#feeds-app .feed-capture form{grid-template-columns:1fr}.feed-capture{padding:.75rem}}
.feed-folder-row{display:flex;align-items:center;min-width:0}#feeds-app .feed-folder-toggle{flex:0 0 1.7rem;border:0;padding:.15rem;min-width:1.7rem}#feeds-app .feed-folder-name{display:flex;align-items:center;gap:.3rem;flex:1;min-width:0;text-align:left;border:0;font-size:.78rem;padding:.2rem}.feed-folder-name span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.feed-folder-name svg{width:1rem;height:1rem;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round}.feed-folder>.feed-subscriptions{padding-left:1.1rem;border-left:1px solid var(--border,#8885);margin-left:.8rem}.feed-catalog .feed-subscriptions[hidden]{display:none}.feed-folder small{font-size:.7rem;opacity:.7;padding:.3rem}.feed-catalog button[aria-current=true]{background:color-mix(in srgb,var(--accent,#659de4) 22%,transparent)!important}.feed-tree-all{width:100%;text-align:left}.feed-folders{min-width:0}
.feed-layout.action-history{grid-template-columns:12rem minmax(0,1fr)}.feed-layout.action-history .feed-index{display:none}.feed-layout.action-history #feed-reader{display:block}.feed-history-controls{display:flex;gap:.3rem;flex-wrap:wrap;margin:.4rem 0}.feed-history-controls select{max-width:100%}.feed-history table{width:100%;table-layout:fixed;border-collapse:collapse;font-size:.8rem}.feed-history th,.feed-history td{padding:.3rem .4rem;text-align:left;border-bottom:1px solid var(--border,#8885);vertical-align:middle;overflow-wrap:anywhere}.feed-history th:first-child{width:7.5rem}.feed-history th:nth-child(3){width:6rem}.feed-history th:last-child{width:7rem}.feed-history td:nth-child(2)>span,.feed-history small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.feed-history small{font-size:.72rem;opacity:.7}.feed-history-buttons{display:flex;gap:.2rem;justify-content:flex-end}.feed-history-buttons a{display:inline-flex;align-items:center;justify-content:center;min-width:1.8rem;min-height:1.8rem;border:1px solid var(--border,#6666);border-radius:.2rem;text-decoration:none}.feed-history [data-state=unknown],.feed-history [data-state=conflict],.feed-history [data-state=failed]{color:var(--danger,#e57a7a)}.feed-history .feed-warning:empty{display:none}
@media(max-width:1100px){.feed-layout.action-history{grid-template-columns:10rem minmax(0,1fr)}}
+15 -6
View File
@@ -175,20 +175,29 @@
form.onsubmit=async event=>{event.preventDefault();save.disabled=true;try{await post('sources',{uuid:sourceID,version:source?.version||0,provider:provider.value,title:title.value,folder:folder.value,url:url.value,interval_seconds:Number(interval.value)*60,enabled:enabled.checked,write_enabled:provider.value==='freshrss'&&write.checked,username:user.value,password:password.value});password.value='';await reload();status.textContent=t('Saved','保存しました');}catch(e){report(e);}finally{save.disabled=false;}};title.focus();
}
function captureForm(item){
editing=true;detailSeq++;reader.replaceChildren();const form=el('form');reader.append(form);form.append(el('h1',t('Attributed Wiki note / task','出典付きWikiメモ・タスク')));
editing=true;detailSeq++;clearTimeout(actionTimer);const dialog=el('dialog',undefined,'feed-capture'),form=el('form');dialog.ariaLabel=t('Capture Wiki / task','Wiki・タスク追加');reader.append(dialog);dialog.append(form);
const close=()=>{if(!busy)dialog.close();},heading=el('div',undefined,'feed-capture-heading');heading.append(el('h2',t('Capture Wiki / task','Wiki・タスク追加')),button('×',t('Close','閉じる'),close));form.append(heading);
dialog.addEventListener('close',()=>{clearTimeout(previewTimer);generation++;dialog.remove();editing=false;pollAction(item);});dialog.addEventListener('cancel',e=>{if(busy)e.preventDefault();});dialog.addEventListener('keydown',e=>e.stopPropagation());
const title=field(form,t('Title','件名'),item.title.slice(0,250));title.required=true;title.maxLength=300;
const task=field(form,t('Also create a task','タスクを作成する'),'','checkbox');task.disabled=root.dataset.tasks!=='true';
const prefix=field(form,t('Wiki parent Path (empty = task only)','Wikiの親Path(空ならタスクのみ)'),root.dataset.wikiPrefix||'');prefix.placeholder='/notes/feeds';prefix.required=true;prefix.maxLength=500;
if(root.dataset.tasks==='true'){const settings=el('a','⚙');settings.href='/-/sys/config?panel=organizer';settings.target='_blank';settings.rel='noopener';settings.title=settings.ariaLabel=t('Configure default Wiki parent path in personal settings','個人設定で既定のWiki親Pathを設定');prefix.parentElement.append(settings);}
const tokens=el('div',undefined,'feed-capture-tokens');for(const token of ['{YYYY}','{MM}','{DD}','{Subject}'])tokens.append(button(token,t('Insert ','挿入: ')+token,()=>{prefix.setRangeText(token,prefix.selectionStart??prefix.value.length,prefix.selectionEnd??prefix.value.length,'end');prefix.dispatchEvent(new Event('input',{bubbles:true}));prefix.focus();}));form.append(tokens);
const destination=el('output',undefined,'feed-capture-destination');destination.ariaLabel=t('Destination','保存先');form.append(destination);
const notes=field(form,t('Your note','メモ'));const copy=field(form,t('Include cached text (explicit copy)','取得済み本文も保存する(明示コピー)'),'','checkbox');
const confirm=field(form,t('I checked the destination publication policy and the material to copy.','保存先の公開範囲と、コピーする内容を確認しました。'),'','checkbox');confirm.required=true;
const validate=()=>{prefix.required=!task.checked;confirm.required=!!prefix.value.trim()||!task.checked;};task.onchange=prefix.oninput=validate;
const save=el('button',t('Create','作成'));save.type='submit';form.append(save,button(t('Cancel','取消'),'',()=>{editing=false;renderItem(item);}));let pending=null;
form.onsubmit=async event=>{event.preventDefault();const body='Source: '+item.url+'\nFeed: '+item.feed+'\n\n'+notes.value+(copy.checked?'\n\n'+item.body:'');const spec={title:title.value,notes:notes.value,prefix:prefix.value.trim(),body,task:task.checked};const fingerprint=JSON.stringify(spec);if(!pending||pending.fingerprint!==fingerprint)pending={fingerprint,request_id:crypto.randomUUID()};save.disabled=true;
for(const [name,input]of Object.entries({title,task,prefix,notes,copy,confirm})){input.name=name;if(input.type==='checkbox')input.parentElement.classList.add('feed-capture-check');else input.parentElement.classList.add('feed-capture-field');}
const notice=el('p',undefined,'feed-warning');notice.role='status';const actions=el('div',undefined,'feed-capture-actions'),save=el('button',t('Create','作成'));save.type='submit';actions.append(button(t('Cancel','取消'),'',close),save);form.append(notice,actions);
let pending=null,generation=0,previewTimer,resolved=null,busy=false;const requestID=crypto.randomUUID();
const preview=()=>{clearTimeout(previewTimer);const n=++generation;resolved=null;confirm.checked=false;prefix.required=!task.checked;confirm.required=!!prefix.value.trim()||!task.checked;save.disabled=true;notice.textContent='';destination.textContent='';
if(!prefix.value.trim()){resolved='';destination.textContent=task.checked?t('Task only','タスクのみ'):'';save.disabled=!task.checked;return;}
previewTimer=setTimeout(async()=>{try{const data=await post('capture-preview',{prefix:prefix.value.trim(),title:title.value});if(n!==generation||!dialog.isConnected)return;resolved=data.prefix;destination.textContent=resolved.replace(/\/$/,'')+'/'+(task.checked?'mail-':'rss-')+requestID;save.disabled=false;}catch(e){if(n===generation&&dialog.isConnected){notice.textContent=t('Check the parent Path and placeholders.','親Pathとプレースホルダを確認してください。');}}},180);
};task.onchange=prefix.oninput=title.oninput=preview;copy.onchange=()=>{confirm.checked=false;};dialog.showModal();preview();title.focus();
form.onsubmit=async event=>{event.preventDefault();if(busy||resolved===null||!form.reportValidity())return;const body='Source: '+item.url+'\nFeed: '+item.feed+'\n\n'+notes.value+(copy.checked?'\n\n'+item.body:'');const spec={title:title.value,notes:notes.value,prefix:resolved,body,task:task.checked};const fingerprint=JSON.stringify(spec);if(!pending||pending.fingerprint!==fingerprint)pending={fingerprint,request_id:requestID};busy=true;save.disabled=true;
try{let data;if(task.checked){const input={request_id:pending.request_id,title:title.value,notes:(notes.value+'\nSource: '+item.url).trim()};if(spec.prefix){input.wiki_prefix=spec.prefix;input.wiki_body=body;}const res=await fetch('/_/api/v1/extension/organizer.tasks/capture',{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify(input)});data=await res.json().catch(()=>({}));if(!res.ok||res.redirected)throw Error(t('Capture failed: ','作成に失敗: ')+(data.error||res.status));}
else data=await post('note',{request_id:pending.request_id,source:item.source,id:item.id,path:spec.prefix.replace(/\/$/,'')+'/rss-'+pending.request_id,title:title.value,body,confirm_publication:confirm.checked});
reader.replaceChildren(el('p',t('Created.','作成しました。')));if(data.item){const a=el('a',t('Open task','タスクを開く'));a.href='/v/plan/task/'+encodeURIComponent(data.item.uuid);reader.append(a);}const page=data.page_uuid||data.item?.page_uuid;if(page){const a=el('a',t('Open Wiki','Wikiを開く'));a.href='/v/uuid:'+encodeURIComponent(page);reader.append(el('p'),a);}editing=false;
}catch(e){report(e);}finally{save.disabled=false;}
dialog.replaceChildren(el('h2',t('Created','作成しました')));if(data.item){const a=el('a',t('Open task','タスクを開く'));a.href='/v/plan/task/'+encodeURIComponent(data.item.uuid);dialog.append(a);}const page=data.page_uuid||data.item?.page_uuid;if(page){const a=el('a',t('Open Wiki','Wikiを開く'));a.href='/v/uuid:'+encodeURIComponent(page);dialog.append(el('p'),a);}const done=button(t('Close','閉じる'),'',close);dialog.append(el('p'),done);done.focus();
}catch(e){notice.textContent=e.message;}finally{busy=false;save.disabled=resolved===null;}
};
}
document.addEventListener('keydown',event=>{if(event.defaultPrevented||event.isComposing||event.ctrlKey||event.altKey||event.metaKey)return;if(event.key==='Escape'&&!help.hidden){hideHelp();event.preventDefault();return;}const input=event.target.closest?.('input,textarea,select,[contenteditable=true]');if(input){if(event.key==='Escape'){event.target.blur();event.preventDefault();}return;}if(event.key==='?'&&!help.hidden){hideHelp();event.preventDefault();return;}if(event.key==='Enter'&&event.target.closest?.('button,a'))return;if(editing){if(event.key==='Escape'){closeReader();event.preventDefault();}return;}
+1 -1
View File
@@ -26,7 +26,7 @@
if(key==='project_uuid')for(const option of input.options)option.defaultSelected=option.selected=option.value===(p.project_uuid||'');
else if(input.type==='checkbox')input.defaultChecked=input.checked;
else input.defaultValue=input.value;
if(key==='wiki_prefix'){input.placeholder='/notes';input.maxLength=500;const help=el('p',ja?'メール本文・RSSのWiki取り込みに使う親Pathです。RSSでは入力欄の初期値になり、空にすればタスクのみ作成できます。設定が空欄の場合、メールはプロジェクトのWiki配下を使い、RSSは未入力になります。保存内容はそのPathの公開範囲・閲覧権限に従います。':'Parent path for mail / RSS Wiki captures. RSS pre-fills this value; clearing it allows task-only capture. If unset, mail uses the project Wiki subtree and RSS leaves the field blank. Saved content inherits the destination visibility and read permissions.');help.className='productivity-note';form.append(help);}
if(key==='wiki_prefix'){input.placeholder='/notes/{YYYY}/{MM}/{Subject}';input.maxLength=500;const help=el('p',ja?'メール・RSS取り込みの保存先。{YYYY}・{MM}・{DD}は作成日(ドメインのタイムゾーン)、{Subject}は件名です。RSSでは入力欄を空にすればタスクのみ作成できます。設定が空欄の場合、メールはプロジェクトのWiki配下を使い、RSSは未入力になります。保存内容はそのPathの公開範囲・閲覧権限に従います。':'Mail / RSS capture destination. {YYYY}, {MM}, {DD} use the creation date in the Domain timezone; {Subject} uses the title. Clear the RSS field for task-only capture. If unset, mail uses the project Wiki subtree and RSS leaves the field blank. Content inherits destination visibility and permissions.');help.className='productivity-note';form.append(help);}
if(key==='reminder_time'){const help=el('p',ja?'新規タスクの対応する日付が設定されている場合だけ通知します。既存タスクは変更しません。通知時刻は保存時のドメインのタイムゾーン('+data.timezone+')を使用します。':'Reminders apply only to new tasks with the corresponding date. Existing tasks are unchanged. Times use the Domain timezone on save ('+data.timezone+').');help.className='productivity-note';form.append(help);}
}
const note=el('p',ja?'日数は作成日からの暦日です。空欄は未設定、0は当日。担当者の指定では閲覧権限は付与されません。メールは今日の計画・期限到来分を最大100件送ります。SMTPは管理者設定を使用し、配信時刻にはキュー待ちの遅延があります。':'Offsets are calendar days from creation; blank means unset, 0 means today. Assignment does not grant access. Email includes up to 100 tasks planned or due today, using administrator SMTP settings. Queue delays may apply.');note.className='productivity-note';form.append(note);