Load mirror.js: every MMR endpoint gets live + mirror bounce links
Browse files- index.html +10 -9
index.html
CHANGED
|
@@ -59,7 +59,6 @@ const OWNER='autobahn247365',DS=OWNER+'/mmr',HF='https://huggingface.co/';
|
|
| 59 |
const tog=id=>{const p=$(id),o=!p.classList.contains('open');document.querySelectorAll('.panel').forEach(x=>x.classList.remove('open'));if(o)p.classList.add('open');};
|
| 60 |
$('fabCat').onclick=()=>tog('cat');$('fabReg').onclick=()=>tog('reg');
|
| 61 |
document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).classList.remove('open'));
|
| 62 |
-
// ===== MIRROR BOUNCE: every feed tries each mirror until one answers; returns [json, which mirror] =====
|
| 63 |
async function B(urls){let last;for(let i=0;i<urls.length;i++){try{const r=await fetch(urls[i]);if(r.ok){const t=await r.text();return [JSON.parse(t),i];}last=r.status;}catch(e){last=e.message||e;}}throw last;}
|
| 64 |
const J=async u=>(await B(Array.isArray(u)?u:[u]))[0];
|
| 65 |
const GH=(repo,path)=>[`https://cdn.jsdelivr.net/gh/${repo}@master/${path}`,`https://raw.githubusercontent.com/${repo}/master/${path}`];
|
|
@@ -104,26 +103,21 @@ $('zx').oninput=render;
|
|
| 104 |
const D={flights:[],iss:[],sats:[],cables:[],quakes:[]};
|
| 105 |
const routes=[];N.forEach((a,i)=>{for(let j=i+1;j<N.length;j++)if((i*5+j*3)%4===0)routes.push({s:[a[1],a[2]],t:[N[j][1],N[j][2]],n:a[0]+' ⇄ '+N[j][0],k:(i+j)%4});});
|
| 106 |
st('routes','live','ok');st('comms','live','ok');
|
| 107 |
-
// FLIGHTS: OpenSky → adsb.lol → airplanes.live
|
| 108 |
async function flights(){
|
| 109 |
try{const [j,i]=await B(['https://opensky-network.org/api/states/all','https://api.adsb.lol/v2/lat/40/lon/-40/dist/5000','https://api.airplanes.live/v2/point/40/-40/250']);
|
| 110 |
if(j.states)D.flights=j.states.filter(s=>s[5]!=null&&s[6]!=null).map(s=>({p:[s[5],s[6],(s[7]||s[13]||0)],n:(s[1]||'').trim()||s[0],t:j.time}));
|
| 111 |
else D.flights=(j.ac||j.aircraft||[]).filter(a=>a.lat!=null).map(a=>({p:[a.lon,a.lat,(+a.alt_baro||0)*0.3048],n:(a.flight||a.hex||'').trim(),t:Date.now()/1000}));
|
| 112 |
st('flights',D.flights.length+' planes · '+M(i),'ok');}catch(e){st('flights','all mirrors blocked','bad');}render();}
|
| 113 |
-
// ISS: wheretheiss.at → open-notify
|
| 114 |
async function iss(){try{const [j,i]=await B(['https://api.wheretheiss.at/v1/satellites/25544','https://api.open-notify.org/iss-now.json']);
|
| 115 |
if(j.latitude!=null)D.iss=[{p:[j.longitude,j.latitude,j.altitude*1000],n:'ISS',t:j.timestamp}];
|
| 116 |
else D.iss=[{p:[+j.iss_position.longitude,+j.iss_position.latitude,420000],n:'ISS',t:j.timestamp}];
|
| 117 |
st('iss','live · '+M(i),'ok');}catch(e){st('iss','all mirrors blocked','bad');}render();}
|
| 118 |
-
// SATELLITES: CelesTrak → TLE API mirror
|
| 119 |
let TLE=[];async function sats(){try{const [j,i]=await B(['https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=json','https://tle.ivanstanojevic.me/api/tle/?search=ISS&page-size=50','https://tle.ivanstanojevic.me/api/tle/?page-size=100']);
|
| 120 |
if(Array.isArray(j))TLE=j.map(g=>({n:g.OBJECT_NAME,rec:satellite.json2satrec(g)}));
|
| 121 |
else TLE=(j.member||[]).map(m=>({n:m.name,rec:satellite.twoline2satrec(m.line1,m.line2)}));
|
| 122 |
TLE=TLE.filter(s=>s.rec);st('sats',TLE.length+' objects · '+M(i),'ok');}catch(e){st('sats','all mirrors blocked','bad');}}
|
| 123 |
function satPos(){const now=new Date(),gm=satellite.gstime(now);D.sats=TLE.map(s=>{const pv=satellite.propagate(s.rec,now);if(!pv||!pv.position)return null;const g=satellite.eciToGeodetic(pv.position,gm);return{p:[satellite.degreesLong(g.longitude),satellite.degreesLat(g.latitude),g.height*1000],n:s.n,t:now.getTime()/1000};}).filter(Boolean);}
|
| 124 |
-
// CABLES: source → jsDelivr GitHub → raw GitHub
|
| 125 |
async function cables(){try{const [j,i]=await B(['https://www.submarinecablemap.com/api/v3/cable/cable-geo.json',...GH('telegeography/www.submarinecablemap.com','web/public/api/v3/cable/cable-geo.json')]);D.cables=[];j.features.forEach(f=>{const g=f.geometry,cs=g.type==='MultiLineString'?g.coordinates:[g.coordinates];cs.forEach(c=>D.cables.push({path:c,n:f.properties.name,col:f.properties.color}));});st('cables',j.features.length+' cables · '+M(i),'ok');}catch(e){st('cables','all mirrors blocked','bad');}render();}
|
| 126 |
-
// QUAKES: USGS → EMSC
|
| 127 |
async function quakes(){try{const since=new Date(Date.now()-864e5).toISOString().slice(0,19);
|
| 128 |
const [j,i]=await B(['https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson','https://www.seismicportal.eu/fdsnws/event/1/query?format=json&limit=2000&starttime='+since]);
|
| 129 |
D.quakes=(j.features||[]).map(f=>{const c=f.geometry.coordinates,p=f.properties;const depth=Math.abs(c[2]||p.depth||0);return{p:[c[0],c[1],-depth*1000],m:p.mag||0,n:p.place||p.flynn_region||'',t:(typeof p.time==='number'?p.time:Date.parse(p.time))/1000};});
|
|
@@ -163,9 +157,16 @@ function load(src){VIEW=HF+'datasets/'+DS+'/viewer?row=';
|
|
| 163 |
$('hd').innerHTML=COLS.map(c=>`<th data-k="${c}">${c==='tab'?'name':c} link ⇅</th>`).join('');
|
| 164 |
document.querySelectorAll('#hd th').forEach(th=>th.onclick=()=>{sd=sk===th.dataset.k?-sd:1;sk=th.dataset.k;draw();});draw();},
|
| 165 |
error:e=>{$('count').textContent='Master did not load: '+e;}});}
|
| 166 |
-
['q','fSuite'].forEach(id=>$(id).addEventListener('input',draw));
|
|
|
|
|
|
|
| 167 |
function draw(){const q=$('q').value.toLowerCase(),fs=$('fSuite').value;
|
| 168 |
const v=ROWS.filter(r=>(!fs||r.suite===fs)&&(!q||Object.values(r).join(' ').toLowerCase().includes(q))).sort((a,b)=>String(a[sk]||'').localeCompare(String(b[sk]||''),undefined,{numeric:true})*sd);
|
| 169 |
-
|
| 170 |
-
$('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
</script></body></html>
|
|
|
|
| 59 |
const tog=id=>{const p=$(id),o=!p.classList.contains('open');document.querySelectorAll('.panel').forEach(x=>x.classList.remove('open'));if(o)p.classList.add('open');};
|
| 60 |
$('fabCat').onclick=()=>tog('cat');$('fabReg').onclick=()=>tog('reg');
|
| 61 |
document.querySelectorAll('[data-close]').forEach(b=>b.onclick=()=>$(b.dataset.close).classList.remove('open'));
|
|
|
|
| 62 |
async function B(urls){let last;for(let i=0;i<urls.length;i++){try{const r=await fetch(urls[i]);if(r.ok){const t=await r.text();return [JSON.parse(t),i];}last=r.status;}catch(e){last=e.message||e;}}throw last;}
|
| 63 |
const J=async u=>(await B(Array.isArray(u)?u:[u]))[0];
|
| 64 |
const GH=(repo,path)=>[`https://cdn.jsdelivr.net/gh/${repo}@master/${path}`,`https://raw.githubusercontent.com/${repo}/master/${path}`];
|
|
|
|
| 103 |
const D={flights:[],iss:[],sats:[],cables:[],quakes:[]};
|
| 104 |
const routes=[];N.forEach((a,i)=>{for(let j=i+1;j<N.length;j++)if((i*5+j*3)%4===0)routes.push({s:[a[1],a[2]],t:[N[j][1],N[j][2]],n:a[0]+' ⇄ '+N[j][0],k:(i+j)%4});});
|
| 105 |
st('routes','live','ok');st('comms','live','ok');
|
|
|
|
| 106 |
async function flights(){
|
| 107 |
try{const [j,i]=await B(['https://opensky-network.org/api/states/all','https://api.adsb.lol/v2/lat/40/lon/-40/dist/5000','https://api.airplanes.live/v2/point/40/-40/250']);
|
| 108 |
if(j.states)D.flights=j.states.filter(s=>s[5]!=null&&s[6]!=null).map(s=>({p:[s[5],s[6],(s[7]||s[13]||0)],n:(s[1]||'').trim()||s[0],t:j.time}));
|
| 109 |
else D.flights=(j.ac||j.aircraft||[]).filter(a=>a.lat!=null).map(a=>({p:[a.lon,a.lat,(+a.alt_baro||0)*0.3048],n:(a.flight||a.hex||'').trim(),t:Date.now()/1000}));
|
| 110 |
st('flights',D.flights.length+' planes · '+M(i),'ok');}catch(e){st('flights','all mirrors blocked','bad');}render();}
|
|
|
|
| 111 |
async function iss(){try{const [j,i]=await B(['https://api.wheretheiss.at/v1/satellites/25544','https://api.open-notify.org/iss-now.json']);
|
| 112 |
if(j.latitude!=null)D.iss=[{p:[j.longitude,j.latitude,j.altitude*1000],n:'ISS',t:j.timestamp}];
|
| 113 |
else D.iss=[{p:[+j.iss_position.longitude,+j.iss_position.latitude,420000],n:'ISS',t:j.timestamp}];
|
| 114 |
st('iss','live · '+M(i),'ok');}catch(e){st('iss','all mirrors blocked','bad');}render();}
|
|
|
|
| 115 |
let TLE=[];async function sats(){try{const [j,i]=await B(['https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=json','https://tle.ivanstanojevic.me/api/tle/?search=ISS&page-size=50','https://tle.ivanstanojevic.me/api/tle/?page-size=100']);
|
| 116 |
if(Array.isArray(j))TLE=j.map(g=>({n:g.OBJECT_NAME,rec:satellite.json2satrec(g)}));
|
| 117 |
else TLE=(j.member||[]).map(m=>({n:m.name,rec:satellite.twoline2satrec(m.line1,m.line2)}));
|
| 118 |
TLE=TLE.filter(s=>s.rec);st('sats',TLE.length+' objects · '+M(i),'ok');}catch(e){st('sats','all mirrors blocked','bad');}}
|
| 119 |
function satPos(){const now=new Date(),gm=satellite.gstime(now);D.sats=TLE.map(s=>{const pv=satellite.propagate(s.rec,now);if(!pv||!pv.position)return null;const g=satellite.eciToGeodetic(pv.position,gm);return{p:[satellite.degreesLong(g.longitude),satellite.degreesLat(g.latitude),g.height*1000],n:s.n,t:now.getTime()/1000};}).filter(Boolean);}
|
|
|
|
| 120 |
async function cables(){try{const [j,i]=await B(['https://www.submarinecablemap.com/api/v3/cable/cable-geo.json',...GH('telegeography/www.submarinecablemap.com','web/public/api/v3/cable/cable-geo.json')]);D.cables=[];j.features.forEach(f=>{const g=f.geometry,cs=g.type==='MultiLineString'?g.coordinates:[g.coordinates];cs.forEach(c=>D.cables.push({path:c,n:f.properties.name,col:f.properties.color}));});st('cables',j.features.length+' cables · '+M(i),'ok');}catch(e){st('cables','all mirrors blocked','bad');}render();}
|
|
|
|
| 121 |
async function quakes(){try{const since=new Date(Date.now()-864e5).toISOString().slice(0,19);
|
| 122 |
const [j,i]=await B(['https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson','https://www.seismicportal.eu/fdsnws/event/1/query?format=json&limit=2000&starttime='+since]);
|
| 123 |
D.quakes=(j.features||[]).map(f=>{const c=f.geometry.coordinates,p=f.properties;const depth=Math.abs(c[2]||p.depth||0);return{p:[c[0],c[1],-depth*1000],m:p.mag||0,n:p.place||p.flynn_region||'',t:(typeof p.time==='number'?p.time:Date.parse(p.time))/1000};});
|
|
|
|
| 157 |
$('hd').innerHTML=COLS.map(c=>`<th data-k="${c}">${c==='tab'?'name':c} link ⇅</th>`).join('');
|
| 158 |
document.querySelectorAll('#hd th').forEach(th=>th.onclick=()=>{sd=sk===th.dataset.k?-sd:1;sk=th.dataset.k;draw();});draw();},
|
| 159 |
error:e=>{$('count').textContent='Master did not load: '+e;}});}
|
| 160 |
+
['q','fSuite'].forEach(id=>$(id).addEventListener('input',()=>draw()));
|
| 161 |
+
const WB=u=>'https://web.archive.org/web/2/'+u,AT=u=>'https://archive.ph/newest/'+u,SH=u=>'https://archive.softwareheritage.org/browse/origin/directory/?origin_url='+encodeURIComponent(u);
|
| 162 |
+
const isCode=u=>/github\.com|gitlab\.com|bitbucket\.org|huggingface\.co/.test(u);
|
| 163 |
function draw(){const q=$('q').value.toLowerCase(),fs=$('fSuite').value;
|
| 164 |
const v=ROWS.filter(r=>(!fs||r.suite===fs)&&(!q||Object.values(r).join(' ').toLowerCase().includes(q))).sort((a,b)=>String(a[sk]||'').localeCompare(String(b[sk]||''),undefined,{numeric:true})*sd);
|
| 165 |
+
const ep=v.filter(r=>String(r.redirect||'').startsWith('http')).length;
|
| 166 |
+
$('count').textContent=`${v.length} of ${ROWS.length} rows · ${ep} endpoints · every one live + mirrored · nothing saved`;
|
| 167 |
+
const hd=$('hd');if(hd.children.length&&!hd.dataset.m){hd.insertAdjacentHTML('beforeend','<th>mirror link</th>');hd.dataset.m=1;}
|
| 168 |
+
$('bd').innerHTML=v.map(r=>{const u=String(r.redirect||'');
|
| 169 |
+
const cells=COLS.map(c=>{const val=(r[c]||'').toString();const href=c==='redirect'&&val?val:VIEW+r._i;return `<td><a href="${href}" target="_blank">${c==='redirect'&&val?'live ↗':val.slice(0,90)||'·'}</a></td>`;}).join('');
|
| 170 |
+
const m=u.startsWith('http')?`<td style="white-space:nowrap"><a href="${WB(u)}" target="_blank">⟲WB</a> <a href="${AT(u)}" target="_blank">⟲AT</a>${isCode(u)?` <a href="${SH(u)}" target="_blank">⟲SH</a>`:''}</td>`:'<td>·</td>';
|
| 171 |
+
return '<tr>'+cells+m+'</tr>';}).join('');}
|
| 172 |
</script></body></html>
|