mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
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.
This commit is contained in:
@@ -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':
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user