Support multiple sysops and bulletin comments; complete UI translations
Allow native SYSOP accounts to sign in independently, with an optional sysopUsers allow-list and isolated browser sessions. Keep station services on the configured service account. Add public bulletin comments that preserve category and distribution, alongside private replies to the author. Complete APRS and dynamic status translations and handle decorated button labels correctly. Document configuration and reply behavior. Add authentication, installer, bulletin reply and translation regression coverage.
This commit is contained in:
1 parent
33f1294405
commit
2ef3c25eb3
16 files changed
+298
-23
No files matched your search
+5
-4
@@ -23,7 +23,8 @@ function mailTimezone(){const minutes=-new Date().getTimezoneOffset();return 'UT
|
||||
function mailTimeMeta(m){const zone=mailTimezone();const stamp=kind=>{const value=kind==='sent'?m.createdAt:m.receivedAt;return value?new Date(value).toLocaleString(BPQI18n.locale(),{day:'2-digit',month:'2-digit',year:'numeric',hour:'2-digit',minute:'2-digit'}):null;};return [stamp('sent')?'Inviato <b>'+esc(stamp('sent'))+'</b>':'',stamp('received')?'Ricevuto <b>'+esc(stamp('received'))+'</b>':'','Timezone: '+esc(zone)].filter(Boolean).map(x=>'<span>'+x+'</span>').join('');}
|
||||
function mailRow(m,selection,attribute,options={}){const unread=!m.read&&m.status==='N',current=selection===m.id;return `<button class="message-item mail-row ${current?'selected':''} ${unread?'unread':''}" ${attribute}="${m.id}" aria-pressed="${current}" title="${esc(m.subject)}"><span class="mail-indicator" aria-label="${unread?'Non letto':'Letto'}">${unread?'●':'○'}</span><span class="mail-from" title="${esc(options.from||m.from)}">${esc(options.from||m.from)}</span><span class="mail-subject">${esc(m.subject||'(Senza oggetto)')}${m.attachmentCount?'<span class="mail-paperclip" aria-label="Allegati" title="'+m.attachmentCount+' '+BPQI18n.t('Allegati')+'">📎 '+m.attachmentCount+'</span>':''}</span><span class="mail-category">${esc(options.category||m.to)}</span><time class="mail-date" datetime="${esc(m.receivedAt||m.createdAt||'')}" title="${esc(mailDate(m,'sent'))}">${esc(mailDate(m,options.dateKind))}</time><span class="mail-size">${size(m.size)}</span><span class="mail-status">${esc(options.status||m.status)}</span></button>`;}
|
||||
function renderMessages(){const q=$('#search').value.toLowerCase(),cat=$('#category').value;const list=allMessages.filter(m=>(filter==='all'||m.type===filter||filter==='sent'&&m.from.replace(/-\d+$/,'')===station.call.replace(/-\d+$/,''))&&(!cat||m.to===cat)&&(!q||`${m.subject} ${m.from} ${m.to} ${m.id}`.toLowerCase().includes(q)));$('#list-count').textContent=list.length+' messaggi';$('#message-list').innerHTML=list.map(m=>mailRow(m,selected,'data-id',{category:categoryLabel(m),status:m.status==='F'?'Inoltrato':m.status==='N'?(m.read?'Letto':'Nuovo'):m.status==='Y'?'Letto':m.status==='H'?'Trattenuto':m.status})).join('')||'<p class="empty">Nessun messaggio corrisponde ai filtri.</p>';$$('#message-list [data-id]').forEach(b=>b.onclick=()=>readMessage(Number(b.dataset.id)));}
|
||||
async function readMessage(id){const generation=++loadGeneration;selected=id;renderMessages();$('#reader').innerHTML='<div class="reader-empty"><h2>Caricamento messaggio…</h2></div>';try{const m=await api('/messages/'+id);if(generation!==loadGeneration)return;$('#reader').innerHTML=`<div class="reader-header"><span class="tag">${m.type==='B'?'BOLLETTINO':'MESSAGGIO PERSONALE'} · #${id}</span><h2>${esc(m.subject)}</h2><div class="reader-meta"><span>Da <b>${esc(m.from)}</b></span><span>A <b>${esc(m.to)}</b></span>${mailTimeMeta(m)}</div></div><div class="reader-body">${readableBody(m.text)}</div><footer class="reader-footer"><span>BID ${esc(m.bid||'—')}</span><button class="secondary" id="reply">↩ Rispondi</button></footer>`;markMessageRead(id).catch(error=>toast(error.message));$('#reply').onclick=()=>openCompose({to:m.from,subject:(/^Re:/i.test(m.subject)?m.subject:'Re: '+m.subject).slice(0,80),text:'\n\n--- '+m.from+' ---\n'+m.text.split('\n').map(l=>'> '+l).join('\n')});}catch(err){$('#reader').innerHTML=`<div class="reader-empty"><h2>Messaggio non disponibile</h2><p>${esc(err.message)}</p></div>`}}
|
||||
function replyDraft(message,comment=false){const bulletin=comment&&message.type==='B',destination=String((bulletin?message.to:message.from)||'').trim().replace(/\s*@\s*/g,'@'),via=String(message.via||'').trim();return {to:bulletin&&via&&!destination.includes('@')?destination+'@'+via:destination,type:bulletin?'B':'P',subject:(/^Re:/i.test(message.subject)?message.subject:'Re: '+message.subject).slice(0,80),text:'\n\n--- '+message.from+' ---\n'+message.text.split('\n').map(line=>'> '+line).join('\n')};}
|
||||
async function readMessage(id){const generation=++loadGeneration;selected=id;renderMessages();$('#reader').innerHTML='<div class="reader-empty"><h2>Caricamento messaggio…</h2></div>';try{const m=await api('/messages/'+id);if(generation!==loadGeneration)return;$('#reader').innerHTML=`<div class="reader-header"><span class="tag">${m.type==='B'?'BOLLETTINO':'MESSAGGIO PERSONALE'} · #${id}</span><h2>${esc(m.subject)}</h2><div class="reader-meta"><span>Da <b>${esc(m.from)}</b></span><span>A <b>${esc(m.to)}</b></span>${mailTimeMeta(m)}</div></div><div class="reader-body">${readableBody(m.text)}</div><footer class="reader-footer"><span>BID ${esc(m.bid||'—')}</span><div class="reader-reply-actions">${m.type==='B'?'<button class="secondary" id="comment" title="Pubblica un commento come bollettino">▤ Commenta</button>':''}<button class="secondary" id="reply" title="Rispondi all’autore con un messaggio personale">↩ Rispondi</button></div></footer>`;markMessageRead(id).catch(error=>toast(error.message));$('#reply').onclick=()=>openCompose(replyDraft(m));if(m.type==='B')$('#comment').onclick=()=>openCompose(replyDraft(m,true));}catch(err){$('#reader').innerHTML=`<div class="reader-empty"><h2>Messaggio non disponibile</h2><p>${esc(err.message)}</p></div>`}}
|
||||
$$('[data-filter]').forEach(b=>b.onclick=()=>{filter=b.dataset.filter;$$('[data-filter]').forEach(x=>x.classList.toggle('active',x===b));renderMessages()});$('#search').oninput=renderMessages;$('#category').onchange=renderMessages;
|
||||
function openCompose(data={}){const f=$('#compose-form');f.reset();for(const [key,value]of Object.entries(data))f.elements[key].value=value;$('#compose-error').textContent='';$('#compose').showModal();f.elements.to.focus()}
|
||||
$$('.compose-button').forEach(b=>b.onclick=()=>openCompose());$$('.close-compose').forEach(b=>b.onclick=()=>{const f=$('#compose-form');if((f.elements.text.value||f.elements.subject.value||window.bpqComposeAttachments?.count())&&!bpqConfirm('Chiudere e scartare questa bozza?'))return;$('#compose').close()});
|
||||
@@ -37,10 +38,10 @@ function applyStation(user){
|
||||
document.title='BPQ Console · '+station.nodeCall;
|
||||
$('.side-station').textContent=[station.nodeCall,station.alias,station.locator].filter(Boolean).join(' · ');
|
||||
$('.profile .avatar').textContent=station.call.slice(0,2);
|
||||
$('.profile > div:nth-child(2)').textContent=user.name+' · '+station.call;
|
||||
$('.profile > div:nth-child(2)').textContent=user.name+' · '+user.call;
|
||||
$('.mission-heading h1').textContent=station.nodeCall+' / '+station.alias;
|
||||
$('.mission-location').textContent=station.locator||'BPQ';
|
||||
$('.modem-brand').textContent=station.radio?.name||'Nessuna porta modem';
|
||||
$('.modem-brand').textContent=station.radio?.name||BPQI18n.t('Nessuna porta modem');
|
||||
$('#home .page-footer').firstChild.textContent='BPQ Console · '+station.nodeCall+' ';
|
||||
$('#compose .eyebrow').textContent=station.call;
|
||||
$('.compose-help').textContent='Il messaggio sarà salvato nella BBS. L’inoltro segue i profili BPQ.';
|
||||
@@ -60,6 +61,6 @@ function applyStation(user){
|
||||
if(!station.features[page]&&['bbs','chat','winlink','monitor'].includes(page))navigate('home');
|
||||
}
|
||||
|
||||
document.addEventListener('bpq-languagechange',()=>{if(csrf){renderMessages();if(typeof wlRender==='function')wlRender();}});
|
||||
document.addEventListener('bpq-languagechange',()=>{if(csrf){if(!station.radio)$('.modem-brand').textContent=BPQI18n.t('Nessuna porta modem');renderMessages();if(typeof wlRender==='function')wlRender();}});
|
||||
|
||||
async function markMessageRead(id){const state=await api('/messages/'+id+'/read',{method:'POST',body:'{}'});for(const item of allMessages)if(item.id===id)Object.assign(item,state);if(typeof wlData!=='undefined'&&wlData)for(const item of wlData.messages)if(item.id===id)Object.assign(item,state);renderMessages();if(typeof wlRender==='function')wlRender();}
|
||||
@@ -6,7 +6,7 @@
|
||||
const snapshots=new WeakMap();
|
||||
function markup(selector,html){const el=$(selector);if(snapshots.get(el)===html)return;snapshots.set(el,html);el.innerHTML=html;}
|
||||
const time=t=>t?new Date(t).toLocaleString(BPQI18n.locale(),{day:'2-digit',month:'2-digit',hour:'2-digit',minute:'2-digit',second:'2-digit'}):'—';
|
||||
const type=t=>({position:'Posizione',message:'Messaggio',status:'Stato',object:'Oggetto',weather:'Meteo',telemetry:'Telemetria','third-party':'Messaggio inoltrato',query:'Richiesta'}[t]||t);
|
||||
const type=t=>({position:'Posizione',message:'Messaggio',status:'Stato',object:'Oggetto APRS',weather:'Meteo',telemetry:'Telemetria','third-party':'Messaggio inoltrato',query:'Richiesta'}[t]||t);
|
||||
const source=()=>$('#aprs-source').value,query=()=>$('#aprs-search').value.trim().toUpperCase();
|
||||
const stations=()=>data?.stations.filter(s=>(!source()||s.transport===source()||source()==='Radio'&&s.heardRadio)&&(!query()||(s.call+' '+s.status+' '+s.lastBody).toUpperCase().includes(query())))||[];
|
||||
function setView(next){view=next;form.hidden=next!=='config';pane.hidden=next!=='activity';$('#aprs-save').hidden=next!=='config';tabs.querySelectorAll('button').forEach(b=>b.setAttribute('aria-selected',String(b.dataset.aprsView===next)));if(next==='activity'&&page==='aprs'){start();requestAnimationFrame(()=>map?.invalidateSize({pan:false}));}}
|
||||
|
||||
@@ -2,6 +2,8 @@ let attachmentGeneration=0,attachmentPdf=null;
|
||||
const attachmentDialog=document.createElement('dialog');attachmentDialog.className='attachment-dialog';attachmentDialog.innerHTML='<div class="dialog-heading"><h2 id="attachment-title">Allegato</h2><button id="attachment-close" class="icon-button" aria-label="Chiudi anteprima">×</button></div><div id="attachment-preview"></div><footer><a id="attachment-download" class="primary" download>Scarica file ↓</a></footer>';document.body.append(attachmentDialog);$('#attachment-close').onclick=()=>attachmentDialog.close();attachmentDialog.addEventListener('close',()=>{attachmentGeneration++;attachmentPdf?.destroy().catch(()=>{});attachmentPdf=null;$('#attachment-preview').replaceChildren();});
|
||||
async function renderPdf(url,generation){const pdfjs=await import('/vendor/pdfjs/pdf.min.mjs');pdfjs.GlobalWorkerOptions.workerSrc='/vendor/pdfjs/pdf.worker.min.mjs';const documentPdf=await pdfjs.getDocument({url,withCredentials:true,isEvalSupported:false,enableXfa:false,disableFontFace:true,useSystemFonts:true,standardFontDataUrl:'/vendor/pdfjs/standard_fonts/',cMapUrl:'/vendor/pdfjs/cmaps/',cMapPacked:true}).promise;if(generation!==attachmentGeneration){await documentPdf.destroy();return;}attachmentPdf=documentPdf;const preview=$('#attachment-preview');preview.innerHTML='<div class="pdf-controls"><button id="pdf-previous" class="secondary">←</button><span id="pdf-page"></span><button id="pdf-next" class="secondary">→</button></div><canvas id="pdf-canvas" aria-label="Anteprima pagina PDF"></canvas>';let page=1,busy=false;async function draw(){if(busy||generation!==attachmentGeneration)return;busy=true;try{const p=await documentPdf.getPage(page);const v=p.getViewport({scale:1});const scale=Math.min(2,Math.max(1,(preview.clientWidth-30)/v.width));const viewport=p.getViewport({scale});const canvas=$('#pdf-canvas');if(!canvas||generation!==attachmentGeneration)return;canvas.width=viewport.width;canvas.height=viewport.height;await p.render({canvasContext:canvas.getContext('2d'),viewport}).promise;$('#pdf-page').textContent=page+' / '+documentPdf.numPages;$('#pdf-previous').disabled=page===1;$('#pdf-next').disabled=page===documentPdf.numPages;}finally{busy=false}}$('#pdf-previous').onclick=()=>{if(page>1&&!busy){page--;draw()}};$('#pdf-next').onclick=()=>{if(page<documentPdf.numPages&&!busy){page++;draw()}};await draw();}
|
||||
async function openAttachment(id,file){const generation=++attachmentGeneration;$('#attachment-title').textContent=file.name;const url='/api/messages/'+id+'/attachments/'+file.index;$('#attachment-download').href=url;$('#attachment-preview').innerHTML='<p class="empty">Caricamento anteprima…</p>';attachmentDialog.showModal();if(file.mime.startsWith('image/')){const image=document.createElement('img');image.alt=file.name;image.src=url+'?preview=1';image.onerror=()=>$('#attachment-preview').innerHTML='<p class="empty">Anteprima non disponibile. Puoi scaricare il file.</p>';$('#attachment-preview').replaceChildren(image);}else if(file.mime==='application/pdf'){try{await renderPdf(url+'?preview=1',generation)}catch{if(generation===attachmentGeneration)$('#attachment-preview').innerHTML='<p class="empty">Anteprima PDF non disponibile. Puoi scaricare il file.</p>';}}else if(file.mime==='text/plain'){try{const data=await api('/messages/'+id+'/attachments/'+file.index+'?text=1');if(generation!==attachmentGeneration)return;const pre=document.createElement('pre');pre.textContent=data.text;$('#attachment-preview').replaceChildren(pre);if(data.truncated){const hint=document.createElement('p');hint.className='muted';hint.textContent='Anteprima limitata ai primi 128 KB. Il download contiene il file completo.';$('#attachment-preview').append(hint)}}catch(e){$('#attachment-preview').textContent=e.message}}else{$('#attachment-preview').innerHTML='<p class="empty">Anteprima non disponibile per questo formato. Puoi scaricare il file.</p>';}}
|
||||
async function showAttachments(id,reader){const section=document.createElement('section');section.className='message-attachments';section.innerHTML='<span class="muted">Controllo allegati…</span>';reader.querySelector('.reader-footer')?.before(section);try{const data=await api('/messages/'+id+'/attachments');if(!section.isConnected)return;if(!data.files.length&&!data.encoded){section.remove();return;}section.replaceChildren();reader.querySelector('.reader-attachment-count')?.remove();if(data.files.length){const count=document.createElement('span');count.className='reader-attachment-count';count.textContent='📎 '+data.files.length;count.title='Allegati';reader.querySelector('.reader-header .tag')?.after(count);}if(data.files.length){const heading=document.createElement('h3');heading.textContent='Allegati · '+data.files.length;section.append(heading);for(const file of data.files){const row=document.createElement('div');row.className='attachment-row';row.innerHTML=`<span class="attachment-icon">${file.mime.startsWith('image/')?'▧':file.mime==='application/pdf'?'PDF':'▤'}</span><div><b>${esc(file.name)}</b><small>${size(file.size)}${file.reconstructed?' · Ricostruito da '+file.parts+' parti · CRC verificati':''}</small></div><button class="secondary attachment-open">Anteprima</button><a class="secondary" href="/api/messages/${id}/attachments/${file.index}" download>Scarica ↓</a>`;row.querySelector('button').onclick=()=>openAttachment(id,file);if(file.mime==='application/octet-stream')row.querySelector('button').hidden=true;section.append(row);}}if(data.encoded?.state==='complete'){const imageFile=data.files.find(f=>f.reconstructed&&f.mime.startsWith('image/')),body=reader.querySelector('.reader-body');if(imageFile&&body){const original=document.createElement('details');original.className='sevenplus-original';const summary=document.createElement('summary');summary.textContent='Mostra messaggio originale e dati 7plus';original.append(summary,...body.childNodes);const preview=document.createElement('div');preview.className='sevenplus-inline';const img=document.createElement('img');img.src='/api/messages/'+id+'/attachments/'+imageFile.index+'?preview=1';img.alt=imageFile.name;img.loading='lazy';img.onclick=()=>openAttachment(id,imageFile);const caption=document.createElement('p');caption.textContent=imageFile.name+' · '+imageFile.parts+' parti ricostruite · CRC verificati';preview.append(img,caption);body.replaceChildren(preview,original);}}if(data.encoded){const box=document.createElement('div');box.className='encoded-attachment';box.innerHTML=`<b>7plus · ${esc(data.encoded.name)}</b><p>${data.encoded.state==='complete'?'Ricostruzione completa · '+data.encoded.total+'/'+data.encoded.total+' parti verificate. Anteprima e download disponibili negli allegati.':data.encoded.state==='incomplete'?'Ricevute '+data.encoded.availableParts.length+'/'+data.encoded.total+' parti. Mancano: '+data.encoded.missingParts.join(', ')+'.'+(data.encoded.damagedParts.length?' Parti danneggiate: '+data.encoded.damagedParts.join(', ')+'.':''):data.encoded.state==='damaged'?'Ricostruzione sospesa: dati incompleti o CRC non validi nelle parti '+data.encoded.damagedParts.join(', ')+'.':'Parte '+data.encoded.part+'/'+data.encoded.total+'. Nessun blocco 7plus riconoscibile nel messaggio.'}</p>${data.encoded.issues?.length?'<p>'+esc(data.encoded.issues.join(' · '))+'</p>':''}${data.encoded.messageIds?.length?'<div class="sevenplus-parts">'+data.encoded.messageIds.map(mid=>'<button class="text-button" data-seven-message="'+mid+'">#'+mid+'</button>').join('')+'</div>':''}<a class="text-button" href="/api/messages/${id}/source" download>Scarica testo originale della parte ↓</a>`;section.append(box);box.querySelectorAll('[data-seven-message]').forEach(b=>b.onclick=()=>{navigate('bbs');readMessage(Number(b.dataset.sevenMessage));});}}catch(e){section.innerHTML=`<span class="muted">${esc(e.message)}</span>`;}}
|
||||
async function showAttachments(id,reader){const section=document.createElement('section');section.className='message-attachments';section.innerHTML='<span class="muted">Controllo allegati…</span>';reader.querySelector('.reader-footer')?.before(section);try{const data=await api('/messages/'+id+'/attachments');if(!section.isConnected)return;if(!data.files.length&&!data.encoded){section.remove();return;}section.replaceChildren();reader.querySelector('.reader-attachment-count')?.remove();if(data.files.length){const count=document.createElement('span');count.className='reader-attachment-count';count.textContent='📎 '+data.files.length;count.title='Allegati';reader.querySelector('.reader-header .tag')?.after(count);}if(data.files.length){const heading=document.createElement('h3');heading.textContent='Allegati · '+data.files.length;section.append(heading);for(const file of data.files){const row=document.createElement('div');row.className='attachment-row';row.innerHTML=`<span class="attachment-icon">${file.mime.startsWith('image/')?'▧':file.mime==='application/pdf'?'PDF':'▤'}</span><div><b>${esc(file.name)}</b><small>${size(file.size)}${file.reconstructed?' · Ricostruito da '+file.parts+' parti · CRC verificati':''}</small></div><button class="secondary attachment-open">Anteprima</button><a class="secondary" href="/api/messages/${id}/attachments/${file.index}" download>Scarica ↓</a>`;row.querySelector('button').onclick=()=>openAttachment(id,file);if(file.mime==='application/octet-stream')row.querySelector('button').hidden=true;section.append(row);}}if(data.encoded?.state==='complete'){const imageFile=data.files.find(f=>f.reconstructed&&f.mime.startsWith('image/')),body=reader.querySelector('.reader-body');if(imageFile&&body){const original=document.createElement('details');original.className='sevenplus-original';const summary=document.createElement('summary');summary.textContent='Mostra messaggio originale e dati 7plus';original.append(summary,...body.childNodes);const preview=document.createElement('div');preview.className='sevenplus-inline';const img=document.createElement('img');img.src='/api/messages/'+id+'/attachments/'+imageFile.index+'?preview=1';img.alt=imageFile.name;img.loading='lazy';img.onclick=()=>openAttachment(id,imageFile);const caption=document.createElement('p');caption.dataset.fileName=imageFile.name;caption.dataset.parts=imageFile.parts;caption.textContent=imageFile.name+' · '+BPQI18n.t(imageFile.parts+' parti ricostruite · CRC verificati');preview.append(img,caption);body.replaceChildren(preview,original);}}if(data.encoded){const box=document.createElement('div');box.className='encoded-attachment';box.innerHTML=`<b>7plus · ${esc(data.encoded.name)}</b><p>${data.encoded.state==='complete'?'Ricostruzione completa · '+data.encoded.total+'/'+data.encoded.total+' parti verificate. Anteprima e download disponibili negli allegati.':data.encoded.state==='incomplete'?'Ricevute '+data.encoded.availableParts.length+'/'+data.encoded.total+' parti. Mancano: '+data.encoded.missingParts.join(', ')+'.'+(data.encoded.damagedParts.length?' Parti danneggiate: '+data.encoded.damagedParts.join(', ')+'.':''):data.encoded.state==='damaged'?'Ricostruzione sospesa: dati incompleti o CRC non validi nelle parti '+data.encoded.damagedParts.join(', ')+'.':'Parte '+data.encoded.part+'/'+data.encoded.total+'. Nessun blocco 7plus riconoscibile nel messaggio.'}</p>${data.encoded.issues?.length?'<p>'+esc(data.encoded.issues.join(' · '))+'</p>':''}${data.encoded.messageIds?.length?'<div class="sevenplus-parts">'+data.encoded.messageIds.map(mid=>'<button class="text-button" data-seven-message="'+mid+'">#'+mid+'</button>').join('')+'</div>':''}<a class="text-button" href="/api/messages/${id}/source" download>Scarica testo originale della parte ↓</a>`;section.append(box);box.querySelectorAll('[data-seven-message]').forEach(b=>b.onclick=()=>{navigate('bbs');readMessage(Number(b.dataset.sevenMessage));});}}catch(e){section.innerHTML=`<span class="muted">${esc(e.message)}</span>`;}}
|
||||
const attachmentRead=readMessage;readMessage=async function(id){await attachmentRead(id);if(selected===id&&$('#reader .reader-footer'))showAttachments(id,$('#reader'));};
|
||||
const attachmentWlRead=wlRead;wlRead=async function(id){await attachmentWlRead(id);if(wlSelected===id&&$('#wl-reader .reader-footer'))showAttachments(id,$('#wl-reader'));};
|
||||
|
||||
document.addEventListener('bpq-languagechange',()=>{$$('.sevenplus-inline p[data-parts]').forEach(caption=>{caption.textContent=caption.dataset.fileName+' · '+BPQI18n.t(caption.dataset.parts+' parti ricostruite · CRC verificati');});});
|
||||
@@ -115,3 +115,5 @@ html{scrollbar-gutter:stable}
|
||||
@media(max-width:700px){#shell .page:not(#home){padding:20px 16px}#shell .topbar{padding-inline:16px}#shell .page :is(.page-heading,.journal-heading,.forward-heading,.chat-heading,.monitor-heading,.terminal-heading){flex-wrap:wrap;gap:12px}#shell .page :is(.page-heading,.journal-heading,.forward-heading,.chat-heading,.monitor-heading,.terminal-heading) h1{font-size:23px}#shell .page :is(.journal-kpis,.forward-summary,.aprs-activity-kpis){gap:10px}#shell .page :is(.journal-kpis article,.forward-summary>div,.aprs-activity-kpis article){padding:14px}}
|
||||
@media(max-width:600px){#shell .sidebar{padding:16px}#shell .sidebar .brand{margin:0}#shell nav button{margin:0;min-height:38px;font-size:12px;padding:8px 10px}}
|
||||
@media(prefers-reduced-motion:reduce){.arrival-toast{animation:none}.chat-messages{scroll-behavior:auto}}
|
||||
|
||||
.reader-reply-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.reader-footer:has(.reader-reply-actions){gap:12px;flex-wrap:wrap}.reader-footer .reader-reply-actions button{white-space:nowrap}@media(max-width:600px){.reader-footer .reader-reply-actions{flex:1}.reader-footer .reader-reply-actions button{flex:1}}
|
||||
+79
-4
@@ -4,6 +4,9 @@
|
||||
const entries=`
|
||||
Dal|Since
|
||||
Dettagli del registro|Log details
|
||||
Commenta|Comment
|
||||
Pubblica un commento come bollettino|Post a comment as a bulletin
|
||||
Rispondi all’autore con un messaggio personale|Reply privately to the author
|
||||
Seleziona un messaggio|Select a message
|
||||
Mappa delle stazioni|Station map
|
||||
Seleziona un collegamento|Select a connection
|
||||
@@ -707,7 +710,63 @@ Configurazione APRS applicata|APRS configuration applied
|
||||
Configurato · lascia vuoto per mantenerlo|Configured · leave blank to keep it
|
||||
Non configurato|Not configured
|
||||
Stazione / APRS|Station / APRS`;
|
||||
const dictionary=new Map((entries+'\n'+uploadCopy+'\n'+sizeCopy+'\n'+deleteCopy+'\n'+portCopy+'\n'+aprsCopy).split(/\r?\n/).map(line=>line.split('|')).filter(([source,target])=>source?.trim()&&typeof target==='string'&&target.trim()));
|
||||
const liveCopy=`Attività|Activity
|
||||
Configurazione|Configuration
|
||||
Viste APRS|APRS views
|
||||
Origine APRS|APRS source
|
||||
Direzione APRS|APRS direction
|
||||
Cerca APRS|Search APRS
|
||||
Mappa stazioni APRS|APRS station map
|
||||
Pausa vista|Pause display
|
||||
Riprendi vista|Resume display
|
||||
Vista in pausa|Display paused
|
||||
APRS in tempo reale|Live APRS
|
||||
Stazioni ricevute|Heard stations
|
||||
Centra stazioni|Fit stations
|
||||
La tua stazione|Your station
|
||||
Ultime ricezioni|Recently heard
|
||||
Traffico APRS|APRS traffic
|
||||
Da → A|From → To
|
||||
Tipo / pacchetto|Type / packet
|
||||
Senza posizione|No position
|
||||
senza posizione|without position
|
||||
sulla mappa|on map
|
||||
Nessuna stazione ricevuta con questi filtri.|No stations match these filters.
|
||||
In attesa di pacchetti APRS ricevuti o inviati.|Waiting for received or transmitted APRS packets.
|
||||
Posizione|Position
|
||||
Oggetto APRS|APRS object
|
||||
Meteo|Weather
|
||||
Telemetria|Telemetry
|
||||
Messaggio inoltrato|Forwarded message
|
||||
Richiesta|Request
|
||||
pacchetti nel registro|packets in the log
|
||||
Ultimi 2000 pacchetti · TX radio = richieste registrate da BPQ.|Last 2000 packets · Radio TX = requests logged by BPQ.
|
||||
Log Internet non disponibile|Internet log unavailable
|
||||
Aggiornato|Updated
|
||||
Salva|Save
|
||||
BBS & messaggi|BBS & messages
|
||||
messaggi|messages
|
||||
messaggio ricevuto|message received
|
||||
messaggi ricevuti|messages received
|
||||
destinazioni|destinations
|
||||
stazioni|stations
|
||||
stazione locale|local station
|
||||
in ascolto|listening
|
||||
— messaggi|— messages
|
||||
— presenti|— online
|
||||
Scrivi un messaggio…|Write a message…
|
||||
BBS / STAZIONE|BBS / STATION
|
||||
Il messaggio sarà salvato nella BBS come STAZIONE. L’inoltro segue le rotte configurate in BPQ.|The message will be saved in the station BBS. BPQ handles forwarding using its configured routes.
|
||||
Chiamata radio verso il nodo remoto avviata|Radio call to the remote node started
|
||||
il nodo remoto si è collegato alla nostra BBS|the remote node connected to our BBS
|
||||
Ricevuto e salvato un nuovo bollettino|New bulletin received and saved
|
||||
Servizio|Service
|
||||
Connessione UTC|Connection UTC
|
||||
Messaggi TX|Messages TX
|
||||
Messaggi RX|Messages RX
|
||||
CRC verificati|CRCs verified
|
||||
Sync automatico gestito dalla console.|Automatic sync managed by the console.`;
|
||||
const dictionary=new Map((entries+'\n'+uploadCopy+'\n'+sizeCopy+'\n'+deleteCopy+'\n'+portCopy+'\n'+aprsCopy+'\n'+liveCopy).split(/\r?\n/).map(line=>line.split('|')).filter(([source,target])=>source?.trim()&&typeof target==='string'&&target.trim()));
|
||||
function resolveLanguage(preference=null,languages=[]){
|
||||
if(preference==='it'||preference==='en')return preference;
|
||||
// The first browser language is the user's preferred UI language; English is the fallback.
|
||||
@@ -732,8 +791,23 @@ Stazione / APRS|Station / APRS`;
|
||||
[/^Attiva · intervallo (.+)$/,m=>'Enabled · interval '+m[1]],
|
||||
[/^Porta (\d+)$/,m=>'Port '+m[1]],
|
||||
[/^Posizioni dai locator · orari (.+)$/,m=>'Positions from locators · times '+m[1]],
|
||||
[/^Posizioni dai locator · (.+)$/,m=>'Positions from locators · '+m[1]],
|
||||
[/^Log disponibili dal (.+) · massimo 30 giorni · (.+)$/,m=>'Logs available since '+m[1]+' · up to 30 days · '+m[2]],
|
||||
[/^(\d+) sulla mappa · (\d+) senza locator$/,m=>m[1]+' on map · '+m[2]+' without locator'],
|
||||
[/^(\d+) sulla mappa · (\d+) senza posizione$/,m=>m[1]+' on map · '+m[2]+' without position'],
|
||||
[/^(\d+) pacchetti nel registro$/,m=>m[1]+' packets in the log'],
|
||||
[/^Dal (.+)$/,m=>'Since '+m[1]],
|
||||
[/^Frequenza APRS Port (\d+)$/,m=>'APRS frequency port '+m[1]],
|
||||
[/^Frequenza FM: (.+)$/,m=>'FM frequency: '+m[1]],
|
||||
[/^(.+) · ultimo collegamento (.+)$/,m=>m[1]+' · last connection '+m[2]],
|
||||
[/^Sync automatico gestito dalla console\. (.+)$/,m=>'Automatic sync managed by the console. '+translate(m[1])],
|
||||
[/^Stessa coda e stesse regole del partner (\S+)\. Sync automatico gestito dalla console\. (.+)$/,m=>'Same queue and rules as partner '+m[1]+'. Automatic sync managed by the console. '+translate(m[2])],
|
||||
[/^(\d+) parti ricostruite$/,m=>m[1]+' reconstructed parts'],
|
||||
[/^Ricostruito da (\d+) parti$/,m=>'Rebuilt from '+m[1]+' parts'],
|
||||
[/^Ricostruzione completa · (\d+)\/(\d+) parti verificate\. Anteprima e download disponibili negli allegati\.$/,m=>'Reconstruction complete · '+m[1]+'/'+m[2]+' verified parts. Preview and download available in attachments.'],
|
||||
[/^Ricevute (\d+)\/(\d+) parti\. Mancano: ([\d, ]+)\.(?: Parti danneggiate: ([\d, ]+)\.)?$/,m=>'Received '+m[1]+'/'+m[2]+' parts. Missing: '+m[3]+'.'+(m[4]?' Damaged parts: '+m[4]+'.':'')],
|
||||
[/^Ricostruzione sospesa: dati incompleti o CRC non validi nelle parti ([\d, ]+)\.$/,m=>'Reconstruction suspended: incomplete data or invalid CRCs in parts '+m[1]+'.'],
|
||||
[/^Parte (\d+)\/(\d+)\. Nessun blocco 7plus riconoscibile nel messaggio\.$/,m=>'Part '+m[1]+'/'+m[2]+'. No recognisable 7plus block in the message.'],
|
||||
[/^(\d+) km dal nodo$/,m=>m[1]+' km from node'],
|
||||
[/^Locator salvato per (\S+)$/,m=>'Locator saved for '+m[1]],
|
||||
[/^(\d+) canali? · (\d+) gateway$/,m=>m[1]+' '+(m[1]==='1'?'channel':'channels')+' · '+m[2]+' gateways'],
|
||||
@@ -752,8 +826,9 @@ Stazione / APRS|Station / APRS`;
|
||||
}
|
||||
function t(value){
|
||||
const text=String(value??'');if(language!=='en')return text;
|
||||
const whole=text.match(/^(\s*)(.*?)(\s*)$/s);if(whole&&dictionary.has(whole[2]))return whole[1]+dictionary.get(whole[2])+whole[3];
|
||||
// Preserve indentation and decorative icons, which often live in the same text node.
|
||||
const match=text.match(/^(\s*[●◇◎+↻↩⇄◉↓↑]*\s*)(.*?)(\s*[→↗↓↵]*\s*)$/s);
|
||||
const match=text.match(/^(\s*(?:(?:▸_|[\p{S}\uFE0E\uFE0F])\s*)*)(.*?)(\s*(?:[\p{S}\uFE0E\uFE0F]\s*)*)$/su);
|
||||
return match?match[1]+translate(match[2])+match[3]:translate(text);
|
||||
}
|
||||
const api={t,resolveLanguage,get language(){return language},get preference(){return preference},locale:()=>language==='it'?'it-IT':'en-GB'};
|
||||
@@ -764,8 +839,8 @@ Stazione / APRS|Station / APRS`;
|
||||
language=resolveLanguage(preference||globalThis.BPQ_DEFAULT_LANGUAGE,browserLanguages());preference=language;try{localStorage.setItem('bpq-language',language);}catch{}document.documentElement.lang=language;
|
||||
const originals=new WeakMap(),attributes=new WeakMap();
|
||||
// These are user/protocol data, never interface copy. Do not translate their labels or contents.
|
||||
const protectedContent='script,style,textarea,pre,code,[contenteditable],[data-no-i18n],.reader-body,.mail-subject,.mail-from,.mail-category,.reader-header h2,.reader-meta b,.chat-message-content p,.chat-message-meta strong,.chat-user-name,.chat-user b,.chat-user small,.room-button,#chat-room-name,.attachment-row b,#attachment-title,#delete-subject,.arrival-toast small,.side-station,.profile>div,.mission-heading h1,.mission-location,.modem-brand,#caller-call,#called-call,.service-call,#nodes,.wl-account,#wl-gateway-rows td:nth-child(2),#category option:not([value]),#terminal-output,.monitor-frame';
|
||||
function excluded(el){return !el||!!el.closest(protectedContent);}
|
||||
const protectedContent='script,style,textarea,pre,code,[contenteditable],[data-no-i18n],.reader-body,.mail-subject,.mail-from,.mail-category,.reader-header h2,.reader-meta b,.chat-message-content p,.chat-message-meta strong,.chat-user-name,.chat-user b,.chat-user small,.room-button,#chat-room-name,.attachment-row b,#attachment-title,#delete-subject,.arrival-toast small,.side-station,.profile>div,.mission-heading h1,.mission-location,.modem-brand,#caller-call,#called-call,.service-call,#nodes,.wl-account,#wl-gateway-rows td:nth-child(2),#category option:not([value]),#terminal-output,.monitor-frame,.aprs-packet-preview,.aprs-received-station p,.aprs-map-popup p,.aprs-map-popup b,.aprs-map-popup small';
|
||||
function excluded(el){if(!el)return true;if(el.matches('.routing-trace>summary,.sevenplus-original>summary'))return false;return !!el.closest(protectedContent);}
|
||||
function textNode(node){
|
||||
if(excluded(node.parentElement))return;
|
||||
let entry=originals.get(node);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="it"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#101916"><title>BPQ Console</title><link rel="stylesheet" href="/i18n.css"><script src="/ui-config.js"></script><script src="/i18n.js?v=20261018-empty-text-fix"></script><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/dark.css"><link rel="stylesheet" href="/mission.css"><link rel="stylesheet" href="/busy.css"><script defer src="/busy.js"></script><script defer src="/app.js"></script><script type="module" src="/enhancements.js"></script><script defer src="/winlink.js"></script><script defer src="/mission.js"></script><script defer src="/attachments.js"></script><link rel="stylesheet" href="/compose-attachments.css"><script defer src="/compose-attachments.js"></script><link rel="stylesheet" href="/monitor.css"><script defer src="/monitor.js"></script><link rel="stylesheet" href="/journal.css"><script defer src="/journal.js"></script><link rel="stylesheet" href="/forwarding.css"><script defer src="/forwarding.js?v=20261017-hourly-2"></script><link rel="stylesheet" href="/winlink-radio.css"><script defer src="/winlink-radio.js"></script><link rel="stylesheet" href="/terminal.css"><script defer src="/terminal.js"></script><link rel="stylesheet" href="/radio-control.css"><link rel="stylesheet" href="/radio-ports.css"><script defer src="/radio-ports.js"></script><link rel="stylesheet" href="/aprs.css"><script defer src="/aprs.js"></script><link rel="stylesheet" href="/vendor/leaflet/leaflet.css"><script defer src="/vendor/leaflet/leaflet.js"></script><link rel="stylesheet" href="/aprs-activity.css?v=20261017-3"><script defer src="/aprs-activity.js?v=20261017-3"></script><link rel="stylesheet" href="/sync-progress.css"><script type="module" src="/sync-progress.js"></script></head>
|
||||
<html lang="it"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#101916"><title>BPQ Console</title><link rel="stylesheet" href="/i18n.css"><script src="/ui-config.js"></script><script src="/i18n.js?v=20261019-label-audit"></script><link rel="stylesheet" href="/style.css"><link rel="stylesheet" href="/dark.css"><link rel="stylesheet" href="/mission.css"><link rel="stylesheet" href="/busy.css"><script defer src="/busy.js"></script><script defer src="/app.js"></script><script type="module" src="/enhancements.js"></script><script defer src="/winlink.js"></script><script defer src="/mission.js"></script><script defer src="/attachments.js"></script><link rel="stylesheet" href="/compose-attachments.css"><script defer src="/compose-attachments.js"></script><link rel="stylesheet" href="/monitor.css"><script defer src="/monitor.js"></script><link rel="stylesheet" href="/journal.css"><script defer src="/journal.js"></script><link rel="stylesheet" href="/forwarding.css"><script defer src="/forwarding.js?v=20261017-hourly-2"></script><link rel="stylesheet" href="/winlink-radio.css"><script defer src="/winlink-radio.js"></script><link rel="stylesheet" href="/terminal.css"><script defer src="/terminal.js"></script><link rel="stylesheet" href="/radio-control.css"><link rel="stylesheet" href="/radio-ports.css"><script defer src="/radio-ports.js"></script><link rel="stylesheet" href="/aprs.css"><script defer src="/aprs.js"></script><link rel="stylesheet" href="/vendor/leaflet/leaflet.css"><script defer src="/vendor/leaflet/leaflet.js"></script><link rel="stylesheet" href="/aprs-activity.css?v=20261017-3"><script defer src="/aprs-activity.js?v=20261017-3"></script><link rel="stylesheet" href="/sync-progress.css"><script type="module" src="/sync-progress.js"></script></head>
|
||||
<body>
|
||||
<section id="login" class="login-screen"><div class="login-art"><h1>BPQ Console</h1><div class="login-byline" data-no-i18n>by IU2EUG</div><p>La tua stazione, in un unico pannello.</p></div><form id="login-form" class="login-card"><div class="login-brand"><span class="brand">BPQ Console</span><div class="login-byline" data-no-i18n>by IU2EUG</div></div><h2>Benvenuto in stazione.</h2><p>Accedi con l’utente e la password Telnet del tuo BPQ.</p><label>Utente<input name="user" autocomplete="username" required placeholder="Il tuo utente BPQ"></label><label>Password<input name="password" type="password" autocomplete="current-password" required></label><button class="primary" type="submit">Entra nel pannello <span>→</span></button><div id="login-error" class="error" role="alert"></div></form></section>
|
||||
<div id="shell" hidden><aside class="sidebar"><a class="brand" href="#home">BPQ Console</a><div class="side-label">LA TUA STAZIONE</div><nav><button data-page="home" class="active"><span>▦</span> Panoramica</button><button data-page="bbs"><span>▤</span> BBS <b id="nav-count">—</b></button><button data-page="network"><span>⌘</span> Rete & nodi</button></nav><div class="side-station">Stazione BPQ</div><div class="profile"><div class="avatar">BP</div><div>Sysop<small>BPQ</small></div><button id="logout" title="Esci" aria-label="Esci dal pannello">↗</button></div></aside>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
function renderSelected(){const p=port();if(!p)return;const originalRadio=station.radio,originalControl=window.bpqRadioControl;station.radio={id:p.id,name:p.name,driver:p.driver};window.bpqRadioControl={txSuspended:data.global.txSuspended||p.control.txSuspended||!p.control.listening};
|
||||
try{legacyRender({current:p.current,history:p.history});$('#radio-status').textContent=!p.control.listening?'PORTA FERMA':window.bpqRadioControl.txSuspended?'TX SOSPESO':!p.current.available?'OFFLINE':p.current.ptt?'TX':p.current.active?'LINK ATTIVO':'IN ASCOLTO';$('#session-detail').textContent=p.name;$('#modem-traffic').textContent=p.current.sent!=null?'TX '+size(p.current.sent)+' / RX '+size(p.current.received||0):'TX '+rate(p.current.txFrames)+' / RX '+rate(p.current.rxFrames)+' frame';$('#bps-value').textContent=p.current.txBps==null&&p.current.rxBps==null?'—':rate((p.current.txBps||0)+(p.current.rxBps||0));$('#bps-caption').textContent=p.current.txBps==null?'Statistiche frame BPQ':'TX '+rate(p.current.txBps)+' / RX '+rate(p.current.rxBps)+' bit/s';$('#radio-scan').textContent=p.current.scan?'● Scansione attiva':p.control.listening?'● Frequenza fissa':'● Porta ferma';$('#radio-modem').textContent='PORT '+p.id+' · '+p.driver;}
|
||||
finally{station.radio=originalRadio;window.bpqRadioControl=originalControl;}
|
||||
document.querySelector('.modem-brand').textContent='PORTE RADIO';
|
||||
document.querySelector('.modem-brand').textContent=BPQI18n.t('PORTE RADIO');
|
||||
const packet=/KISS|AX25|AX\.25/i.test(p.driver),cards=document.querySelectorAll('.telemetry-grid article');cards[1].querySelector('header>span').textContent=packet?'FRAME AX.25':'SNR / BPQ';cards[2].querySelector('header>span').textContent=packet?'TIMEOUT L2':/VARA/i.test(p.driver)?'CPU VARA':'CPU MODEM';cards[2].querySelector('footer').textContent=packet?'Contatore BPQ':'Processo modem · ogni 5 s';
|
||||
if(packet){$('#snr-value').textContent=rate(p.current.txFrames)+' / '+rate(p.current.rxFrames);$('#snr-chart').innerHTML=graph(p.history,['txFrames','rxFrames'],'frame AX25',10);$('#snr-caption').textContent='TX / RX · contatori BPQ';$('#vara-cpu-value').textContent=rate(p.current.timeouts);$('#vara-cpu-chart').innerHTML=graph(p.history,['timeouts'],'timeout L2',5);}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user