Fixed boat direction

This commit is contained in:
2026-09-04 08:57:13 -04:00
parent f3ca75decb
commit 9e1ef69b16
5 changed files with 27 additions and 16 deletions

2
client/public/robots.txt Normal file
View File

@@ -0,0 +1,2 @@
User-Agent: *
Allow: /

View File

@@ -26,7 +26,8 @@ function cycleSpeed() {
const speed = computed(() => SPEED_UNITS[prefs.value.speed as keyof typeof SPEED_UNITS]) const speed = computed(() => SPEED_UNITS[prefs.value.speed as keyof typeof SPEED_UNITS])
const name = computed(() => props.boat.shipname?.trim() || props.boat.callsign?.trim() || '-') const name = computed(() => props.boat.shipname?.trim() || props.boat.callsign?.trim() || '-')
const heading = computed(() => props.boat.heading ?? props.boat.course ?? 0) const heading = computed(() => props.boat.heading ?? props.boat.bearing)
const course = computed(() => props.boat.cog ?? props.boat.course)
const speedVal = computed(() => speed.value.convert(props.boat.speed ?? 0)) const speedVal = computed(() => speed.value.convert(props.boat.speed ?? 0))
const photoError = ref(false) const photoError = ref(false)
@@ -227,15 +228,15 @@ const compass = computed(() => {
<div class="sp-gauge-wrap"> <div class="sp-gauge-wrap">
<div class="sp-gauge-label">Course</div> <div class="sp-gauge-label">Course</div>
<div class="sp-gauge"> <div class="sp-gauge">
<span class="sp-gauge-val">{{ boat.course != null ? boat.course.toFixed(0) : '—' }}</span> <span class="sp-gauge-val">{{ course != null ? course.toFixed(0) : '—' }}</span>
<span v-if="boat.course != null" class="sp-gauge-unit">°</span> <span v-if="course != null" class="sp-gauge-unit">°</span>
</div> </div>
</div> </div>
<div class="sp-gauge-wrap"> <div class="sp-gauge-wrap">
<div class="sp-gauge-label">Heading</div> <div class="sp-gauge-label">Heading</div>
<div class="sp-gauge"> <div class="sp-gauge">
<span class="sp-gauge-val">{{ boat.heading != null ? boat.heading.toFixed(0) : '—' }}</span> <span class="sp-gauge-val">{{ heading != null ? heading.toFixed(0) : '—' }}</span>
<span v-if="boat.heading != null" class="sp-gauge-unit">°</span> <span v-if="heading != null" class="sp-gauge-unit">°</span>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -104,7 +104,7 @@ export class AISLayer {
image: new Icon({ image: new Icon({
src: buildBoatIcon(boat), src: buildBoatIcon(boat),
scale: 0.8, scale: 0.8,
rotation: (boat.heading ?? boat.course ?? 0) * (Math.PI / 180), rotation: (boat.heading ?? boat.bearing ?? boat.cog ?? boat.course ?? 0) * (Math.PI / 180),
anchor: [0.5, 0.5], anchor: [0.5, 0.5],
}), }),
})) }))

View File

@@ -346,18 +346,27 @@ export async function getADSBImage(icao) {
const data = await fetch(url, const data = await fetch(url,
{headers: {'User-Agent': 'Mozilla/5.0', 'Referer': 'https://duckduckgo.com/'}} {headers: {'User-Agent': 'Mozilla/5.0', 'Referer': 'https://duckduckgo.com/'}}
).then(resp => resp.json()); ).then(resp => resp.json());
return data?.results?.[0]?.image || null; console.log(query, data.results)
// Sequentially try each image until we find a valid one
if (data?.results?.length) {
for (const result of data.results) {
if (!result.image) continue;
try {
const imgRes = await fetch(result.image);
if (imgRes.ok) return result.image;
} catch (e) {
continue; // Try next image
}
}
}
return null;
} }
const aircraft = await this.get(icao);
const c = cfg(); const generic = duckduckgo(`${aircraft.type || aircraft.shape} Aircraft`);
let aircraft = (await adsbCache).find(a => a.icao?.toLowerCase() === icao?.toLowerCase());
if(!aircraft) aircraft = enrichAircraft({hex: icao});
if(!aircraft) return null;
const generic = duckduckgo(aircraft.model ? `${aircraft.manufacturer} ${aircraft.model}` : `${aircraft.aircraft} Aircraft`);
const specific = await fetch(`https://api.planespotters.net/pub/photos/hex/${icao.toLowerCase()}`, const specific = await fetch(`https://api.planespotters.net/pub/photos/hex/${icao.toLowerCase()}`,
{headers: {'User-Agent': `Personal ADSB Feeder + Dashboard (${c.EMAIL})`}} {headers: {'User-Agent': `open-sight.net (zaktimson@gmail.com)`}}
).then(resp => resp.ok ? resp.json() : null); ).then(resp => resp.ok ? resp.json() : null);
let src; let src;

View File

@@ -89,7 +89,6 @@ export async function getAIS() {
} }
export async function getAISImage(mmsi) { export async function getAISImage(mmsi) {
console.log(`https://www.vesselfinder.com/vessels/details/${mmsi}`)
const res = await fetch(`https://www.vesselfinder.com/vessels/details/${mmsi}`, { const res = await fetch(`https://www.vesselfinder.com/vessels/details/${mmsi}`, {
headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' } headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36' }
}) })