Pie Control: Traffic tab, empty-sky checklist, orbit traceroute
A new first tab shows what rides the sky: a headline, load per crust, who is riding (tap to highlight on the globe), per-dish load and why a dish is idle, and a checklist when nothing flows. The traceroute lists circuits through orbit with their uplink, laser and downlink hops. Strings in all languages, tests in tests/pie-traffic.test.js.
This commit is contained in:
parent
df6e0e0964
commit
4ad080cb91
14 changed files with 589 additions and 7 deletions
|
|
@ -49,12 +49,26 @@ function traceroute(src,to,mode){mode=TR_MODES.includes(mode)?mode:'normal';cons
|
|||
const order=e.via?tr('traceroute.a_peer_s_customers_come_after'):{c:tr('traceroute.caches_beat_pnis'),p:tr('traceroute.pnis_beat_ix_peering'),ix:tr('traceroute.ix_peering_beats_transit'),t:tr('traceroute.transit_is_the_last_resort')}[e.k];
|
||||
const cn=cnCity(src)!==!!N.cn?' '+tr('traceroute.crossing_the_great_firewall_here',{p:S.ev.gfw>S.day?35:20}):'';
|
||||
return {text:lines.join('\n'),why:`${tr('traceroute.exit_exit_in_city',{exit:e.lab,city:CITY[e.city].name})} ${tr('traceroute.rule_and_closer_exits_win_ties',{rule:order[0].toUpperCase()+order.slice(1)})}${e.pref!=='normal'?tr('traceroute.this_one_is_set_to_mode',{mode:e.pref==='high'?tr('common.prefer'):tr('common.backup_only')}):''}.${direct}${e.used>=e.cap*0.999?' '+tr('traceroute.it_is_full_so_some_traffic'):''}${cn}`,asPath};}
|
||||
// A circuit riding orbit (R.pie.flows, kind 'c'): its hops as compute() routed them, fiber legs, up, across space and down.
|
||||
const trSkyList=()=>R&&R.pie&&R.pie.flows?R.pie.flows.filter(f=>f.k==='c'&&f.hops&&f.hops.some(h=>h.k==='las')):[];
|
||||
function trSky(id){const f=trSkyList().find(x=>x.id===id),b=f&&S.biz.find(x=>x.id===id);if(!f||!b)return null;const me=slug(S.name)+'.net',lines=[],ip=(a,c)=>`100.64.${a%250}.${c%250}`;let rtt=0.3,n=1;
|
||||
const hop=(host,addr,ms,note)=>{rtt+=ms;lines.push(`${String(n++).padStart(2)} ${host} (${addr}) ${rtt.toFixed(1)} ms${note?' ← '+note:''}`);};
|
||||
lines.push(`traceroute to ${f.b}.${me} (${CITY[f.b].name}) for ${b.name}, 30 hops max`);
|
||||
hop(`lo0.cr1.${f.a}.${me}`,ip(hstr(f.a),1),0,tr('traceroute.city_your_router',{city:CITY[f.a].name}));
|
||||
// Round trip, as for the fiber hops: twice the one-way latency.
|
||||
for(const h of f.hops){const ms=h.ms*2+0.05,cr=h.cr&&CRUSTS[h.cr]?CRUSTS[h.cr]:null;
|
||||
if(h.k==='f')hop(`ae1.cr1.${h.city}.${me}`,ip(hstr(h.city),2),ms,CITY[h.city].name);
|
||||
else if(h.k==='up')hop(`dish.${h.city}.${me}`,ip(hstr(h.city),5),ms,tr('traceroute.sky_up',{city:CITY[h.city].name,crust:cr?tr(cr.n):''}));
|
||||
else if(h.k==='las')hop(`laser.${h.cr||'sky'}.${me}`,`10.255.${hstr(h.cr||'x')%250}.${(h.km|0)%250}`,ms,tr('traceroute.sky_laser',{km:Math.round(h.km).toLocaleString()}));
|
||||
else hop(`dish.${h.city}.${me}`,ip(hstr(h.city),6),ms,tr('traceroute.sky_down',{city:CITY[h.city].name}));}
|
||||
const fm=pieFiberMs(f);
|
||||
return {text:lines.join('\n'),why:isFinite(fm)?tr('traceroute.sky_why',{o:pieMs(f.ms||0),f:pieMs(fm)}):tr('traceroute.sky_why_nofiber',{o:pieMs(f.ms||0)}),asPath:null};}
|
||||
function traceModal(src,to,mode){const pops=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name));src=src&&S.pops[src]?src:UI.trFrom&&S.pops[UI.trFrom]?UI.trFrom:S.home&&S.pops[S.home]?S.home:pops[0];
|
||||
const nets=NETS.slice().sort((a,b)=>b.share-a.share),t=to||UI.trTo||'net:ggl';UI.trFrom=src;UI.trTo=t;mode=TR_MODES.includes(mode)?mode:UI.trMode||'normal';UI.trMode=mode;
|
||||
const r=t.startsWith('net:')?traceroute(src,{net:t.slice(4)},mode):traceroute(src,{city:t.slice(5)},mode);
|
||||
const sky=trSkyList(),r=(t.startsWith('sky:')&&trSky(t.slice(4)))||(t.startsWith('net:')||t.startsWith('sky:')?traceroute(src,{net:t.startsWith('net:')?t.slice(4):'ggl'},mode):traceroute(src,{city:t.slice(5)},mode));
|
||||
openModal(`<div style="display:flex;align-items:center"><div><div class="eyebrow">${tr('common.looking_glass')}</div><h2 style="font-size:26px">${tr('common.traceroute')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
|
||||
<div class="trsel"><label>${tr('common.from')} <select id="trFrom">${pops.map(c=>`<option value="${c}"${c===src?' selected':''}>${esc(CITY[c].name)}</option>`).join('')}</select></label>
|
||||
<label>${tr('common.to')} <select id="trTo"><optgroup label="${tr('common.networks')}">${nets.map(n=>`<option value="net:${n.id}"${t==='net:'+n.id?' selected':''}>${esc(n.name)} (AS${n.asn})</option>`).join('')}</optgroup><optgroup label="${tr('common.your_pops')}">${pops.filter(c=>c!==src).map(c=>`<option value="city:${c}"${t==='city:'+c?' selected':''}>${esc(CITY[c].name)}</option>`).join('')}</optgroup></select></label>${btn(tr('common.run'),'traceRun',{},'pink sm')}</div>
|
||||
<label>${tr('common.to')} <select id="trTo"><optgroup label="${tr('common.networks')}">${nets.map(n=>`<option value="net:${n.id}"${t==='net:'+n.id?' selected':''}>${esc(n.name)} (AS${n.asn})</option>`).join('')}</optgroup><optgroup label="${tr('common.your_pops')}">${pops.filter(c=>c!==src).map(c=>`<option value="city:${c}"${t==='city:'+c?' selected':''}>${esc(CITY[c].name)}</option>`).join('')}</optgroup>${sky.length?`<optgroup label="${tr('traceroute.circuits_through_orbit')}">${sky.map(f=>{const b=S.biz.find(x=>x.id===f.id);return `<option value="sky:${esc(f.id)}"${t==='sky:'+f.id?' selected':''}>🛰️ ${esc(b?b.name:f.id)}</option>`;}).join('')}</optgroup>`:''}</select></label>${btn(tr('common.run'),'traceRun',{},'pink sm')}</div>
|
||||
<div class="btns"><span class="meta" style="align-self:center">${tr('common.route_4a2e')}</span>${TR_MODES.map(m=>btn(RT[m],'traceMode',{m},mode===m?'pink sm':'ghost sm')).join('')}</div>
|
||||
${mode!=='normal'?`<p class="note">${tr('traceroute.your_traffic_follows_the_metrics_this',{mode:RT[mode]})}</p>`:''}<pre class="term">${esc(r.text)}</pre>${r.asPath?`<p class="meta">${tr('traceroute.as_path_path',{path:r.asPath.map(a=>'AS'+a).join(' → ')})}</p>`:''}<p class="note">${esc(r.why)}</p>
|
||||
<div class="btns">${btn(tr('common.copy'),'traceCopy',{},'ghost sm')}</div>`);UI.trText=r.text;}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ Object.assign(ACT,{
|
|||
pieSafe:()=>{const P=pieGet();if(!P||!P.co)return;P.safe=!P.safe;sfx('click');pieRe();},
|
||||
pieName:()=>{const P=pieGet();if(!P||!P.co)return;const i=PIE_NAMES.indexOf(P.co.name);P.co.name=PIE_NAMES[(i+1)%PIE_NAMES.length];pieFounder(N_('pie.fp_rename'));pieRe();},
|
||||
pieRename:()=>{const P=pieGet(),el=$('pieNm');if(!P||!P.co||!el)return;const v=el.value.replace(/\s+/g,' ').trim().slice(0,40);if(!v)return;P.co.name=v;pieFounder(N_('pie.fp_rename'));pieRe();},
|
||||
pieTab:({t})=>{if(!['co','fly','dish','book'].includes(t))return;UI.pieTab=t;pieModal();},
|
||||
pieTab:({t})=>{if(!PIE_TABS.includes(t))return;UI.pieTab=t;pieModal();},
|
||||
pieHi:({id})=>{if(typeof id!=='string')return;sfx('click');pieHiSet(id);},
|
||||
pieCity:({v})=>{if(!S||!S.pops[v])return;UI.pieCity=v;pieModal();},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,18 +4,20 @@ function pieLicCountry(cc){try{PIE_CCN=PIE_CCN&&PIE_CCN.l===LANG?PIE_CCN:{l:LANG
|
|||
function pieCard(){if(!pieOn())return '';const P=S.pie;
|
||||
return `<div class="ops-card pie-card"><div class="nm">🥧 ${tr('pie.pie_in_the_sky')}</div><div class="meta">${P&&P.co?esc(pieCoName())+' · '+tr('pie.card_live',{n:Object.keys(CRUSTS).reduce((a,id)=>a+pieLive(id),0),q:P.q.length}):tr('pie.card_pitch')}</div>
|
||||
${pieSpatCard()}<div class="btns">${btn(tr('pie.open_pie_control'),'pieOpen',{},P&&P.co?'sm':'pink sm')}</div></div>`;}
|
||||
const PIE_TABS=['traffic','co','fly','dish','book'];
|
||||
const pieTag=(t,on)=>`<span class="tag ${on?'open':'selective'}">${t}</span>`;
|
||||
function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=['co','fly','dish','book'].includes(UI.pieTab)?UI.pieTab:'co';
|
||||
function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pieCanBuild(),T=PIE_TABS.includes(UI.pieTab)?UI.pieTab:'traffic';
|
||||
let h=`<div style="display:flex;align-items:center"><div class="grow"><div class="eyebrow">${tr('pie.pie_in_the_sky')}</div><h2 style="font-size:24px">${P.co?esc(pieCoName()):tr('pie.pie_control')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>`;
|
||||
if(!can)h+=`<p class="why">${tr('pie.why_not_t1')}</p>`;
|
||||
if(pieSand())h+=`<p class="note">${tr('pie.sandbox_note',{amt:fmt$(P.book.wouldHave)})}</p>`;
|
||||
if(!P.co){h+=`<p class="lead">${tr('pie.found_pitch')}</p><div class="btns">${btn(tr('pie.found_price',{price:fmt$(piePrice(PIE_CO)),mo:fmt$(PIE_CO_MO)}),'pieFound',{},'pink',!can)}</div>`;openModal(h,'pie');return;}
|
||||
const tab=(k,l)=>`<button class="b sm ${T===k?'pink':'ghost'}" data-act="pieTab" data-args='{"t":"${k}"}' aria-pressed="${T===k}">${l}</button>`;
|
||||
h+=pieGlobeHtml()+pieSpatCard();
|
||||
h+=`<div class="seg" style="margin:6px 0 10px">${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}${tab('book',tr('pie.tab_founder'))}</div>`;
|
||||
h+=`<div class="seg" style="margin:6px 0 10px">${tab('traffic',tr('pie_traffic.tab'))}${tab('co',tr('pie.tab_company'))}${tab('fly',tr('pie.tab_launch'))}${tab('dish',tr('pie.tab_dishes'))}${tab('book',tr('pie.tab_founder'))}</div>`;
|
||||
const cities=Object.keys(S.pops).sort((a,b)=>CITY[a].name.localeCompare(CITY[b].name)),c=S.pops[UI.pieCity]?UI.pieCity:cities[0];
|
||||
const sel=`<div class="trsel"><label>${tr('common.your_pop')}<select data-chg="pieCity">${cities.map(x=>`<option value="${x}"${x===c?' selected':''}>${esc(CITY[x].name)}</option>`).join('')}</select></label></div>`;
|
||||
if(T==='co'){
|
||||
if(T==='traffic')h+=pieTrafficHtml();
|
||||
else if(T==='co'){
|
||||
h+=`<div class="kv"><span>${tr('pie.running_costs')}</span><b>${tr('common.price_mo',{price:fmt$(pieMo())})}</b></div>`;
|
||||
h+=`<div class="ops-o${P.fac?' on':''}"><div class="nm">🏭 ${tr('pie.factory')}</div><div class="meta">${P.fac?tr('pie.factory_stock',{n:Math.floor(P.stock),m:PIE_FAC_MONTH}):tr('pie.factory_pitch',{m:PIE_FAC_MONTH,mo:fmt$(PIE_FAC_MO)})}</div>${P.fac?'':`<div class="btns">${btn(tr('pie.build_price',{price:fmt$(piePrice(PIE_FAC))}),'pieFactory',{},'pink sm',!can)}</div>`}</div>`;
|
||||
h+=`<div class="ops-o"><div class="nm">🧪 ${tr('pie.rd')}</div>${Object.keys(PIE_RD).map(k=>`<div class="kv"><span>${tr(PIE_RD[k].n)}</span>${P.rd[k]?`<b>✓</b>`:btn(fmt$(piePrice(PIE_RD[k].cost)),'pieRd',{k},'ghost sm',!can)}</div>`).join('')}
|
||||
|
|
|
|||
47
src/game/93-ui/86-pie-traffic.js
Normal file
47
src/game/93-ui/86-pie-traffic.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/* Pie Control's Traffic tab: what rides your satellites, how much, for whom, and why a sky or a dish is idle. Read from
|
||||
the last compute (R.pie: flows, crust, dish from 35-pie-paths.js); the fiber comparison is worked out only here
|
||||
(pieFiberMs, once per compute). The highlighted row (UI.pieHi) is display only and never saved. */
|
||||
const PIE_ROWS=40;
|
||||
const pieIcon=t=>({pizza:'🏡',flywifi:'✈️',boat:'🚢',marsorb:'🔴',mars:'🔴',hft:'📈'})[t]||'🔗';
|
||||
const pieCn=c=>c&&CITY[c]?esc(CITY[c].name):'?';
|
||||
const pieMs=v=>v<10?v.toFixed(1):String(Math.round(v));
|
||||
// Bar colour by use: green, amber from 60%, red from 90% (the globe's rings and the map badge use the same steps).
|
||||
const pieLoadCls=u=>u>=0.9?'bad':u>=0.6?'warn':'';
|
||||
const pieBar=(u,cls)=>`<div class="bar ${cls}"><i style="width:${Math.round(clamp(u,0,1)*100)}%"></i></div>`;
|
||||
function pieDishWhy(d){const cc=CITY[d.city].cc,l=S.pie.lic[cc];return {nopop:tr('pie_traffic.d_nopop'),down:tr('pie_traffic.d_down'),lic:tr('pie_traffic.d_lic',{country:esc(pieLicCountry(cc))}),
|
||||
ref:tr('pie_traffic.d_ref'),spat:tr('pie_traffic.d_spat',{d:l?dateStr(l.until):''}),nocrust:tr('pie_traffic.d_nocrust'),isl:tr('pie_traffic.d_isl'),rain:tr('pie_traffic.d_rain'),
|
||||
jam:tr('pie_traffic.d_jam'),nolas:tr('pie_traffic.d_nolas'),idle:tr('pie_traffic.d_idle')}[d.st]||'';}
|
||||
function pieCrustWhy(c){return c.st==='half'?tr('pie_traffic.crust_half',{crust:tr(CRUSTS[c.id].n),p:pct(c.cov),min:pct(PIE_BAKED)}):c.st==='safe'?tr('pie_traffic.crust_safe'):c.st==='down'?tr('pie_traffic.crust_down'):'';}
|
||||
// The empty sky: every condition traffic needs, ticked or not, with a hint for the first thing to fix.
|
||||
function pieChecks(Q){const P=S.pie,cr=Q.crust,best=cr.slice().sort((a,b)=>b.cov-a.cov)[0],ds=Q.dish,isl=ds.find(d=>d.st==='isl');
|
||||
const sold=S.biz.some(b=>BIZ_T[b.type].orbit||(BIZ_T[b.type].lat&&b.route==='fast'&&b.city2&&pieKm(b.city,b.city2)>=PIE_MIN_KM));
|
||||
return [
|
||||
{k:'baked',ok:Q.hubs.length>0,l:tr('pie_traffic.ck_baked',{min:pct(PIE_BAKED)}),h:!best?tr('pie_traffic.ck_baked_none'):pieCrustWhy(best)||tr('pie_traffic.ck_baked_none')},
|
||||
{k:'dish',ok:ds.some(d=>d.cap>0),l:tr('pie_traffic.ck_dish'),h:P.dishes.length?tr('pie_traffic.ck_dish_lic'):tr('pie_traffic.ck_dish_none')},
|
||||
{k:'backbone',ok:ds.some(d=>d.cap>0&&!Q.isl.includes(d.city)),l:tr('pie_traffic.ck_backbone'),h:Q.isl.length?tr('pie_traffic.ck_backbone_h',{city:pieCn(isl?isl.city:Q.isl[0])}):tr('pie_traffic.ck_backbone_none')},
|
||||
{k:'lasers',ok:cr.some(c=>c.las),l:tr('pie_traffic.ck_lasers'),h:tr('pie_traffic.ck_lasers_h')},
|
||||
{k:'customers',ok:sold,l:tr('pie_traffic.ck_customers'),h:tr('pie_traffic.ck_customers_h',{km:PIE_MIN_KM.toLocaleString()})}];}
|
||||
function pieFlowRow(f,B){const b=B.get(f.id),hi=UI.pieHi===f.id,nm=b?esc(b.name):'?';let route,ms='';
|
||||
if(f.k==='t')route=f.dish?(f.dish===f.city?tr('pie_traffic.lands_here',{city:pieCn(f.city)}):tr('pie_traffic.lands_at',{city:pieCn(f.city),dish:pieCn(f.dish)})):tr('pie_traffic.no_landing',{city:pieCn(f.city)});
|
||||
else{route=tr('pie_traffic.route_ab',{a:pieCn(f.a),b:pieCn(f.b)})+(f.via.length>1?' · '+tr('pie_traffic.via_dishes',{up:pieCn(f.via[0]),down:pieCn(f.via[f.via.length-1])}):'');
|
||||
if(f.ms!=null){const fm=pieFiberMs(f);ms=isFinite(fm)?tr('pie_traffic.orbit_vs_fiber',{o:pieMs(f.ms),f:pieMs(fm)}):tr('pie_traffic.orbit_no_fiber',{o:pieMs(f.ms)});}}
|
||||
return `<button class="pft-row${hi?' on':''}" data-act="pieHi" data-args="${esc(JSON.stringify({id:f.id}))}" data-fid="${esc(f.id)}" aria-pressed="${hi}">
|
||||
<span class="pft-ic" aria-hidden="true">${pieIcon(f.type)}</span><span class="pft-m"><b>${nm}</b><small>${route}</small>${ms?`<small>${ms}</small>`:''}</span>
|
||||
<span class="pft-n"><b>${fmtG(f.g)}</b><small>${tr('common.price_mo',{price:fmt$(f.rev)})}</small></span></button>`;}
|
||||
function pieTrafficHtml(){const Q=R&&R.pie;if(!Q||!Q.flows)return `<p class="meta">${tr('pie_traffic.no_data')}</p>`;
|
||||
const fl=Q.flows.filter(f=>f.g>0||f.k==='t').sort((a,b)=>b.g-a.g),g=fl.reduce((a,f)=>a+f.g,0),n=fl.filter(f=>f.g>0).length,B=new Map(S.biz.map(b=>[b.id,b]));
|
||||
let h=`<p class="pft-head">${trn('pie_traffic.headline',n,{g:fmtG(g),of:fmtG(pieMarket()),amt:fmt$(Q.rev)})}</p>`;
|
||||
if(!(g>0))h+=`<div class="ops-o pft-why"><div class="nm">${tr('pie_traffic.empty_title')}</div><ul class="pft-ck">${pieChecks(Q).map(c=>`<li class="${c.ok?'on':'off'}" data-k="${c.k}"><span aria-hidden="true">${c.ok?'✅':'⬜'}</span><span><b>${c.l}</b>${c.ok?'':`<small>${c.h}</small>`}</span></li>`).join('')}</ul></div>`;
|
||||
h+=`<h3 class="pft-h">${tr('pie_traffic.crusts')}</h3>`+(Q.crust.length?Q.crust.map(c=>{const why=pieCrustWhy(c);
|
||||
return `<div class="pft-cr"><div class="kv"><span>${tr(CRUSTS[c.id].n)} ${pieTag(c.st==='half'?tr('pie.half_baked'):tr('pie.baked'),c.st!=='half')}</span><b>${c.cap>0?tr('pie_traffic.used_of',{u:fmtG(c.used),cap:fmtG(c.cap)}):pct(c.cov)}</b></div>
|
||||
${c.cap>0?pieBar(c.used/c.cap,pieLoadCls(c.used/c.cap)):pieBar(c.cov/PIE_BAKED,'warn')}${why?`<p class="meta">${why}</p>`:''}</div>`;}).join(''):`<p class="meta">${tr('pie_traffic.ck_baked_none')}</p>`);
|
||||
if(fl.length){h+=`<h3 class="pft-h">${tr('pie_traffic.riding')}</h3><p class="meta">${tr('pie_traffic.tap_hint')}</p><div class="pft-list">${fl.slice(0,PIE_ROWS).map(f=>pieFlowRow(f,B)).join('')}</div>`;
|
||||
if(fl.length>PIE_ROWS)h+=`<p class="meta">${trn('pie_traffic.n_more',fl.length-PIE_ROWS)}</p>`;}
|
||||
if(Q.dish.length)h+=`<h3 class="pft-h">${tr('pie_traffic.dishes')}</h3>`+Q.dish.slice().sort((a,b)=>b.used-a.used).map(d=>{const why=d.st==='ok'?'':pieDishWhy(d);
|
||||
return `<div class="pft-d"><div class="kv"><span>📡 ${pieCn(d.city)}</span><b>${d.cap>0?pct(d.u):'–'}</b></div>${pieBar(d.u,pieLoadCls(d.u))}
|
||||
<p class="meta">${tr('pie_traffic.dish_line',{t:fmtG(d.term),x:fmtG(d.transit),cap:fmtG(d.cap)})}${why?` · <span class="pft-st">${why}</span>`:''}</p></div>`;}).join('');
|
||||
return h;}
|
||||
// Tapping a row: mark it in place and point the globe at it, without rebuilding the panel (the scroll stays where it is).
|
||||
function pieHiSet(id){UI.pieHi=UI.pieHi===id?null:id;
|
||||
for(const r of document.querySelectorAll('#modal .pft-row')){const on=r.dataset.fid===UI.pieHi;r.classList.toggle('on',on);r.setAttribute('aria-pressed',String(on));}
|
||||
if(PG.cv){PG.dAt=-1e9;PG.dirty=true;}}
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
const LBLW={},LINKW=new Map(),LBLF=new Map(),FKEY=new Map(),QKEY=new Map(),CM={off:new Set(),big:new Set(),inc:new Set(),far:false,dish:null};
|
||||
// Pie dishes (Pie in the Sky): city -> up?, or null without any, so most maps pay one null check per city.
|
||||
function pieDishMap(){const d=S.pie&&S.pie.dishes;if(!Array.isArray(d)||!d.length)return null;const m=new Map();for(const x of d)if(x&&x.city)m.set(x.city,m.get(x.city)||!(x.down>S.day));return m;}
|
||||
// Painted once per look and drawn as a sprite, so it shows on the graphics-card map as well.
|
||||
// Painted once per look (the load in 5% steps) and drawn as a sprite, so it shows on the graphics-card map as well.
|
||||
function dishBadge(x,y,up,u,k=1){const q=u>0.005?Math.min(20,Math.round(u*20)):0;stamp('dish|'+(up?1:0)+'|'+q,20,20,10,10,k,x,y,()=>dishPaint(0,0,up,q/20));}
|
||||
function dishPaint(x,y,up,u){if(u>0.005){ctx.lineWidth=1.8;ctx.strokeStyle='rgba(30,38,64,.3)';ctx.beginPath();ctx.arc(x,y,8,0,7);ctx.stroke();ctx.strokeStyle=u>=0.9?'#FF4D5E':u>=0.6?'#FFAA1F':'#22C47A';ctx.beginPath();ctx.arc(x,y,8,-Math.PI/2,-Math.PI/2+Math.min(1,u)*2*Math.PI);ctx.stroke();}
|
||||
|
|
|
|||
|
|
@ -3600,6 +3600,50 @@
|
|||
"pie_spat.pad_r1":"You declined. Everyone shook hands anyway.",
|
||||
"pie_spat.pad_t":"Launch diplomacy",
|
||||
"pie_spat.pad_won":"Ribbon cut: a free launch pad in {city}.",
|
||||
"pie_traffic.ck_backbone":"A dish on your backbone",
|
||||
"pie_traffic.ck_backbone_h":"{city} has no fiber to the rest of your network, so it only serves its own neighbours.",
|
||||
"pie_traffic.ck_backbone_none":"Your dishes need a POP that your backbone reaches.",
|
||||
"pie_traffic.ck_baked":"A crust at least {min} full",
|
||||
"pie_traffic.ck_baked_none":"Launch pies into a crust until it is baked.",
|
||||
"pie_traffic.ck_customers":"Customers who use orbit",
|
||||
"pie_traffic.ck_customers_h":"Sign orbit customers (homes, boats, airlines) or a latency circuit on the fast route between cities over {km} km apart.",
|
||||
"pie_traffic.ck_dish":"A working pie dish with landing rights",
|
||||
"pie_traffic.ck_dish_lic":"Your dishes are down or have no landing rights. Check the Dishes tab.",
|
||||
"pie_traffic.ck_dish_none":"Build a pie dish at one of your POPs (Dishes tab).",
|
||||
"pie_traffic.ck_lasers":"Laser links between pies",
|
||||
"pie_traffic.ck_lasers_h":"Without lasers, traffic only reaches a dish within 1,000 km and nothing crosses space. Launch pies with lasers.",
|
||||
"pie_traffic.crust_down":"Out of service for now (a solar storm).",
|
||||
"pie_traffic.crust_half":"{crust} is {p} baked; it carries traffic from {min}.",
|
||||
"pie_traffic.crust_safe":"Safe mode is on: it carries nothing until you turn it off.",
|
||||
"pie_traffic.crusts":"Crusts",
|
||||
"pie_traffic.d_down":"out of action (a backhoe)",
|
||||
"pie_traffic.d_idle":"no customers use it yet",
|
||||
"pie_traffic.d_isl":"cut off from your backbone",
|
||||
"pie_traffic.d_jam":"jammed near the border",
|
||||
"pie_traffic.d_lic":"no landing rights in {country}",
|
||||
"pie_traffic.d_nocrust":"no baked crust covers it",
|
||||
"pie_traffic.d_nolas":"no lasers yet, and no customers nearby",
|
||||
"pie_traffic.d_nopop":"no POP here any more",
|
||||
"pie_traffic.d_rain":"raining: rain fade",
|
||||
"pie_traffic.d_ref":"landing rights refused for now",
|
||||
"pie_traffic.d_spat":"rights suspended by a spat until {d}",
|
||||
"pie_traffic.dish_line":"Terminals {t} · transit {x} · of {cap}",
|
||||
"pie_traffic.dishes":"Pie dishes",
|
||||
"pie_traffic.empty_title":"Why is my sky empty?",
|
||||
"pie_traffic.headline":{"one":"In orbit now: {g} of {of} sellable · {amt}/mo · {n} customer","other":"In orbit now: {g} of {of} sellable · {amt}/mo · {n} customers"},
|
||||
"pie_traffic.lands_at":"{city} · lands at {dish}",
|
||||
"pie_traffic.lands_here":"Lands at {city}",
|
||||
"pie_traffic.n_more":{"one":"…and {n} more","other":"…and {n} more"},
|
||||
"pie_traffic.no_data":"Nothing measured yet. Traffic shows up after the next update.",
|
||||
"pie_traffic.no_landing":"{city} · no dish can land it",
|
||||
"pie_traffic.orbit_no_fiber":"orbit {o} ms, no fiber path",
|
||||
"pie_traffic.orbit_vs_fiber":"orbit {o} ms vs fiber {f} ms",
|
||||
"pie_traffic.riding":"Who's riding",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Traffic",
|
||||
"pie_traffic.tap_hint":"Tap a row to show its path on the globe.",
|
||||
"pie_traffic.used_of":"{u} of {cap}",
|
||||
"pie_traffic.via_dishes":"up at {up}, down at {down}",
|
||||
"pitcairn.uk_grant_mo":"UK grant {mo}/mo",
|
||||
"pitcairn.uk_grant_mo_once_islanders":"UK grant {mo}/mo once the islanders are online",
|
||||
"pni_all.additional_per_month":"Additional monthly cost",
|
||||
|
|
@ -4480,6 +4524,7 @@
|
|||
"traceroute.across_the_ix_switch":"across the {ix} switch",
|
||||
"traceroute.as_path_path":"<b>AS path:</b> {path}",
|
||||
"traceroute.caches_beat_pnis":"caches beat PNIs",
|
||||
"traceroute.circuits_through_orbit":"Circuits through orbit",
|
||||
"traceroute.city_your_router":"{city}, your router",
|
||||
"traceroute.crossing_the_great_firewall_here":"Crossing the Great Firewall here loses about {p}% of packets.",
|
||||
"traceroute.embedded_cache_in_your_rack":"embedded cache in your rack",
|
||||
|
|
@ -4501,6 +4546,11 @@
|
|||
"traceroute.pnis_beat_ix_peering":"PNIs beat IX peering",
|
||||
"traceroute.private_cross_connect":"private cross-connect",
|
||||
"traceroute.rule_and_closer_exits_win_ties":"{rule}, and closer exits win ties",
|
||||
"traceroute.sky_down":"↓ downlink at {city}",
|
||||
"traceroute.sky_laser":"laser across space {km} km",
|
||||
"traceroute.sky_up":"↑ uplink at {city} ({crust})",
|
||||
"traceroute.sky_why":"This circuit takes the fast route, and through orbit it is {o} ms one way against {f} ms on your fiber: light in a vacuum beats light in glass over long distances.",
|
||||
"traceroute.sky_why_nofiber":"This circuit rides orbit at {o} ms one way; your fiber has no path between these cities.",
|
||||
"traceroute.the_carrier_s_own_port_beats_other":"This port goes straight to {net}, so it beats the other transit ports.",
|
||||
"traceroute.this_one_is_set_to_mode":"; this one is set to {mode}",
|
||||
"traceroute.transit_is_the_last_resort":"transit is the last resort",
|
||||
|
|
|
|||
|
|
@ -3,3 +3,21 @@
|
|||
.pglobe .pgcv{display:block;width:100%;height:100%;touch-action:none;cursor:grab;border-radius:16px}
|
||||
.pglobe .pgnight{position:absolute;top:6px;right:6px;min-width:36px;min-height:36px}
|
||||
@media (max-width:420px){.pglobe{max-width:min(100%,62vh)}}
|
||||
/* Pie Control's Traffic tab (93-ui/86-pie-traffic.js): rows a thumb can hit, nothing wider than the sheet. */
|
||||
.pft-head{font-weight:900;font-size:15px;margin:4px 0 8px;overflow-wrap:anywhere}
|
||||
.pft-h{font-size:15px;margin:12px 0 4px}
|
||||
.pft-cr,.pft-d{margin:6px 0}
|
||||
.pft-cr .kv span,.pft-d .kv span{min-width:0;overflow-wrap:anywhere}
|
||||
.pft-list{display:flex;flex-direction:column;gap:6px}
|
||||
.pft-row{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:6px 10px;border:2px solid var(--line);border-radius:12px;background:var(--paper);color:var(--ink);font:inherit;text-align:left;cursor:pointer;box-sizing:border-box}
|
||||
.pft-row.on{border-color:var(--me);box-shadow:0 0 0 2px var(--me) inset}
|
||||
.pft-ic{font-size:20px;flex:none}
|
||||
.pft-m{flex:1;min-width:0;display:flex;flex-direction:column}
|
||||
.pft-m b,.pft-m small,.pft-n small{overflow-wrap:anywhere}
|
||||
.pft-m small,.pft-n small{font-size:12px;color:var(--ink2)}
|
||||
.pft-n{flex:none;display:flex;flex-direction:column;align-items:flex-end;text-align:right;max-width:40%}
|
||||
.pft-ck{list-style:none;margin:4px 0 0;padding:0}
|
||||
.pft-ck li{display:flex;gap:8px;align-items:flex-start;min-height:32px;margin:4px 0}
|
||||
.pft-ck li span:last-child{display:flex;flex-direction:column;min-width:0}
|
||||
.pft-ck small{font-size:12px;color:var(--ink2);overflow-wrap:anywhere}
|
||||
.pft-st{color:var(--bad);font-weight:800}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue