brendmanager/public/publish.html
Peppa 35403eedbf
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 0с
ci / checks (pull_request) Successful in 3s
deploy / deploy (pull_request) Successful in 2s
BRM-17: публикация в LinkedIn по правилам режима B
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 15:01:52 +05:00

23 lines
1.5 KiB
HTML

<!doctype html><meta charset="utf-8"><title>Журнал публикаций</title>
<h1>Публикации</h1>
<p id="s"></p>
<div id="c"></div>
<table border="1" cellpadding="4"><thead><tr><th>Время<th>Канал<th>Текст<th>Результат<th>Причина<th>Ссылка / кто<tbody id="t"></table>
<script>
async function load(){
const s=await (await fetch('/api/publish/status')).json();
const c=document.getElementById('c'); c.textContent='';
const A={waiting:'ждём одобрения',received:'одобрено',denied:'отказ'};
for(const [k,v] of Object.entries(s.channels)){
const d=document.createElement('p');
d.textContent=k+': '+(v.stopped?'ОСТАНОВЛЕНО':'работает')+(v.approval?'; приложение: '+A[v.approval]:'')+(v.connected?'':'; не подключён')+' ';
for(const a of ['stop','resume']){const b=document.createElement('button');b.textContent=a=='stop'?'Остановить':'Возобновить';b.onclick=()=>act(a,k);d.append(b,' ');}
c.append(d);
}
const l=await (await fetch('/api/publish/log')).json(), t=document.getElementById('t'); t.textContent='';
for(const e of l){const r=t.insertRow();for(const k of ['time','channel','text','result','reason'])r.insertCell().textContent=e[k];r.insertCell().textContent=e.url||e.actor||'';}
}
async function act(a,channel){await fetch('/api/publish/'+a,{method:'POST',body:JSON.stringify({channel,actor:'pm'})});load();}
load();
</script>