Changed ISS API
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
GeorgeWebberley 2026-01-29 11:04:41 +01:00
parent 77ba5d05fc
commit f73f7ff266
2 changed files with 13 additions and 6 deletions

View file

@ -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(`

View file

@ -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 = {