This commit is contained in:
parent
77ba5d05fc
commit
f73f7ff266
|
|
@ -11,7 +11,7 @@ if (!fs.existsSync(dbDir)) {
|
|||
fs.mkdirSync(dbDir, { recursive: true });
|
||||
}
|
||||
|
||||
const dbPath = path.resolve('/app/data/space_data.db');
|
||||
const dbPath = path.join(dbDir, 'space_data.db');
|
||||
const db = new Database(dbPath);
|
||||
|
||||
db.exec(`
|
||||
|
|
|
|||
|
|
@ -12,12 +12,19 @@ const MY_ALT = 0;
|
|||
async function updateISSData() {
|
||||
console.log("🛰️ Fetching TLE data...");
|
||||
|
||||
const response = await fetch('https://celestrak.org/NORAD/elements/gp.php?CATNR=25544&FORMAT=tle');
|
||||
const data = await response.text();
|
||||
const lines = data.split('\n').filter(line => line.trim().length > 0);
|
||||
const response = await fetch('https://data.ivanstanojevic.me/api/tle/25544');
|
||||
|
||||
const line1 = lines[1];
|
||||
const line2 = lines[2];
|
||||
if (!response.ok) {
|
||||
throw new Error(`Mirror API Error: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const line1 = data.line1;
|
||||
const line2 = data.line2;
|
||||
|
||||
if (!line1 || !line2) {
|
||||
throw new Error("Invalid TLE data received from mirror");
|
||||
}
|
||||
const satrec = satellite.twoline2satrec(line1, line2);
|
||||
|
||||
const observerGd = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue