Commit Graph

2363 Commits

Author SHA1 Message Date
dependabot[bot] 1ca7d262a7 chore(deps): bump express and @types/express
Bumps [express](https://github.com/expressjs/express) and [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express). These dependencies needed to be updated together.

Updates `express` from 4.22.3 to 5.3.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v4.22.3...v5.3.0)

Updates `@types/express` from 4.17.25 to 5.0.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/express"
  dependency-version: 5.0.6
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-25 13:01:43 +00:00
Maurice 903868c08c feat(release): show the iOS and Android apps in the 5.2.1 notice, the account settings and the user menu
The release notice moves to 5.2.1 and gets a tile across the release column
with the App Store and Google Play cards, each with a QR code that opens the
store page. The headliner, intro, footnote and note texts are shorter so the
tile fits, in every locale.

Settings > Account shows the same store cards in its right column, except
inside the native app itself. The user menu footer adds round links to
Patreon, Ko-fi and Buy Me a Coffee beside Discord, left out on managed
installs and in the native apps like every donation link.
2026-11-25 13:32:18 +01:00
Maurice d9d901e52d fix(ci): lower the client non-null baseline and arm the wait before PMEDIA-006 advances
Client lint was red because the day plan change took 13 non-null assertions
out of DayPlanSidebar: the count is 354 now, so the baseline goes down to it.

Server tests 6/10 timed out in PMEDIA-006. The test advanced the fake clock
right after asking for the rendition, but the wait it meant to run out is only
armed once the copy has started; on a slow runner the clock moved past a timer
that did not exist yet and the test hung for 15 seconds. It now waits for the
copy to start first, as PMEDIA-006b already does.
2026-11-25 10:37:46 +01:00
Maurice 50cb9364f6 fix(atlas): count the cities the address parser used to miss
The Atlas reads a place's city from its address text, and several common
address shapes lost it:

- The TREK index writes "street, postcode, locality" with no country, and the
  parser always dropped the last part as the country, so a place picked from
  TREK's own search counted no city.
- A city that is its own region (Berlin, Wien, Malé) was skipped as the region
  even where it stands beside its postcode, which is how such an address names
  its city.
- An atoll or a state written with its generic word ("Kaafu Atoll" for the
  region Kaafu) was not recognised as the region and counted as the city of
  every island in it.
- Country names came from a short English and German list, so "Maldives",
  "Österreich" or "Italia" could be counted as a city.

The locality of a postcode-and-locality tail now counts, a region-named part
with a postcode counts when no part before it names a city, a region matches
with its generic word, and countries are recognised by their name in every
language TREK speaks. A region named without a postcode (a mountain in
"Bayern", a resort in "Kaafu") still counts no city, and the lines the parser
already read right read the same.

Closes #3200
2026-11-25 10:29:09 +01:00
Maurice b6c50eb146 fix(wallet): date a booking's pass by its stay or linked day when it has no time of its own
The Wallet pass took its date only from the booking's own time or, for a
journey, its departure stop. A hotel whose check-in and check-out live on its
stay, and a booking linked to a day that carries only a clock, have neither,
so Wallet answered "Give the booking a date first" for a booking the app
shows with its dates. A TestFlight tester hit it with a hotel booked from
8 to 11 January.

The pass context now reads the dates of the days a booking is linked to and,
for a hotel, the first and last day of its stay with its check-in and
check-out times. The pass falls back to them in the order the app uses
(bookingDates): the booking's own time first, then the stay or the linked
day, with the booking's or the stay's clock. A booking with no date anywhere
is still refused.
2026-11-25 10:25:10 +01:00
Maurice 70af8132ef fix(booking-import): let the model choose when a document names several booking types
The keyword table that picks the extraction schema took the first pattern
that matched, with transport tested first since #2076. A hotel confirmation
that mentioned the airport bus, the train station or the cruise port was
therefore extracted with the bus, train or ferry schema. Those schemas have
no hotel name, address or check-in and check-out, so the model returned a
transport booking without the stay's data and the import dropped it.

The keywords now only decide alone when a document names one type. When it
names several, the model gets the union schema narrowed to exactly those
types, with each type's field meanings, and picks. The flight gate is
unchanged: flight numbers still take the flight path only when no other
transport is named. Event words decide only when nothing else is named,
since "ticket" is printed on every transport ticket, and the lodging
pattern also knows motel, accommodation, apartment, guest house, Unterkunft
and Ferienwohnung.
2026-11-25 10:09:24 +01:00
Maurice c65e9bf76e fix(auth): move passkeys to SimpleWebAuthn 14, which no longer fetches a CRL a client names
@simplewebauthn/server 13.3.3 fetched the CRL address in an android-key
attestation certificate before it checked the chain or the signature, with
no timeout or size cap, so anyone signed in could make the server request
any URL by registering a passkey. 14.1.0 only checks revocation for a chain
it validated against Google's pinned roots.

14.x refuses an expected origin with a path, a trailing slash or an
uppercase host and an RP ID that is not lower case, where 13.x only failed
to match them. The configured origins are now reduced to the origin the
browser reports and the RP ID is lower-cased, so such settings keep
working; an origins list in which nothing parses leaves passkeys
unconfigured instead of falling back to APP_URL. Verification gets the
algorithm list the options offer, and stored transports are read as plain
strings.

Stored credentials keep their format. typescript-eslint moves to 8.73.0.
2026-11-25 00:10:14 +01:00
Maurice 3754518d37 fix(ai): say why ChatGPT refused a sign-in, and start a fresh one after any refusal
Every refusal of the code by OpenAI's token endpoint came back as "The
sign-in took too long", and the endpoint's own error was dropped without a
log line. Only invalid_grant means the code ran out or was used already; any
other refusal (invalid_client, a redirect or resource mismatch) now names
its OAuth error in the answer and in a warning with the endpoint's
description, so an admin can see what went wrong.

The server takes a sign-in once whatever it answers, but the panel only
started a fresh one after "expired", so the next try after any other
refusal used a spent sign-in. It now starts a fresh one after every refusal
the server sent; offline and a wrong address keep the one in progress, as
neither reached it.

The address the sign-in window ends on is also taken without http://, the
way the hint under the field and the address bar show it.

Closes #3196
2026-11-24 23:59:33 +01:00
Maurice f928f4b1ca fix(postgres): connect over a Unix socket
TREK_DB_URL could not name a Unix socket. MikroORM builds the pool from the
URL's own host and drops a host parameter, so
postgresql://trek@localhost/trek?host=/var/run/postgresql connected to
localhost over TCP. A percent-encoded socket path as the host reached the
pool, but the client tools got it undecoded in PGHOST, so backups, restores
and the safety copy before a migration failed.

The server address is now read once, the way libpq reads a connection URL:
a host or port parameter takes the place of the URL's own, and a host
written into the URL is percent-decoded. The pool and the client tools both
get that address. The wiki and .env.example show the socket form.
2026-11-24 23:15:34 +01:00
Maurice aa79d6286a fix(paddle): read the Geofabrik region list again
The admin's paddle region picker failed with "The list of regions cannot be
fetched right now". Geofabrik's index now writes a continent's parent as
null instead of leaving the key out, and the schema took only a string or
nothing, so the whole list was refused over nine entries.

The optional fields now take null as well, and the entries are read one by
one: an entry in a shape TREK does not know costs only that region and is
counted in a warning. A list of which nothing can be read is still refused.

Closes #3195
2026-11-24 22:32:17 +01:00
Maurice eeff0398a7 fix(mail-import): retry a busy AI provider and never drop a booking mail in silence
A forwarded booking mail whose AI read failed in passing (a 503 "high
demand", a rate limit, a timeout) was settled at once with an inbox entry
nobody read again, and a manual import printed "no reservations found"
under the AI error as if the file held none.

Both LLM clients now send a failed request again up to twice, honouring
Retry-After within the request timeout. The mail pipeline puts such a mail
back in the queue and keeps the inbox entry only after its last try, and
these attempts no longer count toward the daily AI limit.

The mail prompt now names the answer's shape, { "bookings": [...] }, for
providers that get no tool. An answer in another shape used to read as
"not a booking" and the mail was discarded without a trace; it now ends
as a failed read the person sees in the inbox.

The import warnings lose their dashes, and the image sets LANG=C.UTF-8 so
KItinerary stops warning about the C locale on every run.
2026-11-24 13:30:22 +01:00
Maurice 7fe4fbb683 fix(plugins): mark a plugin that waits for re-consent as failed at boot
A plugin whose files now declare permissions it was never granted is
refused before its process starts, so the supervisor's status hook never
ran and the row kept the 'active' it had from the last run. The plugin
list and the navigation kept offering it while its page answered
"Plugin not available". The boot now stores the refusal as the plugin's
error, so Admin > Plugins says why and the navigation drops it.
2026-11-24 13:20:36 +01:00
github-actions[bot] 8809654a43 chore: bump version to 5.2.0 [skip ci] 2026-11-23 21:40:14 +00:00
Maurice f1d8995d66 chore(deps): hold typescript-eslint at 8.72, lower the knip baseline
typescript-eslint 8.74 reports more no-unused-vars and lifts the client
warning count past its baseline; it gets its own round. knip 6.48 finds
two fewer unused exports and types, so their entries go down with it.
2026-11-23 21:57:06 +01:00
Maurice 34e28d082d chore(deps): bump the npm minor and patch group, MikroORM held
Takes Dependabot's group update except MikroORM, which stays on 7.2.8:
7.2.9 broke the Postgres probe on OauthTokens.insertToken and
OauthConsents.upsertGrant, and 7.2.11 gets its own round. The rollup
musl pins stay with the rollup version the lockfile resolves. The
Playwright container moves to v1.65.1-noble with its digest, as the
lockfile now pins @playwright/test 1.65.1.
2026-11-23 21:19:18 +01:00
Maurice bcdcd69a64 feat(notices): 5.2.0 release modal and Patreon for monthly support
The release modal now shows 5.2.0: booking mails that land in the trip,
live flight status and the new trip PDF, each with its own drawn card,
and links the 5.2.0 release notes. The maintainer note and the support
block are rewritten, shorter and without the sponsor wording.

Patreon joins Buy Me a Coffee and Ko-fi as the monthly way to support
TREK: a full-width button in the release and thank-you notices (a new
optional tertiaryCta on the notice contract), a tile in About and in the
admin GitHub panel on desktop and phone, the README badges and
FUNDING.yml. Like the other donation links it stays hidden inside the
native apps.
2026-11-23 21:15:54 +01:00
Maurice d18a4b2180 fix(flight-live): keep a late inbound aircraft holding near the origin from reading as departed
After the scheduled time an aircraft near the origin that neither climbs nor descends is taken for the leg only when it was on the ground at the origin before or flies away from it.
2026-11-23 20:02:10 +01:00
Maurice 4519430610 fix(plugins): bind the single-array args form on Postgres as on SQLite
A plugin that passed its values as one array had the whole array bound to $1 on Postgres. The array is now spread when it fills the statement's placeholders, unless a placeholder takes an array itself.
2026-11-23 19:59:41 +01:00
Maurice b3845dbdfc fix(memories): wait for a public media copy just under the proxy timeout
No public page retries a 503 by itself, so a first view of a large video that took over 10 s showed a dead player. The request now waits up to 50 s before answering come back later.
2026-11-23 19:57:47 +01:00
Maurice 4498f68cc9 fix(mcp): end live sessions again when documents is switched off
The doc-sync tools still gate on documents through instanceAddonGate, which the parity scan did not see, so documents is back on the list and the scan now reads that gate too.
2026-11-23 19:56:08 +01:00
Maurice 7065e18454 fix(memories): answer 503 while a large public copy is still being made
A request now waits at most ten seconds for the location-free copy and is otherwise told to come back with Retry-After while the copy goes on being made, so a long video no longer holds the first request past a reverse proxy's timeout. Nothing but the copy is ever sent.
2026-11-23 17:33:00 +01:00
Maurice c4326ec545 fix(backup): refuse a Postgres dump from a newer server major before restoring it
The restore reads the server version the dump was taken from in its table of contents and refuses, naming both majors, before anything is cleared, from the admin restore (400) and from RESTORE_FROM_BACKUP alike.
2026-11-23 17:33:00 +01:00
Maurice b03597957c fix(db): let the primary key index serve MikroORM find orders on Postgres
A find ordered by its entity's own primary key now renders the NULL position the btree holds, so ORDER BY id DESC LIMIT n reads the index instead of sorting every matching row. A key is never NULL, so the rows come back in the same order.
2026-11-23 17:33:00 +01:00
Maurice 97da0c5ba6 fix(plugins): send file events for attached files while Documents is off
A file that belongs to a booking, place, expense, note or message stays readable with Documents off, so its events now reach subscribed plugins too; loose files still wait for Documents, and a trip's events keep their order.
2026-11-23 17:30:23 +01:00
Maurice e1147504c2 fix(files): refuse a plugin upload that attaches nothing while Documents is off
files.list hides loose files on such a trip, so files.create now needs a reservation_id or place_id there instead of writing a file the plugin cannot list back.
2026-11-23 17:20:52 +01:00
Maurice b2ba89fe4f fix(immich): keep a public video's location check across its range requests
The verdict is held for five minutes per owner and asset, so a seek no longer asks Immich twice before it streams, and an Immich that times out or fails answers 502 instead of 404. A located video Immich did not transcode still never plays.
2026-11-23 17:18:25 +01:00
Maurice eb32eb1690 fix(flight-live): take a departure near the origin without a vertical rate
After the scheduled time an airborne aircraft within 60 km of the origin is the leg unless it is clearly descending, so a level climb-out or a feed without rates still records departed_at and the delay.
2026-11-23 17:15:56 +01:00
Maurice 5588b7efbb fix(dawarich): read unnamed stays again in turns across runs
Each run now goes on after the last unnamed stay it read, so stays beyond the first twenty get their reread even when the first ones never resolve.
2026-11-23 17:13:57 +01:00
Maurice 20c86f3a44 refactor(auth): hand the trip tags over through the trip members repository
Kept out of MaintenanceRepository, whose raw SQL strings are pinned.
2026-11-23 16:44:45 +01:00
Maurice 6e0c2b894d refactor(auth): hand a deleted user's trip tags over through the maintenance repository
The account deletion no longer reaches into the tags domain, which closed an import cycle between the two.
2026-11-23 16:34:51 +01:00
Maurice 0fe536bbd2 fix(mcp): type the input refusal as the Error it is, so the strict build reads it 2026-11-23 16:29:35 +01:00
Maurice 96fa7ca4e8 refactor(server): keep the fixes within the size and strict ratchets
The admin settings audit summary moves to auth.helpers, the booking stay check to DayAccommodationsRepository.idOnTrip, the strict typings declare the MCP SDK types module, and the useAdmin test leaves the format baseline.
2026-11-23 16:23:21 +01:00
Maurice 8a9f5367b1 chore(lint): keep the fixes within the lint ratchets
No promise in a condition, sequential awaits through a reduce instead of a loop, no non-null assertions or any in the new tests, an awaited act, one options object for a stop edit and a handled rejection for the offline copy.
2026-11-23 16:09:59 +01:00
Maurice f6d52727f7 test(mcp): follow the mail tools and file tools that left their addon gates
Documents leaves the list of addons whose switch ends MCP sessions, since no tool waits for it any more.
2026-11-23 16:04:29 +01:00
Maurice af88aef35e fix(server): resolve the MCP SDK types module at runtime
The tool registry imports McpError from @modelcontextprotocol/sdk/types, which Node only finds through the tsconfig path list the other SDK modules use.
2026-11-23 16:02:37 +01:00
Maurice 4b6911b51f fix(plugins): bind a Buffer in the single-array bind form of ctx.db as its bytes 2026-11-23 15:53:58 +01:00
Maurice 907fc95b00 fix(plugins): let a file write past Documents off only for the targets it writes
files.update and files.createLink took any target key in the call as an attachment, also one they never store.
2026-11-23 15:53:58 +01:00
Maurice 1c6bdb4129 fix(immich): keep a shared journey from streaming an Immich video original with its location
A public link now plays an Immich video only when the asset has no recorded location or Immich serves its own transcode, which it writes without metadata; the original file of a located video is refused with a 404.
2026-11-23 15:45:28 +01:00
Maurice 8349c5066b fix(dawarich): name stays never read before reading unnamed ones again
Unnamed stays are now read again at the end of a run, from the budget the others left and at most 20 per window, so new stays get their names and a Dawarich without a geocoder is not asked about every stay on each run.
2026-11-23 15:45:28 +01:00
Maurice 5e8cc0b90a fix(mail-ingest): read a transfer booking with a numeric code instead of filing it as a forwarding confirmation
Outside Gmail and Outlook senders, only a subject naming mail forwarding counts, so a bare 'transfert' in a shuttle or airport transfer confirmation no longer hides the booking.
2026-11-23 15:45:27 +01:00
Maurice 950942f7b9 fix(backup): refuse a Postgres restore of another schema or past the size limit with a 400
The admin restore now writes and checks the restore script while it verifies the archive, so a dump without TREK's tables in the target schema or one expanding past BACKUP_MAX_DECOMPRESSED_MB is refused before a pre-restore copy is kept, and the restore runs the checked script.
2026-11-23 15:45:27 +01:00
Maurice ac5c91bcaf fix(plugins): bind a Buffer a plugin passes to its own database as bytes
A Buffer crosses the plugin IPC as its JSON form, so db.query, db.exec and db.tx now turn that form back into the bytes before binding, as the plugin docs promise.
2026-11-23 15:45:27 +01:00
Maurice 10f0cb7d04 fix(flight-live): keep a late earlier sector from reading as this flight departing
Until a leg has departed, an aircraft in the air that is no nearer the destination than the origin is now stays the earlier sector's after the scheduled departure too, unless it is climbing out near the origin.
2026-11-23 15:45:27 +01:00
Maurice 08f3a8fe0b fix(flight-live): tell each booking of a flight its own delay once it is late
Bookings sharing a tracked flight can hold different departure times, so the delay notice now goes to each booking when its own delay crosses the line instead of being spent on the first one.
2026-11-23 15:45:27 +01:00
Maurice a0c41bce0a fix(notifications): list the wanderer hints for users whose trip switched Tours on
The user's matrix decides that row by the same per-user Tours rule the wanderer watch sends by, so a user who gets the hints can see and switch them.
2026-11-23 15:45:25 +01:00
Maurice 1a6639eb74 fix(trips): end a plugin-added member's MCP sessions where the trip opened an addon
trips.addMember now calls reattachJoinedMember like the REST, MCP and invite joins, so the new member's session lists the trip's addon tools.
2026-11-23 15:45:25 +01:00
Maurice 807c6a16b4 fix(plugins): handle a failed addon read while an earlier trip event still waits
The addon read of a queued plugin event now settles to off on its own, so a rejection that comes before the earlier event's turn can no longer go unhandled and stop the server.
2026-11-23 15:45:25 +01:00
Maurice 5d7d6072f7 fix(mail-ingest): refresh MCP sessions when an admin switches the mail import
The mail import tools are listed only while the import is on, so a save that changes mail_ingest_enabled now ends the live MCP sessions, as the addon switches do.
2026-11-23 15:45:25 +01:00
Maurice 4cd3f3d650 fix(files): serve a plugin the files a trip keeps while Documents is off
The plugin file surface follows the REST rule: the list and reads keep booking, place, expense, note and message files, a write on a loose file goes through when it attaches it, and uploads and deletes stay open.
2026-11-23 15:45:25 +01:00
Maurice a0d66eb898 fix(files): attach a loose file while the trip has Documents off
update and link go through when the request itself attaches the file to a booking, place, stop or expense, on REST and MCP alike, and upload_trip_file takes budget_item_id like the REST upload.
2026-11-23 15:45:24 +01:00