Decode APRS station symbols and improve map centering

Render local APRS symbol sprites with table and overlay details while preserving markers and open popups during refresh.

Open the map around the local station with a 30 km radius and fit the densest station group without distant outliers. Add localization, attribution and regression coverage.
This commit is contained in:
alberto committed 2026-10-19 14:08:49 +02:00
1 parent 2ef3c25eb3
commit 8ee4e9636a
14 files changed
+605 -21

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
import {aprsSymbol,nativeSymbol} from './aprs-symbols.mjs';
import {AprsKiss} from './aprs-kiss.mjs';
import {readFile,writeFile,rename,open,stat,readdir} from 'node:fs/promises';import path from 'node:path';
import {plain,decode} from './bpq.mjs';import {Monitor} from './monitor.mjs';
@@ -7,13 +8,13 @@ export function parseRadioAprs(frame){const lines=frame.text.split('\n'),m=lines
export function parseIsAprs(line,date){const m=line.match(/^(\d{2}:\d{2}:\d{2})([RT])\s+(.*)$/);if(!m)return null;const packet=parseTnc2(m[3]);return packet?{...packet,at:date+'T'+m[1]+'Z',direction:m[2]==='T'?'TX':'RX',transport:'Internet',port:null,evidence:'BPQ APRS-IS log'}:null;}
export function positionOf(body){let text=body;if(/[\/@]/.test(text[0]))text=text.slice(8);else if(/[!=]/.test(text[0]))text=text.slice(1);else return null;
const m=text.match(/^(\d{2})(\d{2}\.\d{2})([NS])(.)(\d{3})(\d{2}\.\d{2})([EW])(.)(.*)$/);if(!m||Number(m[2])>=60||Number(m[6])>=60)return null;const lat=(+m[1]+Number(m[2])/60)*(m[3]==='S'?-1:1),lon=(+m[5]+Number(m[6])/60)*(m[7]==='W'?-1:1);return Math.abs(lat)<=90&&Math.abs(lon)<=180?{lat,lon,symbol:m[8],symset:m[4]}:null;}
export function parseNativeStations(text,now=Date.now()){const out=[];for(const row of text.split(/\r?\n\|/)){const m=row.trim().match(/^A,(-?[\d.]+),(-?[\d.]+),([^,]+),([\s\S]*),([A-Fa-f0-9]{4}.),(\d+)$/);if(!m)continue;const lat=Number(m[1]),lon=Number(m[2]),call=m[3];if(!/^[A-Z0-9-]{2,12}$/i.test(call)||!Number.isFinite(lat)||!Number.isFinite(lon)||Math.abs(lat)>90||Math.abs(lon)>180)continue;const detail=decode(m[4]),port=Number(detail.match(/Last Heard:.*?on Port (\d+)/)?.[1])||0,lines=detail.split(/<br\s*\/?\s*>/i).map(s=>plain(s).trim()).filter(Boolean);out.push({call,position:{lat,lon},lastAt:new Date(now-Number(m[6])*1000).toISOString(),transport:port?'Radio':'Internet',port:port||null,path:lines[0]||'',lastBody:lines[1]||'',status:lines.find(s=>!s.startsWith('Last Heard')&&!s.startsWith('Distance')&&s!==lines[0]&&s!==lines[1])||'',heardRadio:port>0,positionSource:'BPQ APRS decoder',native:true});}return out;}
export function parseNativeStations(text,now=Date.now()){const out=[];for(const row of text.split(/\r?\n\|/)){const m=row.trim().match(/^A,(-?[\d.]+),(-?[\d.]+),([^,]+),([\s\S]*),([A-Fa-f0-9]{4}.),(\d+)$/);if(!m)continue;const lat=Number(m[1]),lon=Number(m[2]),call=m[3];if(!/^[A-Z0-9-]{2,12}$/i.test(call)||!Number.isFinite(lat)||!Number.isFinite(lon)||Math.abs(lat)>90||Math.abs(lon)>180)continue;const detail=decode(m[4]),port=Number(detail.match(/Last Heard:.*?on Port (\d+)/)?.[1])||0,lines=detail.split(/<br\s*\/?\s*>/i).map(s=>plain(s).trim()).filter(Boolean);out.push({call,position:{lat,lon,...nativeSymbol(m[5])},lastAt:new Date(now-Number(m[6])*1000).toISOString(),transport:port?'Radio':'Internet',port:port||null,path:lines[0]||'',lastBody:lines[1]||'',status:lines.find(s=>!s.startsWith('Last Heard')&&!s.startsWith('Distance')&&s!==lines[0]&&s!==lines[1])||'',heardRadio:port>0,positionSource:'BPQ APRS decoder',native:true});}return out;}
export class AprsActivity{
constructor(config,dir,bpq,credentials,settings){this.config=config;this.bpq=bpq;this.settings=settings;this.file=path.join(dir,'aprs-activity.cache.json');this.events=[];this.stations=new Map();this.seq=0;this.cursor=0;this.monitor=new Monitor(credentials,{port:config.monitorPort});this.kiss=(config.aprsKissMonitor||[]).map(endpoint=>new AprsKiss(endpoint,(packet,port)=>this.ingest({...parseTnc2(packet),at:new Date().toISOString(),direction:'RX',transport:'Radio',port,evidence:'KISS receive-only monitor'})));this.lastNative=0;this.lastPersist=0;this.logFile=null;this.logOffset=null;this.partial='';this.errors=[];this.started=false;this.busy=false;this.init=this.restore();this.timer=setInterval(()=>{if(this.started)this.sample().catch(()=>{});},2000);this.timer.unref();}
async restore(){try{const data=JSON.parse(await readFile(this.file,'utf8'));this.events=(data.events||[]).slice(-2000);this.seq=this.events.at(-1)?.id||0;this.logFile=data.logFile||null;this.logOffset=data.logOffset??null;this.partial=data.partial||'';this.ownPosition=data.ownPosition;for(const s of data.stations||[])if(s.call)this.stations.set(s.call,s);}catch{} }
async start(){await this.init;if(this.starting)return this.starting;if(this.started)return this.snapshot();this.starting=(async()=>{this.started=true;await this.native();try{await this.settings.enableLogging();this.logging=true;}catch{this.logging=false;}if(this.config.monitorPort)await this.monitor.connect();await this.sample();return this.snapshot();})();try{return await this.starting;}finally{this.starting=null;}}
ingest(event){if(!event?.type)return;if(this.events.slice(-40).some(e=>e.packet===event.packet&&e.direction===event.direction&&e.port===event.port&&Math.abs(Date.parse(e.at)-Date.parse(event.at))<1000))return;event={...event,id:++this.seq};this.events.push(event);if(this.events.length>2000)this.events.shift();if(event.direction==='RX'){const old=this.stations.get(event.from)||{call:event.from},position=positionOf(event.body)||old.position;this.stations.set(event.from,{...old,lastAt:event.at,transport:event.transport,port:event.port,path:event.path,lastBody:event.body,heardRadio:old.heardRadio||event.transport==='Radio',position,positionSource:positionOf(event.body)?'APRS position':old.positionSource});}}
async native(){try{const html=await this.bpq('/aprsdata.txt?90|-90|-180|180|1|0|0');const home=html.match(/(?:^|\|)H,(-?[\d.]+),(-?[\d.]+),/);if(home&&Math.abs(+home[1])<=90&&Math.abs(+home[2])<=180)this.ownPosition={lat:+home[1],lon:+home[2]};for(const station of parseNativeStations(html)){const old=this.stations.get(station.call);this.stations.set(station.call,{...old,...station,heardRadio:station.heardRadio||old?.heardRadio});}this.nativeAvailable=true;}catch{this.nativeAvailable=false;}this.lastNative=Date.now();}
async native(){try{const html=await this.bpq('/aprsdata.txt?90|-90|-180|180|1|0|0');const home=html.match(/(?:^|\|)H,(-?[\d.]+),(-?[\d.]+),/);if(home&&Math.abs(+home[1])<=90&&Math.abs(+home[2])<=180)this.ownPosition={lat:+home[1],lon:+home[2]};try{const settings=await this.settings.snapshot?.();if(settings&&this.ownPosition)this.ownPosition={...this.ownPosition,...aprsSymbol(settings.symset,settings.symbol)};}catch{}for(const station of parseNativeStations(html)){const old=this.stations.get(station.call);this.stations.set(station.call,{...old,...station,position:{...old?.position,...station.position},heardRadio:station.heardRadio||old?.heardRadio});}this.nativeAvailable=true;}catch{this.nativeAvailable=false;}this.lastNative=Date.now();}
async readLog(){const now=new Date(),date=now.toISOString().slice(0,10),day=date.replaceAll('-','').slice(2);let file=null;for(const folder of [this.config.aprsLogDirectory,path.join(this.config.root,'Logs'),path.join(this.config.root,'logs')].filter(Boolean)){const candidate=path.join(folder,'APRS_'+day+'.log');try{await stat(candidate);file=candidate;break;}catch{}}if(!file)return;
const info=await stat(file);if(file!==this.logFile){this.logFile=file;this.logOffset=Math.max(0,info.size-262144);this.partial='';}if(info.size<this.logOffset){this.logOffset=0;this.partial='';}if(info.size===this.logOffset)return;const handle=await open(file,'r');try{const data=Buffer.alloc(Math.min(262144,info.size-this.logOffset)),read=await handle.read(data,0,data.length,this.logOffset);this.logOffset+=read.bytesRead;const lines=(this.partial+data.subarray(0,read.bytesRead).toString('utf8')).split(/\r?\n/);this.partial=lines.pop().slice(-4096);for(const line of lines)this.ingest(parseIsAprs(line,date));}finally{await handle.close();}}
async sample(){if(this.busy)return;this.busy=true;try{this.errors=[];for(const source of this.kiss)source.connect();if(this.config.monitorPort){const s=this.monitor.snapshot(this.cursor);if(['offline','error'].includes(s.state))await this.monitor.connect();for(const e of s.events)this.ingest(parseRadioAprs(e));this.cursor=s.latest;}
+13
View File
@@ -0,0 +1,13 @@
// APRS table identifiers and BPQ's row/column icon keys (APRSCode.c).
export function aprsSymbol(symset,symbol){
if(typeof symbol!=='string'||symbol.length!==1||symbol<'!'||symbol>'~'||!/^[/\\A-Z0-9]$/.test(symset||''))return null;
return {symbol,symset,table:symset==='/'?'primary':'alternate',overlay:/^[A-Z0-9]$/.test(symset)?symset:null};
}
export function nativeSymbol(key){
if(!/^[0-9a-f]{4}[@A-Z0-9]$/i.test(key||''))return null;
const row=parseInt(key.slice(0,2),16),col=parseInt(key.slice(2,4),16);
if(row>11||col>15)return null;
const index=(row%6)*16+col;if(index>93)return null;
const overlay=key[4]==='@'?null:key[4];if(overlay&&row<6)return null;
return aprsSymbol(overlay||(row<6?'/':'\\'),String.fromCharCode(33+index));
}
+30
View File
@@ -0,0 +1,30 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {aprsSymbol,nativeSymbol} from './aprs-symbols.mjs';
import {parseNativeStations,positionOf} from './aprs-activity.mjs';
import vm from 'node:vm';
import {readFileSync} from 'node:fs';
test('APRS codes distinguish the primary, alternate and overlay tables without guessing a station type',()=>{
assert.deepEqual(nativeSymbol('010D@'),aprsSymbol('/','>'));
assert.deepEqual(nativeSymbol('0602W'),aprsSymbol('W','#'));
assert.deepEqual(nativeSymbol('0602@'),aprsSymbol('\\','#'));
for(const key of ['FFFF@','000FZ','0B0E@','bad'])assert.equal(nativeSymbol(key),null);
assert.equal(aprsSymbol('?','>'),null);assert.equal(aprsSymbol('/','<script>'),null);
const station=parseNativeStations('A,45,9,N0TEST,APRS<br>Mic-E<br>,0602W,10\r\n|')[0];
assert.equal(station.position.symbol,'#');assert.equal(station.position.symset,'W');assert.equal(station.position.overlay,'W');
assert.deepEqual(aprsSymbol(positionOf('!4534.18NW00907.89E#').symset,'#'),aprsSymbol('W','#'));
});
test('local sprites use the correct ASCII slot and escaped, validated overlay characters',()=>{
const context=vm.createContext({window:{}});vm.runInContext(readFileSync(new URL('./public/aprs-symbols.js',import.meta.url),'utf8'),context);
const symbols=context.window.BPQAprsSymbols;
assert.equal(symbols.decode({symset:'/',symbol:'>'}).name,'Car');
assert.match(symbols.html({symset:'/',symbol:'>'}),/primary.*col-13.*row-1/);
assert.match(symbols.html({symset:'W',symbol:'#'}),/alternate.*col-2.*row-0.*overlay">W/);
assert.match(symbols.html({symset:'<',symbol:'>'}),/unknown/);
assert.equal(symbols.decode({}),null);
assert.doesNotMatch(symbols.html({symset:'/',symbol:'>'}),/style=|class="primary/);
const css=readFileSync(new URL('./public/aprs-activity.css',import.meta.url),'utf8');
assert.match(css,/\.aprs-symbol-col-13\{background-position-x:-312px\}/);
assert.match(css,/\.aprs-symbol-row-1\{background-position-y:-24px\}/);
});
+32 -3
View File
@@ -15,22 +15,23 @@ function harness(file,exportCode,api=async()=>{}){
const context=vm.createContext({$, $$:()=>[],window:{},document:{hidden:false,activeElement:null,createElement:element,addEventListener(){},getElementById(){return null;}},
BPQI18n:{t:s=>s,locale:()=> 'en-GB'},csrf:'test',page:'none',navigate(){},api,fetch:async()=>({ok:true,json:async()=>({features:[]})}),
size:n=>String(n),mailTimezone:()=> 'UTC',esc:s=>String(s??''),toast(){},setInterval(){},setTimeout(){},requestAnimationFrame:f=>f()});
vm.runInContext(readFileSync(new URL('./public/aprs-symbols.js',import.meta.url),'utf8'),context);
const source=readFileSync(new URL('./public/'+file,import.meta.url),'utf8');
vm.runInContext(source.replace(/\}\)\(\);\s*$/,exportCode+'\n})();'),context);
return {context,$,fixture:context.fixture};
}
function leaflet(){
const state={created:[],fits:0,removals:[],zoom:9},map={setView(){return this;},fitBounds(){state.fits++;return this;},getZoom:()=>state.zoom};
const state={created:[],fits:0,removals:[],zoom:9},map={setView(){return this;},fitBounds(bounds,options){state.fits++;state.bounds=bounds;state.fitOptions=options;return this;},getZoom:()=>state.zoom};
const layers={addTo(){return this;},removeLayer(m){state.removals.push(m);}};
function marker(point,options){
let popup='',tooltip='';const m={point,options,moves:0,popupWrites:0,open:false,
bindTooltip(s){tooltip=s;return this;},bindPopup(s,o){popup=s;this.popupOptions=o;return this;},on(){return this;},addTo(){return this;},
getLatLng(){return {lat:this.point[0],lng:this.point[1]};},setLatLng(p){this.point=p;this.moves++;return this;},setStyle(o){Object.assign(this.options,o);},
setIcon(icon){this.options.icon=icon;this.iconWrites=(this.iconWrites||0)+1;return this;},getLatLng(){return {lat:this.point[0],lng:this.point[1]};},setLatLng(p){this.point=p;this.moves++;return this;},setStyle(o){Object.assign(this.options,o);},
getPopup(){return {getContent:()=>popup};},setPopupContent(s){popup=s;this.popupWrites++;},
getTooltip(){return {getContent:()=>tooltip};},setTooltipContent(s){tooltip=s;},openPopup(){this.open=true;}};
state.created.push(m);return m;
}
return {state,L:{map:()=>map,tileLayer:()=>({addTo(){}}),layerGroup:()=>layers,circleMarker:marker,latLngBounds:p=>p}};
return {state,L:{map:()=>map,tileLayer:()=>({addTo(){}}),layerGroup:()=>layers,circleMarker:marker,marker,divIcon:options=>options,latLngBounds:p=>p}};
}
const station=(call,lat=45)=>({call,transport:'Radio',position:{lat,lon:9,locator:'JN45MM'},lastAt:'2026-01-01T12:00:00Z',status:'On air',lastBody:'',path:'TEST',services:['BBS']});
const aprsData=()=>({stations:[station('N0AAA'),station('N0BBB',46)],own:{call:'N0LOCAL',position:{lat:44,lon:9}}});
@@ -46,6 +47,9 @@ test('APRS polling keeps marker identity, popup and viewport; changed positions
data=structuredClone(data);data.stations[0].position.lat=45.1;data.stations[0].status='Updated';h.fixture.setData(data);h.fixture.renderMap();
assert.equal(first.moves,1);assert.equal(first.popupWrites,1);assert.equal(first.open,true);assert.equal(second.moves,0);assert.equal(l.state.fits,1);
assert.equal(first.popupOptions.autoPan,false);
data.stations[0].position.symset='W';data.stations[0].position.symbol='#';h.fixture.setData(data);h.fixture.renderMap();
assert.equal(first.iconWrites,1);assert.match(first.options.icon.html,/alternate.*overlay/);assert.equal(first.open,true);
h.fixture.setData(structuredClone(data));h.fixture.renderMap();assert.equal(first.iconWrites,1);assert.equal(l.state.created.length,3);assert.equal(l.state.fits,1);
});
test('APRS removes only stations outside the filter and retains the local marker',()=>{
@@ -83,3 +87,28 @@ test('background API polls stay quiet, while interactive requests finish the bus
await context.api('/journal');assert.equal(starts,1);assert.equal(finishes,1);
fail=true;await assert.rejects(context.api('/journal'),/offline/);assert.equal(starts,2);assert.equal(finishes,2);
});
test('APRS density fit excludes isolated distant stations and favours a tied group near home',()=>{
const h=harness('aprs-activity.js','globalThis.fixture={densePositions,distanceKm,localBounds};');
const home={lat:45.57,lon:9.13},near=[home,{lat:45.7,lon:9.4},{lat:45.4,lon:9.3}],remote=[{lat:51.5,lon:-.1},{lat:51.6,lon:-.2},{lat:51.4,lon:0}];
const result=h.fixture.densePositions([...remote,...near,{lat:30,lon:120},null,{lat:NaN,lon:4}],home);
assert.equal(result.length,4);assert.ok(result.every(p=>h.fixture.distanceKm(home,p)<100));
assert.equal(h.fixture.densePositions([],null).length,0);
assert.equal(h.fixture.densePositions([],home).length,1);
});
test('APRS opens at a 30 km radius and refresh does not reset a manually selected density fit',()=>{
const h=harness('aprs-activity.js','globalThis.fixture={setData(value){data=value;},renderMap,fit,fitLocal,distanceKm};'),l=leaflet();
h.context.L=l.L;h.context.window.L=l.L;h.context.page='aprs';
const data=aprsData();data.own.position={lat:45.57,lon:9.13};data.stations.push(station('DISTANT',-30));
h.fixture.setData(data);h.fixture.renderMap();
const [southwest,northeast]=l.state.bounds,home=data.own.position;
assert.ok(Math.abs(h.fixture.distanceKm(home,{lat:southwest[0],lon:home.lon})-30)<.001);
assert.ok(Math.abs(h.fixture.distanceKm(home,{lat:home.lat,lon:northeast[1]})-30)<.01);
assert.equal(h.$('#aprs-map-local').attributes['aria-pressed'],'true');assert.equal((southwest[0]+northeast[0])/2,home.lat);assert.equal(h.$('#aprs-map-local').disabled,false);
h.fixture.fit();assert.equal(h.$('#aprs-map-fit').attributes['aria-pressed'],'true');const bounds=JSON.stringify(l.state.bounds);assert.ok(l.state.bounds.every(p=>p[0]>0));
h.fixture.setData(structuredClone(data));h.fixture.renderMap();assert.equal(l.state.fits,2);assert.equal(JSON.stringify(l.state.bounds),bounds);
h.fixture.fitLocal();assert.equal(l.state.fits,3);
data.own.position=null;h.fixture.setData(data);h.fixture.renderMap();assert.equal(h.$('#aprs-map-local').disabled,true);h.fixture.fitLocal();assert.equal(l.state.fits,3);
});
+21
View File
@@ -24,3 +24,24 @@
.aprs-traffic-card>footer summary{cursor:pointer;width:fit-content;color:#a9bfd6;font-size:12px}.aprs-traffic-card>footer p{margin-top:8px;line-height:1.65}
.aprs-map-card .leaflet-tile-pane{filter:invert(1) hue-rotate(180deg) saturate(.4) brightness(.9) contrast(.85)}
/* APRS icons use local high-resolution sprites; transport remains a separate rim. */
.aprs-station-icon{display:grid;place-items:center;background:#edf1ed;border:2px solid #6fd4b1;border-radius:8px;box-shadow:0 2px 7px #0008}
.aprs-station-icon.internet{border-color:#81b9f4}
.aprs-symbol-image{position:relative;display:inline-block;width:24px;height:24px;flex:0 0 24px;background-size:384px 144px;background-repeat:no-repeat;vertical-align:middle}
.aprs-symbol-image.aprs-symbol-primary{background-image:url('/vendor/aprs-symbols/primary.png')}
.aprs-symbol-image.aprs-symbol-alternate{background-image:url('/vendor/aprs-symbols/alternate.png')}
.aprs-symbol-overlay{position:absolute;inset:0;display:grid;place-items:center;font:900 15px/1 Arial,sans-serif;color:#111;text-shadow:1px 0 #fff,-1px 0 #fff,0 1px #fff,0 -1px #fff}
.aprs-symbol-unknown{display:inline-grid;place-items:center;width:24px;height:24px;color:#647373;font:700 17px/1 sans-serif}
.aprs-list-symbol{display:inline-grid;place-items:center;background:#edf1ed;border-radius:5px;flex:0 0 28px;height:28px;margin-right:7px}
.aprs-symbol-detail{font-size:11px;color:var(--muted,#99aaa5);line-height:1.5}
.aprs-symbol-detail code{color:inherit;font-size:11px}
.aprs-received-station>span{justify-content:flex-start;gap:7px}.aprs-received-station>span>b{flex:1}.aprs-list-symbol{margin-right:0}.aprs-station-icon.own{border-color:#efcf89;box-shadow:0 0 0 3px #efcf8930,0 2px 7px #0008}
.aprs-symbol-col-0{background-position-x:0px}.aprs-symbol-col-1{background-position-x:-24px}.aprs-symbol-col-2{background-position-x:-48px}.aprs-symbol-col-3{background-position-x:-72px}.aprs-symbol-col-4{background-position-x:-96px}.aprs-symbol-col-5{background-position-x:-120px}.aprs-symbol-col-6{background-position-x:-144px}.aprs-symbol-col-7{background-position-x:-168px}.aprs-symbol-col-8{background-position-x:-192px}.aprs-symbol-col-9{background-position-x:-216px}.aprs-symbol-col-10{background-position-x:-240px}.aprs-symbol-col-11{background-position-x:-264px}.aprs-symbol-col-12{background-position-x:-288px}.aprs-symbol-col-13{background-position-x:-312px}.aprs-symbol-col-14{background-position-x:-336px}.aprs-symbol-col-15{background-position-x:-360px}
.aprs-symbol-row-0{background-position-y:0px}.aprs-symbol-row-1{background-position-y:-24px}.aprs-symbol-row-2{background-position-y:-48px}.aprs-symbol-row-3{background-position-y:-72px}.aprs-symbol-row-4{background-position-y:-96px}.aprs-symbol-row-5{background-position-y:-120px}
.aprs-map-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.aprs-map-actions .secondary{white-space:nowrap}@media(max-width:650px){.aprs-map-actions{width:100%;justify-content:flex-start}.aprs-map-actions .secondary{flex:1}}
.aprs-map-actions .secondary[aria-pressed=true]{border-color:#88c7b1;background:#8acbb018;color:#c8ebdf}
+51 -14
View File
@@ -1,7 +1,7 @@
(()=>{
const section=$('#aprs'),form=$('#aprs-form'),heading=form.querySelector('.page-heading');section.prepend(heading);$('#aprs-save').setAttribute('form','aprs-form');
const tabs=document.createElement('div');tabs.className='aprs-view-tabs';tabs.setAttribute('role','tablist');tabs.setAttribute('aria-label','Viste APRS');tabs.innerHTML='<button role="tab" aria-selected="true" data-aprs-view="activity">Attività</button><button role="tab" aria-selected="false" data-aprs-view="config">Configurazione</button>';heading.after(tabs);
const pane=document.createElement('section');pane.className='aprs-activity-pane';pane.innerHTML='<div class="aprs-activity-toolbar"><span id="aprs-live-state" class="tag">Collegamento…</span><select id="aprs-source" aria-label="Origine APRS"><option value="Radio">Radio</option><option value="">Radio + Internet</option><option value="Internet">Internet</option></select><select id="aprs-direction" aria-label="Direzione APRS"><option value="">RX + TX</option><option value="RX">RX</option><option value="TX">TX</option></select><input id="aprs-search" type="search" placeholder="Cerca nominativo o testo…" aria-label="Cerca APRS"><button class="secondary" id="aprs-activity-pause">Pausa vista</button><button class="secondary" id="aprs-activity-refresh">↻ Aggiorna</button></div><div class="aprs-activity-kpis" id="aprs-activity-kpis"></div><div class="aprs-map-layout"><article class="card aprs-map-card"><header><div><h2>Stazioni ricevute</h2><span id="aprs-map-count"></span></div><button class="secondary" id="aprs-map-fit">Centra stazioni</button></header><div id="aprs-station-map" aria-label="Mappa stazioni APRS"></div><footer><span class="aprs-legend radio">Radio</span><span class="aprs-legend internet">Internet</span><span class="aprs-legend own">La tua stazione</span></footer></article><aside class="card aprs-stations-card"><header><h2>Ultime ricezioni</h2></header><div id="aprs-received-stations"></div></aside></div><article class="card aprs-traffic-card"><header><h2>Traffico APRS</h2><span id="aprs-traffic-count"></span></header><div class="aprs-traffic-scroll"><table class="aprs-traffic-table"><thead><tr><th>Data e ora</th><th>Direzione</th><th>Trasporto</th><th>Da → A</th><th>Tipo / pacchetto</th></tr></thead><tbody id="aprs-traffic-rows"></tbody></table></div><footer><details><summary>Dettagli del registro</summary><p id="aprs-traffic-scope"></p></details></footer></article><div class="aprs-activity-status" id="aprs-activity-status" role="status"></div>';
const pane=document.createElement('section');pane.className='aprs-activity-pane';pane.innerHTML='<div class="aprs-activity-toolbar"><span id="aprs-live-state" class="tag">Collegamento…</span><select id="aprs-source" aria-label="Origine APRS"><option value="Radio">Radio</option><option value="">Radio + Internet</option><option value="Internet">Internet</option></select><select id="aprs-direction" aria-label="Direzione APRS"><option value="">RX + TX</option><option value="RX">RX</option><option value="TX">TX</option></select><input id="aprs-search" type="search" placeholder="Cerca nominativo o testo…" aria-label="Cerca APRS"><button class="secondary" id="aprs-activity-pause">Pausa vista</button><button class="secondary" id="aprs-activity-refresh">↻ Aggiorna</button></div><div class="aprs-activity-kpis" id="aprs-activity-kpis"></div><div class="aprs-map-layout"><article class="card aprs-map-card"><header><div><h2>Stazioni ricevute</h2><span id="aprs-map-count"></span></div><div class="aprs-map-actions"><button class="secondary" id="aprs-map-fit" aria-pressed="false" title="Inquadra il gruppo più denso, ignorando le stazioni isolate">Centra stazioni</button><button class="secondary" id="aprs-map-local" aria-pressed="true">Zona locale · 30 km</button></div></header><div id="aprs-station-map" aria-label="Mappa stazioni APRS"></div><footer><span class="aprs-legend radio">Radio</span><span class="aprs-legend internet">Internet</span><span class="aprs-legend own">La tua stazione</span></footer></article><aside class="card aprs-stations-card"><header><h2>Ultime ricezioni</h2></header><div id="aprs-received-stations"></div></aside></div><article class="card aprs-traffic-card"><header><h2>Traffico APRS</h2><span id="aprs-traffic-count"></span></header><div class="aprs-traffic-scroll"><table class="aprs-traffic-table"><thead><tr><th>Data e ora</th><th>Direzione</th><th>Trasporto</th><th>Da → A</th><th>Tipo / pacchetto</th></tr></thead><tbody id="aprs-traffic-rows"></tbody></table></div><footer><details><summary>Dettagli del registro</summary><p id="aprs-traffic-scope"></p></details></footer></article><div class="aprs-activity-status" id="aprs-activity-status" role="status"></div>';
tabs.after(pane);let view='activity',data=null,loading=false,starting=false,paused=false,map=null,layers=null,markers=new Map(),ownMarker=null,fitted=false,selected=null,selectedEvent=null;
const snapshots=new WeakMap();
function markup(selector,html){const el=$(selector);if(snapshots.get(el)===html)return;snapshots.set(el,html);el.innerHTML=html;}
@@ -11,28 +11,65 @@
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}));}}
tabs.onclick=e=>{const next=e.target.closest('[data-aprs-view]')?.dataset.aprsView;if(next)setView(next);};
function popup(s){return '<div class="aprs-map-popup"><b>'+esc(s.call)+'</b><span>'+esc(s.transport)+(s.port?' · Port '+s.port:'')+'</span><span>'+esc(time(s.lastAt))+'</span><span>'+s.position.lat.toFixed(5)+', '+s.position.lon.toFixed(5)+'</span><p>'+esc(s.status||s.lastBody||'')+'</p><small>'+esc(s.path||'')+'</small></div>';}
function initMap(){if(map||!window.L)return;map=L.map('aprs-station-map',{zoomControl:true,scrollWheelZoom:true}).setView([25,0],2);L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{maxZoom:19,referrerPolicy:'origin',attribution:'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap</a> contributors'}).addTo(map);layers=L.layerGroup().addTo(map);if(typeof ResizeObserver!=='undefined')new ResizeObserver(()=>{if(page==='aprs'&&view==='activity')map.invalidateSize({pan:false});}).observe($('#aprs-station-map'));}
function fit(){if(!map)return;const positions=stations().filter(s=>s.position).map(s=>[s.position.lat,s.position.lon]);if(data?.own.position)positions.push([data.own.position.lat,data.own.position.lon]);if(positions.length)map.fitBounds(L.latLngBounds(positions),{padding:[38,38],maxZoom:13});}
function symbolIcon(position,transport='Radio'){
const info=window.BPQAprsSymbols.decode(position),html=window.BPQAprsSymbols.html(position);
return L.divIcon({className:'aprs-station-icon '+(transport==='Own'?'own':transport==='Radio'?'radio':'internet'),html,iconSize:[32,32],iconAnchor:[16,16],popupAnchor:[0,-17]});
}
const symbolKey=(s)=>JSON.stringify([s.position?.symset,s.position?.symbol,s.transport]);
function symbolDetail(position){const info=window.BPQAprsSymbols.decode(position);return info?esc(info.name)+' · <code>'+esc(info.code)+'</code>'+(info.overlay?' · '+BPQI18n.t('Sovrapposizione')+' '+esc(info.overlay):''):BPQI18n.t('Simbolo non disponibile');}
function popup(s){return '<div class="aprs-map-popup"><b>'+esc(s.call)+'</b><span class="aprs-symbol-detail">'+symbolDetail(s.position)+'</span><span>'+esc(s.transport)+(s.port?' · Port '+s.port:'')+'</span><span>'+esc(time(s.lastAt))+'</span><span>'+s.position.lat.toFixed(5)+', '+s.position.lon.toFixed(5)+'</span><p>'+esc(s.status||s.lastBody||'')+'</p><small>'+esc(s.path||'')+'</small></div>';}
function initMap(){if(map||!window.L)return;map=L.map('aprs-station-map',{zoomControl:true,scrollWheelZoom:true}).setView([25,0],2);L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{maxZoom:19,referrerPolicy:'origin',attribution:'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">OpenStreetMap</a> contributors · <a href="/vendor/aprs-symbols/README.md" target="_blank" rel="noopener">APRS symbols © OH7LZB</a>'}).addTo(map);layers=L.layerGroup().addTo(map);if(typeof ResizeObserver!=='undefined')new ResizeObserver(()=>{if(page==='aprs'&&view==='activity')map.invalidateSize({pan:false});}).observe($('#aprs-station-map'));}
const validPosition=p=>p&&Number.isFinite(p.lat)&&Number.isFinite(p.lon)&&Math.abs(p.lat)<=90&&Math.abs(p.lon)<=180;
function distanceKm(a,b){
const rad=Math.PI/180,lat=(b.lat-a.lat)*rad,lon=(b.lon-a.lon)*rad;
const h=Math.sin(lat/2)**2+Math.cos(a.lat*rad)*Math.cos(b.lat*rad)*Math.sin(lon/2)**2;
return 12742*Math.asin(Math.sqrt(Math.min(1,h)));
}
function densePositions(points,own){
// A fixed neighbourhood prevents chains of scattered stations from expanding the fit.
points=points.filter(validPosition);let best=[],center=null,tie=Infinity;
for(const candidate of points){
const nearby=points.filter(p=>distanceKm(candidate,p)<=100);
const rank=validPosition(own)?distanceKm(candidate,own):nearby.reduce((n,p)=>n+distanceKm(candidate,p),0);
if(nearby.length>best.length||nearby.length===best.length&&rank<tie){best=nearby;center=candidate;tie=rank;}
}
if(validPosition(own)&&(!center||distanceKm(center,own)<=100))best.push(own);
return best;
}
function localBounds(position,radiusKm=30){
const latDelta=radiusKm/6371*180/Math.PI,lat=position.lat;
const lonDelta=Math.abs(lat)+latDelta>=90?180:Math.asin(Math.sin(radiusKm/6371)/Math.cos(lat*Math.PI/180))*180/Math.PI;
return [[Math.max(-90,lat-latDelta),position.lon-lonDelta],[Math.min(90,lat+latDelta),position.lon+lonDelta]];
}
function mapPreset(local){$('#aprs-map-local').setAttribute('aria-pressed',String(local));$('#aprs-map-fit').setAttribute('aria-pressed',String(!local));}
function fit(){
if(!map)return;
const positions=densePositions(stations().map(s=>s.position),data?.own.position);
if(positions.length){map.fitBounds(L.latLngBounds(positions.map(p=>[p.lat,p.lon])),{padding:[38,38],maxZoom:13});mapPreset(false);}
}
function fitLocal(){
if(!map||!validPosition(data?.own.position))return;
map.fitBounds(L.latLngBounds(localBounds(data.own.position)),{padding:[20,20]});mapPreset(true);fitted=true;
}
function renderMap(){
if(page!=='aprs'||view!=='activity')return;
initMap();if(!map)return;
initMap();if(!map)return;$('#aprs-map-local').disabled=!validPosition(data?.own.position);$('#aprs-map-local').title=BPQI18n.t(validPosition(data?.own.position)?'Inquadra un raggio di 30 km dalla tua stazione':'Posizione della tua stazione non disponibile');
const list=stations(),visible=new Set();
for(const s of list){
if(!s.position)continue;
visible.add(s.call);
const color=s.transport==='Radio'?'#6fd4b1':'#81b9f4',point=[s.position.lat,s.position.lon],html=popup(s);
const point=[s.position.lat,s.position.lon],html=popup(s);
let marker=markers.get(s.call);
if(!marker){
marker=L.circleMarker(point,{radius:7,color:'#0b1723',weight:2,fillColor:color,fillOpacity:.96})
marker=L.marker(point,{title:s.call,alt:s.call,icon:symbolIcon(s.position,s.transport)})
.bindTooltip(esc(s.call),{direction:'top',offset:[0,-6]})
.bindPopup(html,{autoPan:false});
marker.on('click',()=>{selected=s.call;renderStations();});
marker.addTo(layers);markers.set(s.call,marker);
marker.symbolKey=symbolKey(s);marker.addTo(layers);markers.set(s.call,marker);
}else{
const current=marker.getLatLng();
if(current.lat!==point[0]||current.lng!==point[1])marker.setLatLng(point);
if(marker.options.fillColor!==color)marker.setStyle({fillColor:color});
if(marker.symbolKey!==symbolKey(s)){marker.setIcon(symbolIcon(s.position,s.transport));marker.symbolKey=symbolKey(s);}
if(marker.getPopup().getContent()!==html)marker.setPopupContent(html);
}
}
@@ -40,13 +77,13 @@
const own=data?.own;
if(own?.position){
const point=[own.position.lat,own.position.lon],label=esc(own.call)+' · '+BPQI18n.t('La tua stazione');
if(!ownMarker)ownMarker=L.circleMarker(point,{radius:10,color:'#efcf89',weight:2,fillColor:'#efcf89',fillOpacity:.3}).bindTooltip(label).addTo(layers);
else{const current=ownMarker.getLatLng();if(current.lat!==point[0]||current.lng!==point[1])ownMarker.setLatLng(point);if(ownMarker.getTooltip().getContent()!==label)ownMarker.setTooltipContent(label);}
if(!ownMarker){ownMarker=L.marker(point,{title:own.call,alt:own.call,icon:symbolIcon(own.position,'Own')}).bindTooltip(label).addTo(layers);ownMarker.symbolKey=symbolKey(own);}
else{if(ownMarker.symbolKey!==symbolKey(own)){ownMarker.setIcon(symbolIcon(own.position,'Own'));ownMarker.symbolKey=symbolKey(own);}const current=ownMarker.getLatLng();if(current.lat!==point[0]||current.lng!==point[1])ownMarker.setLatLng(point);if(ownMarker.getTooltip().getContent()!==label)ownMarker.setTooltipContent(label);}
}else if(ownMarker){layers.removeLayer(ownMarker);ownMarker=null;}
$('#aprs-map-count').textContent=visible.size+' '+BPQI18n.t('sulla mappa')+' · '+(list.length-visible.size)+' '+BPQI18n.t('senza posizione');
if(!fitted&&(visible.size||own?.position)){fit();fitted=true;}
if(!fitted&&(visible.size||own?.position)){if(validPosition(own?.position))fitLocal();else fit();fitted=true;}
}
function renderStations(){const list=stations();markup('#aprs-received-stations',list.map(s=>'<button data-aprs-station="'+esc(s.call)+'" class="aprs-received-station '+(s.call===selected?'selected':'')+'"><span><b>'+esc(s.call)+'</b><i class="aprs-source-dot '+s.transport.toLowerCase()+'"></i></span><small>'+esc(s.transport)+(s.port?' · Port '+s.port:'')+' · '+esc(time(s.lastAt))+'</small><p>'+esc(s.status||s.lastBody||'—').slice(0,170)+'</p>'+(!s.position?'<small>Senza posizione</small>':'')+'</button>').join('')||'<p class="empty">Nessuna stazione ricevuta con questi filtri.</p>');}
function renderStations(){const list=stations();markup('#aprs-received-stations',list.map(s=>'<button data-aprs-station="'+esc(s.call)+'" class="aprs-received-station '+(s.call===selected?'selected':'')+'"><span><span class="aprs-list-symbol">'+window.BPQAprsSymbols.html(s.position)+'</span><b>'+esc(s.call)+'</b><i class="aprs-source-dot '+s.transport.toLowerCase()+'"></i></span><small>'+esc(s.transport)+(s.port?' · Port '+s.port:'')+' · '+esc(time(s.lastAt))+'</small><small class="aprs-symbol-detail">'+symbolDetail(s.position)+'</small><p>'+esc(s.status||s.lastBody||'—').slice(0,170)+'</p>'+(!s.position?'<small>Senza posizione</small>':'')+'</button>').join('')||'<p class="empty">Nessuna stazione ricevuta con questi filtri.</p>');}
function render(){if(!data)return;const events=data.events.filter(e=>(!source()||e.transport===source())&&(!$('#aprs-direction').value||e.direction===$('#aprs-direction').value)&&(!query()||(e.packet+' '+e.from).toUpperCase().includes(query()))).slice().reverse();
$('#aprs-live-state').textContent=paused?'Vista in pausa':data.monitor==='online'?'● APRS in tempo reale':'Monitor '+data.monitor;
markup('#aprs-activity-kpis',[['Radio RX',events.filter(e=>e.transport==='Radio'&&e.direction==='RX').length],['Radio TX · BPQ',events.filter(e=>e.transport==='Radio'&&e.direction==='TX').length],['Internet RX',events.filter(e=>e.transport==='Internet'&&e.direction==='RX').length],['Internet TX',events.filter(e=>e.transport==='Internet'&&e.direction==='TX').length],['Stazioni ricevute',stations().length]].map(([k,v])=>'<article><span>'+esc(k)+'</span><strong>'+v+'</strong></article>').join(''));
@@ -55,7 +92,7 @@
}
async function start(){if(!csrf)return;if(starting||data?.started){if(data)render();return;}starting=true;try{data=await api('/aprs/activity/start',{method:'POST',body:'{}'});render();}catch(e){$('#aprs-activity-status').textContent=e.message;}finally{starting=false;}}
async function poll(background=true){if(!csrf||loading||paused||document.hidden||page!=='aprs'||view!=='activity')return;loading=true;try{const next=await api('/aprs/activity',{busy:!background});data=next;render();if(!data.started)start();}catch(e){$('#aprs-activity-status').textContent=e.message;}finally{loading=false;}}
$('#aprs-map-fit').onclick=fit;$('#aprs-activity-refresh').onclick=()=>{if(paused){render();return;}poll(false);};$('#aprs-activity-pause').onclick=()=>{paused=!paused;$('#aprs-activity-pause').textContent=paused?'Riprendi vista':'Pausa vista';if(!paused)poll();else render();};for(const id of ['aprs-source','aprs-direction','aprs-search'])$('#'+id).addEventListener(id==='aprs-search'?'input':'change',()=>{render();if(id==='aprs-source')fit();});
$('#aprs-map-fit').onclick=fit;$('#aprs-map-local').onclick=fitLocal;$('#aprs-activity-refresh').onclick=()=>{if(paused){render();return;}poll(false);};$('#aprs-activity-pause').onclick=()=>{paused=!paused;$('#aprs-activity-pause').textContent=paused?'Riprendi vista':'Pausa vista';if(!paused)poll();else render();};for(const id of ['aprs-source','aprs-direction','aprs-search'])$('#'+id).addEventListener(id==='aprs-search'?'input':'change',()=>{render();});
$('#aprs-received-stations').onclick=e=>{const call=e.target.closest('[data-aprs-station]')?.dataset.aprsStation;if(!call)return;selected=call;const marker=markers.get(call);if(marker){map.setView(marker.getLatLng(),Math.max(map.getZoom(),13));marker.openPopup();}renderStations();};
$('#aprs-traffic-rows').onclick=e=>{const row=e.target.closest('[data-aprs-event]');if(row){const id=Number(row.dataset.aprsEvent);selectedEvent=selectedEvent===id?null:id;render();}};$('#aprs-traffic-rows').onkeydown=e=>{if(['Enter',' '].includes(e.key)&&e.target.matches('[data-aprs-event]')){e.preventDefault();e.target.click();}};
const prior=navigate;navigate=function(next){prior(next);if(next==='aprs'&&view==='activity'){start();requestAnimationFrame(()=>map?.invalidateSize({pan:false}));}};document.addEventListener('station-ready',()=>{if(page==='aprs')start();});document.addEventListener('bpq-languagechange',()=>{if(data)render();});setInterval(poll,2000);setView('activity');
+17
View File
@@ -0,0 +1,17 @@
/* APRS descriptions: OH7LZB / aprs-symbol-index, CC BY-SA 4.0. See vendor/aprs-symbols/README.md. */
(()=>{
const names={"/!":"Police station","/#":"Digipeater","/$":"Telephone","/%":"DX cluster","/&":"HF gateway","/'":"Small aircraft","/(":"Mobile satellite station","/)":"Wheelchair, handicapped","/*":"Snowmobile","/+":"Red Cross","/,":"Boy Scouts","/-":"House","/.":"Red X","//":"Red dot","/0":"Numbered circle: 0","/1":"Numbered circle: 1","/2":"Numbered circle: 2","/3":"Numbered circle: 3","/4":"Numbered circle: 4","/5":"Numbered circle: 5","/6":"Numbered circle: 6","/7":"Numbered circle: 7","/8":"Numbered circle: 8","/9":"Numbered circle: 9","/:":"Fire","/;":"Campground, tent","/<":"Motorcycle","/=":"Railroad engine","/>":"Car","/?":"File server","/@":"Hurricane predicted path","/A":"Aid station","/B":"BBS","/C":"Canoe","/E":"Eyeball","/F":"Farm vehicle, tractor","/G":"Grid square, 3 by 3","/H":"Hotel","/I":"TCP/IP network station","/K":"School","/L":"PC user","/M":"Mac apple","/N":"NTS station","/O":"Balloon","/P":"Police car","/R":"Recreational vehicle","/S":"Space Shuttle","/T":"SSTV","/U":"Bus","/V":"ATV, Amateur Television","/W":"Weather service site","/X":"Helicopter","/Y":"Sailboat","/Z":"Windows flag","/[":"Human","/\\":"DF triangle","/]":"Mailbox, post office","/^":"Large aircraft","/_":"Weather station","/`":"Satellite dish antenna","/a":"Ambulance","/b":"Bicycle","/c":"Incident command post","/d":"Fire station","/e":"Horse, equestrian","/f":"Fire truck","/g":"Glider","/h":"Hospital","/i":"IOTA, islands on the air","/j":"Jeep","/k":"Truck","/l":"Laptop","/m":"Mic-E repeater","/n":"Node, black bulls-eye","/o":"Emergency operations center","/p":"Dog","/q":"Grid square, 2 by 2","/r":"Repeater tower","/s":"Ship, power boat","/t":"Truck stop","/u":"Semi-trailer truck, 18-wheeler","/v":"Van","/w":"Water station","/x":"X / Unix","/y":"House, yagi antenna","/z":"Shelter","\\!":"Emergency","\\#":"Digipeater, green star","\\$":"Bank or ATM","\\&":"Gateway station","\\'":"Crash / incident site","\\(":"Cloudy","\\)":"Firenet MEO, MODIS Earth Observation","\\*":"Snow","\\+":"Church","\\,":"Girl Scouts","\\-":"House, HF antenna","\\.":"Ambiguous, question mark inside circle","\\/":"Waypoint destination","\\0":"Circle, IRLP / Echolink/WIRES","\\8":"802.11 WiFi or other network node","\\9":"Gas station","\\:":"Hail","\\;":"Park, picnic area","\\<":"Advisory, single red flag","\\>":"Red car","\\?":"Info kiosk","\\@":"Hurricane, Tropical storm","\\A":"White box","\\B":"Blowing snow","\\C":"Coast Guard","\\D":"Drizzling rain","\\E":"Smoke, Chimney","\\F":"Freezing rain","\\G":"Snow shower","\\H":"Haze","\\I":"Rain shower","\\J":"Lightning","\\K":"Kenwood HT","\\L":"Lighthouse","\\N":"Navigation buoy","\\O":"Rocket","\\P":"Parking","\\Q":"Earthquake","\\R":"Restaurant","\\S":"Satellite","\\T":"Thunderstorm","\\U":"Sunny","\\V":"VORTAC, Navigational aid","\\W":"NWS site","\\X":"Pharmacy","\\[":"Wall Cloud","\\^":"Aircraft","\\_":"Weather site","\\`":"Rain","\\a":"Red diamond","\\b":"Blowing dust, sand","\\c":"CD triangle, RACES, CERTS, SATERN","\\d":"DX spot","\\e":"Sleet","\\f":"Funnel cloud","\\g":"Gale, two red flags","\\h":"Store","\\i":"Black box, point of interest","\\j":"Work zone, excavating machine","\\k":"SUV, ATV","\\m":"Value sign, 3 digit display","\\n":"Red triangle","\\o":"Small circle","\\p":"Partly cloudy","\\r":"Restrooms","\\s":"Ship, boat","\\t":"Tornado","\\u":"Truck","\\v":"Van","\\w":"Flooding","\\y":"Skywarn","\\z":"Shelter","\\{":"Fog"};
function decode(position){
const {symbol,symset}=position||{};
if(typeof symbol!=='string'||symbol.length!==1||symbol<'!'||symbol>'~'||!/^[/\\A-Z0-9]$/.test(symset||''))return null;
const table=symset==='/'?'primary':'alternate',overlay=/^[A-Z0-9]$/.test(symset)?symset:null;
const index=symbol.charCodeAt(0)-33;
return {symbol,symset,table,overlay,index,name:names[(table==='primary'?'/':'\\')+symbol]||'APRS',code:symset+symbol};
}
function html(position){
const info=decode(position);if(!info)return '<span class="aprs-symbol-unknown" aria-hidden="true">?</span>';
const col=info.index%16,row=Math.floor(info.index/16);
return '<span class="aprs-symbol-image aprs-symbol-'+info.table+' aprs-symbol-col-'+col+' aprs-symbol-row-'+row+'" aria-hidden="true">'+(info.overlay?'<span class="aprs-symbol-overlay">'+info.overlay+'</span>':'')+'</span>';
}
window.BPQAprsSymbols={decode,html};
})();
+6
View File
@@ -4,6 +4,12 @@
const entries=`
Dal|Since
Dettagli del registro|Log details
Zona locale · 30 km|Local area · 30 km
Inquadra il gruppo più denso, ignorando le stazioni isolate|Fit the densest group, excluding isolated stations
Inquadra un raggio di 30 km dalla tua stazione|Show a 30 km radius around your station
Posizione della tua stazione non disponibile|Your station position is unavailable
Simbolo non disponibile|Symbol unavailable
Sovrapposizione|Overlay
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
+1 -1
View File
@@ -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=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>
<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=20261019-map-fit"><script defer src="/aprs-symbols.js"></script><script defer src="/aprs-activity.js?v=20261019-map-fit"></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>
+423
View File
@@ -0,0 +1,423 @@
Copyright and licensing information
======================================
This is a collection of vectorized symbols for use on the APRS system.
The copyright status of this collection is a bit complicated, since the
symbols come from various sources, each having different copyright owners.
Most of the vectorized symbols are loosely based on the low-resolution
"standard" bitmap symbol set as distributed by Stephen Smith, WA8LMF. That
set is used by most APRS software around the world. The low resolution of
those symbols does not allow direct vector conversion, so I've drawn new
symbols in a similar layout. The vector versions try to mimic the original
appearance and colours, with the intention of keeping the set recognizable
and familiar to existing users. In some cases the vector versions are
probably similar enough to the originals, so that they cannot be considered
"original work" by myself. In some of these cases, the originals are
probably also mimicking someone else's design.
The original symbols do not come with any information on their licensing.
They've been distributed with a lot of APRS software over time, but I don't
know who designed which symbol originally. Most likely all of them are
drawn by one of:
* Roger Barker, G4IDE, "original set provided with UI-View" (SK)
* Steve Dimse, KH4G, "U.S. customary set"
* Stephen Smith, WA8LMF
The Adobe Illustrator (.ai) file contains a copy of the original bitmaps
as a hidden layer, just for reference.
Some symbols I obtained from other sources, such as Wikipedia. In those
cases I picked SVG versions which allow commercial reuse (source known, and
the work is placed on public domain, or with a CC license which allows
adaptation and commercial reuse).
Some symbols are vectorized versions of product or brand logos. The
copyright of those is owned by the respective companies (Apple, Microsoft,
Kenwood), and each of those may have some opinions on how the logos are
used. Please check for yourself if you can use them or not.
In the list below I try to summarize the licensing status for each symbol.
Shorthand notation for common licensing status
-------------------------------------------------
* *VEC-OH7LZB* - Vectorized by OH7LZB, based on original APRS symbol set
* Source of original bitmap: http://wa8lmf.net/aprs/APRS_symbols.htm
* Original designer of individual symbol unknown at this time, but one of:
* Roger Barker, G4IDE
* Steve Dimse, KH4G
* Stephen Smith, WA8LMF
* Vectorized versions are designed to look similar
* Licensing: Unknown
* *OH7LZB* - Original vector design by Heikki Hannikainen, OH7LZB
* Different enough (by author's opinion) to make it a new original work,
instead of a copy of the old symbol
* License: CC BY-SA 2.0
* https://creativecommons.org/licenses/by-sa/2.0/
Primary table
----------------
* /! - Police station
* VEC-OH7LZB
* /# - Digipeater / Green star with D in middle
* VEC-OH7LZB
* /$ - Telephone
* VEC-OH7LZB
* /% - DX cluster
* VEC-OH7LZB
* /& - HF gateway
* VEC-OH7LZB
* /' - Small aircraft
* https://openclipart.org/detail/27182/topdown-airplane-view
* Author: Wirelizard (Brian Burger)
* With color and some other small tuning added by OH7LZB
* PD: https://openclipart.org/share
* /( - Mobile satellite station
* OH7LZB
* /) - Wheelchair, handicapped
* PD wheelchair symbol
* Vectorized from bitmap by OH7LZB
* /* - Snowmobile
* https://openclipart.org/detail/15849/snowmobile
* Author: Mystica (https://openclipart.org/user-detail/mystica)
* PD: https://openclipart.org/share
* /+ - Red Cross
* VEC-OH7LZB
* /, - Boy Scouts
* VEC-OH7LZB
* /- - House
* VEC-OH7LZB
* /. - Red X
* VEC-OH7LZB
* // - Red dot
* VEC-OH7LZB
* /0 to /9 - Numbered circles
* VEC-OH7LZB
* Fire
* http://commons.wikimedia.org/wiki/File:FireIcon.svg
* Author: Piotr Jaworski
* PD: I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
* Tent
* https://openclipart.org/detail/174933/green-tent-by-stamps-174933
* Author: stamps
* PD: https://openclipart.org/share
* Motorcycle
* http://commons.wikimedia.org/wiki/File:MUTCD_W8-15P.svg
* This file is in the public domain because it comes from the Manual on
Uniform Traffic Control Devices, sign number W8-15P, which states
specifically on page I-1 that: Any traffic control device design or
application provision contained in this Manual shall be considered to
be in the public domain. Traffic control devices contained in this
Manual shall not be protected by a patent, trademark, or copyright,
except for the Interstate Shield and any other items owned by FHWA.
* Colour version by OH7LZB
* /= - Railroad engine
* http://commons.wikimedia.org/wiki/File:Icon_train.svg
* Author: http://en.wikipedia.org/wiki/User:Richtom80
* CC-BY-SA-2.5,2.0,1.0
* /> - Car
* OH7LZB
* /? - File server
* https://openclipart.org/detail/163717/file-server-by-lyte
* Author: lyte
* PD: https://openclipart.org/share
* /@ - Hurricane predicted path
* VEC-OH7LZB
* /A - Aid station
* VEC-OH7LZB
* Mail (BBS)
* https://openclipart.org/detail/29268/yellow-mail-by-rg1024-29268
* Author: rg1024
* PD: https://openclipart.org/share
* /C - Canoe
* https://openclipart.org/detail/179047/red-canoe-by-rambo-tribble-179047
* https://openclipart.org/detail/179041/canoe-paddle-by-rambo-tribble-179041
* Author: Rambo Tribble
* PD: I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
* /E - Eyeball
* http://commons.wikimedia.org/wiki/File:Blue_eye.svg
* PD: "This file is from the Open Clip Art Library, which released it explicitly into the public domain"
* PD: https://openclipart.org/share
* /F - Tractor
* https://openclipart.org/detail/191654/farm-tractor-by-tmjbeary-191654
* Author: tmjbeary
* PD: https://openclipart.org/share
* /G - Grid square, 3 by 3
* VEC-OH7LZB
* /H - Hotel
* VEC-OH7LZB
* /I - TCP/IP
* VEC-OH7LZB
* /K - School
* OH7LZB
* /L - PC user
* OH7LZB
* /M - Mac apple
* Apple
* /N - NTS
* VEC-OH7LZB
* /O - Hot air balloon
* OH7LZB
* /P - Police
* OH7LZB
* /R - RV
* OH7LZB
* /S - Space Shuttle
* https://openclipart.org/detail/814/space-shuttle-by-johnny_automatic
* PD: Published by the NASA, in "The Brain in Space"
* /T - SSTV
* https://openclipart.org/detail/48997/flat-screen-by-rg1024
* Author: rg1024
* Adjusted by OH7LZB
* PD: https://openclipart.org/share
* /U - Bus
* OH7LZB
* /V - ATV, amateur television
* https://openclipart.org/detail/48997/flat-screen-by-rg1024
* Author: rg1024
* Adjusted by OH7LZB
* PD: https://openclipart.org/share
* /W - Wx, Weather service site
* VEC-OH7LZB
* /X - Helicopter
* OH7LZB
* /Y - Sailboat
* OH7LZB
* /Z - Windows flag
* Microsoft
* /[ - Human
* VEC-OH7LZB
* /\ - DF triangle
* VEC-OH7LZB
* /] - Mailbox, post office, letter
* /^ - Large aircraft
* https://openclipart.org/detail/183204/plane-red-by-sketchartist-183204
* Author: SketchArtist
* PD: https://openclipart.org/share
* /_ - Weather station
* VEC-OH7LZB
* /` - Satellite dish
* OH7LZB
* /a - Ambulance
* OH7LZB
* /b - Bicycle
* http://commons.wikimedia.org/wiki/File:Bicycle_evolution-numbers.svg
* Author: Wikipedia user: Al2
* CC BY 3.0
* /c - Incident command post
* VEC-OH7LZB
* /d - Fire station
* VEC-OH7LZB
* /e - Horse, equestrian
* https://openclipart.org/detail/142627/horse-riding-lesson-by-olku
* Author: OlKu
* PD: https://openclipart.org/share
* /f - Fire truck
* OH7LZB
* /g - Hang glider
* OH7LZB
* /h - Hospital
* VEC-OH7LZB
* /i - IOTA, islands on the air
* http://commons.wikimedia.org/wiki/File:Palm_Island_R.svg
* PI
* /j - Jeep
* OH7LZB
* /k - Truck
* OH7LZB
* /l - Laptop
* OH7LZB
* /m - Mic-E repeater
* VEC-OH7LZB
* /n - Node, black bulls-eye
* VEC-OH7LZB
* /o - Emergency operations center
* VEC-OH7LZB
* /p - Dog(e)
* OH7LZB
* /q - Grid square, 2 by 2
* VEC-OH7LZB
* /r - Repeater tower
* OH7LZB
* /s - Ship, power boat
* OH7LZB
* /t - Truck stop
* VEC-OH7LZB
* /u - Semi-trailer truck, 18-wheeler
* OH7LZB
* /v - Van
* OH7LZB
* /w - Water station
* VEC-OH7LZB
* /x - X / Unix
* https://commons.wikimedia.org/wiki/File:X11.svg
* PD
* /y - House, yagi antenna
* VEC-OH7LZB
* /z - Shelter
* VEC-OH7LZB
Secondary table
------------------
* Emergency
* VEC-OH7LZB
* Numbered digipeater / Green star
* VEC-OH7LZB
* Bank
* VEC-OH7LZB
* Numbered gateway / Black diamond
* VEC-OH7LZB
* Crash site
* OH7LZB
* Cloudy
* OH7LZB
* MEO
* VEC-OH7LZB
* Snowflake
* http://commons.wikimedia.org/wiki/File:Snowflake_01.svg
* Author: Wikipedia user: Amada44
* Public Domain
* Church
* VEC-OH7LZB
* Girl Scout
* VEC-OH7LZB
* Looks slightly like the common USA girl scouts logos. Should be different
enough to not infringe on "Girl Scouts of the USA" copyrights.
* Home (HF antenna)
* VEC-OH7LZB
* Unknown position
* VEC-OH7LZB
* Destination
* VEC-OH7LZB
* Numbered circle
* VEC-OH7LZB
* Petrol Station
* OH7LZB
* Hail
* VEC-OH7LZB
* Park
* VEC-OH7LZB
* Gale Flag
* VEC-OH7LZB
* Red car from above
* OH7LZB
* Info Kiosk
* VEC-OH7LZB
* Hurricane
* OH7LZB
* Numbered white box
* VEC-OH7LZB
* Snow blowing
* VEC-OH7LZB
* Coast Guard
* VEC-OH7LZB
* Drizzle
* VEC-OH7LZB
* Smoke / Chimney
* VEC-OH7LZB
* Freezing rain
* VEC-OH7LZB
* Snow Shwr
* VEC-OH7LZB
* Haze
* VEC-OH7LZB
* Rain Shower
* VEC-OH7LZB
* Lightning
* OH7LZB
* "Kenwood radio"
* Kenwood logo, vectorized
* "Lighthouse"
* CC BY-SA 2.0
* http://wiki.openstreetmap.org/wiki/File:Lighthouse.svg
* Nav Buoy
* OH7LZB
* Rocket
* http://www.clker.com/clipart-gglkuglug.html
* PD according to clker.com license
* Parking
* VEC-OH7LZB
* Earthquake, Restaurant
* VEC-OH7LZB
* Satellite
* OH7LZB
* Thunderstorm
* OH7LZB
* Sunny
* OH7LZB
* VORTAC, Numbered WXS
* VEC-OH7LZB
* Pharmacy Rx
* OH7LZB
* Wall Cloud
* OH7LZB
* Numbered plane
* https://openclipart.org/detail/183204/plane-red-by-sketchartist-183204
* Author: SketchArtist
* PD: https://openclipart.org/share
* Numbered WX Station
* VEC-OH7LZB
* Rain
* Source: http://commons.wikimedia.org/wiki/File:Heavy-rain-shower-transparent.svg
* Author: Wikipedia user: Peepo
* Public Domain
* With modifications by OH7LZB
* Numbered diamond
* VEC-OH7LZB
* Dust blowing
* NA
* Numbered civil defence
* VEC-OH7LZB
* DX spot
* VEC-OH7LZB
* Sleet
* NA
* Funnel Cloud
* NA
* Gale
* VEC-OH7LZB
* Store
* https://openclipart.org/detail/89299/cart-medium-by-martins.bruvelis
* Author: martins.bruvelis
* Public Domain
* Adjustments by OH7LZB
* Numbered black box
* VEC-OH7LZB
* Work zone / Excavator
* Based on http://www.clker.com/clipart-292480.html PNG version
* Vectorized and colors adjusted by OH7LZB
* PD according to clker.com documentation, uploader KURSVEIAL
* SUV
* OH7LZB
* Milepost, Numbered triangle, Circle sm
* VEC-OH7LZB
* Partly cloudy
* OH7LZB
* Restrooms, Numbered boat
* VEC-OH7LZB
* Tornado (also used in Funnel cloud, Skywarn)
* https://openclipart.org/detail/104887/tornado-by-laabadon
* Author: Laabadon
* Public Domain
* Numbered truck
* OH7LZB
* Numbered van
* OH7LZB
* Flooding
* NA
* Sky warn, Numbered shelter, fog
* VEC-OH7LZB
+7
View File
@@ -0,0 +1,7 @@
# APRS symbol assets
Unmodified 48-pixel PNG sprite sheets from [aprs.fi high-resolution symbols](https://github.com/hessu/aprs-symbols), by Heikki Hannikainen, OH7LZB and the individual contributors listed in COPYRIGHT.md. Displayed at 24 CSS pixels. Copyright and licensing vary by symbol; the full upstream notice is preserved in COPYRIGHT.md.
Descriptions in ../../aprs-symbols.js are adapted from [aprs-symbol-index](https://github.com/hessu/aprs-symbol-index), maintained by OH7LZB for aprs.fi, licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). Blank descriptions are omitted. Symbol overlays are drawn as text on the alternate table.
Mapping: printable APRS symbol codes ! through ~, sixteen columns per row, six rows per table. Unknown symbols use a neutral question mark rather than an invented station type.
Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

+1 -1
View File
@@ -210,7 +210,7 @@ const server=http.createServer(async(req,res)=>{
}
if(req.method!=='GET'){json(res,405,{error:'Metodo non disponibile'});return;}
const vendor=url.pathname.match(/^\/vendor\/pdfjs\/(pdf\.min\.mjs|pdf\.worker\.min\.mjs|(?:standard_fonts|cmaps)\/[A-Za-z0-9_.-]+)$/);if(vendor&&!vendor[1].includes('..')){const bytes=await readFile(path.join(dir,'public','vendor','pdfjs',vendor[1]));res.writeHead(200,{'Content-Type':vendor[1].endsWith('.mjs')?'text/javascript':'application/octet-stream','Cache-Control':'public, max-age=86400'});res.end(bytes);return;}
const files={'/busy.js':'busy.js','/busy.css':'busy.css','/vendor/leaflet/leaflet.js':'vendor/leaflet/leaflet.js','/vendor/leaflet/leaflet.css':'vendor/leaflet/leaflet.css','/aprs-activity.js':'aprs-activity.js','/aprs-activity.css':'aprs-activity.css','/aprs.js':'aprs.js','/aprs.css':'aprs.css','/radio-ports.js':'radio-ports.js','/radio-ports.css':'radio-ports.css','/compose-attachments.js':'compose-attachments.js','/compose-attachments.css':'compose-attachments.css','/i18n.js':'i18n.js','/i18n.css':'i18n.css','/sync-state.js':'sync-state.js','/sync-progress.js':'sync-progress.js','/sync-progress.css':'sync-progress.css','/radio-control.js':'radio-control.js','/radio-control.css':'radio-control.css','/terminal.js':'terminal.js','/terminal.css':'terminal.css','/winlink-radio.js':'winlink-radio.js','/winlink-radio.css':'winlink-radio.css','/forwarding.js':'forwarding.js','/forwarding.css':'forwarding.css','/journal.js':'journal.js','/journal.css':'journal.css','/world-land.json':'world-land.json','/monitor.js':'monitor.js','/monitor.css':'monitor.css','/':'index.html','/app.js':'app.js','/enhancements.js':'enhancements.js','/notifications.js':'notifications.js','/winlink.js':'winlink.js','/mission.js':'mission.js','/attachments.js':'attachments.js','/mission.css':'mission.css','/style.css':'style.css','/dark.css':'dark.css'};const file=files[url.pathname];if(!file){json(res,404,{error:'Pagina non trovata'});return;}const bytes=await readFile(path.join(dir,'public',file));res.writeHead(200,{'Content-Type':file.endsWith('.json')?'application/json':file.endsWith('.css')?'text/css; charset=utf-8':file.endsWith('.js')?'text/javascript; charset=utf-8':'text/html; charset=utf-8','Cache-Control':'no-cache'});res.end(bytes);
const files={'/aprs-symbols.js':'aprs-symbols.js','/vendor/aprs-symbols/primary.png':'vendor/aprs-symbols/primary.png','/vendor/aprs-symbols/alternate.png':'vendor/aprs-symbols/alternate.png','/vendor/aprs-symbols/README.md':'vendor/aprs-symbols/README.md','/vendor/aprs-symbols/COPYRIGHT.md':'vendor/aprs-symbols/COPYRIGHT.md','/busy.js':'busy.js','/busy.css':'busy.css','/vendor/leaflet/leaflet.js':'vendor/leaflet/leaflet.js','/vendor/leaflet/leaflet.css':'vendor/leaflet/leaflet.css','/aprs-activity.js':'aprs-activity.js','/aprs-activity.css':'aprs-activity.css','/aprs.js':'aprs.js','/aprs.css':'aprs.css','/radio-ports.js':'radio-ports.js','/radio-ports.css':'radio-ports.css','/compose-attachments.js':'compose-attachments.js','/compose-attachments.css':'compose-attachments.css','/i18n.js':'i18n.js','/i18n.css':'i18n.css','/sync-state.js':'sync-state.js','/sync-progress.js':'sync-progress.js','/sync-progress.css':'sync-progress.css','/radio-control.js':'radio-control.js','/radio-control.css':'radio-control.css','/terminal.js':'terminal.js','/terminal.css':'terminal.css','/winlink-radio.js':'winlink-radio.js','/winlink-radio.css':'winlink-radio.css','/forwarding.js':'forwarding.js','/forwarding.css':'forwarding.css','/journal.js':'journal.js','/journal.css':'journal.css','/world-land.json':'world-land.json','/monitor.js':'monitor.js','/monitor.css':'monitor.css','/':'index.html','/app.js':'app.js','/enhancements.js':'enhancements.js','/notifications.js':'notifications.js','/winlink.js':'winlink.js','/mission.js':'mission.js','/attachments.js':'attachments.js','/mission.css':'mission.css','/style.css':'style.css','/dark.css':'dark.css'};const file=files[url.pathname];if(!file){json(res,404,{error:'Pagina non trovata'});return;}const bytes=await readFile(path.join(dir,'public',file));res.writeHead(200,{'Content-Type':file.endsWith('.png')?'image/png':file.endsWith('.md')?'text/plain; charset=utf-8':file.endsWith('.json')?'application/json':file.endsWith('.css')?'text/css; charset=utf-8':file.endsWith('.js')?'text/javascript; charset=utf-8':'text/html; charset=utf-8','Cache-Control':'no-cache'});res.end(bytes);
}catch(e){json(res,502,{error:e.message||'BPQ temporaneamente non disponibile'});}
});
server.listen(port,'0.0.0.0',()=>console.log(`BPQ Console: http://127.0.0.1:${port}`));