mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-29 23:23:50 +00:00
2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
|
import{S as ut}from"./index.2af22349.js";import{e as lt,q as it,_ as ct}from"./index.074206ed.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as pt,r as dt,o as _t,bp as ft,bU as mt,aU as gt,bB as bt,bN as wt,bC as yt,C as w,D as S,aI as s,aH as u,u as Ft,aM as f,aN as x,aK as A,aJ as C,aE as B,G as ht,n as tt,ba as St,bX as xt,aZ as Dt,b8 as At,bD as Ct,bM as Bt}from"./arco.ad52411f.js";import{e as I,f as c,h as p,s as Et,g as Pt}from"./serial.b70f48dc.js";import{u as vt}from"./loading.c3da220e.js";import"./chart.a61d812b.js";import"./vue.e2942a0c.js";const Tt={class:"container"},Vt=["innerHTML"],It={name:"Sat"},Ut=pt({...It,setup(kt){const{loading:at,setLoading:m}=vt(!0),a=lt(),t=dt({status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u536B\u661F\u6570\u636E\u5230\u8BBE\u5907<br/><br/>",sat:"",satData:[],lng:0,lat:0,alt:0,tx:0,rx:0,txTone:0,rxTone:0,CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],pass:void 0,passOption:[],dt:"",timer:void 0});_t(()=>{t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),ft(()=>{try{clearInterval(t.timer)}catch{}});const et=async()=>{var e,n,i,l,_,g;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}const r=new Date;m(!0),await I(a.connectPort),await c(a.connectPort,589824,p(parseInt(r.getFullYear().toString().substring(2,4)).toString(16)),1,(e=a.configuration)==null?void 0:e.uart),await c(a.connectPort,589825,p((r.getMonth()+1).toString(16)),1,(n=a.configuration)==null?void 0:n.uart),await c(a.connectPort,589826,p(r.getDate().toString(16)),1,(i=a.configuration)==null?void 0:i.uart),await c(a.connectPort,589827,p(r.getHours().toString(16)),1,(l=a.configuration)==null?void 0:l.uart),await c(a.connectPort,589828,p(r.getMinutes().toString(16)),1,(_=a.configuration)==null?void 0:_.uart),await c(a.connectPort,589829,p(r.getSeconds().toString(16)),1,(g=a.configuration)==null?void 0:g.uart),m(!1)},nt=async r=>{const e=t.satData.find(n=>n.name==r);e&&e.path&&(t.status+="<br/>\u536B\u661F\u53C2\u6570\uFF1A<br/>",e.path.map(n=>{t.status+=n+"<br/>"})),tt(()=>{const n=document==null?void 0:document.getElementById("statusArea");n&&(n.scrollTop=n==null?void 0:n.scrollHeight)})};(async()=>{m(!0);const e=(await(await fetch("https://celestrak.org/NORAD/elements/amateur.txt")).text()).split(/\r?\n/),n=[];let i={};for(let l=0;l<e.length;l++)Number.isNaN(parseInt(e[l].substring(0,1)))?(i.name&&i.name!=""&&(n.push(i),i={}),i.name=e[l]):(i.path||(i.path=[]),i.path.push(e[l]));t.satData=n,m(!1)})();const U=async()=>{m(!0),navigator.geolocation.getCurrentPosition(r=>{r.coords&&(t.lat=r.coords.latitude,t.lng=r.coords.longitude,r.coords.altitude&&(t.alt=r.coords.altitude))}),m(!1)};U();const ot=async(r=0,e)=>{var n;await I(a.connectPort);for(let i=r;i<e.length+r;i+=128)await c(a.connectPort,i,e.slice(i-r,i-r+128),128,(n=a.configuration)==null?void 0:n.uart),t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((i-r)/e.length*100).toFixed(1)+"%<br/>",tt(()=>{const l=document==null?void 0:document.getElementById("statusArea");l&&(l.scrollTop=l==null?void 0:l.scrollHeight)});t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>",await Pt(a.connectPort)},st=async()=>{if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}m(!0);const r=await(await fetch("https://k5.vicicode.com/api/pass",{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sat:t.sat,sat_line_1:t.satData.find(n=>n.name==t.sat).path[0],sat_line_2:t.satData.find(n=>n.name==t.sat).path[1],lat:t.lat,lng:t.lng,alt:t.alt})})).json(),e=[];for(let n=0;n<r.pass_times
|