From 76ff6e15b11d717ffca8615d668f5508cd59a398 Mon Sep 17 00:00:00 2001 From: aaronspruit Date: Mon, 16 Nov 2026 18:52:57 -0800 Subject: [PATCH] feat(airtrail): use the AirTrail /api/v1 routes, and keep the legacy routes AirTrail 3.13 adds /api/v1 and marks the /api/flight/* routes as deprecated. TREK now asks the public discovery document GET /api/v1 and uses v1 when the instance has it. It uses the legacy routes for an older instance. The client methods keep their signatures, and the sync hash stays the same, so a linked flight does not sync again when an instance changes to v1. The probe cache holds only a clear answer: 200 with the discovery document gives v1, and 404 gives legacy. The cache is per AirTrail URL, for 10 minutes. A timeout, a 5xx or a network error fails that call only. A 401, a 403 or a page that is not the discovery document uses legacy for that call only. A 404 for one flight makes the client ask the probe again before it reports the flight as deleted. A missing scope gives AirtrailScopeError, which names the scope. It does not unlink a flight. The API key hint and the help step list the scopes for read and for write-back, in all languages. Each new request goes through safeFetch, with the SSRF guard, the timeout and the size cap. The flight list reads pages of 100 and fails above 50 pages. A failed list unlinks nothing. airtrail-v1.ts translates between the v1 shapes and the legacy shapes. A write-back looks up the airport, airline and aircraft ids, and changes each local time to a UTC instant in the zone of its own airport. It writes each instant in the +00:00 form of the legacy save, because AirTrail stores the string as it gets it and the sync hash reads that string. The tests cover both APIs over HTTP, the probe cache rules, the sync hash on a switch and on a save, the page limit, the scope error, and the UTC conversion across midnight, the date line and daylight-saving changes. --- .../integrations/airtrail-sync.service.ts | 2 + server/src/nest/integrations/airtrail-v1.ts | 267 ++++++ .../src/nest/integrations/airtrail.client.ts | 282 +++++- .../integrations/airtrailClientV1.test.ts | 803 ++++++++++++++++++ .../integrations/airtrailWriteGate.test.ts | 27 +- shared/src/i18n/ar/help.ts | 2 +- shared/src/i18n/ar/settings.ts | 3 +- shared/src/i18n/az/help.ts | 2 +- shared/src/i18n/az/settings.ts | 2 +- shared/src/i18n/br/help.ts | 2 +- shared/src/i18n/br/settings.ts | 3 +- shared/src/i18n/ca/help.ts | 2 +- shared/src/i18n/ca/settings.ts | 3 +- shared/src/i18n/cs/help.ts | 2 +- shared/src/i18n/cs/settings.ts | 3 +- shared/src/i18n/de/help.ts | 2 +- shared/src/i18n/de/settings.ts | 2 +- shared/src/i18n/en/help.ts | 2 +- shared/src/i18n/en/settings.ts | 3 +- shared/src/i18n/es/help.ts | 2 +- shared/src/i18n/es/settings.ts | 3 +- shared/src/i18n/et/help.ts | 2 +- shared/src/i18n/et/settings.ts | 3 +- shared/src/i18n/fr/help.ts | 2 +- shared/src/i18n/fr/settings.ts | 3 +- shared/src/i18n/gr/help.ts | 2 +- shared/src/i18n/gr/settings.ts | 3 +- shared/src/i18n/he/help.ts | 2 +- shared/src/i18n/he/settings.ts | 3 +- shared/src/i18n/hu/help.ts | 2 +- shared/src/i18n/hu/settings.ts | 3 +- shared/src/i18n/id/help.ts | 2 +- shared/src/i18n/id/settings.ts | 3 +- shared/src/i18n/it/help.ts | 2 +- shared/src/i18n/it/settings.ts | 3 +- shared/src/i18n/ja/help.ts | 2 +- shared/src/i18n/ja/settings.ts | 3 +- shared/src/i18n/ko/help.ts | 2 +- shared/src/i18n/ko/settings.ts | 3 +- shared/src/i18n/nl/help.ts | 2 +- shared/src/i18n/nl/settings.ts | 3 +- shared/src/i18n/pl/help.ts | 2 +- shared/src/i18n/pl/settings.ts | 2 +- shared/src/i18n/ru/help.ts | 2 +- shared/src/i18n/ru/settings.ts | 2 +- shared/src/i18n/sk/help.ts | 2 +- shared/src/i18n/sk/settings.ts | 3 +- shared/src/i18n/sv/help.ts | 2 +- shared/src/i18n/sv/settings.ts | 3 +- shared/src/i18n/th/help.ts | 2 +- shared/src/i18n/th/settings.ts | 3 +- shared/src/i18n/tr/help.ts | 2 +- shared/src/i18n/tr/settings.ts | 3 +- shared/src/i18n/uk/help.ts | 2 +- shared/src/i18n/uk/settings.ts | 2 +- shared/src/i18n/vi/help.ts | 2 +- shared/src/i18n/vi/settings.ts | 3 +- shared/src/i18n/zh-TW/help.ts | 2 +- shared/src/i18n/zh-TW/settings.ts | 3 +- shared/src/i18n/zh/help.ts | 2 +- shared/src/i18n/zh/settings.ts | 3 +- 61 files changed, 1442 insertions(+), 74 deletions(-) create mode 100644 server/src/nest/integrations/airtrail-v1.ts create mode 100644 server/tests/unit/nest/integrations/airtrailClientV1.test.ts diff --git a/server/src/nest/integrations/airtrail-sync.service.ts b/server/src/nest/integrations/airtrail-sync.service.ts index d0bcf2285..0c38d2493 100644 --- a/server/src/nest/integrations/airtrail-sync.service.ts +++ b/server/src/nest/integrations/airtrail-sync.service.ts @@ -61,7 +61,9 @@ export class AirtrailSyncService { try { flights = await this.client.listFlights(creds); } catch (err) { + // A failed list detaches nothing. Without a full list, no flight is known to be deleted in AirTrail. if (err instanceof AirtrailAuthError) logError(`AirTrail sync: invalid API key for user ${uid}`); + else logError(`AirTrail sync for user ${uid}: ${err instanceof Error ? err.message : err}`); return 0; } const byId = new Map(flights.map((f) => [String(f.id), f])); diff --git a/server/src/nest/integrations/airtrail-v1.ts b/server/src/nest/integrations/airtrail-v1.ts new file mode 100644 index 000000000..ad6c6a79f --- /dev/null +++ b/server/src/nest/integrations/airtrail-v1.ts @@ -0,0 +1,267 @@ +import { wallClockInstant } from '../common/timezoneService'; +import type { AirtrailAirport, AirtrailFlightRaw, AirtrailSavePayload } from './airtrail.client'; + +/** + * The translation between AirTrail's `/api/v1` and the shapes the rest of TREK + * uses (AirtrailFlightRaw, AirtrailSavePayload), which are the shapes of the + * legacy `/api/flight/*` routes. The callers use one shape for each API that an + * instance speaks. This file is the only place that knows the difference. + * + * The contract comes from AirTrail 3.13.0 to 3.14.0 (`src/lib/api/v1/schemas.ts`, + * `src/lib/api/v1/dto.ts`). The v1 contract is the same in these versions. + * + * The functions are pure, so the unit test gives them fixture objects. + */ + +/** An airport as v1 returns it, on a flight and from `GET /api/v1/airports`. */ +export interface AirtrailV1Airport { + id: number; + icao: string | null; + iata: string | null; + name: string | null; + latitude: number | null; + longitude: number | null; + timezone: string | null; + country: string | null; +} + +/** An airline or aircraft as v1 returns it. Aircraft have no IATA code. */ +export interface AirtrailV1Entity { + id: number; + name: string | null; + icao: string | null; + iata?: string | null; +} + +interface AirtrailV1Passenger { + id: number; + user: { id: string } | null; + guestName: string | null; + seat: string | null; + seatNumber: string | null; + seatClass: string | null; + flightReason: string | null; +} + +/** A flight as `GET /api/v1/flights` and `GET /api/v1/flights/{id}` return it. */ +export interface AirtrailV1Flight { + id: number; + from: AirtrailV1Airport | null; + to: AirtrailV1Airport | null; + airline: AirtrailV1Entity | null; + aircraft: AirtrailV1Entity | null; + passengers: AirtrailV1Passenger[]; + [key: string]: unknown; +} + +/** What a v1 write needs that a code-based payload does not carry. */ +export interface AirtrailV1References { + from: AirtrailV1Airport; + to: AirtrailV1Airport; + airlineId: number | null; + aircraftId: number | null; + /** The key owner's AirTrail user id, for a `` passenger. */ + selfUserId: string | null; +} + +/** A payload that cannot become a valid v1 body. The message is for the log. */ +export class AirtrailV1InputError extends Error { + constructor(message: string) { + super(message); + this.name = 'AirtrailV1InputError'; + } +} + +/** The placeholder the legacy save resolved to the key owner. */ +export const AIRTRAIL_SELF_USER_PLACEHOLDER = ''; + +function toAirport(a: AirtrailV1Airport | null): AirtrailAirport | null { + if (!a) return null; + return { + id: a.id, + icao: a.icao, + iata: a.iata, + name: a.name, + lat: a.latitude, + lon: a.longitude, + tz: a.timezone, + country: a.country, + }; +} + +/** + * A v1 flight in the legacy shape. Airports rename their coordinate and zone + * keys, and a passenger names its user as an object instead of a `userId`. + * Every other key passes through, so `buildSavePayload` still carries the + * AirTrail-owned fields (terminal, gate, takeoff and landing times) it does not + * model. + */ +export function fromAirtrailV1Flight(f: AirtrailV1Flight): AirtrailFlightRaw { + return { + ...(f as unknown as AirtrailFlightRaw), + from: toAirport(f.from), + to: toAirport(f.to), + passengers: (f.passengers ?? []).map((p) => ({ + userId: p.user?.id ?? null, + guestName: p.guestName, + seat: p.seat, + seatNumber: p.seatNumber, + seatClass: p.seatClass, + flightReason: p.flightReason, + })), + }; +} + +/** + * The entry of a search result whose code is `code`: an ICAO match first, then + * an IATA match, as the legacy save looked up an airport. With `icaoOnly`, an + * IATA match does not count, as the legacy save looked up an airline and an + * aircraft. + */ +export function pickAirtrailByCode( + rows: T[], + code: string, + icaoOnly: boolean, +): T | null { + const wanted = code.trim().toUpperCase(); + const icao = rows.find((r) => r.icao?.toUpperCase() === wanted); + if (icao || icaoOnly) return icao ?? null; + return rows.find((r) => r.iata?.toUpperCase() === wanted) ?? null; +} + +const DATE = /^\d{4}-\d{2}-\d{2}/; +const FULL_ISO = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:\d{2})$/; + +function datePart(value: unknown): string | null { + return typeof value === 'string' && DATE.test(value) ? value.slice(0, 10) : null; +} + +function text(value: unknown): string | null { + return typeof value === 'string' ? value : null; +} + +/** + * A local date and `HH:MM` at an airport, as an ISO instant. Null when there is no time. + * + * AirTrail stores the string as it gets it, and the sync hash reads that string. + * The instant ends in `+00:00`, as the legacy save wrote it, so that a save + * that changes no time keeps the hash. + */ +function localInstant(date: string | null, time: unknown, zone: string | null, field: string): string | null { + if (!date || typeof time !== 'string' || !time) return null; + const ms = wallClockInstant(date, time, zone || 'UTC'); + if (ms === null) throw new AirtrailV1InputError(`Invalid ${field} time "${time}" on ${date}`); + return new Date(ms).toISOString().replace(/Z$/, '+00:00'); +} + +/** + * A takeoff or landing time. The payload carries it as AirTrail returned it (an + * ISO instant) unless a caller set the date and `HH:MM` form; the instant then + * passes through unchanged. + */ +function carriedInstant(p: Record, key: string, zone: string | null): string | null { + if (`${key}Time` in p) return localInstant(datePart(p[key]), p[`${key}Time`], zone, key); + const value = p[key]; + return typeof value === 'string' && FULL_ISO.test(value) ? value : null; +} + +/** + * A legacy save payload as a v1 flight body (`POST /api/v1/flights`, + * `PUT /api/v1/flights/{id}`), with the rules the legacy save applied: + * - Departure and its scheduled time are the local wall clock at the origin, + * arrival and its scheduled time at the destination. A date without a time + * gives no instant. An arrival time without an arrival date takes the + * departure date. + * - `date` is the departure date, else the scheduled departure date. + * - A precision other than `day` keeps only the departure, at 10:00 UTC. + * - A flight-level reason fills each passenger that has none. + * + * v1 does not derive `duration`, so it is the departure-to-arrival time when + * both are known, else the duration AirTrail had. + * + * v1 replaces every field a PUT omits with its default, so the body names each + * field except `track`. Without a track, AirTrail keeps the stored track. A + * track in the body needs the `tracks.write` scope. + */ +export function toAirtrailV1FlightInput( + payload: AirtrailSavePayload, + refs: AirtrailV1References, +): Record { + const p = payload as unknown as Record; + const fromTz = refs.from.timezone; + const toTz = refs.to.timezone; + + const depDate = datePart(p.departure); + const date = depDate ?? datePart(p.departureScheduled); + if (!date) throw new AirtrailV1InputError('A departure date is required'); + + const datePrecision = text(p.datePrecision) ?? 'day'; + const passengers = (payload.passengers ?? payload.seats ?? []).map((s) => { + const userId = s.userId === AIRTRAIL_SELF_USER_PLACEHOLDER ? refs.selfUserId : s.userId; + if (s.userId === AIRTRAIL_SELF_USER_PLACEHOLDER && !userId) + throw new AirtrailV1InputError('The AirTrail user of this API key is unknown'); + return { + userId: userId ?? null, + guestName: s.guestName ?? null, + seat: s.seat ?? null, + seatNumber: s.seatNumber ?? null, + seatClass: s.seatClass ?? null, + flightReason: s.flightReason ?? payload.flightReason ?? null, + }; + }); + + let times: Record; + if (datePrecision !== 'day') { + times = { + departure: `${date}T10:00:00.000+00:00`, + arrival: null, + departureScheduled: null, + arrivalScheduled: null, + takeoffScheduled: null, + takeoffActual: null, + landingScheduled: null, + landingActual: null, + }; + } else { + const arrivalDate = datePart(p.arrival) ?? (p.arrivalTime ? depDate : null); + times = { + departure: localInstant(depDate, p.departureTime, fromTz, 'departure'), + arrival: localInstant(arrivalDate, p.arrivalTime, toTz, 'arrival'), + departureScheduled: localInstant( + datePart(p.departureScheduled), + p.departureScheduledTime, + fromTz, + 'scheduled departure', + ), + arrivalScheduled: localInstant(datePart(p.arrivalScheduled), p.arrivalScheduledTime, toTz, 'scheduled arrival'), + takeoffScheduled: carriedInstant(p, 'takeoffScheduled', fromTz), + takeoffActual: carriedInstant(p, 'takeoffActual', fromTz), + landingScheduled: carriedInstant(p, 'landingScheduled', toTz), + landingActual: carriedInstant(p, 'landingActual', toTz), + }; + } + + const known = + times.departure && times.arrival ? (Date.parse(times.arrival) - Date.parse(times.departure)) / 1000 : null; + const duration = + known !== null && known >= 0 ? Math.round(known) : typeof p.duration === 'number' ? p.duration : null; + + return { + date, + datePrecision, + ...times, + duration, + departureTerminal: text(p.departureTerminal), + departureGate: text(p.departureGate), + arrivalTerminal: text(p.arrivalTerminal), + arrivalGate: text(p.arrivalGate), + flightNumber: text(p.flightNumber), + aircraftReg: text(p.aircraftReg), + note: text(p.note), + fromId: refs.from.id, + toId: refs.to.id, + airlineId: refs.airlineId, + aircraftId: refs.aircraftId, + passengers, + }; +} diff --git a/server/src/nest/integrations/airtrail.client.ts b/server/src/nest/integrations/airtrail.client.ts index ea9b63c68..352af03cc 100644 --- a/server/src/nest/integrations/airtrail.client.ts +++ b/server/src/nest/integrations/airtrail.client.ts @@ -1,30 +1,66 @@ import { safeFetch } from '../../utils/ssrfGuard'; +import { + AirtrailV1InputError, + fromAirtrailV1Flight, + pickAirtrailByCode, + AIRTRAIL_SELF_USER_PLACEHOLDER, + toAirtrailV1FlightInput, + type AirtrailV1Airport, + type AirtrailV1Entity, + type AirtrailV1Flight, +} from './airtrail-v1'; import { Injectable } from '@nestjs/common'; /** * Thin HTTP client for the AirTrail REST API (github.com/johanohly/AirTrail). * This is the ONLY place that talks to a user's AirTrail instance. * - * Verified against AirTrail source: - * - Auth: `Authorization: Bearer `; a key maps to exactly one user. - * - GET /api/flight/list — defaults to scope=mine. We NEVER send a scope - * param so the key only ever returns its owner's own flights (isolation - * holds even if an admin key is pasted). - * - GET /api/flight/get/{id} - * - POST /api/flight/save — `id` present => update, else create. The - * passenger list is required (>=1). An entry with userId '' is - * attributed to the key owner server-side, so we never need the caller's - * AirTrail user id. - * - AirTrail 3.12.0 renamed that list from `seats` to `passengers` and moved - * flightReason from the flight onto each passenger, with no alias on either - * side (verified against running 3.11.1 and 3.12.0 instances: each returns - * its own key and null for the other). TREK reads and writes both shapes so - * one build works against either version. + * AirTrail 3.13.0 and later serve the versioned API under `/api/v1`. They mark + * the `/api/flight/*` routes as deprecated, and the next major release removes + * them. Older instances have only `/api/flight/*`. The client asks the public + * discovery document `GET /api/v1` which API an instance has, and keeps the + * answer for FLAVOR_TTL_MS (see `apiFlavor`). A 404 from a flight route cannot + * tell the difference, because v1 also answers 404 for a flight that does not exist. + * + * Both APIs, verified against AirTrail source: + * - Auth: `Authorization: Bearer `; a key maps to exactly one user. A key + * made before 3.13.0 holds every scope. A newer key needs `flight.read.own`, + * and for the write-back also `flight.update.own`, + * `flight.passengers.manage.own` (a PUT that changes a passenger, for example + * the seat), `reference_data.read` (code lookups) and `profile.read` + * (`GET /api/v1/me`, for a flight with no passenger). A save with no id also + * needs `flight.create.own`. A missing scope raises AirtrailScopeError, which + * names it. + * - The flight list defaults to scope=mine. We NEVER send a scope param so the + * key only ever returns its owner's own flights (isolation holds even if an + * admin key is pasted). v1 gives the list in pages, and the client reads every page. + * - Legacy: GET /api/flight/list, GET /api/flight/get/{id}, and + * POST /api/flight/save (`id` present => update, else create), with airports, + * airline and aircraft as codes and times as a local date plus `HH:MM`. An + * entry with userId '' is attributed to the key owner server-side. + * - v1: GET /api/v1/flights, GET /api/v1/flights/{id}, POST /api/v1/flights, + * PUT /api/v1/flights/{id}, with numeric ids and ISO instants. airtrail-v1.ts + * translates both ways, so callers use the legacy shapes for either API. + * - The passenger list is required (>=1). AirTrail 3.12.0 renamed it from + * `seats` to `passengers` and moved flightReason from the flight onto each + * passenger, with no alias on either side (verified against running 3.11.1 + * and 3.12.0 instances: each returns its own key and null for the other). + * TREK reads and writes both shapes so one build works against either version. * - There is no webhook and no updated_at on a flight, so change detection is * snapshot-hash based (see airtrailSync). */ const TIMEOUT_MS = 12000; +/** How long the client keeps the answer of the discovery probe. After this time, it sees an AirTrail upgrade. */ +const FLAVOR_TTL_MS = 10 * 60_000; +/** The largest page `GET /api/v1/flights` gives. */ +const V1_PAGE_LIMIT = 100; +/** + * The most list pages read in one call (5000 flights). Past it the list fails + * instead of answering a part, because the sync detaches every linked flight + * that is missing from the list. + */ +const V1_MAX_PAGES = 50; export interface AirtrailCreds { /** Instance origin without a trailing /api. */ @@ -40,6 +76,24 @@ export class AirtrailAuthError extends Error { } } +/** + * A v1 key that is valid but does not have a scope that the request needs. It is + * not an AirtrailAuthError, because the key still works for its other scopes. + * A caller must not detach linked flights for this error. + */ +export class AirtrailScopeError extends Error { + readonly scope: string | null; + constructor(scope: string | null) { + super( + scope + ? `The AirTrail API key lacks the scope ${scope}. Add it to the key in AirTrail, or create a new key.` + : 'The AirTrail API key lacks a scope that this request needs.', + ); + this.name = 'AirtrailScopeError'; + this.scope = scope; + } +} + export class AirtrailRequestError extends Error { status?: number; constructor(message: string, status?: number) { @@ -179,6 +233,25 @@ async function parseJson(resp: Response): Promise { } } +/** The error of a v1 error body (`{error:{code,message,details}}`), when the response holds one. */ +async function airtrailV1Error(resp: Response): Promise<{ code: string | null; message: string } | null> { + try { + const body = JSON.parse(await resp.text()) as { error?: { code?: unknown; message?: unknown; details?: unknown } }; + const message = typeof body?.error?.message === 'string' ? body.error.message : null; + if (!message) return null; + const code = typeof body.error?.code === 'string' ? body.error.code : null; + const details = body.error?.details; + return { code, message: details === undefined ? message : `${message}: ${JSON.stringify(details)}` }; + } catch { + return null; + } +} + +/** The scope name in AirTrail's `insufficient_scope` message ("The credential requires flight.read.own"). */ +function scopeIn(message: string): string | null { + return /\b[a-z_]+(?:\.[a-z_]+)+\b/.exec(message)?.[0] ?? null; +} + async function request(creds: AirtrailCreds, path: string, init: RequestInit): Promise { const url = apiBase(creds.baseUrl) + path; let resp: Response; @@ -200,11 +273,21 @@ async function request(creds: AirtrailCreds, path: string, init: RequestInit): P throw new AirtrailRequestError(err instanceof Error ? err.message : 'Could not reach AirTrail'); } if (resp.status === 401 || resp.status === 403) { - throw new AirtrailAuthError(); + // v1 gives the cause, for example the scope that the key does not have. The legacy API does not. + const reason = await airtrailV1Error(resp); + if (reason?.code === 'insufficient_scope') throw new AirtrailScopeError(scopeIn(reason.message)); + throw reason ? new AirtrailAuthError(`AirTrail refused the request: ${reason.message}`) : new AirtrailAuthError(); } return resp; } +async function airtrailV1Failure(resp: Response, action: string): Promise { + const reason = await airtrailV1Error(resp); + return new AirtrailRequestError(reason?.message ?? `AirTrail ${action} failed (HTTP ${resp.status})`, resp.status); +} + +type ApiFlavor = 'v1' | 'legacy'; + /** * The AirTrail HTTP surface, as a provider. * @@ -215,7 +298,11 @@ async function request(creds: AirtrailCreds, path: string, init: RequestInit): P */ @Injectable() export class AirtrailClient { + /** The API each instance speaks, by API base URL, with the time it was asked. */ + private readonly flavors = new Map(); + async listFlights(creds: AirtrailCreds): Promise { + if ((await this.apiFlavor(creds)) === 'v1') return this.listFlightsV1(creds); const resp = await request(creds, '/flight/list', { method: 'GET' }); if (!resp.ok) throw new AirtrailRequestError(`AirTrail list failed (HTTP ${resp.status})`, resp.status); const data = await parseJson<{ flights?: AirtrailFlightRaw[] }>(resp); @@ -223,14 +310,31 @@ export class AirtrailClient { } async getFlight(creds: AirtrailCreds, id: number): Promise { - const resp = await request(creds, `/flight/get/${id}`, { method: 'GET' }); + const flavor = await this.apiFlavor(creds); + const flight = await this.getFlightAs(creds, id, flavor); + if (flight) return flight; + // A 404 from a stale answer (AirTrail was upgraded or downgraded) looks like a deleted + // flight, and a caller detaches a deleted flight. Ask the probe again before null. + this.flavors.delete(apiBase(creds.baseUrl)); + const fresh = await this.apiFlavor(creds); + return fresh === flavor ? null : this.getFlightAs(creds, id, fresh); + } + + private async getFlightAs(creds: AirtrailCreds, id: number, flavor: ApiFlavor): Promise { + const v1 = flavor === 'v1'; + const resp = await request(creds, v1 ? `/v1/flights/${id}` : `/flight/get/${id}`, { method: 'GET' }); if (resp.status === 404) return null; if (!resp.ok) throw new AirtrailRequestError(`AirTrail get failed (HTTP ${resp.status})`, resp.status); + if (v1) { + const data = await parseJson<{ data?: AirtrailV1Flight }>(resp); + return data.data ? fromAirtrailV1Flight(data.data) : null; + } const data = await parseJson<{ flight?: AirtrailFlightRaw }>(resp); return data.flight ?? null; } async saveFlight(creds: AirtrailCreds, payload: AirtrailSavePayload): Promise<{ id?: number }> { + if ((await this.apiFlavor(creds)) === 'v1') return this.saveFlightV1(creds, payload); const resp = await request(creds, '/flight/save', { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -250,4 +354,148 @@ export class AirtrailClient { const data = await parseJson<{ id?: number }>(resp); return { id: data.id }; } + + /** + * Which API the instance speaks. `GET /api/v1` is public and answers a + * discovery document with `api.version` on 3.13.0 and later. An older + * instance answers 404. The client keeps only these two answers. For each + * other answer, the client asks again on the next call: + * - A 5xx, a timeout or a network error fails this call. + * - A page that is not the discovery document (for example a login page in + * front of AirTrail) sends this call to the legacy route. The error of + * that route explains a wrong URL. + */ + private async apiFlavor(creds: AirtrailCreds): Promise { + const base = apiBase(creds.baseUrl); + const known = this.flavors.get(base); + if (known && Date.now() - known.at < FLAVOR_TTL_MS) return known.flavor; + + let resp: Response; + try { + resp = await request(creds, '/v1', { method: 'GET' }); + } catch (err) { + // `GET /api/v1` is public in AirTrail, so a 401 or 403 comes from a proxy in front of it. + // It says nothing about the key. Use the legacy route for this call, and do not keep the answer. + if (err instanceof AirtrailAuthError || err instanceof AirtrailScopeError) return 'legacy'; + throw err; + } + let flavor: ApiFlavor; + let keep = true; + if (resp.status === 404) { + flavor = 'legacy'; + } else if (resp.ok) { + let version: unknown; + try { + version = (JSON.parse(await resp.text()) as { api?: { version?: unknown } })?.api?.version; + } catch { + version = undefined; + } + flavor = version === 'v1' ? 'v1' : 'legacy'; + keep = flavor === 'v1'; + } else { + throw new AirtrailRequestError(`AirTrail did not answer (HTTP ${resp.status})`, resp.status); + } + if (keep) { + if (this.flavors.size >= 1000) this.flavors.clear(); + this.flavors.set(base, { flavor, at: Date.now() }); + } + return flavor; + } + + /** + * Every page of `GET /api/v1/flights`, one after the other, because each + * request needs the cursor of the page before it. + */ + private async listFlightsV1( + creds: AirtrailCreds, + cursor: string | null = null, + flights: AirtrailFlightRaw[] = [], + seen: Set = new Set(), + ): Promise { + const query = new URLSearchParams({ limit: String(V1_PAGE_LIMIT) }); + if (cursor) query.set('cursor', cursor); + const resp = await request(creds, `/v1/flights?${query}`, { method: 'GET' }); + if (!resp.ok) throw new AirtrailRequestError(`AirTrail list failed (HTTP ${resp.status})`, resp.status); + const body = await parseJson<{ data?: AirtrailV1Flight[]; page?: { nextCursor?: string | null } }>(resp); + for (const f of body.data ?? []) flights.push(fromAirtrailV1Flight(f)); + const next = body.page?.nextCursor ?? null; + if (!next) return flights; + // A cursor that came before makes an endless loop. AirTrail does not send one, but a caching proxy can. + if (seen.has(next)) throw new AirtrailRequestError('AirTrail repeated a page cursor'); + seen.add(next); + if (seen.size >= V1_MAX_PAGES) + throw new AirtrailRequestError(`AirTrail has more than ${V1_MAX_PAGES * V1_PAGE_LIMIT} flights`); + return this.listFlightsV1(creds, next, flights, seen); + } + + private async saveFlightV1(creds: AirtrailCreds, payload: AirtrailSavePayload): Promise<{ id?: number }> { + const [from, to, airline, aircraft] = await Promise.all([ + this.findByCode(creds, 'airports', payload.from, false, 'departure airport'), + this.findByCode(creds, 'airports', payload.to, false, 'arrival airport'), + payload.airline ? this.findByCode(creds, 'airlines', payload.airline, true, 'airline') : null, + payload.aircraft + ? this.findByCode(creds, 'aircraft', payload.aircraft, true, 'aircraft') + : null, + ]); + const people = payload.passengers ?? payload.seats ?? []; + const selfUserId = people.some((s) => s.userId === AIRTRAIL_SELF_USER_PLACEHOLDER) + ? await this.selfUserId(creds) + : null; + + let body: Record; + try { + body = toAirtrailV1FlightInput(payload, { + from, + to, + airlineId: airline?.id ?? null, + aircraftId: aircraft?.id ?? null, + selfUserId, + }); + } catch (err) { + if (err instanceof AirtrailV1InputError) throw new AirtrailRequestError(err.message, 400); + throw err; + } + + const update = payload.id !== undefined && payload.id !== null; + const resp = await request(creds, update ? `/v1/flights/${payload.id}` : '/v1/flights', { + method: update ? 'PUT' : 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(body), + }); + if (!resp.ok) throw await airtrailV1Failure(resp, 'save'); + // The legacy save answers an id only for a new flight. This method does the same. + if (update) return {}; + const data = await parseJson<{ data?: { id?: number } }>(resp); + return { id: data.data?.id }; + } + + /** + * The row whose code is `code`, from a v1 reference search. The search also + * matches names, so `pickAirtrailByCode` compares the code again. + */ + private async findByCode( + creds: AirtrailCreds, + kind: 'airports' | 'airlines' | 'aircraft', + code: string, + icaoOnly: boolean, + label: string, + ): Promise { + const resp = await request(creds, `/v1/${kind}?${new URLSearchParams({ query: code.trim() })}`, { + method: 'GET', + }); + if (!resp.ok) throw await airtrailV1Failure(resp, `${label} lookup`); + const body = await parseJson<{ data?: T[] }>(resp); + const row = pickAirtrailByCode(body.data ?? [], code, icaoOnly); + if (!row) throw new AirtrailRequestError(`Invalid ${label}: ${code}`, 400); + return row; + } + + /** The AirTrail user id of the key owner, which v1 needs where the legacy save took ''. */ + private async selfUserId(creds: AirtrailCreds): Promise { + const resp = await request(creds, '/v1/me', { method: 'GET' }); + if (!resp.ok) throw await airtrailV1Failure(resp, 'profile read'); + const body = await parseJson<{ data?: { id?: unknown } }>(resp); + if (typeof body.data?.id !== 'string') throw new AirtrailRequestError('AirTrail did not name the key owner'); + return body.data.id; + } } diff --git a/server/tests/unit/nest/integrations/airtrailClientV1.test.ts b/server/tests/unit/nest/integrations/airtrailClientV1.test.ts new file mode 100644 index 000000000..12af20ba1 --- /dev/null +++ b/server/tests/unit/nest/integrations/airtrailClientV1.test.ts @@ -0,0 +1,803 @@ +import { buildSavePayload } from '../../../../src/nest/integrations/airtrail-sync.helpers'; +import { + fromAirtrailV1Flight, + toAirtrailV1FlightInput, + type AirtrailV1Airport, +} from '../../../../src/nest/integrations/airtrail-v1'; +import { + AirtrailAuthError, + AirtrailClient, + AirtrailRequestError, + AirtrailScopeError, + type AirtrailCreds, + type AirtrailSavePayload, +} from '../../../../src/nest/integrations/airtrail.client'; +import { canonicalHash } from '../../../../src/nest/integrations/airtrail.mapper'; +import { safeFetch } from '../../../../src/utils/ssrfGuard'; + +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; + +vi.mock('../../../../src/utils/ssrfGuard', () => ({ + checkSsrf: vi.fn(async () => ({ allowed: true, isPrivate: false })), + safeFetch: vi.fn(), +})); + +const fetchMock = vi.mocked(safeFetch); +const creds: AirtrailCreds = { baseUrl: 'https://at.example', apiKey: 'k', allowInsecureTls: false }; + +type Route = (url: URL, init: RequestInit) => Response | undefined; +let routes: Route[]; +let calls: { method: string; url: URL; body: unknown }[]; + +const json = (body: unknown, status = 200) => + new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } }); + +function on(method: string, path: string, answer: (url: URL, body: unknown) => Response) { + routes.push((url, init) => + (init.method ?? 'GET') === method && url.pathname === path + ? answer(url, init.body ? JSON.parse(String(init.body)) : undefined) + : undefined, + ); +} + +function present(value: T | null | undefined): T { + if (value === null || value === undefined) throw new Error('expected a value'); + return value; +} + +const DISCOVERY = { api: { version: 'v1', minimumSupportedVersion: 'v1' }, instance: { version: '3.14.0' } }; + +const LAX: AirtrailV1Airport = { + id: 11, + icao: 'KLAX', + iata: 'LAX', + name: 'Los Angeles International Airport', + latitude: 33.94, + longitude: -118.41, + timezone: 'America/Los_Angeles', + country: 'US', +}; +const MEL: AirtrailV1Airport = { + id: 22, + icao: 'YMML', + iata: 'MEL', + name: 'Melbourne Airport', + latitude: -37.67, + longitude: 144.84, + timezone: 'Australia/Melbourne', + country: 'AU', +}; +const QANTAS = { id: 7, name: 'Qantas', icao: 'QFA', iata: 'QF', iconPath: null }; + +function v1Flight(id: number, overrides: Record = {}) { + return { + id, + date: '2026-10-04', + datePrecision: 'day', + departure: '2026-10-05T05:00:00.000+00:00', + arrival: '2026-10-05T20:30:00.000+00:00', + departureScheduled: '2026-10-05T05:00:00.000+00:00', + arrivalScheduled: '2026-10-05T20:30:00.000+00:00', + takeoffScheduled: null, + takeoffActual: '2026-10-05T05:21:00.000+00:00', + landingScheduled: null, + landingActual: null, + duration: 55800, + departureTerminal: 'B', + departureGate: '148', + arrivalTerminal: null, + arrivalGate: null, + flightNumber: 'QF94', + aircraftReg: null, + note: null, + from: LAX, + to: MEL, + airline: QANTAS, + aircraft: null, + passengers: [ + { + id: 5, + user: { id: 'u-self', username: 'aaron', displayName: 'Aaron' }, + guestName: null, + seat: 'aisle', + seatNumber: '4D', + seatClass: 'business', + flightReason: 'business', + }, + ], + track: null, + ...overrides, + }; +} + +function v1Instance() { + on('GET', '/api/v1', () => json(DISCOVERY)); + on('GET', '/api/v1/airports', (url) => { + const q = url.searchParams.get('query')?.toUpperCase(); + return json({ data: [LAX, MEL].filter((a) => a.iata === q || a.icao === q), page: { nextCursor: null } }); + }); + on('GET', '/api/v1/airlines', (url) => { + const q = url.searchParams.get('query')?.toUpperCase(); + return json({ data: [QANTAS].filter((a) => a.iata === q || a.icao === q), page: { nextCursor: null } }); + }); + on('GET', '/api/v1/me', () => json({ data: { id: 'u-self', username: 'aaron' } })); +} + +beforeEach(() => { + routes = []; + calls = []; + fetchMock.mockReset(); + fetchMock.mockImplementation(async (input, init = {}) => { + const url = new URL(String(input)); + calls.push({ method: init.method ?? 'GET', url, body: init.body ? JSON.parse(String(init.body)) : undefined }); + for (const route of routes) { + const answer = route(url, init); + if (answer) return answer; + } + return new Response('not found', { status: 404 }); + }); +}); + +describe('AirtrailClient picks the API the instance speaks', () => { + it('reads every v1 page into the legacy shape, with no scope parameter', async () => { + v1Instance(); + on('GET', '/api/v1/flights', (url) => + url.searchParams.get('cursor') === 'c2' + ? json({ data: [v1Flight(2)], page: { nextCursor: null } }) + : json({ data: [v1Flight(1)], page: { nextCursor: 'c2' } }), + ); + + const flights = await new AirtrailClient().listFlights(creds); + + expect(flights.map((f) => f.id)).toEqual([1, 2]); + expect(flights[0].from).toMatchObject({ iata: 'LAX', lat: 33.94, lon: -118.41, tz: 'America/Los_Angeles' }); + expect(flights[0].passengers?.[0]).toMatchObject({ userId: 'u-self', seatNumber: '4D', flightReason: 'business' }); + const lists = calls.filter((c) => c.url.pathname === '/api/v1/flights'); + expect(lists).toHaveLength(2); + expect(lists.every((c) => c.url.searchParams.get('limit') === '100' && !c.url.searchParams.has('scope'))).toBe( + true, + ); + }); + + it('uses the legacy routes when the instance has no /api/v1', async () => { + on('GET', '/api/flight/list', () => json({ success: true, flights: [{ id: 9 }] })); + + const flights = await new AirtrailClient().listFlights(creds); + + expect(flights).toEqual([{ id: 9 }]); + expect(calls.map((c) => c.url.pathname)).toEqual(['/api/v1', '/api/flight/list']); + }); + + it('asks once and keeps the answer for the next call', async () => { + v1Instance(); + on('GET', '/api/v1/flights/3', () => json({ data: v1Flight(3) })); + const client = new AirtrailClient(); + + await client.getFlight(creds, 3); + await client.getFlight(creds, 3); + + expect(calls.filter((c) => c.url.pathname === '/api/v1')).toHaveLength(1); + }); + + it('does not keep an answer that is not the discovery document, such as a login page', async () => { + on('GET', '/api/v1', () => new Response('sign in', { status: 200 })); + on('GET', '/api/flight/get/3', () => json({ success: true, flight: { id: 3 } })); + const client = new AirtrailClient(); + + expect(await client.getFlight(creds, 3)).toEqual({ id: 3 }); + await client.getFlight(creds, 3); + + expect(calls.filter((c) => c.url.pathname === '/api/v1')).toHaveLength(2); + }); + + it('gives a v1 flight the same sync hash as the legacy route gave it, so a switch re-syncs nothing', async () => { + v1Instance(); + on('GET', '/api/v1/flights/1', () => json({ data: v1Flight(1) })); + const fromV1 = present(await new AirtrailClient().getFlight(creds, 1)); + const airport = (a: AirtrailV1Airport) => ({ + id: a.id, + icao: a.icao, + iata: a.iata, + name: a.name, + lat: a.latitude, + lon: a.longitude, + tz: a.timezone, + country: a.country, + }); + const { passengers, ...rest } = v1Flight(1); + const legacy = { + ...rest, + from: airport(LAX), + to: airport(MEL), + passengers: passengers.map(({ user, ...p }) => ({ ...p, flightId: 1, userId: user.id, user })), + }; + + expect(canonicalHash(fromV1)).toBe(canonicalHash(legacy as never)); + }); + + it('answers null for a v1 flight that does not exist', async () => { + v1Instance(); + on('GET', '/api/v1/flights/404', () => json({ error: { code: 'not_found', message: 'Flight not found' } }, 404)); + + expect(await new AirtrailClient().getFlight(creds, 404)).toBeNull(); + }); + + it('names the missing scope when v1 refuses the key, and does not call the key invalid', async () => { + on('GET', '/api/v1', () => json(DISCOVERY)); + on('GET', '/api/v1/flights', () => + json({ error: { code: 'insufficient_scope', message: 'The credential requires flight.read.own' } }, 403), + ); + + const err = await new AirtrailClient().listFlights(creds).catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailScopeError); + expect(err).not.toBeInstanceOf(AirtrailAuthError); + expect((err as AirtrailScopeError).scope).toBe('flight.read.own'); + expect((err as Error).message).toContain('lacks the scope flight.read.own'); + }); + + it('gives the auth error when v1 refuses the key for a reason other than a scope', async () => { + on('GET', '/api/v1', () => json(DISCOVERY)); + on('GET', '/api/v1/flights', () => json({ error: { code: 'unauthorized', message: 'Invalid API key' } }, 401)); + + const err = await new AirtrailClient().listFlights(creds).catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailAuthError); + }); + + it('stops at the hard page limit, and fails so that it does not give a part of the list', async () => { + v1Instance(); + on('GET', '/api/v1/flights', (url) => { + const n = Number(url.searchParams.get('cursor') ?? '0'); + return json({ data: [v1Flight(n + 1)], page: { nextCursor: String(n + 1) } }); + }); + + const err = await new AirtrailClient().listFlights(creds).catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailRequestError); + expect((err as Error).message).toBe('AirTrail has more than 5000 flights'); + expect(calls.filter((c) => c.url.pathname === '/api/v1/flights')).toHaveLength(50); + }); + + it('sends every v1 request through the guarded fetch, with the timeout signal', async () => { + v1Instance(); + on('GET', '/api/v1/flights', () => json({ data: [v1Flight(1)], page: { nextCursor: null } })); + on('PUT', '/api/v1/flights/1', () => json({ data: v1Flight(1) })); + const client = new AirtrailClient(); + + await client.listFlights(creds); + await client.saveFlight(creds, { + id: 1, + from: 'LAX', + to: 'MEL', + departure: '2026-10-04', + seats: [], + passengers: [{ userId: '', guestName: null, seat: null, seatNumber: null, seatClass: null }], + }); + + const paths = calls.map((c) => c.url.pathname); + expect(paths).toEqual( + expect.arrayContaining(['/api/v1', '/api/v1/flights', '/api/v1/airports', '/api/v1/me', '/api/v1/flights/1']), + ); + expect(fetchMock).toHaveBeenCalledTimes(calls.length); + // The timeout signal on each request, and no override of the default response size cap. + for (const [, init, options] of fetchMock.mock.calls) { + expect(init?.signal).toBeInstanceOf(AbortSignal); + expect(options).not.toHaveProperty('maxBytes'); + } + }); +}); + +describe('AirtrailClient keeps only a clear answer of the discovery probe', () => { + afterEach(() => vi.useRealTimers()); + + it('keeps a 404 as the legacy API', async () => { + on('GET', '/api/flight/get/3', () => json({ success: true, flight: { id: 3 } })); + const client = new AirtrailClient(); + + await client.getFlight(creds, 3); + await client.getFlight(creds, 3); + + expect(calls.filter((c) => c.url.pathname === '/api/v1')).toHaveLength(1); + }); + + it('fails the call on a 5xx and asks again on the next call', async () => { + let down = true; + on('GET', '/api/v1', () => (down ? json({ message: 'bad gateway' }, 502) : json(DISCOVERY))); + on('GET', '/api/v1/flights/3', () => json({ data: v1Flight(3) })); + const client = new AirtrailClient(); + + const err = await client.getFlight(creds, 3).catch((e: unknown) => e); + down = false; + const flight = await client.getFlight(creds, 3); + + expect((err as AirtrailRequestError).status).toBe(502); + expect(flight?.id).toBe(3); + expect(calls.filter((c) => c.url.pathname === '/api/flight/get/3')).toHaveLength(0); + }); + + it('fails the call on a timeout or a network error and asks again on the next call', async () => { + v1Instance(); + on('GET', '/api/v1/flights/3', () => json({ data: v1Flight(3) })); + const client = new AirtrailClient(); + fetchMock.mockRejectedValueOnce(new DOMException('The operation was aborted due to timeout', 'TimeoutError')); + fetchMock.mockRejectedValueOnce(new Error('connect ECONNREFUSED')); + + const timeout = await client.getFlight(creds, 3).catch((e: unknown) => e); + const refused = await client.getFlight(creds, 3).catch((e: unknown) => e); + const flight = await client.getFlight(creds, 3); + + expect(timeout).toBeInstanceOf(AirtrailRequestError); + expect(refused).toBeInstanceOf(AirtrailRequestError); + expect(flight?.id).toBe(3); + expect(fetchMock.mock.calls.filter(([u]) => new URL(String(u)).pathname === '/api/v1')).toHaveLength(3); + }); + + it('asks the probe again on a 404 for a flight, so a stale answer does not look like a deleted flight', async () => { + let upgraded = false; + on('GET', '/api/v1', () => (upgraded ? json(DISCOVERY) : json({}, 404))); + on('GET', '/api/v1/flights/3', () => json({ data: v1Flight(3) })); + on('GET', '/api/flight/get/3', () => (upgraded ? json({}, 404) : json({ success: true, flight: { id: 3 } }))); + const client = new AirtrailClient(); + + await client.getFlight(creds, 3); + upgraded = true; // the next major AirTrail has no /api/flight/* routes + const flight = await client.getFlight(creds, 3); + + expect(flight?.id).toBe(3); + expect(calls.map((c) => c.url.pathname)).toEqual([ + '/api/v1', + '/api/flight/get/3', + '/api/flight/get/3', + '/api/v1', + '/api/v1/flights/3', + ]); + }); + + it('answers null after the probe gives the same API again, because the flight is deleted', async () => { + v1Instance(); + const client = new AirtrailClient(); + + expect(await client.getFlight(creds, 404)).toBeNull(); + // The probe again, but no second read: the probe gave the same API. + expect(calls.map((c) => c.url.pathname)).toEqual(['/api/v1', '/api/v1/flights/404', '/api/v1']); + }); + + it('uses the legacy route, and does not call the key invalid, when a proxy refuses the probe', async () => { + on('GET', '/api/v1', () => new Response('Unauthorized', { status: 401 })); + on('GET', '/api/flight/get/3', () => json({ success: true, flight: { id: 3 } })); + const client = new AirtrailClient(); + + expect(await client.getFlight(creds, 3)).toEqual({ id: 3 }); + await client.getFlight(creds, 3); + + expect(calls.filter((c) => c.url.pathname === '/api/v1')).toHaveLength(2); + }); + + it('keeps the answer for each AirTrail URL apart', async () => { + on('GET', '/api/v1', (url) => (url.hostname === 'new.example' ? json(DISCOVERY) : json({}, 404))); + on('GET', '/api/v1/flights/3', () => json({ data: v1Flight(3) })); + on('GET', '/api/flight/get/3', () => json({ success: true, flight: { id: 3 } })); + const client = new AirtrailClient(); + const old = { ...creds, baseUrl: 'https://old.example' }; + const fresh = { ...creds, baseUrl: 'https://new.example/' }; + + await client.getFlight(creds, 3); + await client.getFlight(old, 3); + await client.getFlight(fresh, 3); + await client.getFlight({ ...fresh, baseUrl: 'https://new.example/api' }, 3); + + const got = calls.filter((c) => c.url.pathname !== '/api/v1').map((c) => `${c.url.hostname}${c.url.pathname}`); + expect(got).toEqual([ + 'at.example/api/flight/get/3', + 'old.example/api/flight/get/3', + 'new.example/api/v1/flights/3', + 'new.example/api/v1/flights/3', + ]); + // One probe for each instance. A trailing slash or /api names the same instance. + expect(calls.filter((c) => c.url.pathname === '/api/v1').map((c) => c.url.hostname)).toEqual([ + 'at.example', + 'old.example', + 'new.example', + ]); + }); + + it('asks again after ten minutes, and the flight keeps its sync hash when the instance moved to v1', async () => { + vi.useFakeTimers({ toFake: ['Date'] }); + let upgraded = false; + on('GET', '/api/v1', () => (upgraded ? json(DISCOVERY) : json({}, 404))); + on('GET', '/api/v1/flights/1', () => json({ data: v1Flight(1) })); + const { passengers, ...rest } = v1Flight(1); + const legacyFlight = { + ...rest, + from: { + id: 11, + icao: 'KLAX', + iata: 'LAX', + name: LAX.name, + lat: 33.94, + lon: -118.41, + tz: LAX.timezone, + country: 'US', + }, + to: { + id: 22, + icao: 'YMML', + iata: 'MEL', + name: MEL.name, + lat: -37.67, + lon: 144.84, + tz: MEL.timezone, + country: 'AU', + }, + passengers: passengers.map(({ user, ...p }) => ({ ...p, flightId: 1, userId: user.id, user })), + }; + on('GET', '/api/flight/get/1', () => json({ success: true, flight: legacyFlight })); + const client = new AirtrailClient(); + + const before = present(await client.getFlight(creds, 1)); + upgraded = true; + vi.advanceTimersByTime(9 * 60_000); + await client.getFlight(creds, 1); + vi.advanceTimersByTime(2 * 60_000); + const after = present(await client.getFlight(creds, 1)); + + expect(calls.map((c) => c.url.pathname)).toEqual([ + '/api/v1', + '/api/flight/get/1', + '/api/flight/get/1', + '/api/v1', + '/api/v1/flights/1', + ]); + expect(canonicalHash(after)).toBe(canonicalHash(before)); + }); +}); + +/** An instance with no /api/v1: the probe gets the default 404 route. */ +describe('AirtrailClient on the legacy routes', () => { + const payload: AirtrailSavePayload = { + id: 41, + from: 'KLAX', + to: 'YMML', + departure: '2026-10-04', + departureTime: '22:00', + airline: 'QFA', + seats: [{ userId: '', guestName: null, seat: null, seatNumber: '3A', seatClass: null }], + passengers: [{ userId: '', guestName: null, seat: null, seatNumber: '3A', seatClass: null }], + }; + + it('reads one flight, and answers null for a flight that does not exist', async () => { + on('GET', '/api/flight/get/3', () => json({ success: true, flight: { id: 3, flightNumber: 'QF94' } })); + const client = new AirtrailClient(); + + expect(await client.getFlight(creds, 3)).toEqual({ id: 3, flightNumber: 'QF94' }); + expect(await client.getFlight(creds, 4)).toBeNull(); + }); + + it('lists the flights with no scope parameter', async () => { + on('GET', '/api/flight/list', () => json({ success: true, flights: [{ id: 1 }, { id: 2 }] })); + + expect(await new AirtrailClient().listFlights(creds)).toEqual([{ id: 1 }, { id: 2 }]); + const list = present(calls.find((c) => c.url.pathname === '/api/flight/list')); + expect(list.url.search).toBe(''); + }); + + it('sends the save payload unchanged, with codes and local times, and answers the id', async () => { + on('POST', '/api/flight/save', () => json({ success: true, id: 41 })); + + expect(await new AirtrailClient().saveFlight(creds, payload)).toEqual({ id: 41 }); + const save = present(calls.find((c) => c.method === 'POST')); + expect(save.body).toEqual(payload); + // The legacy save needs no lookup and no profile read. + expect(calls.map((c) => c.url.pathname)).toEqual(['/api/v1', '/api/flight/save']); + }); + + it('passes the save error message through', async () => { + on('POST', '/api/flight/save', () => json({ success: false, message: 'Invalid airline' }, 400)); + + const err = await new AirtrailClient().saveFlight(creds, payload).catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailRequestError); + expect((err as AirtrailRequestError).status).toBe(400); + expect((err as Error).message).toBe('Invalid airline'); + }); + + it('gives a refused key the auth error with the generic message', async () => { + on('GET', '/api/flight/list', () => new Response('Unauthorized', { status: 401 })); + + const err = await new AirtrailClient().listFlights(creds).catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailAuthError); + expect((err as Error).message).toBe('AirTrail rejected the API key'); + }); + + it('explains a page that is not JSON, such as a wrong URL', async () => { + on('GET', '/api/flight/list', () => new Response('app', { status: 200 })); + + const err = await new AirtrailClient().listFlights(creds).catch((e: unknown) => e); + + expect((err as Error).message).toContain('AirTrail returned a non-JSON response'); + }); +}); + +describe('AirtrailClient writes a flight through v1', () => { + it('turns the write-back payload into a PUT with ids, UTC instants and the AirTrail-owned fields', async () => { + v1Instance(); + on('PUT', '/api/v1/flights/41', () => json({ data: v1Flight(41) })); + on('GET', '/api/v1/flights/41', () => json({ data: v1Flight(41) })); + const existing = present(await new AirtrailClient().getFlight(creds, 41)); + const reservation = { + id: 1, + external_id: '41', + notes: 'Window if free', + reservation_time: '2026-10-04T22:00', + reservation_end_time: '2026-10-06T07:30', + endpoints: [ + { role: 'from', code: 'LAX' }, + { role: 'to', code: 'MEL' }, + ], + metadata: JSON.stringify({ seat: '3A', airline_code: 'QFA', flight_number: 'QF94' }), + }; + const payload = present(buildSavePayload(reservation, existing)); + + expect(await new AirtrailClient().saveFlight(creds, payload)).toEqual({}); + + const put = present(calls.find((c) => c.method === 'PUT')); + expect(put.url.pathname).toBe('/api/v1/flights/41'); + expect(put.body).toMatchObject({ + date: '2026-10-04', + fromId: 11, + toId: 22, + airlineId: 7, + aircraftId: null, + // 22:00 in Los Angeles (UTC-7) and 07:30 in Melbourne (UTC+11). + departure: '2026-10-05T05:00:00.000+00:00', + departureScheduled: '2026-10-05T05:00:00.000+00:00', + arrival: '2026-10-05T20:30:00.000+00:00', + arrivalScheduled: '2026-10-05T20:30:00.000+00:00', + duration: 55800, + takeoffActual: '2026-10-05T05:21:00.000+00:00', + departureTerminal: 'B', + departureGate: '148', + flightNumber: 'QF94', + note: 'Window if free', + passengers: [ + { + userId: 'u-self', + guestName: null, + seat: 'aisle', + seatNumber: '3A', + seatClass: 'business', + flightReason: 'business', + }, + ], + }); + expect(put.body).not.toHaveProperty('track'); + // The owner is named on the flight already, so the profile is not read. + expect(calls.some((c) => c.url.pathname === '/api/v1/me')).toBe(false); + }); + + it('keeps the sync hash when a save changes no time, because AirTrail stores the time string as it gets it', async () => { + v1Instance(); + on('GET', '/api/v1/flights/41', () => json({ data: v1Flight(41) })); + on('PUT', '/api/v1/flights/41', () => json({ data: v1Flight(41) })); + const existing = present(await new AirtrailClient().getFlight(creds, 41)); + const reservation = { + id: 1, + external_id: '41', + reservation_time: '2026-10-04T22:00', + reservation_end_time: '2026-10-06T07:30', + endpoints: [ + { role: 'from', code: 'LAX' }, + { role: 'to', code: 'MEL' }, + ], + metadata: JSON.stringify({ seat: '4D', airline_code: 'QFA', flight_number: 'QF94' }), + }; + + await new AirtrailClient().saveFlight(creds, present(buildSavePayload(reservation, existing))); + + const body = present(calls.find((c) => c.method === 'PUT')).body as Record; + const times = ['departure', 'arrival', 'departureScheduled', 'arrivalScheduled']; + const stored = fromAirtrailV1Flight(v1Flight(41, Object.fromEntries(times.map((k) => [k, body[k]]))) as never); + expect(times.map((k) => body[k])).toEqual(times.map((k) => (existing as unknown as Record)[k])); + expect(canonicalHash(stored)).toBe(canonicalHash(existing)); + }); + + it('creates a flight for the key owner with POST and answers its id', async () => { + v1Instance(); + on('POST', '/api/v1/flights', () => json({ data: { id: 77 } }, 201)); + + const out = await new AirtrailClient().saveFlight(creds, { + from: 'KLAX', + to: 'MEL', + departure: '2026-10-04', + departureTime: '22:00', + seats: [], + passengers: [{ userId: '', guestName: null, seat: null, seatNumber: null, seatClass: null }], + }); + + expect(out).toEqual({ id: 77 }); + const post = present(calls.find((c) => c.method === 'POST')); + expect(post.body).toMatchObject({ fromId: 11, toId: 22, passengers: [{ userId: 'u-self' }] }); + }); + + it('refuses an airline code that only an IATA code matches, as the legacy save did', async () => { + v1Instance(); + + const err = await new AirtrailClient() + .saveFlight(creds, { + from: 'LAX', + to: 'MEL', + departure: '2026-10-04', + airline: 'QF', + seats: [], + passengers: [{ userId: 'u-self', guestName: null, seat: null, seatNumber: null, seatClass: null }], + }) + .catch((e: unknown) => e); + + expect(err).toBeInstanceOf(AirtrailRequestError); + expect((err as AirtrailRequestError).status).toBe(400); + expect((err as Error).message).toBe('Invalid airline: QF'); + expect(calls.some((c) => c.method === 'POST' || c.method === 'PUT')).toBe(false); + }); + + it('passes the v1 validation message through', async () => { + v1Instance(); + on('POST', '/api/v1/flights', () => + json( + { + error: { + code: 'validation_failed', + message: 'Request validation failed', + details: [{ path: ['flightNumber'] }], + }, + }, + 422, + ), + ); + + const err = await new AirtrailClient() + .saveFlight(creds, { + from: 'LAX', + to: 'MEL', + departure: '2026-10-04', + seats: [], + passengers: [{ userId: 'u-self', guestName: null, seat: null, seatNumber: null, seatClass: null }], + }) + .catch((e: unknown) => e); + + expect((err as AirtrailRequestError).status).toBe(422); + expect((err as Error).message).toContain('Request validation failed'); + expect((err as Error).message).toContain('flightNumber'); + }); +}); + +describe('toAirtrailV1FlightInput keeps the rules of the legacy save', () => { + const refs = { from: LAX, to: MEL, airlineId: null, aircraftId: null, selfUserId: 'u-self' }; + const base = { + from: 'LAX', + to: 'MEL', + departure: '2026-10-04', + seats: [], + passengers: [{ userId: 'u-self', guestName: null, seat: null, seatNumber: null, seatClass: null }], + }; + + it('gives no instant for a date without a time, and keeps the date', () => { + const body = toAirtrailV1FlightInput( + { ...base, departureTime: null, arrival: '2026-10-06', arrivalTime: null }, + refs, + ); + expect(body).toMatchObject({ date: '2026-10-04', departure: null, arrival: null, duration: null }); + }); + + it('puts an arrival time without an arrival date on the departure date', () => { + const body = toAirtrailV1FlightInput({ ...base, departureTime: '06:00', arrivalTime: '23:00' }, refs); + expect(body.arrival).toBe('2026-10-04T12:00:00.000+00:00'); + }); + + it('keeps only the departure for a flight known to the month, at 10:00 UTC', () => { + const body = toAirtrailV1FlightInput({ ...base, datePrecision: 'month', departureTime: '22:00' }, refs); + expect(body).toMatchObject({ datePrecision: 'month', departure: '2026-10-04T10:00:00.000+00:00', arrival: null }); + }); + + it('gives each passenger without a reason the flight-level reason', () => { + const body = toAirtrailV1FlightInput({ ...base, flightReason: 'leisure' }, refs); + expect(body.passengers).toEqual([expect.objectContaining({ flightReason: 'leisure' })]); + }); + + it('refuses a time the clock cannot show', () => { + expect(() => toAirtrailV1FlightInput({ ...base, departureTime: '25:00' }, refs)).toThrow('Invalid departure time'); + }); +}); + +describe('toAirtrailV1FlightInput converts the local wall clock to UTC', () => { + const SYD: AirtrailV1Airport = { ...MEL, id: 33, icao: 'YSSY', iata: 'SYD', timezone: 'Australia/Sydney' }; + const LHR: AirtrailV1Airport = { ...LAX, id: 44, icao: 'EGLL', iata: 'LHR', timezone: 'Europe/London' }; + const NOZONE: AirtrailV1Airport = { ...LAX, id: 55, timezone: null }; + const refs = (from: AirtrailV1Airport, to: AirtrailV1Airport) => ({ + from, + to, + airlineId: null, + aircraftId: null, + selfUserId: 'u-self', + }); + const flight = (fields: Partial & { departure: string }): AirtrailSavePayload => ({ + from: 'X', + to: 'Y', + seats: [], + passengers: [{ userId: 'u-self', guestName: null, seat: null, seatNumber: null, seatClass: null }], + ...fields, + }); + + it('moves a late-evening departure west of UTC onto the next UTC day, and keeps the local date', () => { + const body = toAirtrailV1FlightInput(flight({ departure: '2026-10-04', departureTime: '23:30' }), refs(LAX, MEL)); + expect(body).toMatchObject({ date: '2026-10-04', departure: '2026-10-05T06:30:00.000+00:00' }); + }); + + it('moves an early-morning departure east of UTC onto the previous UTC day, and keeps the local date', () => { + const body = toAirtrailV1FlightInput(flight({ departure: '2026-10-06', departureTime: '00:30' }), refs(MEL, LAX)); + expect(body).toMatchObject({ date: '2026-10-06', departure: '2026-10-05T13:30:00.000+00:00' }); + }); + + it('puts each end in the zone of its own airport, across the date line', () => { + // QF94: Oct 4 22:00 in Los Angeles (PDT, UTC-7), lands Oct 6 07:30 in Melbourne (AEDT, UTC+11). + const body = toAirtrailV1FlightInput( + flight({ departure: '2026-10-04', departureTime: '22:00', arrival: '2026-10-06', arrivalTime: '07:30' }), + refs(LAX, MEL), + ); + expect(body).toMatchObject({ + departure: '2026-10-05T05:00:00.000+00:00', + arrival: '2026-10-05T20:30:00.000+00:00', + duration: 15.5 * 3600, + }); + }); + + it('follows a daylight-saving change at the airport', () => { + // Sydney moves to UTC+11 on 2026-10-04. Los Angeles moves back to UTC-8 on 2026-11-01. + const before = toAirtrailV1FlightInput(flight({ departure: '2026-10-03', departureTime: '10:00' }), refs(SYD, LHR)); + const after = toAirtrailV1FlightInput(flight({ departure: '2026-10-05', departureTime: '10:00' }), refs(SYD, LHR)); + const pdt = toAirtrailV1FlightInput(flight({ departure: '2026-10-31', departureTime: '22:00' }), refs(LAX, LHR)); + const pst = toAirtrailV1FlightInput(flight({ departure: '2026-11-02', departureTime: '22:00' }), refs(LAX, LHR)); + expect(before.departure).toBe('2026-10-03T00:00:00.000+00:00'); + expect(after.departure).toBe('2026-10-04T23:00:00.000+00:00'); + expect(pdt.departure).toBe('2026-11-01T05:00:00.000+00:00'); + expect(pst.departure).toBe('2026-11-03T06:00:00.000+00:00'); + }); + + it('converts the scheduled times in the same zones as the actual times', () => { + const body = toAirtrailV1FlightInput( + flight({ + departure: '2026-10-04', + departureScheduled: '2026-10-04', + departureScheduledTime: '23:45', + arrivalScheduled: '2026-10-05', + arrivalScheduledTime: '06:10', + }), + refs(LAX, LHR), + ); + expect(body).toMatchObject({ + departureScheduled: '2026-10-05T06:45:00.000+00:00', + arrivalScheduled: '2026-10-05T05:10:00.000+00:00', + }); + }); + + it('reads the time as UTC at an airport with no zone', () => { + const body = toAirtrailV1FlightInput( + flight({ departure: '2026-10-04', departureTime: '23:30' }), + refs(NOZONE, MEL), + ); + expect(body.departure).toBe('2026-10-04T23:30:00.000+00:00'); + }); + + it('keeps the stored duration for an arrival before the departure', () => { + const body = toAirtrailV1FlightInput( + // `duration` is not a payload field; it passes through from the AirTrail flight. + { + ...flight({ departure: '2026-10-05', departureTime: '10:00', arrival: '2026-10-05', arrivalTime: '09:00' }), + duration: 600, + } as AirtrailSavePayload, + refs(LHR, LHR), + ); + expect(body.duration).toBe(600); + }); +}); diff --git a/server/tests/unit/nest/integrations/airtrailWriteGate.test.ts b/server/tests/unit/nest/integrations/airtrailWriteGate.test.ts index 304188d98..282864e10 100644 --- a/server/tests/unit/nest/integrations/airtrailWriteGate.test.ts +++ b/server/tests/unit/nest/integrations/airtrailWriteGate.test.ts @@ -4,7 +4,11 @@ import type { ReservationsRepository } from '../../../../src/db/repositories/Res import type { AddonsService } from '../../../../src/nest/addons/addons.service'; import { AirtrailLinkService } from '../../../../src/nest/integrations/airtrail-link.service'; import { AirtrailSyncService } from '../../../../src/nest/integrations/airtrail-sync.service'; -import { AirtrailAuthError } from '../../../../src/nest/integrations/airtrail.client'; +import { + AirtrailAuthError, + AirtrailRequestError, + AirtrailScopeError, +} from '../../../../src/nest/integrations/airtrail.client'; import type { AirtrailClient } from '../../../../src/nest/integrations/airtrail.client'; import type { AirtrailService } from '../../../../src/nest/integrations/airtrail.service'; import type { RealtimeService } from '../../../../src/nest/realtime/realtime.service'; @@ -184,6 +188,14 @@ describe('pushReservationToAirtrail write gate (#1240)', () => { expect(detachSpy).toHaveBeenCalledWith(5); }); + it('keeps the link when the key only lacks a scope, because the key still works', async () => { + isAirtrailWriteEnabled.mockReturnValue(true); + getFlight.mockRejectedValue(new AirtrailScopeError('flight.read.own')); + await svc.link.pushReservationToAirtrail(5, 9); + expect(saveFlight).not.toHaveBeenCalled(); + expect(detachSpy).not.toHaveBeenCalled(); + }); + it('detaches when the flight is gone from AirTrail — the same as a remote delete', async () => { isAirtrailWriteEnabled.mockReturnValue(true); getFlight.mockResolvedValue(null); @@ -234,6 +246,19 @@ describe('inbound sync multi-leg guard (#1535)', () => { expect(changed).toBe(1); }); + it.each([ + ['the page limit', new AirtrailRequestError('AirTrail has more than 5000 flights')], + ['a missing scope', new AirtrailScopeError('flight.read.own')], + ['a 5xx', new AirtrailRequestError('AirTrail list failed (HTTP 502)', 502)], + ])('detaches nothing when the list fails on %s', async (_, error) => { + withLinkedRow(2); + listFlights.mockRejectedValue(error); + const { changed } = await svc.sync.runAirtrailSyncForUser(7); + expect(updateReservation).not.toHaveBeenCalled(); + expect(detachSpy).not.toHaveBeenCalled(); + expect(changed).toBe(0); + }); + it('leaves a disconnected owner alone rather than detaching their rows', async () => { withLinkedRow(2); getAirtrailCredentials.mockReturnValue(null); diff --git a/shared/src/i18n/ar/help.ts b/shared/src/i18n/ar/help.ts index 0a34dea86..21d483f14 100644 --- a/shared/src/i18n/ar/help.ts +++ b/shared/src/i18n/ar/help.ts @@ -4333,7 +4333,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'تعرض البطاقة «مُفعّل على هذا الجهاز»، وتصلك الأحداث المفعّلة تحت «إشعارات فورية» حتى عندما يكون TREK مغلقًا.', 'help.guide.connect-airtrail.step.1': - 'تحت «التكاملات»، ابحث عن AirTrail وأدخل «رابط النسخة» و«مفتاح API». تنشئ المفتاح في AirTrail من «الإعدادات»، ثم «الأمان».', + 'تحت «التكاملات»، ابحث عن AirTrail وأدخل «رابط النسخة» و«مفتاح API». تنشئ المفتاح في AirTrail من «الإعدادات»، ثم «الأمان». إذا أنشأت المفتاح في AirTrail 3.13 أو أحدث، فإنه يحتاج إلى النطاق flight.read.own للقراءة. ولكتابة التغييرات إلى AirTrail يحتاج أيضًا إلى flight.update.own و flight.passengers.manage.own و reference_data.read و profile.read.', 'help.guide.connect-dawarich.step.1': 'تحت «التكاملات»، ابحث عن Dawarich وأدخل «عنوان الخادم» و«مفتاح API» الذي تجده في Dawarich تحت «الحساب»، ثم «مفتاح API».', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/ar/settings.ts b/shared/src/i18n/ar/settings.ts index 5c893de9a..7cb8a2418 100644 --- a/shared/src/i18n/ar/settings.ts +++ b/shared/src/i18n/ar/settings.ts @@ -412,7 +412,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'رابط النسخة', 'settings.airtrail.apiKey': 'مفتاح API', 'settings.airtrail.apiKeyPlaceholder': 'مفتاح API من نوع Bearer', - 'settings.airtrail.apiKeyHint': 'يُنشأ في AirTrail ضمن الإعدادات ← الأمان. يُخزَّن مشفّرًا.', + 'settings.airtrail.apiKeyHint': + 'يُنشأ في AirTrail ضمن الإعدادات ← الأمان. يُخزَّن مشفّرًا. إذا أنشأت المفتاح في AirTrail 3.13 أو أحدث، فإنه يحتاج إلى النطاق flight.read.own للقراءة. ولكتابة التغييرات إلى AirTrail يحتاج أيضًا إلى flight.update.own و flight.passengers.manage.own و reference_data.read و profile.read.', 'settings.airtrail.allowInsecureTls': 'السماح بالشهادات الموقّعة ذاتيًا', 'settings.airtrail.allowInsecureTlsHint': 'فعّل هذا فقط لنسخة موثوقة على شبكتك الخاصة.', 'settings.airtrail.writeBack': 'كتابة التغييرات إلى AirTrail', diff --git a/shared/src/i18n/az/help.ts b/shared/src/i18n/az/help.ts index 95c269b98..2b34f9a2c 100644 --- a/shared/src/i18n/az/help.ts +++ b/shared/src/i18n/az/help.ts @@ -4676,7 +4676,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Kartda «Bu cihaz üçün aktivdir» yazılır, Push altında yandırılmış hadisələr isə TREK bağlı olsa belə gəlir.', 'help.guide.connect-airtrail.step.1': - '«İnteqrasiyalar» altında AirTrail-i tapın və «İnstansiya URL-i» ilə API açarını daxil edin. Açarı AirTrail-də «Settings», «Security» bölməsində yaradırsınız.', + '«İnteqrasiyalar» altında AirTrail-i tapın və «İnstansiya URL-i» ilə API açarını daxil edin. Açarı AirTrail-də «Settings», «Security» bölməsində yaradırsınız. Açarı AirTrail 3.13 və ya daha yeni versiyada yaratsanız, oxumaq üçün ona flight.read.own icazəsi lazımdır. Dəyişiklikləri geri yazmaq üçün həmçinin flight.update.own, flight.passengers.manage.own, reference_data.read və profile.read lazımdır.', 'help.guide.connect-dawarich.step.1': '«İnteqrasiyalar» altında Dawarich-i tapın, «İnstansiya ünvanı»nı və Dawarich-də «Account», «API key» bölməsindəki API açarını daxil edin.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/az/settings.ts b/shared/src/i18n/az/settings.ts index feb2d9d59..a993bd2eb 100644 --- a/shared/src/i18n/az/settings.ts +++ b/shared/src/i18n/az/settings.ts @@ -470,7 +470,7 @@ const settings: TranslationStrings = { 'settings.airtrail.apiKey': 'API açarı', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API açarı', 'settings.airtrail.apiKeyHint': - 'AirTrail-də Tənzimləmələr → Təhlükəsizlik bölməsindən yaradılır. Şifrələnmiş şəkildə saxlanılır.', + 'AirTrail-də Tənzimləmələr → Təhlükəsizlik bölməsindən yaradılır. Şifrələnmiş şəkildə saxlanılır. Açarı AirTrail 3.13 və ya daha yeni versiyada yaratsanız, oxumaq üçün ona flight.read.own icazəsi lazımdır. Dəyişiklikləri geri yazmaq üçün həmçinin flight.update.own, flight.passengers.manage.own, reference_data.read və profile.read lazımdır.', 'settings.airtrail.allowInsecureTls': 'Öz-özünə imzalanmış sertifikatlara icazə ver', 'settings.airtrail.allowInsecureTlsHint': 'Yalnız öz şəbəkənizdəki etibarlı instansiya üçün aktivləşdirin.', 'settings.airtrail.writeBack': 'Dəyişiklikləri AirTrail-ə geri yaz', diff --git a/shared/src/i18n/br/help.ts b/shared/src/i18n/br/help.ts index 6839e7d38..d2f34f9cf 100644 --- a/shared/src/i18n/br/help.ts +++ b/shared/src/i18n/br/help.ts @@ -4656,7 +4656,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'O cartão mostra “Ativado neste dispositivo”, e os eventos ativados em Push chegam mesmo com o TREK fechado.', 'help.guide.connect-airtrail.step.1': - 'Em Integrações, procure o AirTrail e informe a “URL da instância” e uma chave de API. A chave é criada no AirTrail, em Settings, Security.', + 'Em Integrações, procure o AirTrail e informe a “URL da instância” e uma chave de API. A chave é criada no AirTrail, em Settings, Security. Se você criar a chave no AirTrail 3.13 ou posterior, ela precisa do escopo flight.read.own para leitura. Para gravar alterações de volta, também precisa de flight.update.own, flight.passengers.manage.own, reference_data.read e profile.read.', 'help.guide.connect-dawarich.step.1': 'Em Integrações, procure o Dawarich e informe o “Endereço da instância” e a chave de API, que fica no Dawarich em Account, API key.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/br/settings.ts b/shared/src/i18n/br/settings.ts index b12dca353..371980dc8 100644 --- a/shared/src/i18n/br/settings.ts +++ b/shared/src/i18n/br/settings.ts @@ -424,7 +424,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL da instância', 'settings.airtrail.apiKey': 'Chave de API', 'settings.airtrail.apiKeyPlaceholder': 'Chave de API Bearer', - 'settings.airtrail.apiKeyHint': 'Gerada no AirTrail em Configurações → Segurança. Armazenada de forma criptografada.', + 'settings.airtrail.apiKeyHint': + 'Gerada no AirTrail em Configurações → Segurança. Armazenada de forma criptografada. Se você criar a chave no AirTrail 3.13 ou posterior, ela precisa do escopo flight.read.own para leitura. Para gravar alterações de volta, também precisa de flight.update.own, flight.passengers.manage.own, reference_data.read e profile.read.', 'settings.airtrail.allowInsecureTls': 'Permitir certificados autoassinados', 'settings.airtrail.allowInsecureTlsHint': 'Ative apenas para uma instância confiável na sua própria rede.', 'settings.airtrail.writeBack': 'Gravar alterações de volta no AirTrail', diff --git a/shared/src/i18n/ca/help.ts b/shared/src/i18n/ca/help.ts index 8f05269f7..88ad2a669 100644 --- a/shared/src/i18n/ca/help.ts +++ b/shared/src/i18n/ca/help.ts @@ -4704,7 +4704,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': "La targeta mostra «Activat en aquest dispositiu», i els esdeveniments activats a Push t'arriben encara que TREK estigui tancat.", 'help.guide.connect-airtrail.step.1': - 'A «Integracions», busca AirTrail i introdueix la «URL de la instància» i una clau API. La clau es crea a AirTrail, a «Settings», «Security».', + "A «Integracions», busca AirTrail i introdueix la «URL de la instància» i una clau API. La clau es crea a AirTrail, a «Settings», «Security». Si crees la clau a AirTrail 3.13 o posterior, necessita l'abast flight.read.own per llegir. Per sincronitzar els canvis cap a AirTrail, també necessita flight.update.own, flight.passengers.manage.own, reference_data.read i profile.read.", 'help.guide.connect-dawarich.step.1': "A «Integracions», busca Dawarich i introdueix l'«Adreça de la instància» i la clau API que trobaràs a Dawarich, a «Account», «API key».", 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/ca/settings.ts b/shared/src/i18n/ca/settings.ts index dfa38d167..fc20874b4 100644 --- a/shared/src/i18n/ca/settings.ts +++ b/shared/src/i18n/ca/settings.ts @@ -401,7 +401,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL de la instància', 'settings.airtrail.apiKey': "Clau de l'API", 'settings.airtrail.apiKeyPlaceholder': "Clau d'API Bearer", - 'settings.airtrail.apiKeyHint': "Generada a AirTrail sota Ajustos → Seguretat. S'emmagatzema xifrada.", + 'settings.airtrail.apiKeyHint': + "Generada a AirTrail sota Ajustos → Seguretat. S'emmagatzema xifrada. Si crees la clau a AirTrail 3.13 o posterior, necessita l'abast flight.read.own per llegir. Per sincronitzar els canvis cap a AirTrail, també necessita flight.update.own, flight.passengers.manage.own, reference_data.read i profile.read.", 'settings.airtrail.allowInsecureTls': 'Permetre certificats autodirigits', 'settings.airtrail.allowInsecureTlsHint': 'Activa-ho només per a una instància de confiança a la teva pròpia xarxa.', 'settings.airtrail.writeBack': 'Sincronitzar els canvis cap a AirTrail', diff --git a/shared/src/i18n/cs/help.ts b/shared/src/i18n/cs/help.ts index db895c7a0..4caa69c4c 100644 --- a/shared/src/i18n/cs/help.ts +++ b/shared/src/i18n/cs/help.ts @@ -4568,7 +4568,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Karta ukazuje „Zapnuto pro toto zařízení“ a události zapnuté ve sloupci Push vám přijdou, i když je TREK zavřený.', 'help.guide.connect-airtrail.step.1': - 'V části „Integrace“ najděte AirTrail a zadejte jeho „URL instance“ a API klíč. Klíč vytvoříte v AirTrail v části Nastavení, Zabezpečení.', + 'V části „Integrace“ najděte AirTrail a zadejte jeho „URL instance“ a API klíč. Klíč vytvoříte v AirTrail v části Nastavení, Zabezpečení. Pokud klíč vytvoříte v AirTrail 3.13 nebo novějším, potřebuje oprávnění flight.read.own pro čtení. Pro zápis změn zpět potřebuje také flight.update.own, flight.passengers.manage.own, reference_data.read a profile.read.', 'help.guide.connect-dawarich.step.1': 'V části „Integrace“ najděte Dawarich a zadejte jeho „Adresa instance“ a API klíč, který najdete v Dawarich v části Účet, API klíč.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/cs/settings.ts b/shared/src/i18n/cs/settings.ts index 2d570e4d6..b4efe9506 100644 --- a/shared/src/i18n/cs/settings.ts +++ b/shared/src/i18n/cs/settings.ts @@ -417,7 +417,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL instance', 'settings.airtrail.apiKey': 'API klíč', 'settings.airtrail.apiKeyPlaceholder': 'API klíč Bearer', - 'settings.airtrail.apiKeyHint': 'Vygenerován v AirTrail v Nastavení → Zabezpečení. Uložen šifrovaně.', + 'settings.airtrail.apiKeyHint': + 'Vygenerován v AirTrail v Nastavení → Zabezpečení. Uložen šifrovaně. Pokud klíč vytvoříte v AirTrail 3.13 nebo novějším, potřebuje oprávnění flight.read.own pro čtení. Pro zápis změn zpět potřebuje také flight.update.own, flight.passengers.manage.own, reference_data.read a profile.read.', 'settings.airtrail.allowInsecureTls': 'Povolit certifikáty podepsané sebou samým', 'settings.airtrail.allowInsecureTlsHint': 'Povolte pouze pro důvěryhodnou instanci ve vlastní síti.', 'settings.airtrail.writeBack': 'Zapisovat změny zpět do AirTrail', diff --git a/shared/src/i18n/de/help.ts b/shared/src/i18n/de/help.ts index 8ecb35deb..4ed65f34f 100644 --- a/shared/src/i18n/de/help.ts +++ b/shared/src/i18n/de/help.ts @@ -4744,7 +4744,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Auf der Karte steht „Für dieses Gerät eingeschaltet“, und die Ereignisse, die du unter „Push“ eingeschaltet hast, kommen auch an, wenn TREK geschlossen ist.', 'help.guide.connect-airtrail.step.1': - 'Such unter „Integrationen“ AirTrail und gib die „Instanz-URL“ und einen API-Schlüssel ein. Den Schlüssel erstellst du in AirTrail unter „Einstellungen“, „Sicherheit“.', + 'Such unter „Integrationen“ AirTrail und gib die „Instanz-URL“ und einen API-Schlüssel ein. Den Schlüssel erstellst du in AirTrail unter „Einstellungen“, „Sicherheit“. Wenn du den Schlüssel in AirTrail 3.13 oder neuer erstellst, braucht er den Scope flight.read.own zum Lesen. Zum Zurückschreiben braucht er zusätzlich flight.update.own, flight.passengers.manage.own, reference_data.read und profile.read.', 'help.guide.connect-dawarich.step.1': 'Such unter „Integrationen“ Dawarich und gib die „Adresse der Instanz“ und den API-Schlüssel ein, den du in Dawarich unter „Konto“, „API-Schlüssel“ findest.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/de/settings.ts b/shared/src/i18n/de/settings.ts index 4d5a5fcdc..a488d7eb8 100644 --- a/shared/src/i18n/de/settings.ts +++ b/shared/src/i18n/de/settings.ts @@ -428,7 +428,7 @@ const settings: TranslationStrings = { 'settings.airtrail.apiKey': 'API-Schlüssel', 'settings.airtrail.apiKeyPlaceholder': 'Bearer-API-Schlüssel', 'settings.airtrail.apiKeyHint': - 'Wird in AirTrail unter Einstellungen → Sicherheit erstellt. Verschlüsselt gespeichert.', + 'Wird in AirTrail unter Einstellungen → Sicherheit erstellt. Verschlüsselt gespeichert. Wenn du den Schlüssel in AirTrail 3.13 oder neuer erstellst, braucht er den Scope flight.read.own zum Lesen. Zum Zurückschreiben braucht er zusätzlich flight.update.own, flight.passengers.manage.own, reference_data.read und profile.read.', 'settings.airtrail.allowInsecureTls': 'Selbstsignierte Zertifikate erlauben', 'settings.airtrail.allowInsecureTlsHint': 'Nur für eine vertrauenswürdige Instanz im eigenen Netzwerk aktivieren.', 'settings.airtrail.writeBack': 'Änderungen zurück nach AirTrail schreiben', diff --git a/shared/src/i18n/en/help.ts b/shared/src/i18n/en/help.ts index 8bddfa521..d98b3f440 100644 --- a/shared/src/i18n/en/help.ts +++ b/shared/src/i18n/en/help.ts @@ -1560,7 +1560,7 @@ const help: TranslationStrings = { 'help.guide.connect-airtrail.title': 'Connect your AirTrail', 'help.guide.connect-airtrail.goal': 'Let TREK import and sync the flights of your own AirTrail.', 'help.guide.connect-airtrail.step.1': - 'Under Integrations, find AirTrail and enter its Instance URL and an API key. You create the key in AirTrail under Settings, Security.', + 'Under Integrations, find AirTrail and enter its Instance URL and an API key. You create the key in AirTrail under Settings, Security. If you make the key in AirTrail 3.13 or later, the key must have the scope flight.read.own to read flights. To write changes back to AirTrail, the key must also have flight.update.own, flight.passengers.manage.own, reference_data.read and profile.read.', 'help.guide.connect-airtrail.step.2': 'Allow self-signed certificates is only for a trusted instance on your own network. Write changes back to AirTrail is off by default, so TREK only reads; switch it on to send your edits back.', 'help.guide.connect-airtrail.step.3': diff --git a/shared/src/i18n/en/settings.ts b/shared/src/i18n/en/settings.ts index 29517d852..d9f64e7b2 100644 --- a/shared/src/i18n/en/settings.ts +++ b/shared/src/i18n/en/settings.ts @@ -426,7 +426,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Instance URL', 'settings.airtrail.apiKey': 'API key', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API key', - 'settings.airtrail.apiKeyHint': 'Generated in AirTrail under Settings → Security. Stored encrypted.', + 'settings.airtrail.apiKeyHint': + 'Generated in AirTrail under Settings → Security. Stored encrypted. If you make the key in AirTrail 3.13 or later, the key must have the scope flight.read.own to read flights. To write changes back to AirTrail, the key must also have flight.update.own, flight.passengers.manage.own, reference_data.read and profile.read.', 'settings.airtrail.allowInsecureTls': 'Allow self-signed certificates', 'settings.airtrail.allowInsecureTlsHint': 'Enable only for a trusted instance on your own network.', 'settings.airtrail.writeBack': 'Write changes back to AirTrail', diff --git a/shared/src/i18n/es/help.ts b/shared/src/i18n/es/help.ts index 955eaf8f7..2c5ba62d0 100644 --- a/shared/src/i18n/es/help.ts +++ b/shared/src/i18n/es/help.ts @@ -4715,7 +4715,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'La tarjeta muestra «Activado en este dispositivo», y los eventos activados en Push te llegan aunque TREK esté cerrado.', 'help.guide.connect-airtrail.step.1': - 'En «Integraciones», busca AirTrail e introduce su «URL de la instancia» y una clave de API. La clave se crea en AirTrail, en «Ajustes», «Seguridad».', + 'En «Integraciones», busca AirTrail e introduce su «URL de la instancia» y una clave de API. La clave se crea en AirTrail, en «Ajustes», «Seguridad». Si creas la clave en AirTrail 3.13 o posterior, necesita el ámbito flight.read.own para leer. Para escribir cambios de vuelta, también necesita flight.update.own, flight.passengers.manage.own, reference_data.read y profile.read.', 'help.guide.connect-dawarich.step.1': 'En «Integraciones», busca Dawarich e introduce su «Dirección de la instancia» y la clave de API que encontrarás en Dawarich, en «Cuenta», «Clave de API».', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/es/settings.ts b/shared/src/i18n/es/settings.ts index 5a5d6abd4..a30558da1 100644 --- a/shared/src/i18n/es/settings.ts +++ b/shared/src/i18n/es/settings.ts @@ -426,7 +426,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL de la instancia', 'settings.airtrail.apiKey': 'Clave de API', 'settings.airtrail.apiKeyPlaceholder': 'Clave de API Bearer', - 'settings.airtrail.apiKeyHint': 'Generada en AirTrail en Ajustes → Seguridad. Se almacena cifrada.', + 'settings.airtrail.apiKeyHint': + 'Generada en AirTrail en Ajustes → Seguridad. Se almacena cifrada. Si creas la clave en AirTrail 3.13 o posterior, necesita el ámbito flight.read.own para leer. Para escribir cambios de vuelta, también necesita flight.update.own, flight.passengers.manage.own, reference_data.read y profile.read.', 'settings.airtrail.allowInsecureTls': 'Permitir certificados autofirmados', 'settings.airtrail.allowInsecureTlsHint': 'Actívalo solo para una instancia de confianza en tu propia red.', 'settings.airtrail.writeBack': 'Escribir cambios de vuelta en AirTrail', diff --git a/shared/src/i18n/et/help.ts b/shared/src/i18n/et/help.ts index f6e36bccd..05ffc602b 100644 --- a/shared/src/i18n/et/help.ts +++ b/shared/src/i18n/et/help.ts @@ -4577,7 +4577,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Kaardil on kirjas „Selles seadmes sisse lülitatud“ ja jaotises „Tõuketeavitus“ sisse lülitatud sündmused jõuavad sinuni ka siis, kui TREK on suletud.', 'help.guide.connect-airtrail.step.1': - 'Leia jaotisest „Integratsioonid“ AirTrail ja sisesta selle „Serveri URL“ ja API-võti. Võtme lood AirTrailis jaotises „Settings“, „Security“.', + 'Leia jaotisest „Integratsioonid“ AirTrail ja sisesta selle „Serveri URL“ ja API-võti. Võtme lood AirTrailis jaotises „Settings“, „Security“. Kui lood võtme AirTraili versioonis 3.13 või uuemas, vajab see lugemiseks õigust flight.read.own. Muudatuste tagasi kirjutamiseks vajab see ka õigusi flight.update.own, flight.passengers.manage.own, reference_data.read ja profile.read.', 'help.guide.connect-dawarich.step.1': 'Leia jaotisest „Integratsioonid“ Dawarich ja sisesta selle „Serveri aadress“ ning API-võti, mille leiad Dawarichis jaotisest „Account“, „API key“.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/et/settings.ts b/shared/src/i18n/et/settings.ts index dd0bef4d4..f9f78b9ed 100644 --- a/shared/src/i18n/et/settings.ts +++ b/shared/src/i18n/et/settings.ts @@ -430,7 +430,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Serveri URL', 'settings.airtrail.apiKey': 'API-võti', 'settings.airtrail.apiKeyPlaceholder': 'Bearer-tüüpi API-võti', - 'settings.airtrail.apiKeyHint': 'Loodud AirTraili jaotises Settings → Security. Salvestatakse krüptitult.', + 'settings.airtrail.apiKeyHint': + 'Loodud AirTraili jaotises Settings → Security. Salvestatakse krüptitult. Kui lood võtme AirTraili versioonis 3.13 või uuemas, vajab see lugemiseks õigust flight.read.own. Muudatuste tagasi kirjutamiseks vajab see ka õigusi flight.update.own, flight.passengers.manage.own, reference_data.read ja profile.read.', 'settings.airtrail.allowInsecureTls': 'Luba iseallkirjastatud sertifikaadid', 'settings.airtrail.allowInsecureTlsHint': 'Luba ainult usaldatud serverile oma võrgus.', 'settings.airtrail.writeBack': 'Kirjuta muudatused AirTraili tagasi', diff --git a/shared/src/i18n/fr/help.ts b/shared/src/i18n/fr/help.ts index 3b5c4cdad..620c2d44e 100644 --- a/shared/src/i18n/fr/help.ts +++ b/shared/src/i18n/fr/help.ts @@ -4775,7 +4775,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'La carte affiche « Activé sur cet appareil », et les événements activés dans la colonne Push vous parviennent même quand TREK est fermé.', 'help.guide.connect-airtrail.step.1': - "Sous « Intégrations », repérez AirTrail et saisissez son « URL de l'instance » et une clé API. Vous créez la clé dans AirTrail, sous Paramètres, Sécurité.", + "Sous « Intégrations », repérez AirTrail et saisissez son « URL de l'instance » et une clé API. Vous créez la clé dans AirTrail, sous Paramètres, Sécurité. Si vous créez la clé dans AirTrail 3.13 ou une version ultérieure, elle a besoin du scope flight.read.own pour la lecture. Pour réécrire les modifications, il lui faut aussi flight.update.own, flight.passengers.manage.own, reference_data.read et profile.read.", 'help.guide.connect-dawarich.step.1': 'Sous « Intégrations », repérez Dawarich et saisissez son « Adresse de l’instance » et la clé API que vous trouvez dans Dawarich sous Compte, Clé API.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/fr/settings.ts b/shared/src/i18n/fr/settings.ts index 9ffbe4227..2dcdce206 100644 --- a/shared/src/i18n/fr/settings.ts +++ b/shared/src/i18n/fr/settings.ts @@ -432,7 +432,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': "URL de l'instance", 'settings.airtrail.apiKey': 'Clé API', 'settings.airtrail.apiKeyPlaceholder': 'Clé API Bearer', - 'settings.airtrail.apiKeyHint': 'Générée dans AirTrail sous Paramètres → Sécurité. Stockée chiffrée.', + 'settings.airtrail.apiKeyHint': + 'Générée dans AirTrail sous Paramètres → Sécurité. Stockée chiffrée. Si vous créez la clé dans AirTrail 3.13 ou une version ultérieure, elle a besoin du scope flight.read.own pour la lecture. Pour réécrire les modifications, il lui faut aussi flight.update.own, flight.passengers.manage.own, reference_data.read et profile.read.', 'settings.airtrail.allowInsecureTls': 'Autoriser les certificats auto-signés', 'settings.airtrail.allowInsecureTlsHint': 'À activer uniquement pour une instance de confiance sur votre propre réseau.', diff --git a/shared/src/i18n/gr/help.ts b/shared/src/i18n/gr/help.ts index e9b3e284f..5de42b987 100644 --- a/shared/src/i18n/gr/help.ts +++ b/shared/src/i18n/gr/help.ts @@ -4765,7 +4765,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Η κάρτα γράφει «Ενεργό για αυτή τη συσκευή», και τα συμβάντα που ενεργοποιήσατε στη στήλη Push σάς έρχονται ακόμη κι όταν το TREK είναι κλειστό.', 'help.guide.connect-airtrail.step.1': - 'Στις «Ενσωματώσεις», βρείτε το AirTrail και συμπληρώστε το «URL της εγκατάστασης» και ένα κλειδί API. Το κλειδί το δημιουργείτε στο AirTrail, στις ρυθμίσεις ασφαλείας (Settings, Security).', + 'Στις «Ενσωματώσεις», βρείτε το AirTrail και συμπληρώστε το «URL της εγκατάστασης» και ένα κλειδί API. Το κλειδί το δημιουργείτε στο AirTrail, στις ρυθμίσεις ασφαλείας (Settings, Security). Αν δημιουργήσετε το κλειδί στο AirTrail 3.13 ή νεότερο, χρειάζεται το δικαίωμα flight.read.own για ανάγνωση. Για εγγραφή αλλαγών πίσω χρειάζεται επίσης flight.update.own, flight.passengers.manage.own, reference_data.read και profile.read.', 'help.guide.connect-dawarich.step.1': 'Στις «Ενσωματώσεις», βρείτε το Dawarich και συμπληρώστε τη «Διεύθυνση εγκατάστασης» και το κλειδί API που θα βρείτε στο Dawarich, στο Account, API key.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/gr/settings.ts b/shared/src/i18n/gr/settings.ts index 03c276111..253af1210 100644 --- a/shared/src/i18n/gr/settings.ts +++ b/shared/src/i18n/gr/settings.ts @@ -435,7 +435,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL της εγκατάστασης', 'settings.airtrail.apiKey': 'Κλειδί API', 'settings.airtrail.apiKeyPlaceholder': 'Κλειδί API τύπου Bearer', - 'settings.airtrail.apiKeyHint': 'Δημιουργείται στο AirTrail από Ρυθμίσεις → Ασφάλεια. Αποθηκεύεται κρυπτογραφημένο.', + 'settings.airtrail.apiKeyHint': + 'Δημιουργείται στο AirTrail από Ρυθμίσεις → Ασφάλεια. Αποθηκεύεται κρυπτογραφημένο. Αν δημιουργήσετε το κλειδί στο AirTrail 3.13 ή νεότερο, χρειάζεται το δικαίωμα flight.read.own για ανάγνωση. Για εγγραφή αλλαγών πίσω χρειάζεται επίσης flight.update.own, flight.passengers.manage.own, reference_data.read και profile.read.', 'settings.airtrail.allowInsecureTls': 'Να επιτρέπονται αυτο-υπογεγραμμένα πιστοποιητικά', 'settings.airtrail.allowInsecureTlsHint': 'Ενεργοποιήστε το μόνο για μια αξιόπιστη εγκατάσταση στο δικό σας δίκτυο.', 'settings.airtrail.writeBack': 'Εγγραφή αλλαγών πίσω στο AirTrail', diff --git a/shared/src/i18n/he/help.ts b/shared/src/i18n/he/help.ts index 68e08144b..7f6dfedea 100644 --- a/shared/src/i18n/he/help.ts +++ b/shared/src/i18n/he/help.ts @@ -1456,7 +1456,7 @@ const help: TranslationStrings = { 'help.guide.connect-airtrail.title': 'חיבור ל-AirTrail שלכם', 'help.guide.connect-airtrail.goal': 'אפשרו ל-TREK לייבא ולסנכרן את הטיסות ממופע ה-AirTrail שלכם.', 'help.guide.connect-airtrail.step.1': - 'תחת שילובים, מצאו את AirTrail והזינו את כתובת המופע ומפתח API. את המפתח יוצרים ב-AirTrail תחת הגדרות, אבטחה.', + 'תחת שילובים, מצאו את AirTrail והזינו את כתובת המופע ומפתח API. את המפתח יוצרים ב-AirTrail תחת הגדרות, אבטחה. אם יוצרים את המפתח ב-AirTrail 3.13 ואילך, הוא צריך את ההרשאה flight.read.own כדי לקרוא. כדי לכתוב שינויים בחזרה, הוא צריך גם את flight.update.own, flight.passengers.manage.own, reference_data.read ו-profile.read.', 'help.guide.connect-airtrail.step.2': 'אפשור תעודות בחתימה עצמית מיועד רק למופע מהימן ברשת שלכם. כתיבת שינויים בחזרה ל-AirTrail כבויה כברירת מחדל, כך ש-TREK רק קורא נתונים; הפעילו אותה כדי לשלוח בחזרה את העריכות שלכם.', 'help.guide.connect-airtrail.step.3': 'לחצו על שמירה ואז על בדיקת חיבור. יוצג מספר הטיסות שנמצאו, והתג ישתנה למחובר.', diff --git a/shared/src/i18n/he/settings.ts b/shared/src/i18n/he/settings.ts index 81dfe75a6..640b14de9 100644 --- a/shared/src/i18n/he/settings.ts +++ b/shared/src/i18n/he/settings.ts @@ -415,7 +415,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'כתובת המופע', 'settings.airtrail.apiKey': 'מפתח API', 'settings.airtrail.apiKeyPlaceholder': 'מפתח API מסוג Bearer', - 'settings.airtrail.apiKeyHint': 'נוצר ב-AirTrail תחת Settings ← Security. נשמר מוצפן.', + 'settings.airtrail.apiKeyHint': + 'נוצר ב-AirTrail תחת Settings ← Security. נשמר מוצפן. אם יוצרים את המפתח ב-AirTrail 3.13 ואילך, הוא צריך את ההרשאה flight.read.own כדי לקרוא. כדי לכתוב שינויים בחזרה, הוא צריך גם את flight.update.own, flight.passengers.manage.own, reference_data.read ו-profile.read.', 'settings.airtrail.allowInsecureTls': 'אפשור תעודות בחתימה עצמית', 'settings.airtrail.allowInsecureTlsHint': 'הפעילו רק עבור מופע מהימן ברשת שלכם.', 'settings.airtrail.writeBack': 'כתיבת שינויים בחזרה ל-AirTrail', diff --git a/shared/src/i18n/hu/help.ts b/shared/src/i18n/hu/help.ts index 70dcc5816..ac9bce5dc 100644 --- a/shared/src/i18n/hu/help.ts +++ b/shared/src/i18n/hu/help.ts @@ -4725,7 +4725,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'A kártyán a „Bekapcsolva ezen az eszközön” felirat látszik, és a „Push” alatt bekapcsolt eseményekről akkor is kapsz értesítést, ha a TREK be van zárva.', 'help.guide.connect-airtrail.step.1': - 'Az „Integráció” részben keresd meg az AirTrailt, és add meg a „Példány URL-címe” mezőt és egy API-kulcsot. A kulcsot az AirTrailben hozhatod létre a Settings, Security menüpontban.', + 'Az „Integráció” részben keresd meg az AirTrailt, és add meg a „Példány URL-címe” mezőt és egy API-kulcsot. A kulcsot az AirTrailben hozhatod létre a Settings, Security menüpontban. Ha a kulcsot az AirTrail 3.13-as vagy újabb verziójában hozod létre, olvasáshoz a(z) flight.read.own jogosultság kell. A módosítások visszaírásához ezek is kellenek: flight.update.own, flight.passengers.manage.own, reference_data.read és profile.read.', 'help.guide.connect-dawarich.step.1': 'Az „Integráció” részben keresd meg a Dawarichot, és add meg „A példány címe” mezőt, valamint az API-kulcsot, amelyet a Dawarichban az Account, API key menüpontban találsz.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/hu/settings.ts b/shared/src/i18n/hu/settings.ts index c0c0d3323..dbb080837 100644 --- a/shared/src/i18n/hu/settings.ts +++ b/shared/src/i18n/hu/settings.ts @@ -425,7 +425,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Példány URL-címe', 'settings.airtrail.apiKey': 'API-kulcs', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API-kulcs', - 'settings.airtrail.apiKeyHint': 'Az AirTrailben a Beállítások → Biztonság menüpontban generálva. Titkosítva tárolva.', + 'settings.airtrail.apiKeyHint': + 'Az AirTrailben a Beállítások → Biztonság menüpontban generálva. Titkosítva tárolva. Ha a kulcsot az AirTrail 3.13-as vagy újabb verziójában hozod létre, olvasáshoz a(z) flight.read.own jogosultság kell. A módosítások visszaírásához ezek is kellenek: flight.update.own, flight.passengers.manage.own, reference_data.read és profile.read.', 'settings.airtrail.allowInsecureTls': 'Önaláírt tanúsítványok engedélyezése', 'settings.airtrail.allowInsecureTlsHint': 'Csak megbízható, saját hálózaton futó példány esetén engedélyezd.', 'settings.airtrail.writeBack': 'Módosítások visszaírása az AirTrailbe', diff --git a/shared/src/i18n/id/help.ts b/shared/src/i18n/id/help.ts index 06f2a2b95..627871e7e 100644 --- a/shared/src/i18n/id/help.ts +++ b/shared/src/i18n/id/help.ts @@ -4674,7 +4674,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Kartu menampilkan “Aktif untuk perangkat ini”, dan peristiwa yang diaktifkan di kolom Push tetap sampai meskipun TREK sedang ditutup.', 'help.guide.connect-airtrail.step.1': - 'Di bawah “Integrasi”, cari AirTrail, lalu isi “URL Instans” dan kunci API-nya. Kunci itu kamu buat di AirTrail, di Settings, Security.', + 'Di bawah “Integrasi”, cari AirTrail, lalu isi “URL Instans” dan kunci API-nya. Kunci itu kamu buat di AirTrail, di Settings, Security. Jika kamu membuat kunci di AirTrail 3.13 atau yang lebih baru, kunci memerlukan cakupan flight.read.own untuk membaca. Untuk menulis perubahan kembali, kunci juga memerlukan flight.update.own, flight.passengers.manage.own, reference_data.read, dan profile.read.', 'help.guide.connect-dawarich.step.1': 'Di bawah “Integrasi”, cari Dawarich, lalu isi “Alamat instans” dan kunci API dari Dawarich, yang ada di Account, API key.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/id/settings.ts b/shared/src/i18n/id/settings.ts index 6992f14aa..b56804514 100644 --- a/shared/src/i18n/id/settings.ts +++ b/shared/src/i18n/id/settings.ts @@ -421,7 +421,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL Instans', 'settings.airtrail.apiKey': 'Kunci API', 'settings.airtrail.apiKeyPlaceholder': 'Kunci API Bearer', - 'settings.airtrail.apiKeyHint': 'Dibuat di AirTrail pada Pengaturan → Keamanan. Disimpan terenkripsi.', + 'settings.airtrail.apiKeyHint': + 'Dibuat di AirTrail pada Pengaturan → Keamanan. Disimpan terenkripsi. Jika kamu membuat kunci di AirTrail 3.13 atau yang lebih baru, kunci memerlukan cakupan flight.read.own untuk membaca. Untuk menulis perubahan kembali, kunci juga memerlukan flight.update.own, flight.passengers.manage.own, reference_data.read, dan profile.read.', 'settings.airtrail.allowInsecureTls': 'Izinkan sertifikat yang ditandatangani sendiri', 'settings.airtrail.allowInsecureTlsHint': 'Aktifkan hanya untuk instans tepercaya di jaringanmu sendiri.', 'settings.airtrail.writeBack': 'Tulis perubahan kembali ke AirTrail', diff --git a/shared/src/i18n/it/help.ts b/shared/src/i18n/it/help.ts index 6a897fdaf..9fa7eb184 100644 --- a/shared/src/i18n/it/help.ts +++ b/shared/src/i18n/it/help.ts @@ -4703,7 +4703,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'La scheda mostra «Attivo su questo dispositivo», e gli eventi attivati sotto Push ti arrivano anche quando TREK è chiuso.', 'help.guide.connect-airtrail.step.1': - 'In «Integrazioni», cerca AirTrail e inserisci «URL istanza» e una «Chiave API». La chiave si crea in AirTrail, in Settings, Security.', + 'In «Integrazioni», cerca AirTrail e inserisci «URL istanza» e una «Chiave API». La chiave si crea in AirTrail, in Settings, Security. Se crei la chiave in AirTrail 3.13 o versioni successive, richiede lo scope flight.read.own per la lettura. Per scrivere le modifiche su AirTrail richiede anche flight.update.own, flight.passengers.manage.own, reference_data.read e profile.read.', 'help.guide.connect-dawarich.step.1': 'In «Integrazioni», cerca Dawarich e inserisci «Indirizzo dell’istanza» e la chiave API che trovi in Dawarich, in Account, API key.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/it/settings.ts b/shared/src/i18n/it/settings.ts index 76846f29d..e870ed9db 100644 --- a/shared/src/i18n/it/settings.ts +++ b/shared/src/i18n/it/settings.ts @@ -423,7 +423,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL istanza', 'settings.airtrail.apiKey': 'Chiave API', 'settings.airtrail.apiKeyPlaceholder': 'Chiave API Bearer', - 'settings.airtrail.apiKeyHint': 'Generata in AirTrail in Impostazioni → Sicurezza. Memorizzata crittografata.', + 'settings.airtrail.apiKeyHint': + 'Generata in AirTrail in Impostazioni → Sicurezza. Memorizzata crittografata. Se crei la chiave in AirTrail 3.13 o versioni successive, richiede lo scope flight.read.own per la lettura. Per scrivere le modifiche su AirTrail richiede anche flight.update.own, flight.passengers.manage.own, reference_data.read e profile.read.', 'settings.airtrail.allowInsecureTls': 'Consenti certificati autofirmati', 'settings.airtrail.allowInsecureTlsHint': "Abilita solo per un'istanza attendibile sulla tua rete.", 'settings.airtrail.writeBack': 'Scrivi le modifiche su AirTrail', diff --git a/shared/src/i18n/ja/help.ts b/shared/src/i18n/ja/help.ts index 1b1bb0130..3c4b70e15 100644 --- a/shared/src/i18n/ja/help.ts +++ b/shared/src/i18n/ja/help.ts @@ -4500,7 +4500,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'カードに「このデバイスでオン」と表示され、「プッシュ」でオンにしたイベントがTREKを閉じていても届きます。', 'help.guide.connect-airtrail.step.1': - '「連携」でAirTrailを探し、「インスタンス URL」とAPIキーを入力します。キーはAirTrailの「設定」の「セキュリティ」で作成します。', + '「連携」でAirTrailを探し、「インスタンス URL」とAPIキーを入力します。キーはAirTrailの「設定」の「セキュリティ」で作成します。AirTrail 3.13 以降でキーを作成する場合、読み取りにはスコープ flight.read.own が必要です。変更を書き戻すには、flight.update.own、flight.passengers.manage.own、reference_data.read、profile.read も必要です。', 'help.guide.connect-dawarich.step.1': '「連携」でDawarichを探し、「インスタンスのアドレス」と、Dawarichの「アカウント」の「APIキー」にあるAPIキーを入力します。', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/ja/settings.ts b/shared/src/i18n/ja/settings.ts index 0e96d138a..98caf3c9a 100644 --- a/shared/src/i18n/ja/settings.ts +++ b/shared/src/i18n/ja/settings.ts @@ -397,7 +397,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'インスタンス URL', 'settings.airtrail.apiKey': 'API キー', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API キー', - 'settings.airtrail.apiKeyHint': 'AirTrail の「設定 → セキュリティ」で生成します。暗号化して保存されます。', + 'settings.airtrail.apiKeyHint': + 'AirTrail の「設定 → セキュリティ」で生成します。暗号化して保存されます。AirTrail 3.13 以降でキーを作成する場合、読み取りにはスコープ flight.read.own が必要です。変更を書き戻すには、flight.update.own、flight.passengers.manage.own、reference_data.read、profile.read も必要です。', 'settings.airtrail.allowInsecureTls': '自己署名証明書を許可する', 'settings.airtrail.allowInsecureTlsHint': '自分のネットワーク内の信頼できるインスタンスの場合にのみ有効にしてください。', diff --git a/shared/src/i18n/ko/help.ts b/shared/src/i18n/ko/help.ts index 82d3c6a7c..19e0b5ed6 100644 --- a/shared/src/i18n/ko/help.ts +++ b/shared/src/i18n/ko/help.ts @@ -4295,7 +4295,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': '카드에 ‘이 기기에서 켜짐’이 보이고, ‘푸시’에서 켠 이벤트는 TREK를 닫아 둬도 알림이 와요.', 'help.guide.connect-airtrail.step.1': - '‘통합’에서 AirTrail을 찾아 ‘인스턴스 URL’과 API 키를 입력하세요. 키는 AirTrail의 ‘Settings’, ‘Security’에서 만들어요.', + '‘통합’에서 AirTrail을 찾아 ‘인스턴스 URL’과 API 키를 입력하세요. 키는 AirTrail의 ‘Settings’, ‘Security’에서 만들어요. AirTrail 3.13 이상에서 키를 만드는 경우, 읽기에는 flight.read.own 범위가 필요합니다. 변경 사항을 다시 기록하려면 flight.update.own, flight.passengers.manage.own, reference_data.read, profile.read 범위도 필요합니다.', 'help.guide.connect-dawarich.step.1': '‘통합’에서 Dawarich를 찾아 ‘인스턴스 주소’와 API 키를 입력하세요. API 키는 Dawarich의 ‘Account’, ‘API key’에 있어요.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/ko/settings.ts b/shared/src/i18n/ko/settings.ts index 85f3b9283..a75fe0fdc 100644 --- a/shared/src/i18n/ko/settings.ts +++ b/shared/src/i18n/ko/settings.ts @@ -412,7 +412,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': '인스턴스 URL', 'settings.airtrail.apiKey': 'API 키', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API 키', - 'settings.airtrail.apiKeyHint': 'AirTrail의 설정 → 보안에서 생성됩니다. 암호화하여 저장됩니다.', + 'settings.airtrail.apiKeyHint': + 'AirTrail의 설정 → 보안에서 생성됩니다. 암호화하여 저장됩니다. AirTrail 3.13 이상에서 키를 만드는 경우, 읽기에는 flight.read.own 범위가 필요합니다. 변경 사항을 다시 기록하려면 flight.update.own, flight.passengers.manage.own, reference_data.read, profile.read 범위도 필요합니다.', 'settings.airtrail.allowInsecureTls': '자체 서명 인증서 허용', 'settings.airtrail.allowInsecureTlsHint': '자체 네트워크의 신뢰할 수 있는 인스턴스에서만 활성화하세요.', 'settings.airtrail.writeBack': '변경 사항을 AirTrail에 다시 기록', diff --git a/shared/src/i18n/nl/help.ts b/shared/src/i18n/nl/help.ts index ddadc3823..e65594710 100644 --- a/shared/src/i18n/nl/help.ts +++ b/shared/src/i18n/nl/help.ts @@ -4699,7 +4699,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'De kaart toont ‘Ingeschakeld op dit apparaat’, en de gebeurtenissen die onder Push aanstaan, komen binnen, ook als TREK gesloten is.', 'help.guide.connect-airtrail.step.1': - 'Zoek onder Integraties AirTrail en vul de ‘Instantie-URL’ en een API-sleutel in. De sleutel maak je in AirTrail aan onder Instellingen, Beveiliging.', + 'Zoek onder Integraties AirTrail en vul de ‘Instantie-URL’ en een API-sleutel in. De sleutel maak je in AirTrail aan onder Instellingen, Beveiliging. Als je de sleutel in AirTrail 3.13 of nieuwer aanmaakt, heeft hij de scope flight.read.own nodig om te lezen. Om wijzigingen terug te schrijven, heeft hij ook flight.update.own, flight.passengers.manage.own, reference_data.read en profile.read nodig.', 'help.guide.connect-dawarich.step.1': 'Zoek onder Integraties Dawarich en vul het ‘Adres van de instantie’ in, plus de API-sleutel die je in Dawarich vindt onder Account, API-sleutel.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/nl/settings.ts b/shared/src/i18n/nl/settings.ts index c603d817a..d3fa3b066 100644 --- a/shared/src/i18n/nl/settings.ts +++ b/shared/src/i18n/nl/settings.ts @@ -425,7 +425,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Instantie-URL', 'settings.airtrail.apiKey': 'API-sleutel', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API-sleutel', - 'settings.airtrail.apiKeyHint': 'Aangemaakt in AirTrail onder Instellingen → Beveiliging. Versleuteld opgeslagen.', + 'settings.airtrail.apiKeyHint': + 'Aangemaakt in AirTrail onder Instellingen → Beveiliging. Versleuteld opgeslagen. Als je de sleutel in AirTrail 3.13 of nieuwer aanmaakt, heeft hij de scope flight.read.own nodig om te lezen. Om wijzigingen terug te schrijven, heeft hij ook flight.update.own, flight.passengers.manage.own, reference_data.read en profile.read nodig.', 'settings.airtrail.allowInsecureTls': 'Zelfondertekende certificaten toestaan', 'settings.airtrail.allowInsecureTlsHint': 'Schakel dit alleen in voor een vertrouwde instantie op je eigen netwerk.', 'settings.airtrail.writeBack': 'Wijzigingen terugschrijven naar AirTrail', diff --git a/shared/src/i18n/pl/help.ts b/shared/src/i18n/pl/help.ts index bfcd70348..2116f3b9f 100644 --- a/shared/src/i18n/pl/help.ts +++ b/shared/src/i18n/pl/help.ts @@ -4638,7 +4638,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Karta pokazuje „Włączone na tym urządzeniu”, a zdarzenia włączone w kolumnie „Push” docierają do ciebie nawet wtedy, gdy TREK jest zamknięty.', 'help.guide.connect-airtrail.step.1': - 'W „Integracjach” znajdź AirTrail i wpisz „Adres URL instancji” oraz klucz API. Klucz utworzysz w AirTrail w „Settings”, „Security”.', + 'W „Integracjach” znajdź AirTrail i wpisz „Adres URL instancji” oraz klucz API. Klucz utworzysz w AirTrail w „Settings”, „Security”. Jeśli tworzysz klucz w AirTrail 3.13 lub nowszym, do odczytu potrzebuje on zakresu flight.read.own. Do zapisywania zmian z powrotem potrzebuje też flight.update.own, flight.passengers.manage.own, reference_data.read i profile.read.', 'help.guide.connect-dawarich.step.1': 'W „Integracjach” znajdź Dawarich i wpisz „Adres instancji” oraz klucz API z Dawarich (w „Account”, „API key”).', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/pl/settings.ts b/shared/src/i18n/pl/settings.ts index 9476e1dfc..072443e69 100644 --- a/shared/src/i18n/pl/settings.ts +++ b/shared/src/i18n/pl/settings.ts @@ -425,7 +425,7 @@ const settings: TranslationStrings = { 'settings.airtrail.apiKey': 'Klucz API', 'settings.airtrail.apiKeyPlaceholder': 'Klucz API typu Bearer', 'settings.airtrail.apiKeyHint': - 'Wygenerowany w AirTrail w sekcji Ustawienia → Bezpieczeństwo. Przechowywany w postaci zaszyfrowanej.', + 'Wygenerowany w AirTrail w sekcji Ustawienia → Bezpieczeństwo. Przechowywany w postaci zaszyfrowanej. Jeśli tworzysz klucz w AirTrail 3.13 lub nowszym, do odczytu potrzebuje on zakresu flight.read.own. Do zapisywania zmian z powrotem potrzebuje też flight.update.own, flight.passengers.manage.own, reference_data.read i profile.read.', 'settings.airtrail.allowInsecureTls': 'Zezwalaj na certyfikaty samopodpisane', 'settings.airtrail.allowInsecureTlsHint': 'Włącz tylko dla zaufanej instancji we własnej sieci.', 'settings.airtrail.writeBack': 'Zapisuj zmiany z powrotem w AirTrail', diff --git a/shared/src/i18n/ru/help.ts b/shared/src/i18n/ru/help.ts index d4974a552..53f8375eb 100644 --- a/shared/src/i18n/ru/help.ts +++ b/shared/src/i18n/ru/help.ts @@ -4630,7 +4630,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'В карточке написано «Включено на этом устройстве», и события, включённые в столбце Push, приходят, даже когда TREK закрыт.', 'help.guide.connect-airtrail.step.1': - 'В разделе «Интеграции» найдите AirTrail и введите «URL экземпляра» и «Ключ API». Ключ создаётся в AirTrail в разделе «Настройки», «Безопасность».', + 'В разделе «Интеграции» найдите AirTrail и введите «URL экземпляра» и «Ключ API». Ключ создаётся в AirTrail в разделе «Настройки», «Безопасность». Если вы создаёте ключ в AirTrail 3.13 или новее, для чтения ему нужна область flight.read.own. Для записи изменений обратно также нужны flight.update.own, flight.passengers.manage.own, reference_data.read и profile.read.', 'help.guide.connect-dawarich.step.1': 'В разделе «Интеграции» найдите Dawarich и введите «Адрес экземпляра» и ключ API, который можно найти в Dawarich в разделе «Аккаунт», «Ключ API».', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/ru/settings.ts b/shared/src/i18n/ru/settings.ts index 6fe0cffde..48289d3e5 100644 --- a/shared/src/i18n/ru/settings.ts +++ b/shared/src/i18n/ru/settings.ts @@ -427,7 +427,7 @@ const settings: TranslationStrings = { 'settings.airtrail.apiKey': 'Ключ API', 'settings.airtrail.apiKeyPlaceholder': 'Bearer-ключ API', 'settings.airtrail.apiKeyHint': - 'Создаётся в AirTrail в разделе «Настройки → Безопасность». Хранится в зашифрованном виде.', + 'Создаётся в AirTrail в разделе «Настройки → Безопасность». Хранится в зашифрованном виде. Если вы создаёте ключ в AirTrail 3.13 или новее, для чтения ему нужна область flight.read.own. Для записи изменений обратно также нужны flight.update.own, flight.passengers.manage.own, reference_data.read и profile.read.', 'settings.airtrail.allowInsecureTls': 'Разрешить самоподписанные сертификаты', 'settings.airtrail.allowInsecureTlsHint': 'Включайте только для доверенного экземпляра в вашей собственной сети.', 'settings.airtrail.writeBack': 'Записывать изменения обратно в AirTrail', diff --git a/shared/src/i18n/sk/help.ts b/shared/src/i18n/sk/help.ts index fe24ac573..d3982f530 100644 --- a/shared/src/i18n/sk/help.ts +++ b/shared/src/i18n/sk/help.ts @@ -4591,7 +4591,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Karta ukazuje Zapnuté pre toto zariadenie a udalosti zapnuté pod Push vám prídu, aj keď je TREK zatvorený.', 'help.guide.connect-airtrail.step.1': - 'V časti Integrácie nájdite AirTrail a zadajte jeho URL inštancie a API kľúč. Kľúč vytvoríte v AirTrail v časti Nastavenia, Zabezpečenie.', + 'V časti Integrácie nájdite AirTrail a zadajte jeho URL inštancie a API kľúč. Kľúč vytvoríte v AirTrail v časti Nastavenia, Zabezpečenie. Ak kľúč vytvoríte v AirTrail 3.13 alebo novšom, potrebuje oprávnenie flight.read.own na čítanie. Na zápis zmien späť potrebuje aj flight.update.own, flight.passengers.manage.own, reference_data.read a profile.read.', 'help.guide.connect-dawarich.step.1': 'V časti Integrácie nájdite Dawarich a zadajte jeho Adresu inštancie a API kľúč z Dawarich z časti Účet, API kľúč.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/sk/settings.ts b/shared/src/i18n/sk/settings.ts index 5d96296c5..4d7c72baa 100644 --- a/shared/src/i18n/sk/settings.ts +++ b/shared/src/i18n/sk/settings.ts @@ -430,7 +430,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL inštancie', 'settings.airtrail.apiKey': 'API kľúč', 'settings.airtrail.apiKeyPlaceholder': 'API kľúč Bearer', - 'settings.airtrail.apiKeyHint': 'Vygenerovaný v AirTrail v Nastavenia → Zabezpečenie. Uložený šifrovane.', + 'settings.airtrail.apiKeyHint': + 'Vygenerovaný v AirTrail v Nastavenia → Zabezpečenie. Uložený šifrovane. Ak kľúč vytvoríte v AirTrail 3.13 alebo novšom, potrebuje oprávnenie flight.read.own na čítanie. Na zápis zmien späť potrebuje aj flight.update.own, flight.passengers.manage.own, reference_data.read a profile.read.', 'settings.airtrail.allowInsecureTls': 'Povoliť certifikáty podpísané sebou samým', 'settings.airtrail.allowInsecureTlsHint': 'Povoľte iba pre dôveryhodnú inštanciu vo vlastnej sieti.', 'settings.airtrail.writeBack': 'Zapisovať zmeny späť do AirTrail', diff --git a/shared/src/i18n/sv/help.ts b/shared/src/i18n/sv/help.ts index ea54f3caf..693e67e31 100644 --- a/shared/src/i18n/sv/help.ts +++ b/shared/src/i18n/sv/help.ts @@ -4605,7 +4605,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Kortet visar På för den här enheten, och händelserna du har slagit på under Push kommer fram även när TREK är stängt.', 'help.guide.connect-airtrail.step.1': - 'Hitta AirTrail under Integrationer och ange dess Instans URL och en API-nyckel. Nyckeln skapar du i AirTrail under Inställningar, Säkerhet.', + 'Hitta AirTrail under Integrationer och ange dess Instans URL och en API-nyckel. Nyckeln skapar du i AirTrail under Inställningar, Säkerhet. Om du skapar nyckeln i AirTrail 3.13 eller senare behöver den behörigheten flight.read.own för att läsa. För att skriva tillbaka ändringar behöver den även flight.update.own, flight.passengers.manage.own, reference_data.read och profile.read.', 'help.guide.connect-dawarich.step.1': 'Hitta Dawarich under Integrationer och ange dess Instansens adress och API-nyckeln från Dawarich under Konto, API-nyckel.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/sv/settings.ts b/shared/src/i18n/sv/settings.ts index 8830af23f..61cef9daf 100644 --- a/shared/src/i18n/sv/settings.ts +++ b/shared/src/i18n/sv/settings.ts @@ -423,7 +423,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Instans URL', 'settings.airtrail.apiKey': 'API nyckel', 'settings.airtrail.apiKeyPlaceholder': 'API-nyckel för innehavare', - 'settings.airtrail.apiKeyHint': 'Skapad i AirTrail under Inställningar → Säkerhet. Lagras i krypterad form.', + 'settings.airtrail.apiKeyHint': + 'Skapad i AirTrail under Inställningar → Säkerhet. Lagras i krypterad form. Om du skapar nyckeln i AirTrail 3.13 eller senare behöver den behörigheten flight.read.own för att läsa. För att skriva tillbaka ändringar behöver den även flight.update.own, flight.passengers.manage.own, reference_data.read och profile.read.', 'settings.airtrail.allowInsecureTls': 'Tillåt självsignerade certifikat', 'settings.airtrail.allowInsecureTlsHint': 'Aktivera endast för en betrodd instans i ditt eget nätverk.', 'settings.airtrail.writeBack': 'Skriv tillbaka ändringarna till AirTrail', diff --git a/shared/src/i18n/th/help.ts b/shared/src/i18n/th/help.ts index 1d76b339e..38f8aa407 100644 --- a/shared/src/i18n/th/help.ts +++ b/shared/src/i18n/th/help.ts @@ -3975,7 +3975,7 @@ const help: TranslationStrings = { 'help.guide.dashboard-widgets.step.3': '“รีเซ็ตเป็นค่าเริ่มต้น” ใต้การ์ดจะคืนแท็บ “ลักษณะที่ปรากฏ” ทั้งหมดเป็นค่าเดิม', 'help.guide.web-push-device.result': 'การ์ดจะแสดง “เปิดอยู่สำหรับอุปกรณ์นี้” และเหตุการณ์ที่เปิดไว้ใต้ “พุช” จะส่งมาถึงแม้ปิด TREK อยู่', 'help.guide.connect-airtrail.step.1': - 'ใต้ “การเชื่อมต่อ” หา AirTrail แล้วกรอก “URL ของอินสแตนซ์” และคีย์ API คุณสร้างคีย์ได้ใน AirTrail ที่ “การตั้งค่า” แล้วไปที่ความปลอดภัย', + 'ใต้ “การเชื่อมต่อ” หา AirTrail แล้วกรอก “URL ของอินสแตนซ์” และคีย์ API คุณสร้างคีย์ได้ใน AirTrail ที่ “การตั้งค่า” แล้วไปที่ความปลอดภัย หากคุณสร้างคีย์ใน AirTrail 3.13 ขึ้นไป คีย์ต้องมีขอบเขต flight.read.own เพื่ออ่าน หากต้องการเขียนการเปลี่ยนแปลงกลับ คีย์ต้องมี flight.update.own, flight.passengers.manage.own, reference_data.read และ profile.read ด้วย', 'help.guide.connect-dawarich.step.1': 'ใต้ “การเชื่อมต่อ” หา Dawarich แล้วกรอก “ที่อยู่ของอินสแตนซ์” และคีย์ API จาก Dawarich ที่ “บัญชี” แล้วไปที่ “คีย์ API”', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/th/settings.ts b/shared/src/i18n/th/settings.ts index 13d163f3b..8bce59a3e 100644 --- a/shared/src/i18n/th/settings.ts +++ b/shared/src/i18n/th/settings.ts @@ -395,7 +395,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'URL ของอินสแตนซ์', 'settings.airtrail.apiKey': 'คีย์เอพีไอ', 'settings.airtrail.apiKeyPlaceholder': 'คีย์ API ของผู้ถือ', - 'settings.airtrail.apiKeyHint': 'สร้างใน AirTrail ภายใต้การตั้งค่า → ความปลอดภัย จัดเก็บแบบเข้ารหัส', + 'settings.airtrail.apiKeyHint': + 'สร้างใน AirTrail ภายใต้การตั้งค่า → ความปลอดภัย จัดเก็บแบบเข้ารหัส หากคุณสร้างคีย์ใน AirTrail 3.13 ขึ้นไป คีย์ต้องมีขอบเขต flight.read.own เพื่ออ่าน หากต้องการเขียนการเปลี่ยนแปลงกลับ คีย์ต้องมี flight.update.own, flight.passengers.manage.own, reference_data.read และ profile.read ด้วย', 'settings.airtrail.allowInsecureTls': 'อนุญาตใบรับรองที่ลงนามด้วยตนเอง', 'settings.airtrail.allowInsecureTlsHint': 'เปิดใช้งานสำหรับอินสแตนซ์ที่เชื่อถือได้บนเครือข่ายของคุณเองเท่านั้น', 'settings.airtrail.writeBack': 'เขียนการเปลี่ยนแปลงกลับไปที่ AirTrail', diff --git a/shared/src/i18n/tr/help.ts b/shared/src/i18n/tr/help.ts index 2e609a502..7002a3564 100644 --- a/shared/src/i18n/tr/help.ts +++ b/shared/src/i18n/tr/help.ts @@ -4627,7 +4627,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Kartta Bu cihaz için açık yazar. Anlık bildirim altında açtığınız olaylar TREK kapalıyken bile size ulaşır.', 'help.guide.connect-airtrail.step.1': - "Entegrasyonlar altında AirTrail'i bulun ve Örnek URL'sini ile bir API anahtarını girin. Anahtarı AirTrail'de Ayarlar, Güvenlik bölümünden oluşturursunuz.", + "Entegrasyonlar altında AirTrail'i bulun ve Örnek URL'sini ile bir API anahtarını girin. Anahtarı AirTrail'de Ayarlar, Güvenlik bölümünden oluşturursunuz. Anahtarı AirTrail 3.13 veya sonraki bir sürümde oluşturursanız, okumak için flight.read.own kapsamı gerekir. Değişiklikleri geri yazmak için ayrıca flight.update.own, flight.passengers.manage.own, reference_data.read ve profile.read gerekir.", 'help.guide.connect-dawarich.step.1': "Entegrasyonlar altında Dawarich'i bulun ve Sunucu adresi ile Dawarich'te Hesap, API anahtarı bölümündeki API anahtarını girin.", 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/tr/settings.ts b/shared/src/i18n/tr/settings.ts index 91464688e..d06c49b67 100644 --- a/shared/src/i18n/tr/settings.ts +++ b/shared/src/i18n/tr/settings.ts @@ -422,7 +422,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': "Örnek URL'si", 'settings.airtrail.apiKey': 'API anahtarı', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API anahtarı', - 'settings.airtrail.apiKeyHint': "AirTrail'de Ayarlar → Güvenlik altında oluşturulur. Şifreli olarak saklanır.", + 'settings.airtrail.apiKeyHint': + "AirTrail'de Ayarlar → Güvenlik altında oluşturulur. Şifreli olarak saklanır. Anahtarı AirTrail 3.13 veya sonraki bir sürümde oluşturursanız, okumak için flight.read.own kapsamı gerekir. Değişiklikleri geri yazmak için ayrıca flight.update.own, flight.passengers.manage.own, reference_data.read ve profile.read gerekir.", 'settings.airtrail.allowInsecureTls': 'Kendinden imzalı sertifikalara izin ver', 'settings.airtrail.allowInsecureTlsHint': 'Yalnızca kendi ağınızdaki güvenilir bir örnek için etkinleştirin.', 'settings.airtrail.writeBack': 'Değişiklikleri AirTrail’e geri yaz', diff --git a/shared/src/i18n/uk/help.ts b/shared/src/i18n/uk/help.ts index e2eb07277..17a87885d 100644 --- a/shared/src/i18n/uk/help.ts +++ b/shared/src/i18n/uk/help.ts @@ -4642,7 +4642,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Картка показує «Увімкнено на цьому пристрої», а події, увімкнені в Push, надходять, навіть коли TREK закрито.', 'help.guide.connect-airtrail.step.1': - 'У «Інтеграції» знайдіть AirTrail і введіть його «URL екземпляра» та ключ API. Ключ створюється в AirTrail: «Налаштування», «Безпека».', + 'У «Інтеграції» знайдіть AirTrail і введіть його «URL екземпляра» та ключ API. Ключ створюється в AirTrail: «Налаштування», «Безпека». Якщо ви створюєте ключ в AirTrail 3.13 або новішому, для читання йому потрібна область flight.read.own. Для запису змін назад також потрібні flight.update.own, flight.passengers.manage.own, reference_data.read і profile.read.', 'help.guide.connect-dawarich.step.1': 'У «Інтеграції» знайдіть Dawarich і введіть його «Адреса сервера» та ключ API з Dawarich: «Обліковий запис», «Ключ API».', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/uk/settings.ts b/shared/src/i18n/uk/settings.ts index 626f3bfb0..554500d4b 100644 --- a/shared/src/i18n/uk/settings.ts +++ b/shared/src/i18n/uk/settings.ts @@ -427,7 +427,7 @@ const settings: TranslationStrings = { 'settings.airtrail.apiKey': 'API-ключ', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API-ключ', 'settings.airtrail.apiKeyHint': - 'Згенеровано в AirTrail у розділі Налаштування → Безпека. Зберігається в зашифрованому вигляді.', + 'Згенеровано в AirTrail у розділі Налаштування → Безпека. Зберігається в зашифрованому вигляді. Якщо ви створюєте ключ в AirTrail 3.13 або новішому, для читання йому потрібна область flight.read.own. Для запису змін назад також потрібні flight.update.own, flight.passengers.manage.own, reference_data.read і profile.read.', 'settings.airtrail.allowInsecureTls': 'Дозволити самопідписані сертифікати', 'settings.airtrail.allowInsecureTlsHint': 'Вмикайте лише для довіреного екземпляра у вашій власній мережі.', 'settings.airtrail.writeBack': 'Записувати зміни назад у AirTrail', diff --git a/shared/src/i18n/vi/help.ts b/shared/src/i18n/vi/help.ts index 4b521be5a..5e2698634 100644 --- a/shared/src/i18n/vi/help.ts +++ b/shared/src/i18n/vi/help.ts @@ -4592,7 +4592,7 @@ const help: TranslationStrings = { 'help.guide.web-push-device.result': 'Thẻ hiện “Đã bật cho thiết bị này”, và các sự kiện bật trong “Thông báo đẩy” sẽ đến ngay cả khi TREK đã đóng.', 'help.guide.connect-airtrail.step.1': - 'Trong “Tích hợp”, tìm AirTrail và nhập “Ví dụ URL” cùng một khóa API. Bạn tạo khóa trong AirTrail ở “Cài đặt”, “Bảo mật”.', + 'Trong “Tích hợp”, tìm AirTrail và nhập “Ví dụ URL” cùng một khóa API. Bạn tạo khóa trong AirTrail ở “Cài đặt”, “Bảo mật”. Nếu bạn tạo khóa trong AirTrail 3.13 trở lên, khóa cần phạm vi flight.read.own để đọc. Để ghi các thay đổi trở lại, khóa cũng cần flight.update.own, flight.passengers.manage.own, reference_data.read và profile.read.', 'help.guide.connect-dawarich.step.1': 'Trong “Tích hợp”, tìm Dawarich và nhập “Địa chỉ phiên bản” cùng khóa API từ Dawarich ở “Tài khoản”, “Khóa API”.', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/vi/settings.ts b/shared/src/i18n/vi/settings.ts index b4c3b5355..baf98f59e 100644 --- a/shared/src/i18n/vi/settings.ts +++ b/shared/src/i18n/vi/settings.ts @@ -425,7 +425,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': 'Ví dụ URL', 'settings.airtrail.apiKey': 'API Key', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API Key', - 'settings.airtrail.apiKeyHint': 'Được tạo trong AirTrail trong Cài đặt → Bảo mật. Được lưu trữ được mã hóa.', + 'settings.airtrail.apiKeyHint': + 'Được tạo trong AirTrail trong Cài đặt → Bảo mật. Được lưu trữ được mã hóa. Nếu bạn tạo khóa trong AirTrail 3.13 trở lên, khóa cần phạm vi flight.read.own để đọc. Để ghi các thay đổi trở lại, khóa cũng cần flight.update.own, flight.passengers.manage.own, reference_data.read và profile.read.', 'settings.airtrail.allowInsecureTls': 'Cho phép chứng chỉ tự ký', 'settings.airtrail.allowInsecureTlsHint': 'Chỉ kích hoạt cho một phiên bản đáng tin cậy trên mạng của riêng bạn.', 'settings.airtrail.writeBack': 'Viết các thay đổi trở lại AirTrail', diff --git a/shared/src/i18n/zh-TW/help.ts b/shared/src/i18n/zh-TW/help.ts index 085a831e9..5ceb01e29 100644 --- a/shared/src/i18n/zh-TW/help.ts +++ b/shared/src/i18n/zh-TW/help.ts @@ -4025,7 +4025,7 @@ const help: TranslationStrings = { 'help.guide.dashboard-widgets.step.3': '卡片下方的「恢復預設」會讓整個「外觀」分頁恢復為出廠狀態。', 'help.guide.web-push-device.result': '卡片會顯示「已為此裝置開啟」,在「推播」下開啟的事件即使 TREK 已關閉也會送達。', 'help.guide.connect-airtrail.step.1': - '在「整合」下找到 AirTrail,輸入它的「執行個體網址」和 API 金鑰。金鑰需要在 AirTrail 的「設定」、「安全性」中建立。', + '在「整合」下找到 AirTrail,輸入它的「執行個體網址」和 API 金鑰。金鑰需要在 AirTrail 的「設定」、「安全性」中建立。若在 AirTrail 3.13 或更新版本中建立金鑰,讀取需要範圍 flight.read.own。若要將變更寫回,還需要 flight.update.own、flight.passengers.manage.own、reference_data.read 和 profile.read。', 'help.guide.connect-dawarich.step.1': '在「整合」下找到 Dawarich,輸入它的「執行個體位址」,以及 Dawarich 中「帳戶」、「API 金鑰」裡的 API 金鑰。', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/zh-TW/settings.ts b/shared/src/i18n/zh-TW/settings.ts index 08fbe99de..7b6f34217 100644 --- a/shared/src/i18n/zh-TW/settings.ts +++ b/shared/src/i18n/zh-TW/settings.ts @@ -395,7 +395,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': '執行個體網址', 'settings.airtrail.apiKey': 'API 金鑰', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API 金鑰', - 'settings.airtrail.apiKeyHint': '在 AirTrail 的「設定 → 安全性」中產生。以加密方式儲存。', + 'settings.airtrail.apiKeyHint': + '在 AirTrail 的「設定 → 安全性」中產生。以加密方式儲存。若在 AirTrail 3.13 或更新版本中建立金鑰,讀取需要範圍 flight.read.own。若要將變更寫回,還需要 flight.update.own、flight.passengers.manage.own、reference_data.read 和 profile.read。', 'settings.airtrail.allowInsecureTls': '允許自簽憑證', 'settings.airtrail.allowInsecureTlsHint': '僅在你自己網路上受信任的執行個體啟用。', 'settings.airtrail.writeBack': '將變更寫回 AirTrail', diff --git a/shared/src/i18n/zh/help.ts b/shared/src/i18n/zh/help.ts index ff13db960..bc97ba33e 100644 --- a/shared/src/i18n/zh/help.ts +++ b/shared/src/i18n/zh/help.ts @@ -3988,7 +3988,7 @@ const help: TranslationStrings = { 'help.guide.dashboard-widgets.step.3': '卡片下方的“恢复默认”会把整个“外观”标签页恢复为初始设置。', 'help.guide.web-push-device.result': '卡片显示“已为此设备开启”,在“推送”下开启的事件,即使 TREK 没有打开也会送达。', 'help.guide.connect-airtrail.step.1': - '在“集成”下找到 AirTrail,输入它的“实例 URL”和一个 API 密钥。密钥在 AirTrail 的“设置”、“安全”中创建。', + '在“集成”下找到 AirTrail,输入它的“实例 URL”和一个 API 密钥。密钥在 AirTrail 的“设置”、“安全”中创建。若在 AirTrail 3.13 或更高版本中创建密钥,读取需要范围 flight.read.own。若要将更改写回,还需要 flight.update.own、flight.passengers.manage.own、reference_data.read 和 profile.read。', 'help.guide.connect-dawarich.step.1': '在“集成”下找到 Dawarich,输入它的“实例地址”,以及在 Dawarich 的“账户”、“API 密钥”中获取的 API 密钥。', 'help.guide.tour-connect-wanderer.step.1': diff --git a/shared/src/i18n/zh/settings.ts b/shared/src/i18n/zh/settings.ts index 31fbeaf18..7d409b131 100644 --- a/shared/src/i18n/zh/settings.ts +++ b/shared/src/i18n/zh/settings.ts @@ -393,7 +393,8 @@ const settings: TranslationStrings = { 'settings.airtrail.url': '实例 URL', 'settings.airtrail.apiKey': 'API 密钥', 'settings.airtrail.apiKeyPlaceholder': 'Bearer API 密钥', - 'settings.airtrail.apiKeyHint': '在 AirTrail 的“设置 → 安全”中生成。加密存储。', + 'settings.airtrail.apiKeyHint': + '在 AirTrail 的“设置 → 安全”中生成。加密存储。若在 AirTrail 3.13 或更高版本中创建密钥,读取需要范围 flight.read.own。若要将更改写回,还需要 flight.update.own、flight.passengers.manage.own、reference_data.read 和 profile.read。', 'settings.airtrail.allowInsecureTls': '允许自签名证书', 'settings.airtrail.allowInsecureTlsHint': '仅对您自己网络中受信任的实例启用。', 'settings.airtrail.writeBack': '将更改写回 AirTrail',