Changesets · Branches · Tags · Compare
| Changeset | cb8c9d41ea96689dad24dfeb26b7dd0fcef7a211fcc7d6156e0d880bec5964b9 |
|---|---|
| Author | Gemini CLI <gemini@example.com> · 2026-05-26 22:56 -04:00 |
| Committer | Gemini CLI <gemini@example.com> · 2026-05-26 22:56 -04:00 |
| Parents | a15c39d57e3b |
7 files changed
added src/app/api/cctv/italy.ts +113 −0
| @@ -0,0 +1,113 @@ | ||
| 1 | +import type { CctvCamera } from './types'; | |
| 2 | + | |
| 3 | +/** Windy embed + JPG snapshot helper */ | |
| 4 | +function windy(id: string) { | |
| 5 | + return { | |
| 6 | + stream_url: `https://www.windy.com/webcams/${id}/embed`, | |
| 7 | + stream_type: 'iframe' as const, | |
| 8 | + feed_url: `https://images-webcams.windy.com/37/${id}/current/full/${id}.jpg`, | |
| 9 | + external_url: `https://www.windy.com/webcams/${id}`, | |
| 10 | + source: 'Windy', | |
| 11 | + }; | |
| 12 | +} | |
| 13 | + | |
| 14 | +const ITALY_CAMERAS: CctvCamera[] = [ | |
| 15 | + // Rome | |
| 16 | + { | |
| 17 | + id: 'it-rome-colosseum', | |
| 18 | + lat: 41.8902, lng: 12.4922, | |
| 19 | + name: 'Roma - Colosseum', | |
| 20 | + city: 'Rome', country: 'Italy', | |
| 21 | + ...windy('1586955498'), | |
| 22 | + }, | |
| 23 | + { | |
| 24 | + id: 'it-rome-pantheon', | |
| 25 | + lat: 41.8986, lng: 12.4769, | |
| 26 | + name: 'Roma - Pantheon / Piazza della Rotonda', | |
| 27 | + city: 'Rome', country: 'Italy', | |
| 28 | + ...windy('1363017757'), | |
| 29 | + }, | |
| 30 | + { | |
| 31 | + id: 'it-rome-st-peters', | |
| 32 | + lat: 41.9022, lng: 12.4539, | |
| 33 | + name: 'Roma - St. Peter\'s Basilica', | |
| 34 | + city: 'Rome', country: 'Italy', | |
| 35 | + ...windy('1415100696'), | |
| 36 | + }, | |
| 37 | + // Venice | |
| 38 | + { | |
| 39 | + id: 'it-venice-rialto', | |
| 40 | + lat: 45.438, lng: 12.336, | |
| 41 | + name: 'Venezia - Rialto Bridge', | |
| 42 | + city: 'Venice', country: 'Italy', | |
| 43 | + ...windy('1340720365'), | |
| 44 | + }, | |
| 45 | + { | |
| 46 | + id: 'it-venice-stmark', | |
| 47 | + lat: 45.4341, lng: 12.339, | |
| 48 | + name: 'Venezia - St. Mark\'s Square', | |
| 49 | + city: 'Venice', country: 'Italy', | |
| 50 | + ...windy('1363852427'), | |
| 51 | + }, | |
| 52 | + // Milan | |
| 53 | + { | |
| 54 | + id: 'it-milan-duomo', | |
| 55 | + lat: 45.4642, lng: 9.1900, | |
| 56 | + name: 'Milano - Duomo Cathedral', | |
| 57 | + city: 'Milan', country: 'Italy', | |
| 58 | + ...windy('1586862002'), | |
| 59 | + }, | |
| 60 | + // Naples / Vesuvius | |
| 61 | + { | |
| 62 | + id: 'it-naples-vesuvius', | |
| 63 | + lat: 40.8518, lng: 14.2681, | |
| 64 | + name: 'Napoli - Mount Vesuvius', | |
| 65 | + city: 'Naples', country: 'Italy', | |
| 66 | + ...windy('1442453557'), | |
| 67 | + }, | |
| 68 | + { | |
| 69 | + id: 'it-naples-harbor', | |
| 70 | + lat: 40.835, lng: 14.261, | |
| 71 | + name: 'Napoli - Harbor / Castel dell\'Ovo', | |
| 72 | + city: 'Naples', country: 'Italy', | |
| 73 | + ...windy('1502972244'), | |
| 74 | + }, | |
| 75 | + // Florence | |
| 76 | + { | |
| 77 | + id: 'it-florence-duomo', | |
| 78 | + lat: 43.7731, lng: 11.2560, | |
| 79 | + name: 'Firenze - Duomo / Piazza del Duomo', | |
| 80 | + city: 'Florence', country: 'Italy', | |
| 81 | + ...windy('1546268098'), | |
| 82 | + }, | |
| 83 | + // Amalfi Coast | |
| 84 | + { | |
| 85 | + id: 'it-amalfi-coast', | |
| 86 | + lat: 40.6340, lng: 14.6027, | |
| 87 | + name: 'Amalfi Coast - Panoramic View', | |
| 88 | + city: 'Amalfi', country: 'Italy', | |
| 89 | + ...windy('1523789742'), | |
| 90 | + }, | |
| 91 | + // Sardinia | |
| 92 | + { | |
| 93 | + id: 'it-cagliari-port', | |
| 94 | + lat: 39.2181, lng: 9.1109, | |
| 95 | + name: 'Cagliari - Port & Marina', | |
| 96 | + city: 'Cagliari', country: 'Italy', | |
| 97 | + ...windy('1588063754'), | |
| 98 | + }, | |
| 99 | + // Sicily - Mount Etna | |
| 100 | + { | |
| 101 | + id: 'it-etna-volcano', | |
| 102 | + lat: 37.7510, lng: 14.9934, | |
| 103 | + name: 'Mount Etna - Volcano', | |
| 104 | + city: 'Catania', country: 'Italy', | |
| 105 | + ...windy('1283466604'), | |
| 106 | + }, | |
| 107 | +]; | |
| 108 | + | |
| 109 | +export async function fetchItalyCameras(): Promise<CctvCamera[]> { | |
| 110 | + return ITALY_CAMERAS.filter((cam) => cam.feed_url || cam.stream_url || cam.external_url); | |
| 111 | +} | |
| 112 | + | |
| 113 | +export default ITALY_CAMERAS; |
modified src/app/api/cctv/route.ts +5 −1
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | import { fetchTurkeyCameras } from './turkey'; |
| 9 | 9 | import { fetchRomaniaCameras } from './romania'; |
| 10 | 10 | import { fetchAustraliaCameras } from './australia'; |
| 11 | +import { fetchItalyCameras } from './italy'; | |
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * OSIRIS — Worldwide CCTV Camera API v2 |
| @@ -290,6 +291,7 @@ | ||
| 290 | 291 | 'turkey': fetchTurkeyCameras, |
| 291 | 292 | 'romania': fetchRomaniaCameras, |
| 292 | 293 | 'australia': fetchAustraliaCameras, |
| 294 | + 'italy': fetchItalyCameras, | |
| 293 | 295 | }; |
| 294 | 296 | |
| 295 | 297 | // Determine which regions to fetch based on viewport bounds |
| @@ -312,7 +314,8 @@ | ||
| 312 | 314 | const inMacedonia = lat > 40.8 && lat < 42.8 && lng > 20.4 && lng < 23.2; |
| 313 | 315 | const inRomania = lat > 43.5 && lat < 48.5 && lng > 20 && lng < 29.8; |
| 314 | 316 | const inTurkey = lat > 35.5 && lat < 42.5 && lng > 25.5 && lng < 45; |
| 315 | - const inBalkans = inBulgaria || inGreece || inSerbia || inMacedonia || inRomania || inTurkey; | |
| 317 | + const inItaly = lat > 36 && lat < 47.5 && lng > 6.5 && lng < 18.5; | |
| 318 | + const inBalkans = inBulgaria || inGreece || inSerbia || inMacedonia || inRomania || inTurkey || inItaly; | |
| 316 | 319 | |
| 317 | 320 | if (lat > 35 && lat < 72 && lng > -11 && lng < 40 && !inBalkans) { |
| 318 | 321 | regions.push('europe'); |
| @@ -323,6 +326,7 @@ | ||
| 323 | 326 | if (inMacedonia) regions.push('macedonia'); |
| 324 | 327 | if (inRomania) regions.push('romania'); |
| 325 | 328 | if (inTurkey) regions.push('turkey'); |
| 329 | + if (inItaly) regions.push('italy'); | |
| 326 | 330 | |
| 327 | 331 | // Asia (includes Middle East, SE Asia, overriding parts of china but that's ok they can both load) |
| 328 | 332 | if ((lat > -10 && lat < 60 && lng > 60 && lng < 150)) regions.push('asia'); |
modified src/app/api/cctv/turkey.ts +55 −104
| @@ -12,52 +12,42 @@ | ||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | const TURKEY_CAMERAS: CctvCamera[] = [ |
| 15 | - // Makaza / Nymfea (GR-TR border, Rhodopes) | |
| 15 | + // Istanbul — European side & Bosphorus | |
| 16 | 16 | { |
| 17 | - id: 'tr-makaza-nymfea-1', | |
| 18 | - lat: 41.295, lng: 24.137, | |
| 19 | - name: 'Makaza - Nymfea Border (cam 1)', | |
| 20 | - city: 'Komotini', country: 'Turkey', | |
| 21 | - stream_url: 'https://www.youtube.com/embed/pnr0lhrqRAc?autoplay=1&mute=1', | |
| 22 | - stream_type: 'iframe', | |
| 23 | - external_url: 'https://weather-webcam.eu/ueb-kameri-ot-gkpp-makaza-nimfeya/', | |
| 24 | - source: 'YouTube / GKPP', | |
| 17 | + id: 'tr-istanbul-galata', | |
| 18 | + lat: 41.019, lng: 28.974, | |
| 19 | + name: 'Istanbul - Galata Bridge', | |
| 20 | + city: 'Istanbul', country: 'Turkey', | |
| 21 | + ...windy('1573888456'), | |
| 25 | 22 | }, |
| 26 | 23 | { |
| 27 | - id: 'tr-makaza-nymfea-2', | |
| 28 | - lat: 41.294, lng: 24.139, | |
| 29 | - name: 'Makaza - Nymfea Border (cam 2)', | |
| 30 | - city: 'Komotini', country: 'Turkey', | |
| 31 | - stream_url: 'https://www.youtube.com/embed/YXN19ZEpIkc?autoplay=1&mute=1', | |
| 32 | - stream_type: 'iframe', | |
| 33 | - external_url: 'https://weather-webcam.eu/ueb-kameri-ot-gkpp-makaza-nimfeya/', | |
| 34 | - source: 'YouTube / GKPP', | |
| 24 | + id: 'tr-istanbul-sultanahmet', | |
| 25 | + lat: 41.009, lng: 28.977, | |
| 26 | + name: 'Istanbul - Sultanahmet / Grand Bazaar', | |
| 27 | + city: 'Istanbul', country: 'Turkey', | |
| 28 | + ...windy('1573537594'), | |
| 35 | 29 | }, |
| 36 | - // European Thrace - BG border (Edirne / Kirklareli) | |
| 37 | 30 | { |
| 38 | - id: 'tr-kapikule-windy', | |
| 39 | - lat: 41.717, lng: 26.33, | |
| 40 | - name: 'Kapikule - Customs (TR, BG direction)', | |
| 41 | - city: 'Edirne', country: 'Turkey', | |
| 42 | - ...windy('1375653055'), | |
| 31 | + id: 'tr-istanbul-bosphorus', | |
| 32 | + lat: 41.042, lng: 29.009, | |
| 33 | + name: 'Istanbul - Bosphorus (Radisson view)', | |
| 34 | + city: 'Istanbul', country: 'Turkey', | |
| 35 | + ...windy('1511515262'), | |
| 43 | 36 | }, |
| 44 | 37 | { |
| 45 | - id: 'tr-kapikule-entry', | |
| 46 | - lat: 41.716, lng: 26.334, | |
| 47 | - name: 'Kapikule - Entry Queue (TR)', | |
| 48 | - city: 'Edirne', country: 'Turkey', | |
| 49 | - feed_url: 'https://lh3.googleusercontent.com/d/1uA72HJHWIsRAltoF4_BrADsgoer9IpWI', | |
| 50 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/bulgaristan/turkiye/kapikule-kapitan-andreevo/', | |
| 51 | - source: 'alltrafficcams.com', | |
| 38 | + id: 'tr-istanbul-yavuz-bridge', | |
| 39 | + lat: 41.202, lng: 29.121, | |
| 40 | + name: 'Istanbul - Yavuz Sultan Selim Bridge', | |
| 41 | + city: 'Istanbul', country: 'Turkey', | |
| 42 | + ...windy('1601452975'), | |
| 52 | 43 | }, |
| 44 | + // Edirne — Border crossings (Windy cams) | |
| 53 | 45 | { |
| 54 | - id: 'tr-kapikule-exit', | |
| 55 | - lat: 41.714, lng: 26.328, | |
| 56 | - name: 'Kapikule - Exit Lane (TR)', | |
| 46 | + id: 'tr-kapikule-windy', | |
| 47 | + lat: 41.717, lng: 26.33, | |
| 48 | + name: 'Kapikule - Customs (TR, BG direction)', | |
| 57 | 49 | city: 'Edirne', country: 'Turkey', |
| 58 | - feed_url: 'https://lh3.googleusercontent.com/d/1Io3IMcDC8miLLp6J60_k61P-cOW7cTel', | |
| 59 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/bulgaristan/turkiye/kapikule-kapitan-andreevo/', | |
| 60 | - source: 'alltrafficcams.com', | |
| 50 | + ...windy('1375653055'), | |
| 61 | 51 | }, |
| 62 | 52 | { |
| 63 | 53 | id: 'tr-hamzabeyli-windy', |
| @@ -65,53 +55,6 @@ | ||
| 65 | 55 | name: 'Hamzabeyli - Border (TR, live)', |
| 66 | 56 | city: 'Edirne', country: 'Turkey', |
| 67 | 57 | ...windy('1639080445'), |
| 68 | - external_url: 'https://weather-webcam.eu/lesovo-hamzabeyli-live-kamera-balgaria-turcia-granica-trafik-vremeto/', | |
| 69 | - }, | |
| 70 | - { | |
| 71 | - id: 'tr-hamzabeyli-queue', | |
| 72 | - lat: 41.968, lng: 26.385, | |
| 73 | - name: 'Hamzabeyli - Queue (TR)', | |
| 74 | - city: 'Edirne', country: 'Turkey', | |
| 75 | - feed_url: 'https://lh3.googleusercontent.com/d/1n7byLU0LzGvcl3ngtatoaqYPoyPYMNHH', | |
| 76 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/bulgaristan/turkiye/hamzabeyli-lesovo/', | |
| 77 | - source: 'alltrafficcams.com', | |
| 78 | - }, | |
| 79 | - { | |
| 80 | - id: 'tr-derekoy-live', | |
| 81 | - lat: 41.405, lng: 27.521, | |
| 82 | - name: 'Derekoy - Border Queue (TR)', | |
| 83 | - city: 'Kirklareli', country: 'Turkey', | |
| 84 | - feed_url: 'https://lh3.googleusercontent.com/d/1bZI8eKQEOaJINUH0_kp4UrPpnD9eD4p0', | |
| 85 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/bulgaristan/turkiye/derekoy-malko-tarnovo/', | |
| 86 | - source: 'alltrafficcams.com', | |
| 87 | - }, | |
| 88 | - // European Thrace - GR border (Edirne) | |
| 89 | - { | |
| 90 | - id: 'tr-ipsala-exit', | |
| 91 | - lat: 40.928, lng: 26.245, | |
| 92 | - name: 'Ipsala - Passenger Exit (TR)', | |
| 93 | - city: 'Edirne', country: 'Turkey', | |
| 94 | - feed_url: 'https://lh3.googleusercontent.com/d/14WxIhH9GDnPRuELYIfpm7kYaP0U27o_2', | |
| 95 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/yunanistan/turkiye/ipsala-kipi/', | |
| 96 | - source: 'alltrafficcams.com', | |
| 97 | - }, | |
| 98 | - { | |
| 99 | - id: 'tr-ipsala-truck', | |
| 100 | - lat: 40.925, lng: 26.248, | |
| 101 | - name: 'Ipsala - Truck Park (TR)', | |
| 102 | - city: 'Edirne', country: 'Turkey', | |
| 103 | - feed_url: 'https://lh3.googleusercontent.com/d/1jOIFsvlslheZg7SZkD7javLjdixvWxiR', | |
| 104 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/yunanistan/turkiye/ipsala-kipi/', | |
| 105 | - source: 'alltrafficcams.com', | |
| 106 | - }, | |
| 107 | - { | |
| 108 | - id: 'tr-pazarkule', | |
| 109 | - lat: 41.645, lng: 26.478, | |
| 110 | - name: 'Pazarkule - Kastanies Border (TR)', | |
| 111 | - city: 'Edirne', country: 'Turkey', | |
| 112 | - feed_url: 'https://lh3.googleusercontent.com/d/1u4mnEWlZ4YcgP7W1ZjSLNBIbynArOoRt', | |
| 113 | - external_url: 'http://alltrafficcams.com/tr/canli/sinir-kapisi-gumruk/yunanistan/turkiye/pazarkule-kestanelik/', | |
| 114 | - source: 'alltrafficcams.com', | |
| 115 | 58 | }, |
| 116 | 59 | // Tekirdag (European coast) |
| 117 | 60 | { |
| @@ -128,34 +71,42 @@ | ||
| 128 | 71 | city: 'Tekirdag', country: 'Turkey', |
| 129 | 72 | ...windy('1610814488'), |
| 130 | 73 | }, |
| 131 | - // Istanbul - European side & Bosphorus | |
| 74 | + // Makaza / Nymfea (GR-TR border, Rhodopes) — YouTube live | |
| 132 | 75 | { |
| 133 | - id: 'tr-istanbul-galata', | |
| 134 | - lat: 41.019, lng: 28.974, | |
| 135 | - name: 'Istanbul - Galata Bridge', | |
| 136 | - city: 'Istanbul', country: 'Turkey', | |
| 137 | - ...windy('1573888456'), | |
| 76 | + id: 'tr-makaza-nymfea-1', | |
| 77 | + lat: 41.295, lng: 24.137, | |
| 78 | + name: 'Makaza - Nymfea Border (cam 1)', | |
| 79 | + city: 'Komotini', country: 'Turkey', | |
| 80 | + stream_url: 'https://www.youtube.com/embed/pnr0lhrqRAc?autoplay=1&mute=1', | |
| 81 | + stream_type: 'iframe', | |
| 82 | + external_url: 'https://weather-webcam.eu/ueb-kameri-ot-gkpp-makaza-nimfeya/', | |
| 83 | + source: 'YouTube / GKPP', | |
| 138 | 84 | }, |
| 139 | 85 | { |
| 140 | - id: 'tr-istanbul-sultanahmet', | |
| 141 | - lat: 41.009, lng: 28.977, | |
| 142 | - name: 'Istanbul - Sultanahmet / Grand Bazaar', | |
| 143 | - city: 'Istanbul', country: 'Turkey', | |
| 144 | - ...windy('1573537594'), | |
| 86 | + id: 'tr-makaza-nymfea-2', | |
| 87 | + lat: 41.294, lng: 24.139, | |
| 88 | + name: 'Makaza - Nymfea Border (cam 2)', | |
| 89 | + city: 'Komotini', country: 'Turkey', | |
| 90 | + stream_url: 'https://www.youtube.com/embed/YXN19ZEpIkc?autoplay=1&mute=1', | |
| 91 | + stream_type: 'iframe', | |
| 92 | + external_url: 'https://weather-webcam.eu/ueb-kameri-ot-gkpp-makaza-nimfeya/', | |
| 93 | + source: 'YouTube / GKPP', | |
| 145 | 94 | }, |
| 95 | + // Antalya — Mediterranean coast | |
| 146 | 96 | { |
| 147 | - id: 'tr-istanbul-bosphorus', | |
| 148 | - lat: 41.042, lng: 29.009, | |
| 149 | - name: 'Istanbul - Bosphorus (Radisson view)', | |
| 150 | - city: 'Istanbul', country: 'Turkey', | |
| 151 | - ...windy('1511515262'), | |
| 97 | + id: 'tr-antalya-harbor', | |
| 98 | + lat: 36.8841, lng: 30.7056, | |
| 99 | + name: 'Antalya - Old Harbor', | |
| 100 | + city: 'Antalya', country: 'Turkey', | |
| 101 | + ...windy('1546441490'), | |
| 152 | 102 | }, |
| 103 | + // Alanya | |
| 153 | 104 | { |
| 154 | - id: 'tr-istanbul-yavuz-bridge', | |
| 155 | - lat: 41.202, lng: 29.121, | |
| 156 | - name: 'Istanbul - Yavuz Sultan Selim Bridge', | |
| 157 | - city: 'Istanbul', country: 'Turkey', | |
| 158 | - ...windy('1601452975'), | |
| 105 | + id: 'tr-alanya-coast', | |
| 106 | + lat: 36.5437, lng: 31.9935, | |
| 107 | + name: 'Alanya - Coastline', | |
| 108 | + city: 'Alanya', country: 'Turkey', | |
| 109 | + ...windy('1539516234'), | |
| 159 | 110 | }, |
| 160 | 111 | ]; |
| 161 | 112 |
modified src/app/api/gdelt/route.ts +3 −3
| @@ -91,9 +91,9 @@ | ||
| 91 | 91 | // using word boundary regex |
| 92 | 92 | const regex = new RegExp(`\\b${location}\\b`, 'i'); |
| 93 | 93 | if (regex.test(textToSearch)) { |
| 94 | - // Add slight random jitter so events in the same country don't overlap perfectly | |
| 95 | - const jitterLng = (Math.random() - 0.5) * 2.0; | |
| 96 | - const jitterLat = (Math.random() - 0.5) * 2.0; | |
| 94 | + // Deterministic jitter based on event index so events in the same country don't overlap | |
| 95 | + const jitterLng = ((eventId * 137.5) % 200 - 100) / 100 * 1.5; | |
| 96 | + const jitterLat = ((eventId * 251.3) % 200 - 100) / 100 * 1.5; | |
| 97 | 97 | coords = [point[0] + jitterLng, point[1] + jitterLat]; |
| 98 | 98 | break; |
| 99 | 99 | } |
modified src/app/api/satellites/route.ts +36 −77
| @@ -48,7 +48,7 @@ | ||
| 48 | 48 | for (const [keyword, info] of Object.entries(MISSION_CLASSIFY)) { |
| 49 | 49 | if (upper.includes(keyword)) return info; |
| 50 | 50 | } |
| 51 | - return { mission: 'Unknown', color: '#808080' }; | |
| 51 | + return { mission: 'Unknown', color: '#00E5FF' }; | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function gmst(jd: number): number { |
| @@ -57,24 +57,7 @@ | ||
| 57 | 57 | return ((gmstSec % 86400) / 86400.0) * 2 * Math.PI; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -function parseTLE(tleText: string) { | |
| 61 | - const lines = tleText.trim().split('\n').map(l => l.trim()).filter(l => l.length > 0); | |
| 62 | - const satellites: any[] = []; | |
| 63 | - | |
| 64 | - for (let i = 0; i < lines.length - 2; i++) { | |
| 65 | - // Find name + line1 + line2 pattern | |
| 66 | - const name = lines[i]; | |
| 67 | - const line1 = lines[i + 1]; | |
| 68 | - const line2 = lines[i + 2]; | |
| 69 | - | |
| 70 | - if (!line1?.startsWith('1 ') || !line2?.startsWith('2 ')) continue; | |
| 71 | - if (name.startsWith('1 ') || name.startsWith('2 ')) continue; | |
| 72 | - | |
| 73 | - satellites.push({ name, line1, line2 }); | |
| 74 | - i += 2; // skip the TLE lines | |
| 75 | - } | |
| 76 | - return satellites; | |
| 77 | -} | |
| 60 | +// No longer needed: function parseTLE(tleText: string) {} | |
| 78 | 61 | |
| 79 | 62 | function propagateSGP4Simple(line1: string, line2: string): { lat: number; lng: number; alt: number } | null { |
| 80 | 63 | try { |
| @@ -147,42 +130,8 @@ | ||
| 147 | 130 | } |
| 148 | 131 | } |
| 149 | 132 | |
| 150 | -// Multiple TLE sources — individual groups fetched in parallel for resilience | |
| 151 | -// NOTE: The full 'active' catalog often returns empty from cloud/serverless IPs | |
| 152 | -// due to Celestrak rate-limiting. Individual groups are smaller and more reliable. | |
| 153 | -const TLE_SOURCES = [ | |
| 154 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=stations&FORMAT=tle', group: 'stations' }, | |
| 155 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=visual&FORMAT=tle', group: 'visual' }, | |
| 156 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=weather&FORMAT=tle', group: 'weather' }, | |
| 157 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=resource&FORMAT=tle', group: 'resource' }, | |
| 158 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=sarsat&FORMAT=tle', group: 'sarsat' }, | |
| 159 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle', group: 'gps' }, | |
| 160 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=glo-ops&FORMAT=tle', group: 'glonass' }, | |
| 161 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=galileo&FORMAT=tle', group: 'galileo' }, | |
| 162 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=beidou&FORMAT=tle', group: 'beidou' }, | |
| 163 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=military&FORMAT=tle', group: 'military' }, | |
| 164 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=science&FORMAT=tle', group: 'science' }, | |
| 165 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=geodetic&FORMAT=tle', group: 'geodetic' }, | |
| 166 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=engineering&FORMAT=tle', group: 'engineering' }, | |
| 167 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=education&FORMAT=tle', group: 'education' }, | |
| 168 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=starlink&FORMAT=tle', group: 'starlink' }, | |
| 169 | - { url: 'https://celestrak.org/NORAD/elements/gp.php?GROUP=active&FORMAT=tle', group: 'active-fallback' }, | |
| 170 | -]; | |
| 171 | - | |
| 172 | -async function fetchTLEFromSource(source: typeof TLE_SOURCES[0]): Promise<string | null> { | |
| 173 | - try { | |
| 174 | - const res = await stealthFetch(source.url, { | |
| 175 | - signal: AbortSignal.timeout(12000), | |
| 176 | - headers: { 'Accept': 'text/plain, */*; q=0.5' }, | |
| 177 | - }); | |
| 178 | - if (!res.ok) return null; | |
| 179 | - const text = await res.text(); | |
| 180 | - if (text.length < 100 || text.includes('<!DOCTYPE') || text.includes('<html')) return null; | |
| 181 | - return text; | |
| 182 | - } catch { | |
| 183 | - return null; | |
| 184 | - } | |
| 185 | -} | |
| 133 | +// SatNOGS Open API - Provides full TLE JSON without API keys or IP blocks | |
| 134 | +const SATNOGS_API = 'https://db.satnogs.org/api/tle/?format=json'; | |
| 186 | 135 | |
| 187 | 136 | let globalCachedSats: any[] = []; |
| 188 | 137 | let globalCacheTime = 0; |
| @@ -194,34 +143,43 @@ | ||
| 194 | 143 | let source = 'memory-cache'; |
| 195 | 144 | |
| 196 | 145 | if (globalCachedSats.length === 0 || nowTime - globalCacheTime > 3600000) { // 1 hour cache |
| 197 | - const results = await Promise.allSettled( | |
| 198 | - TLE_SOURCES.map(src => fetchTLEFromSource(src)) | |
| 199 | - ); | |
| 200 | - | |
| 201 | - const fetchedSats: any[] = []; | |
| 202 | - const seen = new Set<string>(); | |
| 203 | - | |
| 204 | - for (const result of results) { | |
| 205 | - if (result.status === 'fulfilled' && result.value) { | |
| 206 | - const parsed = parseTLE(result.value); | |
| 207 | - for (const sat of parsed) { | |
| 208 | - if (!seen.has(sat.name)) { | |
| 209 | - seen.add(sat.name); | |
| 210 | - fetchedSats.push(sat); | |
| 146 | + try { | |
| 147 | + const res = await stealthFetch(SATNOGS_API, { | |
| 148 | + signal: AbortSignal.timeout(15000), | |
| 149 | + headers: { 'Accept': 'application/json' }, | |
| 150 | + }); | |
| 151 | + | |
| 152 | + if (res.ok) { | |
| 153 | + const data = await res.json(); | |
| 154 | + const fetchedSats: any[] = []; | |
| 155 | + const seen = new Set<string>(); | |
| 156 | + | |
| 157 | + for (const item of data) { | |
| 158 | + const rawName = (item.tle0 || '').trim(); | |
| 159 | + const cleanName = rawName.replace(/^0\s+/, ''); | |
| 160 | + if (cleanName && item.tle1 && item.tle2 && !seen.has(cleanName)) { | |
| 161 | + seen.add(cleanName); | |
| 162 | + fetchedSats.push({ | |
| 163 | + name: cleanName, | |
| 164 | + line1: item.tle1.trim(), | |
| 165 | + line2: item.tle2.trim(), | |
| 166 | + }); | |
| 211 | 167 | } |
| 212 | 168 | } |
| 169 | + | |
| 170 | + if (fetchedSats.length > 0) { | |
| 171 | + globalCachedSats = fetchedSats; | |
| 172 | + globalCacheTime = nowTime; | |
| 173 | + allSats = fetchedSats; | |
| 174 | + source = 'satnogs-api'; | |
| 175 | + } | |
| 213 | 176 | } |
| 214 | - } | |
| 215 | - | |
| 216 | - if (fetchedSats.length > 0) { | |
| 217 | - globalCachedSats = fetchedSats; | |
| 218 | - globalCacheTime = nowTime; | |
| 219 | - allSats = fetchedSats; | |
| 220 | - source = 'celestrak-groups'; | |
| 177 | + } catch (err) { | |
| 178 | + console.error('SatNOGS fetch error:', err); | |
| 221 | 179 | } |
| 222 | 180 | } |
| 223 | 181 | |
| 224 | - // Emergency Fallback if cache is totally empty and Celestrak is down | |
| 182 | + // Emergency Fallback if cache is totally empty and SatNOGS is down | |
| 225 | 183 | if (allSats.length === 0) { |
| 226 | 184 | const issFallback = "1 25544U 98067A 24146.40251785 .00015505 00000-0 27885-3 0 9997\n2 25544 51.6402 189.7042 0004381 334.8091 106.8778 15.50091157455243"; |
| 227 | 185 | allSats = [{ name: 'ISS (FALLBACK)', line1: issFallback.split('\n')[0], line2: issFallback.split('\n')[1] }]; |
| @@ -246,6 +204,7 @@ | ||
| 246 | 204 | alt: pos.alt, |
| 247 | 205 | mission: classification.mission, |
| 248 | 206 | color: classification.color, |
| 207 | + noradId: sat.line1.substring(2, 7).trim(), | |
| 249 | 208 | }); |
| 250 | 209 | } |
| 251 | 210 |
modified src/app/page.tsx +1 −1
| @@ -82,7 +82,7 @@ | ||
| 82 | 82 | const megabytes = estimatedBytes / 1024 / 1024; |
| 83 | 83 | setThroughput(megabytes > 0 ? (megabytes * 1.5).toFixed(2) : "0.00"); |
| 84 | 84 | |
| 85 | - setPingTime(prev => prev === null ? Math.floor(45 + Math.random() * 20) : Math.max(20, prev + Math.floor((Math.random() - 0.5) * 10))); | |
| 85 | + setPingTime(Math.floor(30 + estimatedBytes / 100000)); | |
| 86 | 86 | }, 2500); |
| 87 | 87 | return () => clearInterval(iv); |
| 88 | 88 | }, [data]); |
modified src/components/OsirisMap.tsx +10 −6
| @@ -262,8 +262,11 @@ | ||
| 262 | 262 | }, paint: { 'text-color': '#76FF03', 'text-halo-color': '#000', 'text-halo-width': 1, 'text-opacity': 0.7 }}); |
| 263 | 263 | |
| 264 | 264 | // Satellites |
| 265 | + map.addLayer({ id: 'sat-glow', type: 'circle', source: 'satellites', paint: { | |
| 266 | + 'circle-radius': ['interpolate',['linear'],['zoom'], 1,3, 5,6], 'circle-color': ['get','color'], 'circle-opacity': 0.3, 'circle-blur': 1, | |
| 267 | + }}); | |
| 265 | 268 | map.addLayer({ id: 'sat-dots', type: 'circle', source: 'satellites', paint: { |
| 266 | - 'circle-radius': ['interpolate',['linear'],['zoom'], 1,1.5, 5,3], 'circle-color': ['get','color'], 'circle-opacity': 0.7, | |
| 269 | + 'circle-radius': ['interpolate',['linear'],['zoom'], 1,1.5, 5,3], 'circle-color': ['get','color'], 'circle-opacity': 1.0, | |
| 267 | 270 | }}); |
| 268 | 271 | |
| 269 | 272 | // Maritime — ports & naval bases |
| @@ -519,18 +522,19 @@ | ||
| 519 | 522 | </div>`); |
| 520 | 523 | }); |
| 521 | 524 | |
| 522 | - // ── Satellites (with N2YO tracking) ── | |
| 525 | + // ── Satellites (SatNOGS powered) ── | |
| 523 | 526 | map.on('click', 'sat-dots', e => { |
| 524 | 527 | if (!e.features?.length) return; |
| 525 | 528 | const p = e.features[0].properties as any; |
| 526 | 529 | const coords = (e.features[0].geometry as any).coordinates; |
| 527 | 530 | popup(coords, `<div style="${pStyle}border:1px solid rgba(212,175,55,0.3);"> |
| 528 | 531 | <div style="color:#D4AF37;font-size:12px;font-weight:700;letter-spacing:0.1em;margin-bottom:4px;">🛰️ ${p.name}</div> |
| 529 | - <div style="display:grid;grid-template-columns:1fr 1fr;gap:4px;font-size:9px;margin-bottom:8px;"> | |
| 532 | + <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;font-size:9px;margin-bottom:8px;"> | |
| 530 | 533 | <div><span style="color:#5C5A54;">MISSION</span><br/><span style="color:${p.color||'#aaa'};">${p.mission||'Unknown'}</span></div> |
| 534 | + <div><span style="color:#5C5A54;">ALT</span><br/><span style="color:#00E5FF;">${p.alt ? p.alt+' km' : '—'}</span></div> | |
| 531 | 535 | <div><span style="color:#5C5A54;">POS</span><br/><span style="color:#E8E6E0;">${coords[1].toFixed(2)}°, ${coords[0].toFixed(2)}°</span></div> |
| 532 | 536 | </div> |
| 533 | - <a href="https://www.n2yo.com/?s=${encodeURIComponent(p.name||'')}" target="_blank" style="${linkStyle}color:#D4AF37;border:1px solid rgba(212,175,55,0.4);background:rgba(212,175,55,0.1);">🔭 TRACK ON N2YO</a> | |
| 537 | + ${p.noradId ? `<a href="https://db.satnogs.org/satellite/${p.noradId}/" target="_blank" style="display:block;text-align:center;padding:4px;margin-top:6px;font-size:8px;font-family:monospace;letter-spacing:0.1em;text-decoration:none;color:#00E5FF;border:1px solid rgba(0,229,255,0.4);background:rgba(0,229,255,0.1);border-radius:2px;cursor:pointer;">🔭 SOURCE: SATNOGS</a>` : ''} | |
| 534 | 538 | </div>`); |
| 535 | 539 | }); |
| 536 | 540 | |
| @@ -814,7 +818,7 @@ | ||
| 814 | 818 | |
| 815 | 819 | useEffect(() => { |
| 816 | 820 | if (!mapReady) return; |
| 817 | - setGeo('satellites', activeLayers.satellites && data.satellites ? data.satellites.map((s: any) => ({ type: 'Feature', geometry: { type: 'Point', coordinates: [s.lng, s.lat] }, properties: { name: s.name, color: s.color, mission: s.mission } })) : []); | |
| 821 | + setGeo('satellites', activeLayers.satellites && data.satellites ? data.satellites.map((s: any) => ({ type: 'Feature', geometry: { type: 'Point', coordinates: [s.lng, s.lat] }, properties: { name: s.name, color: s.color, mission: s.mission, alt: s.alt, noradId: s.noradId } })) : []); | |
| 818 | 822 | }, [mapReady, data.satellites, activeLayers.satellites, setGeo]); |
| 819 | 823 | |
| 820 | 824 | useEffect(() => { |
| @@ -971,7 +975,7 @@ | ||
| 971 | 975 | // Build device features spread in a circle around center |
| 972 | 976 | const allDeviceFeatures = devices.map((d: any, i: number) => { |
| 973 | 977 | const angle = (i / devices.length) * Math.PI * 2; |
| 974 | - const radius = 0.001 + (Math.random() * 0.003); | |
| 978 | + const radius = 0.001 + ((i % 7 + 1) * 0.0004); | |
| 975 | 979 | const dLng = centerCoord[0] + Math.cos(angle) * radius * (1 / Math.cos(center.lat * Math.PI / 180)); |
| 976 | 980 | const dLat = centerCoord[1] + Math.sin(angle) * radius; |
| 977 | 981 | return { |