Compare commits

...

24 Commits

Author SHA1 Message Date
github-actions[bot] 13910464e5 chore: bump version to 5.2.1 [skip ci] 2026-11-25 13:18:29 +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 434baaf6fd fix(native-auth): send the app's SSO sign-in through the identity provider every time
The app signs in through a browser sheet that shares the system browser's
cookies. When that browser still held a TREK session from an earlier
sign-in, the hand-off page skipped the identity provider and offered to
continue at once, so a provider set to demand re-authentication (Pocket ID's
"requires re-authentication") was never asked, and signing out of the app
and in again with SSO asked for nothing.

The SSO button now always goes through the identity provider. It decides as
before: a provider with a running session lets the user through, one that
demands re-authentication asks for it. A sign-in with a password or passkey
still continues with the browser's session after the explicit tap.

Refs #3014
2026-11-25 10:52:34 +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 c1c77d89b5 fix(day-plan): make the legs from a booking or the hotel tappable on the phone
On the phone timeline only a leg that leaves a stop opened the travel mode
menu. The leg from the morning hotel to the first stop, the leg from the last
stop back to the hotel and the leg from a booking's arrival to the next stop
stayed inert, although the desktop day plan already changes them through the
stop at their other end. A TestFlight tester could not tap the walk from their
train's arrival to the hotel.

The timeline now knows which stop owns each of these legs: the first stop's
incoming mode for the morning hotel leg and for a leg out of a booking, the
last stop's outgoing mode for the evening hotel leg. Tapping them in edit mode
opens the same menu as on the desktop, and the phone sets the incoming mode
the way the desktop does.

A leg no stop owns, such as a booking's arrival to the hotel, has no mode to
store. It follows the day default, and on both the phone and the desktop it
now offers the public transit search where a trip has dates, instead of
reacting to nothing.
2026-11-25 10:21:43 +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 85182d2f52 chore(deps): group MikroORM and NestJS updates, hold NestJS majors
Each family releases in lockstep and now arrives as one PR. NestJS majors wait until nestjs-zod supports NestJS 12.
2026-11-25 00:10:14 +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 eed5f75487 docs(readme): space Data sources like the other sections 2026-11-24 23:56:08 +01:00
Maurice f29112698e docs(readme): show See all features as a plain heading
The graphic card goes again; the toggle now reads as a third-level heading.
2026-11-24 23:54:54 +01:00
Maurice d556d706b7 docs(readme): drop the feature tile grid, make See all features a card
The Plan, track, share tile grid goes. The See all features toggle is now a card in the style of the app cards, light and dark, with the feature areas as small chips and a chevron, so the full list is easier to spot.
2026-11-24 23:53:58 +01:00
Maurice 71673085bb docs(readme): make the app store cards flatter
A smaller QR code, and the store's mark beside the first line instead of in a box of its own, so each card is about a quarter less tall.
2026-11-24 23:51:05 +01:00
Maurice 19a01d493b docs(readme): set the sponsor line in normal text size 2026-11-24 23:49:59 +01:00
Maurice 462f08727c docs(readme): shorten the sponsor and AI notes, drop the PWA section
The sponsor line at the top goes; the dataforest cloud block further down is now its logo under a small POWERED BY and one line. The AI usage section is one sentence with its link. The PWA install steps and their link in the quick navigation go, since the store apps now sit at the top.
2026-11-24 23:49:20 +01:00
Maurice 58298703e1 docs(readme): drop the line under the app cards 2026-11-24 23:48:23 +01:00
Maurice 17e75947f0 docs(readme): drop the Docker badge 2026-11-24 23:47:36 +01:00
Maurice 4f1e29b02c docs(readme): drop the Sonar and CI status badges 2026-11-24 23:46:48 +01:00
Maurice d1ee3ceccb docs(readme): show the app stores as cards with their QR code
Two cards, one per store, in a light and a dark version that follow GitHub's theme: the QR code on white on the left, the store's mark and name on the right. They replace the bordered table and the two shield badges, and each card links to its store.
2026-11-24 23:45:47 +01:00
Maurice 69a976e942 docs(readme): put the iOS and Android apps near the top, shorten the sponsor section
A QR code and a store button for the App Store and Google Play sit right
under the introduction, with a line that the app connects to your own TREK
server and a link to the Native Apps page. The QR codes are SVGs on a white
ground, so they scan in GitHub's light and dark theme alike.

The dataforest cloud section keeps its logo and every sponsor link but says
the same in one paragraph instead of four.
2026-11-24 23:41:22 +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
134 changed files with 3077 additions and 915 deletions
+12
View File
@@ -26,9 +26,21 @@ updates:
prefix: chore(deps)
prefix-development: chore(deps-dev)
groups:
# Packages that release in lockstep move together, so a PR never pins
# half of them on one version and half on the next.
mikro-orm:
patterns: ['@mikro-orm/*']
update-types: [minor, patch]
nestjs:
patterns: ['@nestjs/*']
update-types: [minor, patch]
npm-minor-and-patch:
update-types: [minor, patch]
ignore:
# nestjs-zod, which validates every request body, does not support
# NestJS 12 yet. The framework moves by hand once it does.
- dependency-name: '@nestjs/*'
update-types: [version-update:semver-major]
# TypeScript 7 is the native compiler and has no JavaScript API yet:
# typescript-eslint, the coverage instrumenter and the Postgres probe all
# call into it (readConfigFile, ScriptTarget). It moves by hand once the
+14 -59
View File
@@ -12,14 +12,14 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
<br />
<a href="https://apps.apple.com/app/id6831237775"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/app/app-store-dark.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/app/app-store-light.svg" /><img src="docs/app/app-store-light.svg" alt="Download TREK on the App Store, with a QR code" width="320" /></picture></a>
&nbsp;
<a href="https://play.google.com/store/apps/details?id=com.liketrek.trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/app/google-play-dark.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/app/google-play-light.svg" /><img src="docs/app/google-play-light.svg" alt="Get TREK on Google Play, with a QR code" width="320" /></picture></a>
<br />
<a href="https://demo.liketrek.com"><img alt="Demo" src="https://img.shields.io/badge/Demo-try-111827?style=for-the-badge" /></a>
&nbsp;
<a href="https://hub.docker.com/r/mauriceboe/trek"><img alt="Docker" src="https://img.shields.io/badge/Docker-ready-2496ED?style=for-the-badge" /></a>
&nbsp;
<a href="https://sonarcloud.io/project/overview?id=liketrek_TREK"><img alt="Sonar Quality Gate" src="https://img.shields.io/sonar/quality_gate/liketrek_TREK?server=https%3A%2F%2Fsonarcloud.io&style=for-the-badge" /></a>
&nbsp;
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/liketrek/TREK/test.yml?branch=main&style=for-the-badge">
&nbsp;
<a href="https://discord.gg/NhZBDSd4qW"><img alt="Discord" src="https://img.shields.io/badge/Discord-join-5865F2?style=for-the-badge" /></a>
&nbsp;
<a href="https://kanban.pakulat.org/shared/I4wxF6inOOMB0C6hH6kQm3efyNxFjwyI"><img alt="Roadmap" src="https://img.shields.io/badge/Roadmap-view-0EA5E9?style=for-the-badge" /></a>
@@ -38,7 +38,6 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
&nbsp;
<a href="https://github.com/liketrek/TREK"><img alt="Stars" src="https://img.shields.io/github/stars/liketrek/trek?style=for-the-badge&label=Stars&color=6B7280" /></a>
<sub>PUBLIC SERVICES PROUDLY SPONSORED BY</sub><br /><a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" /><img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="30" /></picture></a>
</div>
---
@@ -53,14 +52,8 @@ TREK has grown from a travel planner into a whole ecosystem for trips: plan toge
## What you get
<picture>
<source media="(max-width: 700px)" srcset="docs/tiles/grid-mobile.svg" />
<source media="(prefers-color-scheme: dark)" srcset="docs/tiles/grid-desktop-dark.svg" />
<img src="docs/tiles/grid-desktop.svg" alt="Plan, track, share" width="100%" />
</picture>
<details>
<summary><b>See all features</b></summary>
<summary><h3>See all features</h3></summary>
<br />
@@ -220,34 +213,12 @@ Most of what follows is an addon an admin switches on or off. Lists, Costs, Docu
<br />
## Powered by [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek)
<div align="center">
<br />
<sub>POWERED BY</sub><br />
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" /><source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" /><img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="40" /></picture></a>
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/sponsors/dataforest-light.svg" />
<source media="(prefers-color-scheme: light)" srcset="docs/sponsors/dataforest-dark.svg" />
<img src="docs/sponsors/dataforest-dark.svg" alt="dataforest cloud" height="60" />
</picture>
</a>
<br />
<br />
**Every TREK installation in the world searches through servers that [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) sponsors.**
The place index with over 88 million places, the address search in every TREK language and the planet-wide routing all run on [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) in Frankfurt, Germany, free of charge for everyone who self-hosts TREK. Without this sponsorship, these services would not exist in this form.
Thank you, [dataforest](https://cloud.dataforest.net/en?mtm_campaign=trek), for backing open source this generously. 💚
<br />
<a href="https://cloud.dataforest.net/en?mtm_campaign=trek"><img alt="Visit dataforest cloud" src="https://img.shields.io/badge/Visit-dataforest_cloud-02C382?style=for-the-badge" /></a>
Looking for a server for your own TREK? [dataforest cloud](https://cloud.dataforest.net/en?mtm_campaign=trek) is where TREK's own services live.
The place index with 88 million places, the address search and the planet-wide routing run on <a href="https://cloud.dataforest.net/en?mtm_campaign=trek">dataforest cloud</a> in Frankfurt, free for every self-hosted TREK. Thank you! 💚
</div>
@@ -255,13 +226,7 @@ Looking for a server for your own TREK? [dataforest cloud](https://cloud.datafor
## AI usage
We use LLM-assisted coding tools across parts of this codebase. Nothing ships that a
maintainer has not read and understood: every change goes through a pull request, is
reviewed and tested, and has a human who can answer for it. "The AI wrote that" is not
an answer any of us would accept from ourselves.
See [**How we use AI in TREK**](https://github.com/liketrek/TREK/discussions/1851) for
the details.
We use LLM-assisted coding tools, and nothing ships that a maintainer has not read, reviewed, tested and can answer for. More in [How we use AI in TREK](https://github.com/liketrek/TREK/discussions/1851).
<br />
@@ -285,7 +250,7 @@ Open `http://localhost:3000`, or `http://<server-ip>:3000` from another machine.
<div align="center">
<a href="#docker-compose-production">Docker Compose</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#helm-kubernetes">Helm / Kubernetes</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#install-as-app-pwa">Install as PWA</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#reverse-proxy">Reverse Proxy</a>
<a href="#docker-compose-production">Docker Compose</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#helm-kubernetes">Helm / Kubernetes</a>&nbsp;&nbsp;·&nbsp;&nbsp;<a href="#reverse-proxy">Reverse Proxy</a>
</div>
@@ -342,18 +307,6 @@ See [`charts/README.md`](https://github.com/liketrek/TREK/blob/main/charts/READM
<br />
<h2 id="install-as-app-pwa">Install as App (PWA)</h2>
TREK works as a Progressive Web App, and the TREK Travel Planner app for iPhone, iPad and Android connects to the same server ([Native Apps](https://github.com/liketrek/TREK/wiki/Native-Apps)). To install the web app instead:
1. Open TREK in the browser (HTTPS required)
2. **iOS**: Share ▸ *Add to Home Screen*
3. **Android**: Menu ▸ *Install app* (or *Add to Home Screen*)
TREK then launches fullscreen with its own icon, just like a native app.
<br />
## Updating
See [Updating](https://github.com/liketrek/TREK/wiki/Updating) — Docker Compose,
@@ -442,6 +395,8 @@ Caddy handles TLS and WebSockets automatically.
Every variable, its default and what it does: see
[Environment Variables](https://github.com/liketrek/TREK/wiki/Environment-Variables).
<br />
## Data sources
The Atlas map's country and sub-national (province/county) boundaries come from
+2 -2
View File
@@ -1,5 +1,5 @@
apiVersion: v2
name: trek
version: 5.2.0
version: 5.2.1
description: Minimal Helm chart for TREK app
appVersion: "5.2.0"
appVersion: "5.2.1"
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trek/client",
"version": "5.2.0",
"version": "5.2.1",
"engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
@@ -103,7 +103,7 @@
"@fontsource/yellowtail": "^5.3.0",
"@maplibre/maplibre-gl-leaflet": "0.1.4",
"@noble/hashes": "^1.8.0",
"@simplewebauthn/browser": "^13.3.0",
"@simplewebauthn/browser": "^14.0.0",
"@trek/shared": "*",
"axios": "^1.21.0",
"dexie": "^4.4.7",
@@ -163,7 +163,7 @@
"sharp": "^0.35.5",
"tailwindcss": "^3.4.19",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"vite": "8.3.8",
"vite-plugin-pwa": "^2.0.0",
"vitest": "^4.1.12"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"src": {
"@typescript-eslint/no-non-null-assertion": 367,
"@typescript-eslint/no-non-null-assertion": 354,
"@typescript-eslint/no-misused-promises": 820,
"no-console": 88,
"complexity": 216,
+1 -1
View File
@@ -10,7 +10,7 @@
"src/components/Map/MapViewGL.tsx": 2116,
"src/components/Planner/DayDetailPanel.test.tsx": 2333,
"src/components/Planner/DayPlanSidebar.test.tsx": 5349,
"src/components/Planner/DayPlanSidebar.tsx": 2910,
"src/components/Planner/DayPlanSidebar.tsx": 2908,
"src/components/Planner/PlaceFormModal.test.tsx": 2836,
"src/components/Planner/PlaceInspector.tsx": 1128,
"src/components/Studio/TravelElements.tsx": 1559,
@@ -111,11 +111,23 @@ export const CHATGPT_USAGE_URL = 'https://chatgpt.com/settings/usage';
* error page and the user pastes its address back; only the port may differ.
*/
export function isChatgptCallback(text: string): boolean {
return chatgptCallbackUrl(text) !== null;
}
/**
* The pasted callback as the server reads it, or null when it is something
* else. The address bar and the hint under the field show it without `http://`,
* so an address pasted that way gets the scheme put back.
*/
export function chatgptCallbackUrl(text: string): string | null {
const trimmed = text.trim();
const address = /^[a-z][a-z\d+.-]*:\/\//i.test(trimmed) ? trimmed : `http://${trimmed}`;
let url: URL;
try {
url = new URL(text.trim());
url = new URL(address);
} catch {
return false;
return null;
}
return url.protocol === 'http:' && url.hostname === '127.0.0.1' && url.pathname === '/auth/callback';
const ok = url.protocol === 'http:' && url.hostname === '127.0.0.1' && url.pathname === '/auth/callback';
return ok ? address : null;
}
+2 -2
View File
@@ -544,9 +544,9 @@ describe('Navbar styling and menu details', () => {
const discord = screen.getByTitle('Discord');
fireEvent.mouseEnter(discord);
expect(discord.style.background).toBe('rgba(88, 101, 242, 0.125)');
expect(discord.style.background).toBe('rgba(88, 101, 242, 0.15)');
fireEvent.mouseLeave(discord);
expect(discord.style.background).toBe('var(--bg-tertiary)');
expect(discord.style.background).toBe('');
expect(document.querySelector('img[src="/text-light.svg"]')).not.toBeNull();
});
+3 -18
View File
@@ -17,6 +17,7 @@ import { useCollapseOnOverflow } from '../../hooks/useCollapseOnOverflow'
import { openMailInbox } from '../MailIngest/mailInboxOpener'
import { useMailInboxShell } from '../MailIngest/useMailInboxShell'
import MailInboxDialog from '../MailIngest/MailInboxDialog'
import UserMenuFooter from './UserMenuFooter'
const ADDON_ICONS: Record<string, LucideIcon> = { CalendarDays, Briefcase, Globe, Compass, Bookmark }
@@ -311,7 +312,7 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onSettings
{userMenuOpen && createPortal(
<>
<div style={{ position: 'fixed', inset: 0, zIndex: 9998 }} role="presentation" onClick={() => setUserMenuOpen(false)} />
<div className="trek-menu-enter w-52 rounded-xl shadow-xl border overflow-hidden bg-surface-card border-edge" style={{ position: 'fixed', top: 'var(--nav-h)', insetInlineEnd: 8, zIndex: 9999 }}>
<div className="trek-menu-enter w-60 rounded-xl shadow-xl border overflow-hidden bg-surface-card border-edge" style={{ position: 'fixed', top: 'var(--nav-h)', insetInlineEnd: 8, zIndex: 9999 }}>
<div className="px-4 py-3 border-b border-edge-secondary">
<p className="text-sm font-medium text-content">{user.username}</p>
<p className="text-xs truncate text-content-muted">{user.email}</p>
@@ -368,23 +369,7 @@ export default function Navbar({ tripTitle, tripId, onBack, showBack, onSettings
<LogOut className="w-4 h-4" />
{t('nav.logout')}
</button>
{appVersion && (
<div className="px-4 pt-2 pb-2.5 text-center border-t border-edge-secondary" style={{ marginTop: 4 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6 }}>
<div style={{ display: 'inline-flex', alignItems: 'center', gap: 5, background: 'var(--bg-tertiary)', borderRadius: 99, padding: '4px 12px' }}>
<img src={dark ? '/text-light.svg' : '/text-dark.svg'} alt="TREK" style={{ height: 10, opacity: 0.5 }} />
<span style={{ fontSize: 'calc(10px * var(--fs-scale-caption, 1))', fontWeight: 600, color: 'var(--text-faint)' }}>v{appVersion}</span>
</div>
<a href="https://discord.gg/NhZBDSd4qW" target="_blank" rel="noopener noreferrer"
style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 24, height: 24, borderRadius: 99, background: 'var(--bg-tertiary)', transition: 'background 0.15s' }}
onMouseEnter={e => e.currentTarget.style.background = '#5865F220'}
onMouseLeave={e => e.currentTarget.style.background = 'var(--bg-tertiary)'}
title="Discord">
<svg width="12" height="12" viewBox="0 0 24 24" fill="var(--text-faint)"><path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/></svg>
</a>
</div>
</div>
)}
{appVersion && <UserMenuFooter appVersion={appVersion} dark={dark} managed={!!managed} />}
</div>
</div>
</>,
@@ -0,0 +1,44 @@
// FE-MENUFOOT-001 to FE-MENUFOOT-004
import { describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen } from '../../../tests/helpers/render';
import { isNativeApp } from '../../native/platform';
import UserMenuFooter from './UserMenuFooter';
vi.mock('../../native/platform', () => ({ isNativeApp: vi.fn(() => false) }));
function titles(): string[] {
return [...document.querySelectorAll('a[title]')].map((a) => a.getAttribute('title') ?? '');
}
describe('UserMenuFooter', () => {
it('FE-MENUFOOT-001: shows the version and the three support links beside Discord', () => {
render(<UserMenuFooter appVersion="5.2.1" dark={false} managed={false} />);
expect(screen.getByText('v5.2.1')).toBeInTheDocument();
expect(document.querySelector('img[src="/text-dark.svg"]')).not.toBeNull();
expect(titles()).toEqual(['Patreon', 'Ko-fi', 'Buy Me a Coffee', 'Discord']);
expect(screen.getByTitle('Ko-fi')).toHaveAttribute('href', 'https://ko-fi.com/mauriceboe');
expect(screen.getByTitle('Buy Me a Coffee')).toHaveAttribute('href', 'https://buymeacoffee.com/mauriceboe');
expect(screen.getByTitle('Patreon')).toHaveAttribute('href', 'https://www.patreon.com/cw/mauriceboe');
});
it('FE-MENUFOOT-002: a managed install keeps only Discord', () => {
render(<UserMenuFooter appVersion="5.2.1" dark managed />);
expect(titles()).toEqual(['Discord']);
expect(document.querySelector('img[src="/text-light.svg"]')).not.toBeNull();
});
it('FE-MENUFOOT-003: the native app shows no donation link', () => {
vi.mocked(isNativeApp).mockReturnValueOnce(true);
render(<UserMenuFooter appVersion="5.2.1" dark={false} managed={false} />);
expect(titles()).toEqual(['Discord']);
});
it('FE-MENUFOOT-004: hovering a link washes it in its brand colour and leaving clears it', () => {
render(<UserMenuFooter appVersion="5.2.1" dark={false} managed={false} />);
const kofi = screen.getByTitle('Ko-fi');
fireEvent.mouseEnter(kofi);
expect(kofi.style.background).toBe('rgba(255, 94, 91, 0.15)');
fireEvent.mouseLeave(kofi);
expect(kofi.style.background).toBe('');
});
});
@@ -0,0 +1,100 @@
import { Coffee, Heart } from 'lucide-react';
import React from 'react';
import { donationsShown } from '../../utils/donations';
import { PATREON_PATH, PATREON_URL } from '../shared/PatreonIcon';
const DISCORD_PATH =
'M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z';
interface FooterLink {
title: string;
href: string;
/** The brand's colour, as a faint wash behind the icon on hover. */
tint: string;
icon: React.ReactNode;
}
function brandSvg(path: string): React.ReactNode {
return (
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d={path} />
</svg>
);
}
const DISCORD: FooterLink = {
title: 'Discord',
href: 'https://discord.gg/NhZBDSd4qW',
tint: '#5865F2', // Discord's brand colour
icon: brandSvg(DISCORD_PATH),
};
const SUPPORT: FooterLink[] = [
{
title: 'Patreon',
href: PATREON_URL,
tint: '#ff424d', // Patreon's brand colour
icon: brandSvg(PATREON_PATH),
},
{
title: 'Ko-fi',
href: 'https://ko-fi.com/mauriceboe',
tint: '#ff5e5b', // Ko-fi's brand colour
icon: <Heart size={12} strokeWidth={2.4} aria-hidden="true" />,
},
{
title: 'Buy Me a Coffee',
href: 'https://buymeacoffee.com/mauriceboe',
tint: '#ffdd00', // Buy Me a Coffee's brand colour
icon: <Coffee size={12} strokeWidth={2.4} aria-hidden="true" />,
},
];
interface Props {
appVersion: string;
dark: boolean;
/** A centrally administered install: its users are not the ones to ask for support. */
managed: boolean;
}
/**
* The foot of the user menu: the running version, then the round links to the
* community and, where donations may be shown, the three ways to support TREK.
*/
export default function UserMenuFooter({ appVersion, dark, managed }: Props): React.ReactElement {
const links = !managed && donationsShown() ? [...SUPPORT, DISCORD] : [DISCORD];
return (
<div className="mt-1 flex items-center justify-center gap-1.5 border-t border-edge-secondary px-3 pb-2.5 pt-2">
<div className="inline-flex items-center gap-[5px] rounded-full bg-surface-tertiary px-2.5 py-1">
<img src={dark ? '/text-light.svg' : '/text-dark.svg'} alt="TREK" className="h-2.5 opacity-50" />
<span
className="font-semibold text-content-faint"
style={{ fontSize: 'calc(10px * var(--fs-scale-caption, 1))' }}
>
v{appVersion}
</span>
</div>
{links.map((link) => (
<a
key={link.title}
href={link.href}
target="_blank"
rel="noopener noreferrer"
title={link.title}
aria-label={link.title}
className="grid h-6 w-6 flex-none place-items-center rounded-full bg-surface-tertiary text-content-faint transition-colors"
onMouseEnter={(e) => {
e.currentTarget.style.background = `${link.tint}26`;
e.currentTarget.style.color = 'var(--text-primary)';
}}
onMouseLeave={(e) => {
e.currentTarget.style.background = '';
e.currentTarget.style.color = '';
}}
>
{link.icon}
</a>
))}
</div>
);
}
@@ -585,3 +585,87 @@ describe('DayPlanSidebar, public transit between two city walks (CW-08)', () =>
expect(screen.getByTestId('tour-day-overrun')).toHaveTextContent('Ends at 14:00, after Harbour starts at 13:00');
});
});
// The walk from a train's arrival to the night's hotel: no stop is at either end, so
// there is no mode to change, and the desktop left it inert. The transit search is
// what can be planned for it, as for every other leg.
describe('DayPlanSidebar, public transit from a booking arrival to the hotel', () => {
it('FE-PLANNER-DAYPLAN-171f: the walk from a train arrival to the hotel, which no stop owns, offers public transport', async () => {
const user = userEvent.setup();
const onPlanTransitLeg = vi.fn();
const days = [
buildDay({ id: 10, date: '2025-06-01', title: 'Day 1' }),
buildDay({ id: 11, date: '2025-06-02', title: 'Day 2' }),
buildDay({ id: 12, date: '2025-06-03', title: 'Day 3' }),
];
const accommodations = [
{
id: 1,
trip_id: 1,
start_day_id: 10,
end_day_id: 12,
place_lat: 47.5,
place_lng: 19.05,
place_name: 'Basilica apARTment',
},
];
const train = buildReservation({
id: 430,
type: 'train',
title: 'Wien => Budapest',
day_id: 11,
end_day_id: 11,
day_plan_position: 5,
reservation_time: '2025-06-02T16:42:00',
reservation_end_time: '2025-06-02T19:29:00',
endpoints: [
{
role: 'from',
sequence: 0,
name: 'Wien Hbf',
code: null,
lat: 48.18,
lng: 16.37,
timezone: null,
local_date: null,
local_time: null,
},
{
role: 'to',
sequence: 1,
name: 'Budapest Keleti',
code: null,
lat: 47.5,
lng: 19.08,
timezone: null,
local_date: null,
local_time: null,
},
],
});
const albertina = buildPlace({ id: 1, name: 'Albertina', place_time: '12:00', lat: 48.2, lng: 16.37 });
render(
<DayPlanSidebar
{...makeDefaultProps({
days,
assignments: { '11': [buildAssignment({ id: 11, day_id: 11, order_index: 0, place: albertina })] },
accommodations,
reservations: [train],
selectedDayId: 11,
routeShown: true,
onPlanTransitLeg,
})}
/>
);
await user.click(await screen.findByLabelText('Public transit'));
expect(contextMenu().queryByRole('button', { name: 'Driving' })).not.toBeInTheDocument();
await user.click(contextMenu().getByRole('button', { name: 'Public transit' }));
expect(onPlanTransitLeg).toHaveBeenCalledWith(
expect.objectContaining({
dayId: 11,
from: expect.objectContaining({ lat: 47.5, lng: 19.08 }),
to: { name: 'Basilica apARTment', lat: 47.5, lng: 19.05 },
})
);
});
});
@@ -69,7 +69,7 @@ import { findTodayDayId } from './today'
import { markdownLinkComponents } from '../shared/markdownLink'
import { RouteConnector, HotelRouteConnector } from './DayPlanSidebarRouteConnector'
import { resolveLegMode } from './legMode'
import { useLegModeActions } from './useLegModeActions'
import { transitOnlyMenuItems, useLegModeActions } from './useLegModeActions'
import { dayExportStops, fillAroundLocked } from './dayRoute'
import { projectDayItinerary, projectedById, type TourStageStops } from '../Map/dayTourProjection'
import type { DayRoutePoint } from '../Map/dayRoutePlan'
@@ -1413,6 +1413,27 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
} as unknown as React.MouseEvent)
}
// A hotel bookend leg opens the mode menu of the stop that owns it, the first stop's
// incoming mode at the top and the last stop's outgoing mode at the bottom. One no
// stop owns, a booking's arrival to the hotel, can only have transit planned.
const hotelLegRow = (dayId: number, leg: { seg: RouteSegment; name: string; targetId?: number }, placement: 'top' | 'bottom') => {
const connector = <HotelRouteConnector seg={leg.seg} name={leg.name} profile={routeProfile} placement={placement} />
const targetId = leg.targetId
const planTransit = targetId == null ? transitLegPlanner(dayId, leg.seg) : undefined
const open = targetId != null
? (e: React.MouseEvent) => (placement === 'top' ? openIncomingLegModeMenu : openLegModeMenu)(e, targetId, dayId, leg.seg)
: planTransit && ((e: React.MouseEvent) => ctxMenu.open(e, transitOnlyMenuItems(planTransit, t)))
if (!canEditDays || !open) return connector
const label = targetId != null ? t('dayplan.transportMode.change') : t('transit.title')
return (
<Tooltip label={label} placement="top">
<div role="button" tabIndex={0} onClick={open} onKeyDown={e => openLegMenuByKey(e, open)} style={{ cursor: 'pointer' }} aria-label={label}>
{connector}
</div>
</Tooltip>
)
}
return (
// Sized as a flex child as well as by height: the desktop panel puts the Days / Road
// trip switch above this, and at height 100% alone the list ran the switch's height
@@ -1734,17 +1755,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
dropAfterLastItem(day.id, { assignmentId, noteId })
}}
>
{hotelLegs[day.id]?.top && (() => {
const targetId = hotelLegs[day.id]?.top?.targetId
const connector = <HotelRouteConnector seg={hotelLegs[day.id]!.top!.seg} name={hotelLegs[day.id]!.top!.name} profile={routeProfile} placement="top" />
return canEditDays && targetId != null ? (
<Tooltip label={t('dayplan.transportMode.change')} placement="top">
<div role="button" tabIndex={0} onClick={e => openIncomingLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.top!.seg)} onKeyDown={e => openLegMenuByKey(e, m => openIncomingLegModeMenu(m, targetId, day.id, hotelLegs[day.id]!.top!.seg))} style={{ cursor: 'pointer' }} aria-label={t('dayplan.transportMode.change')}>
{connector}
</div>
</Tooltip>
) : connector
})()}
{hotelLegs[day.id]?.top && hotelLegRow(day.id, hotelLegs[day.id]!.top!, 'top')}
{daySchedule.byPosition[day.id]?.start.map(si => <PluginDayScheduleRow key={`${si.pluginId}:${si.id}`} item={si} />)}
{visibleCount === 0 && !dayNoteUi ? (
<div
@@ -2477,17 +2488,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP
})
)}
{daySchedule.byPosition[day.id]?.end.map(si => <PluginDayScheduleRow key={`${si.pluginId}:${si.id}`} item={si} />)}
{hotelLegs[day.id]?.bottom && (() => {
const targetId = hotelLegs[day.id]?.bottom?.targetId
const connector = <HotelRouteConnector seg={hotelLegs[day.id]!.bottom!.seg} name={hotelLegs[day.id]!.bottom!.name} profile={routeProfile} placement="bottom" />
return canEditDays && targetId != null ? (
<Tooltip label={t('dayplan.transportMode.change')} placement="top">
<div role="button" tabIndex={0} onClick={e => openLegModeMenu(e, targetId, day.id, hotelLegs[day.id]!.bottom!.seg)} onKeyDown={e => openLegMenuByKey(e, m => openLegModeMenu(m, targetId, day.id, hotelLegs[day.id]!.bottom!.seg))} style={{ cursor: 'pointer' }} aria-label={t('dayplan.transportMode.change')}>
{connector}
</div>
</Tooltip>
) : connector
})()}
{hotelLegs[day.id]?.bottom && hotelLegRow(day.id, hotelLegs[day.id]!.bottom!, 'bottom')}
<AssistantDayPreview tripId={tripId} dayId={day.id} />{/* The assistant's waiting changes, then the drop zone at the list end */}
<div
style={{ minHeight: 12, padding: '2px 8px' }}
@@ -34,6 +34,15 @@ export function legModeMenuItems(
];
}
/**
* The menu of a leg no stop owns, a booking's arrival to the night's hotel: nothing
* keeps a mode for it, so it follows the day default and only public transit can be
* planned for it.
*/
export function transitOnlyMenuItems(planTransit: () => void, t: Translate): LegModeMenuItem[] {
return [{ label: t('transit.title'), icon: TramFront, onClick: planTransit }];
}
export interface LegModeDeps {
tripId: number;
toast: { error: (message: string) => void };
@@ -0,0 +1,41 @@
// FE-COMP-ACCOUNT-APPS-001 to FE-COMP-ACCOUNT-APPS-002
import { http, HttpResponse } from 'msw';
import { describe, expect, it, vi } from 'vitest';
import { buildSettings, buildUser } from '../../../tests/helpers/factories';
import { server } from '../../../tests/helpers/msw/server';
import { render, screen } from '../../../tests/helpers/render';
import { resetAllStores, seedStore } from '../../../tests/helpers/store';
import { isNativeApp } from '../../native/platform';
import { useAuthStore } from '../../store/authStore';
import { useSettingsStore } from '../../store/settingsStore';
import AccountTab from './AccountTab';
vi.mock('../../sync/syncTriggers', () => ({ registerSyncTriggers: vi.fn(), unregisterSyncTriggers: vi.fn() }));
vi.mock('../../native/platform', async (importOriginal) => ({
...(await importOriginal<typeof import('../../native/platform')>()),
isNativeApp: vi.fn(() => false),
}));
beforeEach(() => {
resetAllStores();
server.use(http.get('/api/auth/app-config', () => HttpResponse.json({ version: '5.2.1', mfa_enabled: false })));
seedStore(useAuthStore, { user: buildUser({ username: 'testuser', role: 'user' }), isAuthenticated: true });
seedStore(useSettingsStore, { settings: buildSettings() });
});
describe('AccountTab app stores', () => {
it('FE-COMP-ACCOUNT-APPS-001: in a browser it offers both app stores with their QR codes', () => {
render(<AccountTab />);
expect(screen.getByText('TREK app')).toBeInTheDocument();
expect(screen.getByText('Scan a code with your phone, then connect the app to this server.')).toBeInTheDocument();
expect(document.querySelectorAll('a.asc-card')).toHaveLength(2);
});
it('FE-COMP-ACCOUNT-APPS-002: inside the app itself there is nothing to download', () => {
vi.mocked(isNativeApp).mockReturnValue(true);
render(<AccountTab />);
expect(screen.queryByText('TREK app')).toBeNull();
expect(document.querySelector('a.asc-card')).toBeNull();
vi.mocked(isNativeApp).mockReturnValue(false);
});
});
+10 -1
View File
@@ -1,5 +1,5 @@
import React, { useId } from 'react'
import { User, Save, Lock, KeyRound, AlertTriangle, Shield, Camera, Trash2, Copy, Download, Printer, ShieldCheck } from 'lucide-react'
import { User, Save, Lock, KeyRound, AlertTriangle, Shield, Camera, Trash2, Copy, Download, Printer, ShieldCheck, Smartphone } from 'lucide-react'
import { useTranslation } from '../../i18n'
import Section from './Section'
import PasskeysSection from './PasskeysSection'
@@ -12,6 +12,8 @@ import { EditorField, GRID_2, INPUT, PANEL } from '../shared/dialogParts'
import { SETTINGS_BUTTON, SETTINGS_BUTTON_DANGER, SETTINGS_BUTTON_PRIMARY, SettingRow, SettingRows, SettingsHint, StatusPill, SettingsColumns } from './settingsKit'
import { stripTrailingSlashes, useAccountSettings } from './useAccountSettings'
import AccountDemoLock from './AccountDemoLock'
import AppStoreCards from '../shared/AppStoreCards'
import { isNativeApp } from '../../native/platform'
/** The small turning ring a button shows while its request is on the way. */
const SPINNER = 'h-3.5 w-3.5 flex-none animate-spin rounded-full border-2 border-current border-t-transparent'
@@ -366,6 +368,13 @@ export default function AccountTab(): React.ReactElement {
{/* Passkeys */}
<PasskeysSection demoMode={demoMode} />
{/* Where to get the phone app; inside the app itself there is nothing to fetch. */}
{!isNativeApp() && (
<Section title={t('settings.apps.title')} icon={Smartphone} hint={t('settings.apps.hint')}>
<AppStoreCards />
</Section>
)}
</>}
/>
</AccountDemoLock>
@@ -1,4 +1,4 @@
// FE-HOOK-AI-CONNECT-001 to FE-HOOK-AI-CONNECT-015: pasting a key, an own server, the ChatGPT sign-in and the OpenRouter return.
// FE-HOOK-AI-CONNECT-001 to FE-HOOK-AI-CONNECT-017: pasting a key, an own server, the ChatGPT sign-in and the OpenRouter return.
import { act, fireEvent, renderHook, waitFor } from '@testing-library/react';
import { createElement, type ReactNode } from 'react';
import { MemoryRouter, useLocation } from 'react-router';
@@ -20,6 +20,7 @@ vi.mock('../../shared/Toast', () => ({ useToast: () => toast }));
const { useChatgptConnect, useCustomConnect, useKeyConnect, useOpenrouterReturn, useOpenrouterStart } =
await import('./useAiConnect');
const { rememberOpenrouterFlow } = await import('./aiConnectModel');
const { OnlineOnlyError } = await import('../../../repo/onlineOnly');
function wrapperAt(url = '/settings') {
return ({ children }: { children: ReactNode }) =>
@@ -207,7 +208,7 @@ describe('useChatgptConnect', () => {
expect(repo.chatgptFinish).not.toHaveBeenCalled();
});
it('FE-HOOK-AI-CONNECT-010: an account ChatGPT will not share says so and keeps the flow', async () => {
it('FE-HOOK-AI-CONNECT-010: an account ChatGPT will not share says so, and the next try is a fresh sign-in', async () => {
repo.chatgptFinish.mockRejectedValueOnce(refused('not_eligible'));
const onConnected = vi.fn();
const { result } = renderHook(() => useChatgptConnect({ active: true, onConnected }), { wrapper: wrapperAt() });
@@ -216,7 +217,50 @@ describe('useChatgptConnect', () => {
await act(() => result.current.submit());
expect(result.current.error).toEqual({ messageKey: 'assistant.error.notEligible', code: 'not_eligible' });
expect(onConnected).not.toHaveBeenCalled();
expect(repo.chatgptStart).toHaveBeenCalledTimes(1);
// The server took the sign-in when it refused it.
await waitFor(() => expect(repo.chatgptStart).toHaveBeenCalledTimes(2));
});
it('FE-HOOK-AI-CONNECT-016: any refusal the server sent starts exactly one fresh sign-in; offline and a wrong address keep this one', async () => {
const generic = Object.assign(new Error('generic'), {
response: { status: 400, data: { error: 'ChatGPT refused the sign-in (invalid_client)', code: 'generic' } },
});
repo.chatgptFinish.mockRejectedValueOnce(generic).mockRejectedValueOnce(new OnlineOnlyError());
const { result } = renderHook(() => useChatgptConnect({ active: true, onConnected: vi.fn() }), {
wrapper: wrapperAt(),
});
await waitFor(() => expect(result.current.flow).not.toBeNull());
act(() => result.current.change(CALLBACK));
await act(() => result.current.submit());
expect(result.current.error?.code).toBe('generic');
await waitFor(() => expect(repo.chatgptStart).toHaveBeenCalledTimes(2));
await waitFor(() => expect(result.current.flow).not.toBeNull());
act(() => result.current.change(CALLBACK));
await act(() => result.current.submit());
expect(result.current.error?.code).toBe('offline');
expect(repo.chatgptStart).toHaveBeenCalledTimes(2);
// The server refuses a wrong address before it takes the sign-in, so the right one still works.
repo.chatgptFinish.mockRejectedValueOnce(refused('wrong_url'));
act(() => result.current.change(CALLBACK));
await act(() => result.current.submit());
expect(result.current.error?.code).toBe('wrong_url');
expect(repo.chatgptStart).toHaveBeenCalledTimes(2);
});
it('FE-HOOK-AI-CONNECT-017: the address pasted without http://, as the hint shows it, is taken and sent with it', async () => {
const onConnected = vi.fn();
const { result } = renderHook(() => useChatgptConnect({ active: true, onConnected }), { wrapper: wrapperAt() });
await waitFor(() => expect(result.current.flow).not.toBeNull());
const bare = CALLBACK.replace('http://', '');
let taken = false;
act(() => {
taken = result.current.paste(` ${bare} `);
});
expect(taken).toBe(true);
await waitFor(() => expect(onConnected).toHaveBeenCalledTimes(1));
expect(repo.chatgptFinish).toHaveBeenCalledWith({ flowId: FLOW.flowId, pastedUrl: CALLBACK });
});
it('FE-HOOK-AI-CONNECT-013: the clipboard fills the field where the browser lets it be read, else the field gets the cursor', async () => {
@@ -3,7 +3,7 @@ import { useEffect, useEffectEvent, useRef, useState } from 'react';
import { useSearchParams } from 'react-router';
import { useTranslation } from '../../../i18n';
import { aiConnectionsRepo } from '../../../repo/aiConnectionsRepo';
import { detectKeyKind, isChatgptCallback, providerLabel } from '../../Assistant/providerCatalog';
import { chatgptCallbackUrl, detectKeyKind, isChatgptCallback, providerLabel } from '../../Assistant/providerCatalog';
import { useToast } from '../../shared/Toast';
import {
callbackMatchesFlow,
@@ -243,9 +243,9 @@ export function useChatgptConnect({
};
const finish = async (raw: string) => {
const url = raw.trim();
const url = chatgptCallbackUrl(raw);
if (!flow || finishing.current) return;
if (!isChatgptCallback(url) || !callbackMatchesFlow(url, flow.authorizeUrl)) {
if (!url || !callbackMatchesFlow(url, flow.authorizeUrl)) {
setError({ messageKey: 'assistant.connect.chatgptWrong', code: 'wrong_url' });
return;
}
@@ -264,7 +264,9 @@ export function useChatgptConnect({
} catch (err) {
const code = refusalCode(err);
setError({ messageKey: connectErrorKey(err), code });
if (code === 'expired') restart();
// The server takes a sign-in once, whatever it answers: any refusal it sent
// used this one up. Offline the request never left, and a wrong address is refused before the flow is taken.
if (code !== null && code !== 'offline' && code !== 'wrong_url') restart();
} finally {
finishing.current = false;
setBusy(false);
@@ -298,7 +300,7 @@ export function useChatgptConnect({
useOnReturnToTab(opened, () => {
if (pasted.trim() || busy) return;
readClipboard((text) => {
if (flow && !callbackMatchesFlow(text, flow.authorizeUrl)) focusField();
if (flow && !callbackMatchesFlow(chatgptCallbackUrl(text) ?? text, flow.authorizeUrl)) focusField();
else if (!paste(text)) focusField();
}, focusField);
});
@@ -1,4 +1,4 @@
// FE-RN-001 to FE-RN-020
// FE-RN-001 to FE-RN-022
import userEvent from '@testing-library/user-event';
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '../../../tests/helpers/render';
@@ -295,4 +295,23 @@ describe('ReleaseNoticeModal', () => {
expect(document.querySelectorAll('.rn-vis-route-stop')).toHaveLength(5);
expect(document.querySelector('.rn-vis-route-line')).not.toBeNull();
});
it('FE-RN-021: an apps block draws one tile with its title and both store cards', () => {
renderModal(withRelease({ apps: { titleKey: 'rel.apps.title' } }));
const tile = document.querySelector('.rn-apps');
expect(tile).toHaveTextContent('rel.apps.title');
const stores = tile?.querySelectorAll('a.asc-card') ?? [];
expect([...stores].map((a) => a.getAttribute('href'))).toEqual([
'https://apps.apple.com/app/id6831237775',
'https://play.google.com/store/apps/details?id=com.liketrek.trek',
]);
// On the release column, which is dark in either theme.
expect(tile?.querySelector('.asc-row')).toHaveClass('asc-dark');
});
it('FE-RN-022: without an apps block there is no apps tile', () => {
renderModal();
expect(document.querySelector('.rn-apps')).toBeNull();
expect(document.querySelector('.asc-card')).toBeNull();
});
});
@@ -2,6 +2,7 @@ import { ArrowRight, Heart, Infinity as InfinityIcon, ShieldCheck, X } from 'luc
import React from 'react';
import { useTranslation } from '../../i18n/TranslationContext.js';
import type { SystemNoticeDTO } from '../../store/systemNoticeStore.js';
import AppStoreCards from '../shared/AppStoreCards';
import { PATREON_PATH } from '../shared/PatreonIcon';
import { ReleaseFeatureVisual } from './ReleaseNoticeVisuals.js';
import './releaseNotice.css';
@@ -127,6 +128,16 @@ export function ReleaseNoticeModal({ notice, visible, onDismiss, onCTA, onSecond
{withSponsorLink(t(release.introKey))}
</p>
{release.apps && (
<div className="rn-apps">
<div className="rn-feature-shine" aria-hidden="true" />
<div className="rn-apps-text">
<div className="rn-feature-title">{t(release.apps.titleKey)}</div>
</div>
<AppStoreCards tone="dark" className="rn-apps-stores" />
</div>
)}
<div className="rn-features-head">
<span className="rn-features-label">{t(release.featuresLabelKey)}</span>
<span className="rn-features-rule" aria-hidden="true" />
@@ -647,3 +647,28 @@
.rn-sponsor:hover {
text-decoration-color: currentColor;
}
/* ── The apps: one tile across the column, the text beside the store cards ── */
.rn-apps {
position: relative;
margin-top: 22px;
display: flex;
align-items: center;
gap: 22px;
padding: 16px 16px 16px 20px;
border-radius: 20px;
background: linear-gradient(160deg, oklch(1 0 0 / 0.1) 0%, oklch(1 0 0 / 0.045) 62%);
border: 1px solid oklch(1 0 0 / 0.13);
box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16), 0 12px 28px -16px oklch(0 0 0 / 0.7);
overflow: hidden;
}
.rn-apps-text { position: relative; flex: 1 1 200px; min-width: 0; }
.rn-apps-stores { position: relative; flex: 0 1 520px; min-width: 0; }
@media (max-width: 1280px) {
.rn-apps { flex-direction: column; align-items: stretch; }
.rn-apps-stores { flex-basis: auto; }
}
@@ -0,0 +1,39 @@
// FE-APPSTORE-001 to FE-APPSTORE-003
import { describe, expect, it } from 'vitest';
import { render } from '../../../tests/helpers/render';
import AppStoreCards from './AppStoreCards';
describe('AppStoreCards', () => {
it('FE-APPSTORE-001: links both stores in a new tab, each with its QR code', () => {
render(<AppStoreCards />);
const cards = [...document.querySelectorAll<HTMLAnchorElement>('a.asc-card')];
expect(cards.map((a) => a.href)).toEqual([
'https://apps.apple.com/app/id6831237775',
'https://play.google.com/store/apps/details?id=com.liketrek.trek',
]);
for (const a of cards) {
expect(a).toHaveAttribute('target', '_blank');
expect(a).toHaveAttribute('rel', 'noopener noreferrer');
expect(a.querySelector('.asc-qr path')?.getAttribute('d')).toMatch(/^M0 0\.5h7/);
}
});
it('FE-APPSTORE-002: names each store and translates the lines around it', () => {
render(<AppStoreCards />);
const [ios, android] = document.querySelectorAll('a.asc-card');
expect(ios).toHaveTextContent('Download on the');
expect(ios).toHaveTextContent('App Store');
expect(ios).toHaveTextContent('iPhone and iPad');
expect(android).toHaveTextContent('Get it on');
expect(android).toHaveTextContent('Google Play');
expect(android).toHaveTextContent('Phone and tablet');
});
it('FE-APPSTORE-003: the dark tone marks the row, the theme tone does not', () => {
const { unmount } = render(<AppStoreCards tone="dark" className="x" />);
expect(document.querySelector('.asc-row')).toHaveClass('asc-dark', 'x');
unmount();
render(<AppStoreCards />);
expect(document.querySelector('.asc-row')).not.toHaveClass('asc-dark');
});
});
@@ -0,0 +1,65 @@
import React from 'react';
import { useTranslation } from '../../i18n/TranslationContext.js';
import './appStoreCards.css';
/**
* The two app stores TREK is in, each as a card with its QR code: scanned with a
* phone it opens the store page, clicked it opens it here. The README draws the
* same cards. The QR codes are generated from the store addresses below (qrcode,
* margin 0, level M); regenerate them if an address changes.
*/
const APP_STORES = [
{
id: 'ios',
href: 'https://apps.apple.com/app/id6831237775',
store: 'App Store',
captionKey: 'settings.apps.downloadOn',
devicesKey: 'settings.apps.iosDevices',
logo: 'M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701',
qrSize: 29,
qr: 'M0 0.5h7m2 0h1m2 0h1m2 0h5m2 0h7M0 1.5h1m5 0h1m3 0h3m4 0h1m2 0h1m1 0h1m5 0h1M0 2.5h1m1 0h3m1 0h1m1 0h1m5 0h1m1 0h1m3 0h1m1 0h1m1 0h3m1 0h1M0 3.5h1m1 0h3m1 0h1m1 0h1m2 0h2m4 0h1m1 0h1m2 0h1m1 0h3m1 0h1M0 4.5h1m1 0h3m1 0h1m1 0h1m2 0h5m2 0h3m1 0h1m1 0h3m1 0h1M0 5.5h1m5 0h1m1 0h3m1 0h5m1 0h1m1 0h1m1 0h1m5 0h1M0 6.5h7m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h7M8 7.5h3m2 0h1m1 0h2m2 0h2M0 8.5h1m1 0h5m4 0h1m2 0h4m1 0h1m2 0h5M0 9.5h3m2 0h1m2 0h4m3 0h1m3 0h4m1 0h1m3 0h1M0 10.5h4m1 0h7m6 0h1m1 0h1m1 0h2M5 11.5h1m1 0h3m1 0h1m2 0h2m2 0h2m1 0h2m1 0h2m1 0h1M2 12.5h1m3 0h3m1 0h1m1 0h1m2 0h3m5 0h1m1 0h2M0 13.5h1m4 0h1m3 0h1m1 0h1m1 0h2m1 0h1m2 0h6m3 0h1M1 14.5h3m1 0h2m5 0h3m3 0h1m2 0h1m2 0h3M0 15.5h1m2 0h2m2 0h7m2 0h1m1 0h3m3 0h1m2 0h1M3 16.5h2m1 0h1m3 0h1m1 0h1m1 0h1m1 0h4m3 0h1m1 0h2M0 17.5h4m5 0h3m3 0h1m1 0h3m2 0h3m1 0h1m1 0h1M0 18.5h1m1 0h1m2 0h2m8 0h3m2 0h2m2 0h1m1 0h1M0 19.5h1m1 0h2m1 0h1m3 0h4m1 0h1m5 0h2m2 0h1m2 0h1M0 20.5h1m1 0h1m1 0h1m1 0h3m8 0h1m2 0h5m1 0h3M8 21.5h1m1 0h5m2 0h2m1 0h1m3 0h5M0 22.5h7m2 0h1m1 0h1m1 0h2m3 0h3m1 0h1m1 0h3M0 23.5h1m5 0h1m1 0h1m1 0h1m2 0h1m5 0h2m3 0h1M0 24.5h1m1 0h3m1 0h1m1 0h1m2 0h2m1 0h1m2 0h1m2 0h5m1 0h1m1 0h1M0 25.5h1m1 0h3m1 0h1m1 0h2m1 0h1m6 0h1m4 0h1m1 0h2M0 26.5h1m1 0h3m1 0h1m1 0h1m1 0h1m1 0h1m2 0h1m3 0h2m1 0h6M0 27.5h1m5 0h1m2 0h3m3 0h1m2 0h1m1 0h2m1 0h3m1 0h1M0 28.5h7m1 0h2m1 0h1m3 0h2m1 0h2m1 0h1m2 0h1m1 0h1',
},
{
id: 'android',
href: 'https://play.google.com/store/apps/details?id=com.liketrek.trek',
store: 'Google Play',
captionKey: 'settings.apps.getItOn',
devicesKey: 'settings.apps.androidDevices',
logo: 'M22.018 13.298l-3.919 2.218-3.515-3.493 3.543-3.521 3.891 2.202a1.49 1.49 0 0 1 0 2.594zM1.337.924a1.486 1.486 0 0 0-.112.568v21.017c0 .217.045.419.124.6l11.155-11.087L1.337.924zm12.207 10.065l3.258-3.238L3.45.195a1.466 1.466 0 0 0-.946-.179l11.04 10.973zm0 2.067l-11 10.933c.298.036.612-.016.906-.183l13.324-7.54-3.23-3.21z',
qrSize: 37,
qr: 'M0 0.5h7m2 0h1m3 0h1m1 0h1m2 0h1m1 0h3m1 0h2m4 0h7M0 1.5h1m5 0h1m4 0h1m2 0h1m2 0h3m5 0h4m1 0h1m5 0h1M0 2.5h1m1 0h3m1 0h1m1 0h2m2 0h5m2 0h4m1 0h1m1 0h1m3 0h1m1 0h3m1 0h1M0 3.5h1m1 0h3m1 0h1m1 0h2m1 0h1m1 0h1m2 0h5m1 0h1m2 0h2m3 0h1m1 0h3m1 0h1M0 4.5h1m1 0h3m1 0h1m1 0h2m3 0h1m4 0h3m1 0h2m1 0h1m2 0h1m1 0h1m1 0h3m1 0h1M0 5.5h1m5 0h1m1 0h6m4 0h1m3 0h1m2 0h4m1 0h1m5 0h1M0 6.5h7m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h7M8 7.5h1m1 0h4m2 0h1m6 0h1m4 0h1M0 8.5h1m1 0h5m2 0h1m3 0h3m2 0h1m1 0h7m3 0h5M0 9.5h5m5 0h1m4 0h3m3 0h1m4 0h1m1 0h1m2 0h1m3 0h1M0 10.5h3m1 0h4m1 0h3m1 0h1m3 0h1m2 0h9m1 0h1m2 0h1m1 0h2M2 11.5h2m3 0h1m5 0h1m2 0h1m4 0h1m1 0h1m2 0h3m1 0h4m2 0h1M1 12.5h1m1 0h1m2 0h1m3 0h1m1 0h2m2 0h2m2 0h1m1 0h6m1 0h4m1 0h3M0 13.5h1m6 0h1m1 0h3m1 0h1m2 0h6m1 0h2m3 0h1m2 0h1M2 14.5h1m3 0h2m1 0h1m1 0h5m1 0h1m3 0h1m4 0h3m2 0h3m1 0h2M2 15.5h2m3 0h1m1 0h1m2 0h7m2 0h2m5 0h5m2 0h2M1 16.5h1m2 0h3m3 0h2m1 0h2m1 0h1m4 0h1m1 0h1m1 0h3m1 0h2m1 0h1m1 0h1M2 17.5h1m2 0h1m2 0h2m1 0h2m2 0h1m2 0h1m1 0h1m1 0h1m1 0h3m1 0h1m2 0h1m2 0h2M1 18.5h1m4 0h1m3 0h2m2 0h3m2 0h1m2 0h1m3 0h2m1 0h1m2 0h1m2 0h2M1 19.5h3m4 0h5m2 0h1m2 0h5m1 0h1m5 0h3m3 0h1M0 20.5h1m1 0h1m1 0h1m1 0h2m2 0h1m4 0h1m1 0h1m1 0h2m1 0h1m1 0h4m1 0h2m1 0h3M1 21.5h1m6 0h2m1 0h1m1 0h2m1 0h1m1 0h3m1 0h2m4 0h1m4 0h1M2 22.5h1m1 0h5m1 0h1m2 0h4m1 0h1m1 0h1m1 0h1m2 0h1m1 0h1m3 0h3m1 0h2M0 23.5h1m2 0h1m1 0h1m5 0h2m2 0h1m7 0h1m4 0h2m1 0h2m2 0h1M1 24.5h2m3 0h1m3 0h4m4 0h1m1 0h7m1 0h3m1 0h1m1 0h2M0 25.5h4m1 0h1m2 0h4m3 0h2m4 0h1m6 0h1m4 0h1M0 26.5h1m2 0h1m1 0h2m3 0h1m1 0h3m5 0h1m2 0h2m1 0h2m2 0h2m2 0h3M0 27.5h1m1 0h3m3 0h2m6 0h1m4 0h1m1 0h1m2 0h7m2 0h1M0 28.5h1m1 0h1m1 0h1m1 0h1m1 0h2m1 0h2m1 0h1m2 0h1m4 0h4m1 0h9M8 29.5h6m2 0h2m1 0h3m1 0h1m3 0h2m3 0h2m1 0h1M0 30.5h7m2 0h1m5 0h3m2 0h2m4 0h1m1 0h1m1 0h1m1 0h1m1 0h1m1 0h1M0 31.5h1m5 0h1m1 0h1m1 0h6m1 0h8m1 0h3m3 0h2m1 0h1M0 32.5h1m1 0h3m1 0h1m1 0h2m1 0h1m1 0h1m1 0h2m2 0h1m1 0h1m2 0h9m1 0h1m1 0h1M0 33.5h1m1 0h3m1 0h1m1 0h1m2 0h1m1 0h3m2 0h1m1 0h3m1 0h2m3 0h2m1 0h1m1 0h2M0 34.5h1m1 0h3m1 0h1m1 0h1m3 0h1m2 0h2m2 0h1m1 0h2m2 0h5m4 0h1m1 0h1M0 35.5h1m5 0h1m5 0h1m1 0h2m2 0h7m3 0h3m1 0h1m3 0h1M0 36.5h7m1 0h1m1 0h1m1 0h1m1 0h2m1 0h1m1 0h1m3 0h4m2 0h2m1 0h5',
},
] as const;
interface Props {
/** `dark` for a surface that stays dark in either theme, like the release modal. */
tone?: 'theme' | 'dark';
className?: string;
}
export default function AppStoreCards({ tone = 'theme', className }: Props): React.ReactElement {
const { t } = useTranslation();
return (
<div className={['asc-row', tone === 'dark' ? 'asc-dark' : '', className ?? ''].filter(Boolean).join(' ')}>
{APP_STORES.map((s) => (
<a key={s.id} className="asc-card" href={s.href} target="_blank" rel="noopener noreferrer">
<span className="asc-qr" aria-hidden="true">
<svg viewBox={`0 0 ${s.qrSize} ${s.qrSize}`} shapeRendering="crispEdges">
<path className="asc-qr-dots" d={s.qr} />
</svg>
</span>
<span className="asc-text">
<span className="asc-caption">
<svg className="asc-logo" viewBox="0 0 24 24" aria-hidden="true">
<path d={s.logo} />
</svg>
{t(s.captionKey)}
</span>
<span className="asc-store">{s.store}</span>
<span className="asc-devices">{t(s.devicesKey)}</span>
</span>
</a>
))}
</div>
);
}
@@ -0,0 +1,124 @@
/* The store cards: a QR code on its white tile, the store's mark and name beside it.
The theme tone follows the appearance tokens; .asc-dark is for a surface that is
dark in either theme (the release modal). */
.asc-row {
display: grid;
/* Always side by side: two compact cards read as one row of stores. */
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.asc-card {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
padding: 8px 12px 8px 8px;
border-radius: 16px;
border: 1px solid var(--border-faint);
background: var(--bg-card);
color: var(--text-primary);
text-decoration: none;
transition:
transform 160ms ease,
border-color 160ms ease,
box-shadow 160ms ease;
}
.asc-card:hover {
transform: translateY(-1px);
border-color: var(--border-primary);
box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.35); /* a neutral lift shadow */
}
.asc-card:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* A QR code needs its light quiet zone in either theme to scan. */
.asc-qr {
flex: none;
display: grid;
place-items: center;
width: 56px;
height: 56px;
padding: 5px;
border-radius: 10px;
background: #ffffff; /* a QR code needs a white quiet zone to scan */
border: 1px solid var(--border-faint);
}
.asc-qr svg {
width: 100%;
height: 100%;
display: block;
}
.asc-qr-dots {
fill: none;
stroke: #0f172a;
} /* QR modules stay dark on their white tile */
.asc-text {
display: flex;
flex-direction: column;
min-width: 0;
line-height: 1.2;
}
.asc-caption {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: calc(10.5px * var(--fs-scale-caption, 1));
color: var(--text-muted);
white-space: nowrap;
}
.asc-logo {
width: 12px;
height: 12px;
flex: none;
fill: currentColor;
}
.asc-store {
margin-top: 2px;
font-size: calc(16px * var(--fs-scale-subtitle, 1));
font-weight: 700;
letter-spacing: -0.02em;
color: var(--text-primary);
white-space: nowrap;
}
.asc-devices {
margin-top: 2px;
font-size: calc(10.5px * var(--fs-scale-caption, 1));
color: var(--text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.asc-dark .asc-card {
background: linear-gradient(160deg, oklch(1 0 0 / 0.1) 0%, oklch(1 0 0 / 0.045) 62%);
border-color: oklch(1 0 0 / 0.13);
color: #f5f5f7; /* the release modal is dark in either theme */
box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16);
}
.asc-dark .asc-card:hover {
border-color: oklch(1 0 0 / 0.26);
}
.asc-dark .asc-qr {
border-color: transparent;
}
.asc-dark .asc-store {
color: #f5f5f7;
} /* the release modal is dark in either theme */
.asc-dark .asc-caption,
.asc-dark .asc-devices {
color: oklch(1 0 0 / 0.6);
}
@media (prefers-reduced-motion: reduce) {
.asc-card {
transition: none;
}
.asc-card:hover {
transform: none;
}
}
@@ -4,7 +4,7 @@ import type { LucideIcon } from 'lucide-react'
import { useContextMenu, ContextMenu } from '../../../../components/shared/ContextMenu'
import MarkdownText from '../../../../components/shared/MarkdownText'
import { fmtTransitDuration } from '../../../../components/Planner/transitDisplay'
import { legModeMenuItems } from '../../../../components/Planner/useLegModeActions'
import { legModeMenuItems, transitOnlyMenuItems } from '../../../../components/Planner/useLegModeActions'
import { formatTime } from '../../../../utils/formatters'
import { useMPlanTimeline, type MPlanTimelineController } from './useMPlanTimeline'
import { cityPillsForDay } from './planTimelineModel'
@@ -114,16 +114,24 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
const { t, trip, can } = planner
const canEdit = can('day_edit', trip)
const canEditPlaces = can('place_edit', trip)
const openLegMenu = (e: MouseEvent, assignmentId: number, seg: RouteSegment) => {
// Public transit sits under the road profiles, as on the desktop (#2398).
// The tap on a leg while editing: the mode menu of the stop that owns it, its
// outgoing mode for a leg it leaves, its incoming mode for one it enters from a
// booking or the morning hotel, as on the desktop. Public transit sits under the
// road profiles (#2398). A leg no stop owns, a booking's arrival to the hotel, can
// only have transit planned, and stays inert where that is not available.
const legTap = (seg: RouteSegment, owner: { id: number; incoming: boolean } | null): ((e: MouseEvent) => void) | undefined => {
if (!editing) return undefined
const transitLeg = tl.transitLegFor(seg)
legMenu.open(e, legModeMenuItems(
tl.routeModeOptions,
mode => tl.setLegMode(assignmentId, mode),
t,
transitLeg ? () => tl.planTransitLeg(transitLeg, assignmentId) : undefined,
))
const planTransit = transitLeg
? () => tl.planTransitLeg(transitLeg, owner && !owner.incoming ? owner.id : undefined)
: undefined
if (owner) {
const pick = (mode: string | null) => (owner.incoming ? tl.setIncomingLegMode(owner.id, mode) : tl.setLegMode(owner.id, mode))
return e => legMenu.open(e, legModeMenuItems(tl.routeModeOptions, pick, t, planTransit))
}
return planTransit ? e => legMenu.open(e, transitOnlyMenuItems(planTransit, t)) : undefined
}
const owned = (id: number | undefined, incoming: boolean) => (id != null ? { id, incoming } : null)
const day = tl.day
const dayId = day?.id
// A stay chip shows the stay before anything can be changed, as on the
@@ -249,7 +257,12 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
)}
{tl.hotelLegs.top && (
<HotelConnRow seg={tl.hotelLegs.top.seg} name={tl.hotelLegs.top.name} placement="top" />
<HotelConnRow
seg={tl.hotelLegs.top.seg}
name={tl.hotelLegs.top.name}
placement="top"
onTap={legTap(tl.hotelLegs.top.seg, owned(tl.hotelLegs.top.assignmentId, true))}
/>
)}
{dayId != null && daySchedule.byPosition[dayId]?.start.map(si => <PlanScheduleRow key={`${si.pluginId}:${si.id}`} item={si} />)}
@@ -321,13 +334,24 @@ function PlanDayPage({ planner, shell, dayId: pageDayId, active, editing, legMen
/>
)
case 'conn':
return <ConnRow key={row.key} seg={row.seg} onTap={editing && row.assignmentId != null ? e => openLegMenu(e, row.assignmentId!, row.seg) : undefined} />
return (
<ConnRow
key={row.key}
seg={row.seg}
onTap={legTap(row.seg, row.assignmentId != null ? owned(row.assignmentId, false) : owned(row.incomingAssignmentId, true))}
/>
)
}
})}
{dayId != null && daySchedule.byPosition[dayId]?.end.map(si => <PlanScheduleRow key={`${si.pluginId}:${si.id}`} item={si} />)}
{tl.hotelLegs.bottom && (
<HotelConnRow seg={tl.hotelLegs.bottom.seg} name={tl.hotelLegs.bottom.name} placement="bottom" />
<HotelConnRow
seg={tl.hotelLegs.bottom.seg}
name={tl.hotelLegs.bottom.name}
placement="bottom"
onTap={legTap(tl.hotelLegs.bottom.seg, owned(tl.hotelLegs.bottom.assignmentId, false))}
/>
)}
{tl.rows.length === 0 && !editing && (
@@ -534,18 +534,19 @@ export function PlanScheduleRow({ item }: { item: PluginDayScheduleItem }) {
// ── b4b) Accommodation bookend leg (hotel → first stop / last stop → hotel) ──
export function HotelConnRow({ seg, name, placement }: {
export function HotelConnRow({ seg, name, placement, onTap }: {
seg: RouteSegment
name: string
placement: 'top' | 'bottom'
onTap?: (e: MouseEvent) => void
}) {
// Same line as the connectors between two stops, so a bookend leg routed with a
// plugin profile or set to walking reads the same as the rest of the day (#1281).
const travel = (
<div className="flex items-center gap-2 py-px text-[color:var(--m-conn)]">
<TravelLine seg={seg} />
</div>
)
// plugin profile or set to walking reads the same as the rest of the day (#1281),
// and taps the same way. Only the line is the button, the stay's name stays text.
const cls = 'flex w-full items-center gap-2 py-px text-[color:var(--m-conn)]'
const travel = onTap
? <button type="button" onClick={onTap} className={`${cls} transition-transform active:scale-[.98]`}><TravelLine seg={seg} /></button>
: <div className={cls}><TravelLine seg={seg} /></div>
const hotel = (
<div className="flex items-center justify-center gap-[5px] whitespace-nowrap font-geist text-[0.59375rem] font-semibold text-m-muted">
<BedDouble size={11} strokeWidth={2} className="flex-none" />
@@ -31,7 +31,12 @@ export type PlanRow =
| { key: string; kind: 'transport'; item: MergedItem; res: TransportEntry }
| { key: string; kind: 'transit'; item: MergedItem; res: TransportEntry; transit: TransitMeta }
| { key: string; kind: 'note'; item: MergedItem; note: DayNote }
| { key: string; kind: 'conn'; seg: RouteSegment; assignmentId?: number }
/**
* A leg between two rows. `assignmentId` is the stop it leaves, whose outgoing mode it
* uses; a leg that leaves a booking uses the incoming mode of the stop it enters,
* `incomingAssignmentId`, as on the desktop day plan.
*/
| { key: string; kind: 'conn'; seg: RouteSegment; assignmentId?: number; incomingAssignmentId?: number }
export function parseReservationMeta(res: Reservation): Record<string, unknown> {
let meta: unknown = res.metadata
@@ -56,6 +61,26 @@ export function transportSubtitle(res: TransportEntry, t: TranslationFn): string
const sameCoord = (a: [number, number], b: [number, number]): boolean =>
Math.abs(a[0] - b[0]) < 1e-9 && Math.abs(a[1] - b[1]) < 1e-9
/**
* The stops whose mode the two hotel bookend legs use: the first waypoint of the
* day for the leg from the hotel (its incoming mode), the last for the leg back
* (its outgoing mode). Absent where that end of the day is a booking, which no
* stop owns.
*/
export interface BookendOwners {
top?: number
bottom?: number
}
type PlanRowsOptions = {
merged: MergedItem[]
reservations: Reservation[]
routeSegments: RouteSegment[]
dayId: number
toursEnabled?: boolean
places?: Place[]
}
/**
* Map the day's merged items to render rows and slot a travel-time connector
* under the row each drawn leg belongs to. Segments are matched by their exact
@@ -64,14 +89,12 @@ const sameCoord = (a: [number, number], b: [number, number]): boolean =>
* front: they belong to the day's edges, and a stop planned on the hotel's own
* spot would otherwise pair with them (#2501).
*/
export function buildPlanRows(opts: {
merged: MergedItem[]
reservations: Reservation[]
routeSegments: RouteSegment[]
dayId: number
toursEnabled?: boolean
places?: Place[]
}): PlanRow[] {
export function buildPlanRows(opts: PlanRowsOptions): PlanRow[] {
return buildPlanTimeline(opts).rows
}
/** buildPlanRows, plus the stops that own the day's two hotel bookend legs. */
export function buildPlanTimeline(opts: PlanRowsOptions): { rows: PlanRow[]; bookendOwners: BookendOwners } {
const { merged, reservations, routeSegments, dayId } = opts
const pool = routeSegments.filter(s => !s.hotelBookend)
const projected = new Map(projectDayItinerary(
@@ -133,15 +156,24 @@ export function buildPlanRows(opts: {
// A booking whose station is the stop itself leaves a leg that goes nowhere: the
// transit planner saves a journey between two of the day's places at their own
// coordinates. That is no walk and no drive, so it gets no connector.
//
// A leg out of a booking has no stop to keep its mode, so it uses the incoming mode
// of the stop it enters, `toAssignmentId`, the one the route calc routed it in.
type Origin = { at: [number, number]; row: number; assignmentId?: number }
const legs = new Map<number, { seg: RouteSegment; assignmentId?: number }>()
const connect = (origin: Origin | null, to: [number, number], toBooking = false) => {
const legs = new Map<number, { seg: RouteSegment; assignmentId?: number; incomingAssignmentId?: number }>()
const connect = (origin: Origin | null, to: [number, number], toBooking = false, toAssignmentId?: number) => {
if (!origin) return
const seg = takeSegment(origin.at, to)
const fromBooking = origin.assignmentId == null
if (!seg || ((toBooking || fromBooking) && sameCoord(origin.at, to))) return
legs.set(origin.row, { seg, assignmentId: origin.assignmentId })
legs.set(origin.row, {
seg,
assignmentId: origin.assignmentId,
...(fromBooking && toAssignmentId != null ? { incomingAssignmentId: toAssignmentId } : {}),
})
}
// The day's first waypoint, a stop or a booking's departure: the hotel leg runs into it.
let first: { assignmentId?: number } | null = null
let prev: Origin | null = null
for (let i = 0; i < base.length; i++) {
const row = base[i]
@@ -151,7 +183,10 @@ export function buildPlanRows(opts: {
if (row.assignment.route_excluded) continue
const itineraryItem = projected.get(row.assignment.id)
if (itineraryItem?.kind === 'tour') {
if (itineraryItem.start) connect(prev, [itineraryItem.start.lat, itineraryItem.start.lng])
if (itineraryItem.start) {
first ??= { assignmentId: row.assignment.id }
connect(prev, [itineraryItem.start.lat, itineraryItem.start.lng], false, row.assignment.id)
}
prev = itineraryItem.end
? { at: [itineraryItem.end.lat, itineraryItem.end.lng], row: i, assignmentId: row.assignment.id }
: null
@@ -159,7 +194,8 @@ export function buildPlanRows(opts: {
}
if (place?.lat == null || place?.lng == null) continue
const at: [number, number] = [place.lat, place.lng]
connect(prev, at)
first ??= { assignmentId: row.assignment.id }
connect(prev, at, false, row.assignment.id)
// The leg's mode is stored on its ORIGIN place assignment (#1281), so carry
// that id for the tap-to-change menu.
prev = { at, row: i, assignmentId: row.assignment.id }
@@ -171,16 +207,23 @@ export function buildPlanRows(opts: {
if (prev) prev = { ...prev, row: i }
continue
}
if (from) first ??= {}
// Only out of a stop: two bookings back to back are no drive (#1394).
if (from && prev?.assignmentId != null) connect(prev, [from.lat, from.lng], true)
prev = to ? { at: [to.lat, to.lng], row: i } : null
}
}
return base.flatMap((row, i): PlanRow[] => {
const rows = base.flatMap((row, i): PlanRow[] => {
const leg = legs.get(i)
return leg ? [row, { key: `conn-${row.key}`, kind: 'conn', seg: leg.seg, assignmentId: leg.assignmentId }] : [row]
return leg ? [row, { key: `conn-${row.key}`, kind: 'conn', ...leg }] : [row]
})
// The last waypoint is where the day ends: a stop, or a booking's arrival (no owner).
const bookendOwners: BookendOwners = {
...(first?.assignmentId != null ? { top: first.assignmentId } : {}),
...(prev?.assignmentId != null ? { bottom: prev.assignmentId } : {}),
}
return { rows, bookendOwners }
}
export interface HotelChip {
@@ -218,7 +261,12 @@ export function hotelChipsForDay(day: Day, days: Day[], accommodations: Accommod
return chips.filter(c => c.name).sort((a, b) => rank[a.variant] - rank[b.variant])
}
export interface HotelLeg { seg: RouteSegment; name: string }
export interface HotelLeg {
seg: RouteSegment
name: string
/** The stop whose mode the leg uses (see BookendOwners); absent when a booking ends it. */
assignmentId?: number
}
export interface HotelLegs { top: HotelLeg | null; bottom: HotelLeg | null }
/**
@@ -242,17 +290,19 @@ export function hotelLegsForDay(
days: Day[],
accommodations: Accommodation[],
routeSegments: RouteSegment[],
owners: BookendOwners = {},
): HotelLegs {
const { morning, evening } = getDayBookendHotels(day, days, accommodations)
const legOf = (a: Accommodation | undefined, bookend: 'morning' | 'evening'): HotelLeg | null => {
const legOf = (a: Accommodation | undefined, bookend: 'morning' | 'evening', owner?: number): HotelLeg | null => {
if (!a || a.place_lat == null || a.place_lng == null) return null
const at: [number, number] = [a.place_lat, a.place_lng]
const seg = routeSegments.find(s => s.hotelBookend === bookend && sameCoord(bookend === 'morning' ? s.from : s.to, at))
return seg ? { seg, name: accommodationName(a) } : null
if (!seg) return null
return { seg, name: accommodationName(a), ...(owner != null ? { assignmentId: owner } : {}) }
}
// A moving day without stops is one drive from one hotel to the next (#1297). The
// calc tags it as the morning leg, so it shows once, at the top (#2476).
return { top: legOf(morning, 'morning'), bottom: legOf(evening, 'evening') }
return { top: legOf(morning, 'morning', owners.top), bottom: legOf(evening, 'evening', owners.bottom) }
}
/** The day headline as city pills — a "Tokyo → Kyoto" title becomes two pills with an arrow. */
@@ -14,8 +14,8 @@ import type { PlannedTransitLeg, TransitLeg } from '../../../../components/Plann
import { useTransitLegPlanner } from '../../../../components/Planner/useTransitLegPlanner'
import { dayItemOverrun } from '../../../../components/Tours/tourDayTime'
import {
buildPlanRows, breaksChronology, findUpNext, hotelChipsForDay, hotelLegsForDay, itemHasTime,
type HotelLegs, type PlanRow, type TransportEntry,
buildPlanTimeline, breaksChronology, findUpNext, hotelChipsForDay, hotelLegsForDay, itemHasTime,
type BookendOwners, type HotelLegs, type PlanRow, type TransportEntry,
} from './planTimelineModel'
import type { TripPlanner } from '../MTripShell'
import type { WeatherResult } from '@trek/shared'
@@ -99,16 +99,17 @@ export function useMPlanTimeline(planner: TripPlanner, forDayId?: number | null)
tripAccommodations,
)
const rows = useMemo<PlanRow[]>(() => {
if (!day) return []
return buildPlanRows({ merged, reservations, routeSegments: connSegments, dayId: day.id, toursEnabled: planner.toursEnabled, places: planner.places })
const timeline = useMemo<{ rows: PlanRow[]; bookendOwners: BookendOwners }>(() => {
if (!day) return { rows: [], bookendOwners: {} }
return buildPlanTimeline({ merged, reservations, routeSegments: connSegments, dayId: day.id, toursEnabled: planner.toursEnabled, places: planner.places })
}, [day, merged, reservations, connSegments, planner.toursEnabled, planner.places])
const rows = timeline.rows
// Accommodation bookend legs (hotel → first stop, last stop → hotel). The
// segments already sit in connSegments; hotelLegsForDay picks the two out.
const hotelLegs = useMemo<HotelLegs>(
() => (day ? hotelLegsForDay(day, days, tripAccommodations, connSegments) : { top: null, bottom: null }),
[day, days, tripAccommodations, connSegments],
() => (day ? hotelLegsForDay(day, days, tripAccommodations, connSegments, timeline.bookendOwners) : { top: null, bottom: null }),
[day, days, tripAccommodations, connSegments, timeline.bookendOwners],
)
const hotelChips = useMemo(
@@ -375,6 +376,17 @@ export function useMPlanTimeline(planner: TripPlanner, forDayId?: number | null)
persistLegMode(assignmentId, mode)
}, [day, persistLegMode])
// The same for the leg entering a stop: from a booking's arrival or from the
// morning hotel, which no stop leaves (as on the desktop day plan).
const setIncomingLegMode = useCallback((assignmentId: number, mode: string | null) => {
if (!day) return
const key = String(day.id)
useTripStore.setState(state => ({
assignments: { ...state.assignments, [key]: (state.assignments[key] || []).map(a => (a.id === assignmentId ? { ...a, incoming_leg_transport_mode: mode } : a)) },
}))
persistLegMode(assignmentId, mode, 'incoming')
}, [day, persistLegMode])
// ── Public transit for one leg (#2398) ──
// The entry the desktop connector menu carries: the automated search, seeded with
// the leg's two ends and the time the stop it leaves is planned for, between two city
@@ -394,8 +406,9 @@ export function useMPlanTimeline(planner: TripPlanner, forDayId?: number | null)
toursEnabled: planner.toursEnabled, tourOf, onPlan: tripHasDates ? openTransitSearch : undefined,
})
const transitLegFor = useCallback((seg: RouteSegment): TransitLeg | null => (day ? legFor(day.id, seg) : null), [day, legFor])
// `originId` is the stop the leg leaves, which tells two walks ending at one spot apart.
const planTransitLeg = useCallback((leg: TransitLeg, originId: number) => {
// `originId` is the stop the leg leaves, which tells two walks ending at one spot apart;
// a leg that leaves a booking or the hotel has none.
const planTransitLeg = useCallback((leg: TransitLeg, originId?: number) => {
if (day) plan(day.id, leg, originId)
}, [day, plan])
// A saved journey that now arrives after the walk it leads to starts (CW-08).
@@ -414,7 +427,7 @@ export function useMPlanTimeline(planner: TripPlanner, forDayId?: number | null)
moveRowTo,
addPlace, addBooking, addTransport,
optimize, canExportRoute, routeTargets, exportGoogleMaps, exportCoMaps, renameDay, fullPlaceOf,
routeModeOptions, setLegMode, transitLegFor, planTransitLeg, journeyLate, tourOverrun,
routeModeOptions, setLegMode, setIncomingLegMode, transitLegFor, planTransitLeg, journeyLate, tourOverrun,
}
}
@@ -1,4 +1,4 @@
// FE-NATIVE-HANDOFF-001 to FE-NATIVE-HANDOFF-011
// FE-NATIVE-HANDOFF-001 to FE-NATIVE-HANDOFF-012
import React from 'react';
import { MemoryRouter } from 'react-router';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -93,6 +93,16 @@ describe('useNativeHandoff', () => {
expect(rememberHandoffReturn).toHaveBeenCalledWith(`/native-handoff?challenge=${challenge}`);
});
it('FE-NATIVE-HANDOFF-012: goes through the identity provider for SSO even when this browser is still signed in', () => {
// A session left from an earlier sign-in skipped the provider, and with it the
// re-authentication it demands (#3014).
setSearch(`?challenge=${challenge}&start=oidc`);
const { result } = renderHandoff();
expect(window.location.replace).toHaveBeenCalledWith('/api/auth/oidc/login?remember=1');
expect(result.current.ready).toBe(false);
expect(mockNavigate).not.toHaveBeenCalled();
});
it('FE-NATIVE-HANDOFF-005: waits while the session is still being checked', () => {
useAuthStore.setState({ isAuthenticated: false, isLoading: true });
const { result } = renderHandoff();
@@ -35,17 +35,22 @@ export function useNativeHandoff() {
// Back here once signed in, without `start`, so an SSO round trip cannot loop.
const returnPath = `${HANDOFF_PATH}?challenge=${challenge}`;
// The app's SSO button always goes through the identity provider, even when this
// browser still holds a TREK session from an earlier sign-in. That session would
// otherwise skip the provider, and with it a re-authentication it demands.
const startOidc = valid && params.get('start') === 'oidc';
useEffect(() => {
if (!valid || isLoading || isAuthenticated || passkeyStep) return;
if (params.get('start') === 'oidc') {
if (!valid || isLoading || passkeyStep) return;
if (startOidc) {
sessionStorage.setItem('oidc_redirect', returnPath);
rememberHandoffReturn(returnPath);
window.location.replace('/api/auth/oidc/login?remember=1');
return;
}
if (isAuthenticated) return;
void navigate(`/login?redirect=${encodeURIComponent(returnPath)}`, { replace: true });
}, [valid, isLoading, isAuthenticated, passkeyStep, params, returnPath, navigate]);
}, [valid, isLoading, isAuthenticated, passkeyStep, startOidc, returnPath, navigate]);
const openApp = async (): Promise<void> => {
setStatus('sending');
@@ -90,7 +95,7 @@ export function useNativeHandoff() {
passkeyStep: valid && !isLoading && !isAuthenticated && passkeyStep,
continueWithPasskey,
otherSignIn,
ready: valid && !isLoading && isAuthenticated,
ready: valid && !isLoading && isAuthenticated && !startOidc,
userName,
status,
openApp,
@@ -128,6 +128,7 @@ function buildTl(over: Record<string, unknown> = {}): MPlanTimelineController {
{ key: 'plugin:ev/fastest', label: 'EV fastest' },
],
setLegMode: vi.fn(),
setIncomingLegMode: vi.fn(),
transitLegFor: vi.fn(() => null),
planTransitLeg: vi.fn(),
journeyLate: vi.fn(() => null),
@@ -506,6 +507,74 @@ describe('MPlanTimeline', () => {
expect(screen.getByText('7 min').closest('button')).toBeNull()
})
// The legs a booking or the hotel starts: the phone used to leave them inert while
// the desktop opened the mode menu of the stop at their other end.
describe('legs that start at a booking or the hotel', () => {
const HOTEL_SEG: RouteSegment = { ...SEG, drivingText: '12 min', walkingText: '35 min', distanceText: '2.7 km' }
const hotelLeg = () => screen.getByText('12 min').closest('button') as HTMLElement
const leg = { from: { name: 'Budapest Keleti', lat: 47.5, lng: 19.08 }, to: { name: 'Basilica apARTment', lat: 47.5, lng: 19.05 }, time: '19:29' }
it('FE-MOB-PLTL-050: the leg back to the hotel sets the outgoing mode of the last stop', () => {
renderTimeline({ hotelLegs: { top: null, bottom: { seg: HOTEL_SEG, name: 'Basilica', assignmentId: 12 } } }, {}, { mode: 'edit' })
fireEvent.click(hotelLeg())
fireEvent.click(screen.getByText('Walking'))
expect(mocks.tl.setLegMode).toHaveBeenCalledWith(12, 'walking')
expect(mocks.tl.setIncomingLegMode).not.toHaveBeenCalled()
})
it('FE-MOB-PLTL-051: the leg from the hotel sets the incoming mode of the first stop', () => {
renderTimeline({ hotelLegs: { top: { seg: HOTEL_SEG, name: 'Basilica', assignmentId: 11 }, bottom: null } }, {}, { mode: 'edit' })
fireEvent.click(hotelLeg())
fireEvent.click(screen.getByText('dayplan.transportMode.useDefault'))
expect(mocks.tl.setIncomingLegMode).toHaveBeenCalledWith(11, null)
expect(mocks.tl.setLegMode).not.toHaveBeenCalled()
})
it('FE-MOB-PLTL-052: a walk from the train to the hotel that no stop owns offers public transit only', () => {
renderTimeline(
{ hotelLegs: { top: null, bottom: { seg: HOTEL_SEG, name: 'Basilica' } }, transitLegFor: vi.fn(() => leg) },
{}, { mode: 'edit' },
)
fireEvent.click(hotelLeg())
expect(screen.queryByText('Driving')).not.toBeInTheDocument()
expect(screen.queryByText('dayplan.transportMode.useDefault')).not.toBeInTheDocument()
fireEvent.click(screen.getByText('transit.title'))
expect(mocks.tl.planTransitLeg).toHaveBeenCalledWith(leg, undefined)
})
it('FE-MOB-PLTL-053: without a transit search that walk stays plain text', () => {
renderTimeline({ hotelLegs: { top: null, bottom: { seg: HOTEL_SEG, name: 'Basilica' } } }, {}, { mode: 'edit' })
expect(screen.getByText('12 min').closest('button')).toBeNull()
})
it('FE-MOB-PLTL-054: the leg from a booking to the next stop sets the incoming mode of that stop', () => {
const rows: PlanRow[] = [
{ key: 'tr-21', kind: 'transport', item: M_FLIGHT, res: FLIGHT },
{ key: 'conn-tr-21', kind: 'conn', seg: HOTEL_SEG, incomingAssignmentId: 12 },
{ key: 'pl-12', kind: 'place', item: M_PLACE2, assignment: PARK, linkedReservations: [] },
]
renderTimeline({ rows }, {}, { mode: 'edit' })
fireEvent.click(hotelLeg())
fireEvent.click(screen.getByText('Walking'))
expect(mocks.tl.setIncomingLegMode).toHaveBeenCalledWith(12, 'walking')
})
it('FE-MOB-PLTL-055: go mode keeps the hotel legs read-only', () => {
renderTimeline({ hotelLegs: { top: null, bottom: { seg: HOTEL_SEG, name: 'Basilica', assignmentId: 12 } } })
expect(screen.getByText('12 min').closest('button')).toBeNull()
})
})
})
describe('plugin day schedule', () => {
@@ -488,6 +488,23 @@ describe('HotelConnRow', () => {
expect(screen.getByText('1 h 5 min')).toBeInTheDocument()
expect(screen.queryByText('14 min')).not.toBeInTheDocument()
})
it('FE-MOB-PLROW-045: the leg is a button when it can be tapped, the stay name stays text', () => {
const onTap = vi.fn()
render(<HotelConnRow seg={SEG} name="Hotel Sacher" placement="bottom" onTap={onTap} />)
const button = screen.getByRole('button')
expect(button.textContent).toContain('14 min')
expect(button.textContent).not.toContain('Hotel Sacher')
fireEvent.click(button)
expect(onTap).toHaveBeenCalledTimes(1)
})
it('FE-MOB-PLROW-046: without a tap handler nothing on the row is a button', () => {
render(<HotelConnRow seg={SEG} name="Hotel Sacher" placement="top" />)
expect(screen.queryByRole('button')).not.toBeInTheDocument()
})
})
describe('NoteRow', () => {
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest'
import {
breaksChronology, buildPlanRows, cityPillsForDay, findUpNext, getTransitMeta, hotelChipsForDay,
breaksChronology, buildPlanRows, buildPlanTimeline, cityPillsForDay, findUpNext, getTransitMeta, hotelChipsForDay,
hotelLegsForDay, itemHasTime, parseReservationMeta, transportSubtitle,
type TransportEntry,
} from '../../../../src/mobile/screens/trip/plan/planTimelineModel'
@@ -956,3 +956,76 @@ describe('planTimelineModel: a rental car picked up or returned on the day', ()
expect(connectors(rows).map(s => [s.from, s.to])).toEqual([[at(PICKUP), at(MIRADOR)]])
})
})
describe('planTimelineModel: which stop owns a leg that touches a booking or the hotel', () => {
// Day 2 of a stay from day 1 to day 3: the traveller walks from the hotel to the
// museum, takes the train to the lake and walks from the station to the hotel. The
// two legs a booking starts and the two bookend legs are the ones the phone could
// not change before; the desktop takes their mode from the stop at their other end.
const HOTEL = { lat: 47.3769, lng: 8.5417 }
const MUSEUM = { lat: 47.3792, lng: 8.5403 }
const STATION_FROM = { lat: 47.378, lng: 8.54 }
const STATION_TO = { lat: 47.05, lng: 8.31 }
const PIER = { lat: 47.052, lng: 8.309 }
const stay = accommodation({
id: 40, place_id: 950, place_name: 'Hotel Limmat', place_lat: HOTEL.lat, place_lng: HOTEL.lng,
start_day_id: 1, end_day_id: 3,
})
const museum = buildAssignment({ id: 31, day_id: 2, order_index: 0, place: place(960, 'Museum', MUSEUM.lat, MUSEUM.lng) })
const pier = buildAssignment({ id: 32, day_id: 2, order_index: 2, place: place(961, 'Pier', PIER.lat, PIER.lng) })
const train = (id: number, position: number) => buildReservation({
id, type: 'train', title: `IR ${id}`, day_id: 2, end_day_id: 2, day_plan_position: position,
reservation_time: '2026-05-02T11:00', reservation_end_time: '2026-05-02T12:00',
endpoints: [
{ role: 'from', sequence: 0, name: 'Zurich HB', code: null, ...STATION_FROM, timezone: null, local_date: null, local_time: null },
{ role: 'to', sequence: 1, name: 'Lucerne', code: null, ...STATION_TO, timezone: null, local_date: null, local_time: null },
],
})
const timelineOf = (dayAssignments: Assignment[], reservations: Reservation[]) => {
const merged = getMergedItems({
dayAssignments,
dayNotes: [],
dayTransports: getTransportForDay({ reservations, dayId: 2, dayAssignmentIds: dayAssignments.map(a => a.id), days: DAYS }),
dayId: 2,
})
const segments = segmentsOf(buildDayRouteRuns(2, {
days: DAYS, assignments: { '2': dayAssignments }, reservations, accommodations: [stay], optimizeFromAccommodation: true,
}))
const { rows, bookendOwners } = buildPlanTimeline({ merged, reservations, routeSegments: segments, dayId: 2 })
return { rows, legs: hotelLegsForDay(DAY2, DAYS, [stay], segments, bookendOwners) }
}
const conns = (rows: ReturnType<typeof buildPlanRows>) => rows.flatMap(r => (r.kind === 'conn' ? [r] : []))
it('FE-MOB-PTLM-064: the leg out of a booking uses the incoming mode of the stop it reaches', () => {
const { rows } = timelineOf([museum, pier], [train(70, 1)])
expect(rows.map(r => r.kind)).toEqual(['place', 'conn', 'transport', 'conn', 'place'])
const [toStation, toPier] = conns(rows)
// Out of a stop: the stop's own outgoing mode, as before.
expect(toStation).toMatchObject({ assignmentId: 31 })
expect(toStation.incomingAssignmentId).toBeUndefined()
// Out of the train: no stop leaves it, so the pier's incoming mode is the one it uses.
expect(toPier).toMatchObject({ seg: { from: [STATION_TO.lat, STATION_TO.lng], to: [PIER.lat, PIER.lng] }, incomingAssignmentId: 32 })
expect(toPier.assignmentId).toBeUndefined()
})
it('FE-MOB-PTLM-065: the hotel legs belong to the first and the last stop of the day', () => {
const { legs } = timelineOf([museum, pier], [train(70, 1)])
expect(legs.top).toMatchObject({ name: 'Hotel Limmat', assignmentId: 31, seg: { from: [HOTEL.lat, HOTEL.lng], to: [MUSEUM.lat, MUSEUM.lng] } })
expect(legs.bottom).toMatchObject({ name: 'Hotel Limmat', assignmentId: 32, seg: { from: [PIER.lat, PIER.lng], to: [HOTEL.lat, HOTEL.lng] } })
})
it('FE-MOB-PTLM-066: a day that ends with the train has no stop owning the walk to the hotel', () => {
const { legs } = timelineOf([museum], [train(71, 5)])
expect(legs.bottom).toMatchObject({ seg: { from: [STATION_TO.lat, STATION_TO.lng], to: [HOTEL.lat, HOTEL.lng] } })
expect(legs.bottom?.assignmentId).toBeUndefined()
expect(legs.top).toMatchObject({ assignmentId: 31 })
})
it('FE-MOB-PTLM-067: a day that starts with the train has no stop owning the walk from the hotel', () => {
const { legs } = timelineOf([pier], [train(72, -1)])
expect(legs.top).toMatchObject({ seg: { from: [HOTEL.lat, HOTEL.lng], to: [STATION_FROM.lat, STATION_FROM.lng] } })
expect(legs.top?.assignmentId).toBeUndefined()
expect(legs.bottom).toMatchObject({ assignmentId: 32 })
})
})
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 33 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 33 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 32 KiB

+235 -157
View File
@@ -1,12 +1,12 @@
{
"name": "@trek/root",
"version": "5.2.0",
"version": "5.2.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@trek/root",
"version": "5.2.0",
"version": "5.2.1",
"workspaces": [
"client",
"server",
@@ -30,7 +30,7 @@
},
"client": {
"name": "@trek/client",
"version": "5.2.0",
"version": "5.2.1",
"dependencies": {
"@assistant-ui/react": "0.15.37",
"@capacitor/action-sheet": "^8.1.1",
@@ -82,7 +82,7 @@
"@fontsource/yellowtail": "^5.3.0",
"@maplibre/maplibre-gl-leaflet": "0.1.4",
"@noble/hashes": "^1.8.0",
"@simplewebauthn/browser": "^13.3.0",
"@simplewebauthn/browser": "^14.0.0",
"@trek/shared": "*",
"axios": "^1.21.0",
"dexie": "^4.4.7",
@@ -142,7 +142,7 @@
"sharp": "^0.35.5",
"tailwindcss": "^3.4.19",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"vite": "8.3.8",
"vite-plugin-pwa": "^2.0.0",
"vitest": "^4.1.12"
@@ -4935,6 +4935,13 @@
"node": ">=18.0.0"
}
},
"node_modules/@isaacs/nonrecursive-glob-match": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/@istanbuljs/schema": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz",
@@ -7664,130 +7671,192 @@
"tslib": "^2.8.1"
}
},
"node_modules/@peculiar/asn1-cms": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.8.0.tgz",
"integrity": "sha512-NgekZOrSJFSBFLFoLfwePguAWAx7z1+f2TEsWFUMyiqqfntZ4+S/S5hzqME3q4pCA0iOsFKdwiQ35dwY24eVqA==",
"node_modules/@peculiar/asn1-asym-key": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-asym-key/-/asn1-asym-key-2.11.1.tgz",
"integrity": "sha512-YtXR0FbDtjHuNGvWXD4HFE7th5xYwG67O+ApDH/FZsjj5MOrWHzDvqwZ1vm6uFUJtMAkUDcF6VMPGOJ5gnLyUA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-x509-attr": "^2.8.0",
"@peculiar/asn1-pkcs8": "^2.11.1",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-cms": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.11.1.tgz",
"integrity": "sha512-Bk+oatE62dW0Tzzpfk6vdQxfGGEfvuGdWgmijnKjcv7HqZCJISs85z4zw2uDArrk+R1Oel1wts/BBl7HHrtAcA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"@peculiar/asn1-x509-attr": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-csr": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.8.0.tgz",
"integrity": "sha512-akbF8+uvleHs8sejNPQxwmVFuInAg6FMNHOwMILXfP518YfFJwdR3jr6oNUPOaEJfuEhn/vkNOCIT6ASUd4mbg==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.11.1.tgz",
"integrity": "sha512-KVfbXaKng8886/tOPG55t5K1XkTkGbR4amjIJzytXWobFU5nZgw/sKnSpa1hxP17nUSsrOF/7Mt9WUYeyLsi6Q==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-ecc": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.8.0.tgz",
"integrity": "sha512-ohwlk+u9Rv2NOAY1c6MfHj45ATVF8R1DUN/WCgABiRtLi2ZftlZWZX7KvpAbU8v9xPcmoILfELeEABj/rn18AQ==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.11.1.tgz",
"integrity": "sha512-7MSNji77fQa/oN3WAfwagMy8EoJFg50sW4hZ1dtr0zU1BSugit0I2DGpIdPhvkNplopQhz5bogxpn1077eaamA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pfx": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.8.0.tgz",
"integrity": "sha512-5yof1ytoB++RQtaFbqSUJ8pxDJtZT6vbVqZ8XoJ61ph7UjNVvfFwAilnCodqkNsAodpy13gDhoxZXw00pghnyg==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.11.1.tgz",
"integrity": "sha512-2SN2z8qkc2hk/GgTYA8RN54wtsCDZShg9gI2Mq1vLhdj1adcv5fhTbiEmExZUaAMqlizxiEpULQDfHM5iYtn1g==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.8.0",
"@peculiar/asn1-pkcs8": "^2.8.0",
"@peculiar/asn1-rsa": "^2.8.0",
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-cms": "^2.11.1",
"@peculiar/asn1-pkcs8": "^2.11.1",
"@peculiar/asn1-rsa": "^2.11.1",
"@peculiar/asn1-schema": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pkcs8": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.8.0.tgz",
"integrity": "sha512-qAKXtLpBEw9LqhKpjw3ajZSXlBur+ipW+y2ivVBQAG6F6qRx94yO+1ZR4mvw+YaCfKSaOzLeYEzsPaBp4SJELA==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.11.1.tgz",
"integrity": "sha512-HqsSrnpQghRp9SM9QSmR6fa4z/BNktnKq7928+oq4qF0VAnuHZ4cyePKvcxh9fP4taBCP/WHNItlVNsYaQm2qw==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-pkcs9": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.8.0.tgz",
"integrity": "sha512-b5nDWCnkV60+cQ141D6sVVwK9nz64R5n3zSVnklGd+ECdkW2Ol3U1a6yYFlalpSOaD557yuJB64A+q42jG7lUQ==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.11.1.tgz",
"integrity": "sha512-OHFkTg8D2zYafILqFE4KPbqX8srpvd3diGDc2h2cduumawc765mOHGcuFMGvLWlL2bbCMWMmMSCtlXptsOuiPA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.8.0",
"@peculiar/asn1-pfx": "^2.8.0",
"@peculiar/asn1-pkcs8": "^2.8.0",
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-x509-attr": "^2.8.0",
"@peculiar/asn1-cms": "^2.11.1",
"@peculiar/asn1-pfx": "^2.11.1",
"@peculiar/asn1-pkcs8": "^2.11.1",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"@peculiar/asn1-x509-attr": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-rsa": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.8.0.tgz",
"integrity": "sha512-zHEUlCqB2mk7x2lxDwHHJy7hWZOPdGHVlsmITWKB5/PbQo61atbu9PJ/0r9dQNMwFzbKPXZ8uK8/91eUhRznSg==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.11.1.tgz",
"integrity": "sha512-6KwKGjulF489CpidZqkogNgLj6oGzgC4BL2FClM8PuJQ4t5NqT4q4a6A4vrSxBIBhMnL8hGYkLOpbVw0Vq38Tw==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-schema": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.8.0.tgz",
"integrity": "sha512-7YT0U/ze0tF2QOBbE15gKZwy5tvgGyLRiRHLzhlbOpf7BT032oBSd0haZqXn5W6l26WLlu3dyxzjM+2638/z2Q==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.11.1.tgz",
"integrity": "sha512-jaU9OaCcbZUdyXx9hMETZB9xoNmxTGjOGFqd3cOwKFkpKnyKd9WxF3uqj4PvX4cyOMP9bSdHg5YyML2qtx/d/g==",
"license": "MIT",
"dependencies": {
"@peculiar/utils": "^2.0.2",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-x509": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.8.0.tgz",
"integrity": "sha512-N0CMuhWUzsWEVq6F1q9X6+VKUnWzSW+cSVg+aPaGGwDdbFoFWTYgin5MHwXgpWd6y9COMBxnfy/Qc+Xc7F0Zwg==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.11.1.tgz",
"integrity": "sha512-SXU4/X6B3FquqQAN6ARI0bFDUV7+L1WlvPEPMKzEMkstd2D7UyM0r93fv241+OjdhqAKYGx5MvV3gzZMAp0APA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/utils": "^2.0.2",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-x509-attr": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.8.0.tgz",
"integrity": "sha512-tHjkfS/qhMnmrlB2J9NhflQlQ7In3khO3CfmVrriOlpTeErY9ZIKOso1hQ5JQiyrJ7ShvqVPk7E5fQmbclkSKA==",
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.11.1.tgz",
"integrity": "sha512-n7RKFrbTzt8pGBlZ90kmKEn1qsLTTyw7lrvHMK0xsA42kQugPk/GXYpNbEcl7DkkdVsU/one5UX7KQPfxLj8vQ==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-schema": "^2.8.0",
"@peculiar/asn1-x509": "^2.8.0",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/asn1-x509-post-quantum": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-post-quantum/-/asn1-x509-post-quantum-2.11.1.tgz",
"integrity": "sha512-yD/pxCQ97nzwF7MGAW4kRd1WVLiMPhD39HxOnAr38DfGFwbpVhPnMbq+r6WX0XUrxn4w8ulsTdUafwVl46igLA==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-asym-key": "^2.11.1",
"@peculiar/asn1-schema": "^2.11.1",
"@peculiar/asn1-x509": "^2.11.1",
"asn1js": "^3.0.10",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14"
}
},
"node_modules/@peculiar/utils": {
@@ -7800,20 +7869,20 @@
}
},
"node_modules/@peculiar/x509": {
"version": "1.14.3",
"resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
"integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-2.2.0.tgz",
"integrity": "sha512-adpW58ySPQMOUPv8pTKT3RIyCFqfUFt8X05ukPdtkQToXDVr8dMtxuenik1yx8tNFTbpApWsM/Hi5SzlIx48+Q==",
"license": "MIT",
"dependencies": {
"@peculiar/asn1-cms": "^2.6.0",
"@peculiar/asn1-csr": "^2.6.0",
"@peculiar/asn1-ecc": "^2.6.0",
"@peculiar/asn1-pkcs9": "^2.6.0",
"@peculiar/asn1-rsa": "^2.6.0",
"@peculiar/asn1-schema": "^2.6.0",
"@peculiar/asn1-x509": "^2.6.0",
"@peculiar/asn1-cms": "^2.11.0",
"@peculiar/asn1-csr": "^2.11.0",
"@peculiar/asn1-ecc": "^2.11.0",
"@peculiar/asn1-pkcs9": "^2.11.0",
"@peculiar/asn1-rsa": "^2.11.0",
"@peculiar/asn1-schema": "^2.11.0",
"@peculiar/asn1-x509": "^2.11.0",
"@peculiar/asn1-x509-post-quantum": "^2.11.0",
"pvtsutils": "^1.3.6",
"reflect-metadata": "^0.2.2",
"tslib": "^2.8.1",
"tsyringe": "^4.10.0"
},
@@ -10170,15 +10239,15 @@
"license": "Apache-2.0"
},
"node_modules/@simplewebauthn/browser": {
"version": "13.3.0",
"resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-13.3.0.tgz",
"integrity": "sha512-BE/UWv6FOToAdVk0EokzkqQQDOWtNydYlY6+OrmiZ5SCNmb41VehttboTetUM3T/fr6EAFYVXjz4My2wg230rQ==",
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-14.0.0.tgz",
"integrity": "sha512-1odWVqeEBTl7lJ9zMKLEsmTlnyrDO5iRcTvfMKKk1WThUnp/i8JJdffdj2icP+tty159s4PgwE3BiMoEW9NFow==",
"license": "MIT"
},
"node_modules/@simplewebauthn/server": {
"version": "13.3.3",
"resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-13.3.3.tgz",
"integrity": "sha512-LelX/lcy5cjc15A86i/aNxHhB5eU7dd20QsbP0VLAf9e38+SLlsnqCCyecx3xqfGofhmX05h1J9fKRYWxw+luA==",
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-14.1.0.tgz",
"integrity": "sha512-HPRRBR4Vzr45+RVvbmf6JuCfGdYYcSs4Pnnnp9YSY2IABa4JKnG+wxybczoB7rmdLCOMS/mbBa2ZL/Bcz58UlA==",
"license": "MIT",
"dependencies": {
"@hexagon/base64": "^1.1.27",
@@ -10188,10 +10257,12 @@
"@peculiar/asn1-rsa": "^2.6.1",
"@peculiar/asn1-schema": "^2.6.0",
"@peculiar/asn1-x509": "^2.6.1",
"@peculiar/x509": "^1.14.3"
"@peculiar/asn1-x509-post-quantum": "^2.9.4",
"@peculiar/x509": "^2.1.0",
"reflect-metadata": "^0.2.2"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
}
},
"node_modules/@smithy/core": {
@@ -11220,17 +11291,17 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.2.tgz",
"integrity": "sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.73.0.tgz",
"integrity": "sha512-UkygMFer53Yzn29MCYFTHf34hGXf5KJhiDWfIm1tXtXRrym1CS6l5H9Y3yCtPWChpC0/f93H88gdj8tN0dd4kw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/type-utils": "8.72.2",
"@typescript-eslint/utils": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/type-utils": "8.73.0",
"@typescript-eslint/utils": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"ignore": "^7.0.5",
"natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0"
@@ -11243,15 +11314,15 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^8.72.2",
"@typescript-eslint/parser": "^8.73.0",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0"
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.14",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.14.tgz",
"integrity": "sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==",
"version": "7.0.16",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz",
"integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -11259,16 +11330,16 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.2.tgz",
"integrity": "sha512-llP+T1YuJOLlxEciP6OyQGtz5SMxyn+9LA2BvZw5RmToGVa1y4beEDVQL6Gje7T5WFYh19WREjDCN9Ev4gm5AA==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.73.0.tgz",
"integrity": "sha512-AuL45bVcmssHfZ3Di3cs9Q0l4gBm4ZFVrJOQEE7VpqW+PVgQaEwSwazz4TVIiFabXkk6U51EprYDwqw+HR8ePw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"debug": "^4.4.3"
},
"engines": {
@@ -11284,14 +11355,14 @@
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.2.tgz",
"integrity": "sha512-6y5dLTZdHhI8Eh3yIQ/bfQhRKwn5e+TpJj64o18Cngc0iW/BCrVvrr6zGYqXPnYH31u6YXAYiFh0+qxX5mybJw==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.73.0.tgz",
"integrity": "sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.72.2",
"@typescript-eslint/types": "^8.72.2",
"@typescript-eslint/tsconfig-utils": "^8.73.0",
"@typescript-eslint/types": "^8.73.0",
"debug": "^4.4.3"
},
"engines": {
@@ -11306,14 +11377,14 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.2.tgz",
"integrity": "sha512-iIoMJ6/8c1/QpFNyFjU0d1YzPco4MsZjQw0k3V+vfzNWAFmUmvhlyMoYEoYYDQZXc+J6Gi1X5XcxlzW2taIIGQ==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.73.0.tgz",
"integrity": "sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2"
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -11324,9 +11395,9 @@
}
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.2.tgz",
"integrity": "sha512-+h3iCgZXuTNtoLXcnnjP12ZUHLMqoUcIHPfQrFEXTUqvb9dF8QK9b5nv5VtSo5fLkdHuks8ehbTzZj3rImAm9w==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.73.0.tgz",
"integrity": "sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==",
"dev": true,
"license": "MIT",
"engines": {
@@ -11341,15 +11412,15 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.2.tgz",
"integrity": "sha512-STfkR38qIdhfkLpgtXnUjAzsNy4xouqiBO0lrVc/Wpk9Kem5/aHXUx1J8dGC16zpdYN1+yc2ILQ28er1kXX7ag==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.73.0.tgz",
"integrity": "sha512-MOC9i4xy1F7KcDde7Ip8jf1SrRiALb2Km4UWxGNjUE2YlhjIEo1ayE27GHIwIQyfWuHTmEonQT14uyurlyC6aA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2",
"@typescript-eslint/utils": "8.72.2",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0",
"@typescript-eslint/utils": "8.73.0",
"debug": "^4.4.3",
"ts-api-utils": "^2.5.0"
},
@@ -11366,9 +11437,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.2.tgz",
"integrity": "sha512-Xfn37OLZx03+PCU7qWx9DTv2FCRh1E6fk2+wONeNY15HXIwtcwuveaSwVpGAUptkNmPQegRxW5JyRel9T7wrog==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.73.0.tgz",
"integrity": "sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==",
"dev": true,
"license": "MIT",
"engines": {
@@ -11380,18 +11451,18 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.2.tgz",
"integrity": "sha512-pQEGqIK/cqEvKivVWaFLYpe7XYejFxfuAOi4mu1oAWFvIo36aRHI9esRFTUxcIy/z8N482RJyH+LpZB0ZIU7Ow==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.73.0.tgz",
"integrity": "sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/project-service": "8.72.2",
"@typescript-eslint/tsconfig-utils": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/visitor-keys": "8.72.2",
"@typescript-eslint/project-service": "8.73.0",
"@typescript-eslint/tsconfig-utils": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/visitor-keys": "8.73.0",
"debug": "^4.4.3",
"minimatch": "^10.2.2",
"minimatch": "^11.0.1",
"semver": "^7.7.3",
"tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0"
@@ -11404,7 +11475,13 @@
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev",
"typescript": ">=4.8.4 <6.1.0"
},
"peerDependenciesMeta": {
"@typescript/native": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {
@@ -11418,9 +11495,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "5.0.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
"integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz",
"integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -11431,32 +11508,33 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
"version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"version": "11.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz",
"integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"brace-expansion": "^5.0.8"
"@isaacs/nonrecursive-glob-match": "^1.1.0",
"brace-expansion": "^5.0.12"
},
"engines": {
"node": "18 || 20 || >=22"
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@typescript-eslint/utils": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.2.tgz",
"integrity": "sha512-hv3eRYbpPbbpezuax1EfGrzpa3C4ySgNZkPUkLOWOAjU8HsOKowEDAr8C7nsNl1C+SBSKDpvno6VKHnlhvp9iA==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.73.0.tgz",
"integrity": "sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.72.2",
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2"
"@typescript-eslint/scope-manager": "8.73.0",
"@typescript-eslint/types": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -11471,13 +11549,13 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.2.tgz",
"integrity": "sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.73.0.tgz",
"integrity": "sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.72.2",
"@typescript-eslint/types": "8.73.0",
"eslint-visitor-keys": "^5.0.0"
},
"engines": {
@@ -23881,16 +23959,16 @@
}
},
"node_modules/typescript-eslint": {
"version": "8.72.2",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.72.2.tgz",
"integrity": "sha512-c/+AKMW1KB81r28Sp0AAdcyXj5dzNmAsZFcsrxKbZTKmcBK2xIwBR31dcSYSDu3bKmzXe8GKrSxO+eDQ401Uzg==",
"version": "8.73.0",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.73.0.tgz",
"integrity": "sha512-+EnKy9rkYPun4l+kG2bDuYWQ6y1tGVgdR/tY1U9AC6h21CjEwOoc7gsjwe0FXB8uWFzk4QiCFbuRWgX758PiAg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "8.72.2",
"@typescript-eslint/parser": "8.72.2",
"@typescript-eslint/typescript-estree": "8.72.2",
"@typescript-eslint/utils": "8.72.2"
"@typescript-eslint/eslint-plugin": "8.73.0",
"@typescript-eslint/parser": "8.73.0",
"@typescript-eslint/typescript-estree": "8.73.0",
"@typescript-eslint/utils": "8.73.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -25913,7 +25991,7 @@
},
"server": {
"name": "@trek/server",
"version": "5.2.0",
"version": "5.2.1",
"dependencies": {
"@aws-lite/client": "^0.24.1",
"@aws-lite/s3": "^0.2.7",
@@ -25934,7 +26012,7 @@
"@nestjs/schedule": "^12.0.4",
"@nestjs/swagger": "^11.4.7",
"@nestjs/websockets": "^11.2.5",
"@simplewebauthn/server": "^13.3.3",
"@simplewebauthn/server": "^14.1.0",
"@trek/shared": "*",
"archiver": "^6.0.2",
"bcryptjs": "^2.4.3",
@@ -26003,7 +26081,7 @@
"prettier": "^3.10.1",
"prettier-plugin-organize-imports": "^4.3.0",
"supertest": "^7.3.1",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"unplugin-swc": "^1.6.0",
"vitest": "^4.1.11"
},
@@ -26330,7 +26408,7 @@
},
"shared": {
"name": "@trek/shared",
"version": "5.2.0",
"version": "5.2.1",
"dependencies": {
"isomorphic-dompurify": "^3.23.0",
"zod": "^4.6.7"
@@ -26346,7 +26424,7 @@
"prettier-plugin-organize-imports": "^4.3.0",
"tsdown": "^0.23.7",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"vitest": "^4.1.11"
},
"engines": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@trek/root",
"private": true,
"version": "5.2.0",
"version": "5.2.1",
"engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
+1 -1
View File
@@ -52,7 +52,7 @@ DEMO_MODE=false # Demo mode: resets data hourly
# BACKUP_MAX_DECOMPRESSED_MB=5120 # Max size (MB) a restore archive may unpack to, on both restore paths: the zip-bomb guard. Raise it if a large backup is refused with "Backup exceeds the maximum decompressed size". (default: 5120)
# BACKUP_UPLOAD_LIMIT_MB=500 # Max size (MB) of a backup archive you can upload when restoring. Raise it if your backup exceeds 500 MB. If you sit behind a reverse proxy, raise its upload limit too (e.g. nginx client_max_body_size).
# TREK_DB_URL=postgres://trek:password@db:5432/trek # Run on a Postgres database instead of the SQLite file in data/. TREK creates its schema in an empty database and refuses one holding tables it did not create. sslmode=disable, require, verify-ca or verify-full (the last three always verify the certificate; sslrootcert= names the CA file). Cannot be combined with TREK_DB_FILE, TREK_DB_JOURNAL_MODE or TREK_DB_SYNCHRONOUS.
# TREK_DB_URL=postgres://trek:password@db:5432/trek # Run on a Postgres database instead of the SQLite file in data/. TREK creates its schema in an empty database and refuses one holding tables it did not create. sslmode=disable, require, verify-ca or verify-full (the last three always verify the certificate; sslrootcert= names the CA file). A Unix socket: postgresql://trek@localhost/trek?host=/var/run/postgresql (a host= or port= parameter takes the place of the URL's own, as in libpq). Cannot be combined with TREK_DB_FILE, TREK_DB_JOURNAL_MODE or TREK_DB_SYNCHRONOUS.
# TREK_DB_PG_BIN_DIR=/usr/lib/postgresql/18/bin # The directory holding pg_dump, pg_restore and psql, which back up and restore a Postgres database. Unset, TREK looks in /usr/lib/postgresql/<18..14>/bin, newest first, then /usr/local/bin and /usr/bin (the Docker image installs the version 18 tools, which work with every supported server; tools older than the server are refused). Unused on SQLite.
# TREK_DB_POOL_MAX=10 # Most connections TREK opens to the Postgres database (1 to 100). Unused on SQLite. (default: 10)
# TREK_DB_JOURNAL_MODE=WAL # SQLite journal mode (DELETE, TRUNCATE, PERSIST, MEMORY, WAL, OFF). WAL is fastest and the right choice on local disk. Set DELETE if the data directory lives on network storage (Azure App Service, an SMB/NFS volume on a NAS) — WAL coordinates writers through a shared-memory file that those filesystems do not implement reliably. The mode is stored inside the database file, so it survives a restart; changing this applies on the next boot.
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@trek/server",
"version": "5.2.0",
"version": "5.2.1",
"engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
@@ -82,7 +82,7 @@
"@nestjs/schedule": "^12.0.4",
"@nestjs/swagger": "^11.4.7",
"@nestjs/websockets": "^11.2.5",
"@simplewebauthn/server": "^13.3.3",
"@simplewebauthn/server": "^14.1.0",
"@trek/shared": "*",
"archiver": "^6.0.2",
"bcryptjs": "^2.4.3",
@@ -151,7 +151,7 @@
"prettier": "^3.10.1",
"prettier-plugin-organize-imports": "^4.3.0",
"supertest": "^7.3.1",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"unplugin-swc": "^1.6.0",
"vitest": "^4.1.11"
}
+5 -2
View File
@@ -1,3 +1,5 @@
import { pgServerAddress } from './server-address';
import { execFile, spawn } from 'node:child_process';
import fs from 'node:fs';
import path from 'node:path';
@@ -65,9 +67,10 @@ export function resolvePgTool(tool: PgTool, binDir: string | undefined): string
*/
export function pgConnectionEnv(url: string): Record<string, string> {
const parsed = new URL(url);
const address = pgServerAddress(url);
const env: Record<string, string> = {
PGHOST: parsed.hostname.replace(/^\[(.*)\]$/, '$1'),
PGPORT: parsed.port || '5432',
PGHOST: address.host,
PGPORT: String(address.port ?? 5432),
PGDATABASE: decodeURIComponent(parsed.pathname.replace(/^\//, '')),
PGCONNECT_TIMEOUT: CONNECT_TIMEOUT_SECONDS,
};
@@ -5,6 +5,7 @@ import type { DatabaseEngine } from '../engine';
import { redactUrl } from '../redact-url';
import { TrekPostgreSqlDriver } from './postgres-driver';
import { bootstrapPostgresSchema, defaultPostgresBootstrapDeps, type PostgresBootstrapDeps } from './schema-bootstrap';
import { pgServerAddress } from './server-address';
import { putTempSchemaLast } from './session-search-path';
import { sslOptionFor } from './ssl';
import type { EntityManager } from '@mikro-orm/core';
@@ -84,9 +85,13 @@ export class PostgresEngine implements DatabaseEngine {
/** Every new pool connection first puts `pg_temp` last on its `search_path` (`session-search-path.ts`). */
ormOptions() {
const ssl = sslOptionFor(this.settings.url);
// MikroORM takes the address from the URL's authority alone; a `host` parameter (a socket directory) would be lost.
const { host, port } = pgServerAddress(this.settings.url);
return {
driver: TrekPostgreSqlDriver,
clientUrl: this.settings.url,
host,
port,
pool: { min: 0, max: this.settings.poolMax },
driverOptions: ssl === undefined ? {} : { ssl },
onCreateConnection: (connection: unknown) => putTempSchemaLast(connection as DatabaseConnection),
@@ -0,0 +1,28 @@
/** Where the Postgres server listens, as TREK_DB_URL names it. */
interface PgServerAddress {
/** A host name, an IP address, or the directory of a Unix socket (a path starting with `/`); empty when the URL names none. */
host: string;
port: number | undefined;
}
/**
* The server address in `url`, read the way libpq reads a connection URL: a
* `host` or `port` query parameter takes the place of the URL's own, so
* `postgresql://trek@localhost/trek?host=/var/run/postgresql` connects through
* the socket in that directory, and a host written into the URL itself is
* percent-decoded (`%2Fvar%2Frun%2Fpostgresql`). The app's pool and the client
* tools both connect to this one address, so a backup reaches the database
* the app runs on.
*/
export function pgServerAddress(url: string): PgServerAddress {
const parsed = new URL(url);
const params = parsed.searchParams;
const host = params.get('host') ?? decodeURIComponent(parsed.hostname.replace(/^\[(.*)\]$/, '$1'));
const rawPort = params.get('port') ?? parsed.port;
if (rawPort === '') return { host, port: undefined };
const port = Number(rawPort);
if (!/^\d+$/.test(rawPort) || port < 1 || port > 65535) {
throw new Error(`TREK_DB_URL names port "${rawPort}", which is not a port number.`);
}
return { host, port };
}
@@ -3,7 +3,7 @@ import { accommodationIdMatches } from './reservation-accommodation';
import type { SqlEntityManager } from '@mikro-orm/sql';
/** The tables `passContextQuery` reads. */
type PassContextDB = Pick<DB, 'reservations' | 'trips' | 'places' | 'day_accommodations'>;
type PassContextDB = Pick<DB, 'reservations' | 'trips' | 'places' | 'day_accommodations' | 'days'>;
/** What a booking's Wallet pass needs beyond the booking: where it is, and the trip's name. */
export interface ReservationPassContext {
@@ -11,11 +11,21 @@ export interface ReservationPassContext {
place_lat: number | null;
place_lng: number | null;
place_name: string | null;
/** The date of the day the booking is linked to, and of the day it ends on. */
day_date: string | null;
end_day_date: string | null;
/** A hotel's stay: its first and last day, and its check-in and check-out times. */
stay_start_date: string | null;
stay_end_date: string | null;
stay_check_in: string | null;
stay_check_out: string | null;
}
/**
* The trip's title and the place a booking is at (its own place, else its
* stay's), for its Apple Wallet pass (`ReservationsRepository.findPassContext`).
* stay's), for its Apple Wallet pass (`ReservationsRepository.findPassContext`),
* and the dates of the days it is linked to: a day-linked booking, or a hotel
* whose dates live on its stay, carries no date of its own.
* Scoped to the trip, so a booking of another trip reads as none. Kept out of
* the repository file, which is at its size baseline. `em` is the repository's
* own, which has checked the request context.
@@ -35,6 +45,10 @@ export async function passContextQuery(
join.on((eb) => accommodationIdMatches(platform, eb, 'r.accommodation_id', 'ap.id')),
)
.leftJoin('places as acc_p', 'acc_p.id', 'ap.place_id')
.leftJoin('days as rd', 'rd.id', 'r.day_id')
.leftJoin('days as red', 'red.id', 'r.end_day_id')
.leftJoin('days as asd', 'asd.id', 'ap.start_day_id')
.leftJoin('days as aed', 'aed.id', 'ap.end_day_id')
.where('r.id', '=', id)
.where('r.trip_id', '=', trip_id)
.select([
@@ -42,6 +56,12 @@ export async function passContextQuery(
(eb) => eb.fn.coalesce('p.lat', 'acc_p.lat').as('place_lat'),
(eb) => eb.fn.coalesce('p.lng', 'acc_p.lng').as('place_lng'),
(eb) => eb.fn.coalesce('p.name', 'acc_p.name').as('place_name'),
'rd.date as day_date',
'red.date as end_day_date',
'asd.date as stay_start_date',
'aed.date as stay_end_date',
'ap.check_in as stay_check_in',
'ap.check_out as stay_check_out',
])
.executeTakeFirst();
return row as ReservationPassContext | undefined;
@@ -5,6 +5,7 @@ import type { AiConnectionRow, AiConnectionsRepository } from '../../db/reposito
import { readCappedJson } from '../../utils/cappedFetch';
import { decodeJson, encodeJson } from '../../utils/json-column';
import { safeFetch } from '../../utils/ssrfGuard';
import { logWarn } from '../audit/audit-log.logger';
import { OidcService } from '../oidc/oidc.service';
import { AI_AUTH_FLOW_TTL_MS, AiAuthFlowStore } from './ai-auth-flow.store';
import { aiRefusal, providerRefusal } from './ai-connections.constants';
@@ -64,16 +65,24 @@ const tokenResponseSchema = z.object({
});
type TokenResponse = z.infer<typeof tokenResponseSchema>;
/** The token endpoint said no, with its HTTP status and its error code. */
/** The token endpoint said no, with its HTTP status, its error code and the reason it gave. */
class TokenEndpointError extends Error {
constructor(
readonly status: number,
readonly code: string | undefined,
readonly description?: string,
) {
super(`token endpoint ${status}${code ? ` (${code})` : ''}`);
super(`token endpoint ${status}${code ? ` (${code})` : ''}${description ? `: ${description}` : ''}`);
}
}
/** The OAuth `error_description` of a refusal, cut to one log line. */
function errorDescriptionOf(body: unknown): string | undefined {
if (!body || typeof body !== 'object') return undefined;
const text = (body as Record<string, unknown>).error_description;
return typeof text === 'string' && text ? text.slice(0, 300) : undefined;
}
function randomToken(): string {
return randomBytes(32).toString('base64url');
}
@@ -348,11 +357,14 @@ export class ChatgptAuthService {
resource: RESOURCE,
});
} catch (err) {
// A code that is refused has expired or was used already: the sign-in starts over.
if (err instanceof TokenEndpointError && err.status === 400) {
throw aiRefusal('expired', 'The sign-in took too long; start it again');
if (!(err instanceof TokenEndpointError) || err.status === 0 || err.status >= 500) {
throw aiRefusal('provider_unavailable', 'ChatGPT is not responding');
}
throw aiRefusal('provider_unavailable', 'ChatGPT is not responding');
// The endpoint's own words, so an admin can tell an expired code from a client or redirect it refused.
logWarn(`[AI] ChatGPT sign-in: the token endpoint refused the code, ${err.message}`);
// Only invalid_grant means the code ran out or was used already; anything else is not the user's delay.
if (err.code === 'invalid_grant') throw aiRefusal('expired', 'The sign-in took too long; start it again');
throw aiRefusal('generic', `ChatGPT refused the sign-in (${err.code ?? `HTTP ${err.status}`})`);
}
}
@@ -407,7 +419,7 @@ export class ChatgptAuthService {
throw new TokenEndpointError(0, undefined);
}
const json = await readCappedJson<unknown>(res, MAX_TOKEN_BYTES);
if (!res.ok) throw new TokenEndpointError(res.status, errorCodeOf(json));
if (!res.ok) throw new TokenEndpointError(res.status, errorCodeOf(json), errorDescriptionOf(json));
const parsed = tokenResponseSchema.safeParse(json);
if (!parsed.success) throw new TokenEndpointError(res.status, 'unreadable_answer');
return parsed.data;
+2 -2
View File
@@ -34,7 +34,7 @@ import {
reverseGeocodeRegion,
} from './atlas-geo';
import type { RegionInfo } from './atlas-geo';
import { KNOWN_COUNTRIES } from './known-countries';
import { isCountryName } from './known-countries';
import { cityFromAddress } from './city-from-address';
import { transferEndpointIds } from './transfer-endpoints';
import { countryVisitDates } from './visit-dates';
@@ -1046,7 +1046,7 @@ export class AtlasService {
// Explicit null checks: lat/lng of exactly 0 (equator / prime meridian)
// are valid coordinates a falsy check would drop.
if (p.lat != null && p.lng != null) coords.push({ lat: p.lat, lng: p.lng });
const city = cityFromAddress(p.address, (part) => KNOWN_COUNTRIES.has(part), p.region_name);
const city = cityFromAddress(p.address, isCountryName, p.region_name);
if (city && !cities.has(city.toLowerCase())) cities.set(city.toLowerCase(), city);
}
return { totalPlaces: places.length, cities: [...cities.values()], coords };
+44 -3
View File
@@ -60,6 +60,25 @@ function normalize(value: string): string {
return value.trim().toLowerCase();
}
/** A part that is a postcode and nothing else ("10117", "150-0002"), as the TREK index writes it. */
function isBarePostcode(part: string): boolean {
let rest = part;
for (const pattern of POSTCODES) rest = rest.replace(pattern, ' ');
return rest !== part && !/[\p{L}\d]/u.test(rest);
}
/**
* The generic word a geocoder writes after a region's own name: "Kaafu Atoll" for
* the region the map calls Kaafu. Without it the atoll was read as the city, and
* every island in it counted as one (#3200).
*/
const REGION_WORD = /\s+(?:atoll|province|region|state|prefecture|county|governorate|oblast)$/i;
function sameRegion(part: string, region: string): boolean {
const name = normalize(part);
return name === region || name.replace(REGION_WORD, '') === region;
}
export function cityFromAddress(
address: string | null | undefined,
isKnownCountry: (part: string) => boolean,
@@ -76,21 +95,43 @@ export function cityFromAddress(
const region = regionName ? normalize(regionName) : null;
// The TREK index writes "street, postcode, locality" with no country: the locality
// is the city, whatever the region is called (#3200).
const tail = parts[parts.length - 1] as string;
if (
parts.length >= 3 &&
isBarePostcode(parts[parts.length - 2] as string) &&
!isKnownCountry(tail) &&
!hasDigits(tail) &&
/\p{L}/u.test(tail)
) {
return tail;
}
// A geocoder always ends on the country, so drop the last part outright once the
// address is long enough for that to be certain. The country-name list below still
// runs for every part, but it is a finite list (it has no "Nederland", for one), and
// this way a country it has never heard of cannot be counted as a city.
const last = parts.length >= 3 ? parts.length - 2 : parts.length - 1;
// A city that is its own region (Berlin, Wien, Malé) is skipped like any region,
// but written beside its postcode ("10117 Berlin") it is the city of the address.
// It counts when no part before it names a city (#3200).
let cityRegion: string | null = null;
// Index 0 stays out of the running: geocoders lead with the place itself.
for (let i = last; i >= 1; i--) {
const part = hasDigits(parts[i]) ? besidePostcode(parts[i]) : parts[i];
const withPostcode = hasDigits(parts[i]);
const part = withPostcode ? besidePostcode(parts[i]) : parts[i];
if (!part) continue;
if (isKnownCountry(part)) continue;
if (region && normalize(part) === region) continue;
if (region && sameRegion(part, region)) {
if (withPostcode) cityRegion ??= part;
continue;
}
// Anything with no letter at all (stray punctuation, a lone dash) is not a name.
if (!/\p{L}/u.test(part)) continue;
return part;
}
return null;
return cityRegion;
}
+34 -1
View File
@@ -1,3 +1,5 @@
import { SUPPORTED_LANGUAGES } from '@trek/shared';
/**
* Country names, English and German, used to tell a city apart from a country
* when splitting a free-text place address. Moved here from auth.helpers.ts
@@ -6,7 +8,7 @@
* Deliberately not ISO codes: it matches against whatever the geocoder wrote
* into places.address, which is display text in the user's language.
*/
export const KNOWN_COUNTRIES = new Set([
const KNOWN_COUNTRIES = new Set([
// Nominatim inserts an extra tier above the country for France and its overseas
// territories, which reads exactly like a place name and would otherwise be counted
// as a city.
@@ -186,3 +188,34 @@ export const KNOWN_COUNTRIES = new Set([
'Belarus',
'Weissrussland',
]);
/**
* Every country's name in every language TREK speaks, as the platform's ICU writes
* it, lower-cased. The list above is English and German only, so an address ending
* in "Maldives", "Österreich" or "Italia" counted the country as its city (#3200).
* The TREK index writes its country with the same Intl names.
*/
const COUNTRY_NAMES: ReadonlySet<string> = (() => {
const names = new Set<string>();
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (const { locale } of SUPPORTED_LANGUAGES) {
let display: Intl.DisplayNames;
try {
display = new Intl.DisplayNames([locale], { type: 'region', fallback: 'none' });
} catch {
continue;
}
for (const a of letters) {
for (const b of letters) {
const name = display.of(a + b);
if (name) names.add(name.normalize('NFC').toLowerCase());
}
}
}
return names;
})();
/** Whether a part of an address names a country, in any language TREK speaks. */
export function isCountryName(part: string): boolean {
return KNOWN_COUNTRIES.has(part) || COUNTRY_NAMES.has(part.trim().normalize('NFC').toLowerCase());
}
+5 -4
View File
@@ -20,7 +20,6 @@ import {
verifyRegistrationResponse,
generateAuthenticationOptions,
verifyAuthenticationResponse,
type AuthenticatorTransportFuture,
} from '@simplewebauthn/server';
import bcrypt from 'bcryptjs';
@@ -72,11 +71,11 @@ function originFromResponse(resp: unknown): string | null {
return typeof origin === 'string' ? origin : null;
}
function parseTransports(raw: string | null): AuthenticatorTransportFuture[] | undefined {
function parseTransports(raw: string | null): string[] | undefined {
if (!raw) return undefined;
try {
const parsed = JSON.parse(raw);
return Array.isArray(parsed) ? (parsed as AuthenticatorTransportFuture[]) : undefined;
const parsed: unknown = JSON.parse(raw);
return Array.isArray(parsed) ? parsed.filter((t): t is string => typeof t === 'string') : undefined;
} catch {
return undefined;
}
@@ -308,6 +307,8 @@ export class PasskeyService {
expectedOrigin,
expectedRPID: cfg.rpID,
requireUserVerification: true,
// The same list the options offered, so the verifier never falls back to its own default.
supportedAlgorithmIDs: SUPPORTED_ALGORITHM_IDS,
});
} catch (err) {
// Body stays the generic 400 (parity), but the operator gets to see WHY —
+50 -10
View File
@@ -2,7 +2,7 @@ import { getAppUrl, readEnv } from '../../app-config';
import { AppSettings } from '../../db/entities/AppSettings.entity';
import type { AppSettingsRepository } from '../../db/repositories/AppSettings.repository';
import { InjectRepository } from '@mikro-orm/nestjs';
import { Injectable } from '@nestjs/common';
import { Injectable, Logger } from '@nestjs/common';
function hostOf(url: string): string | null {
try {
@@ -19,6 +19,23 @@ function isIpHost(host: string): boolean {
return false;
}
/**
* An http(s) origin reduced to the scheme, host and port the browser reports
* (`new URL(o).origin`), so a configured path, trailing slash or uppercase host
* still matches. @simplewebauthn/server refuses such an expected origin
* outright, where older releases only failed to match it. Any other scheme (an
* app package origin) is kept as written. Null when the value does not parse.
*/
function normalizeOrigin(origin: string): string | null {
let url: URL;
try {
url = new URL(origin);
} catch {
return null;
}
return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : origin;
}
/**
* The scope rule WebAuthn itself applies when the browser runs a ceremony: the
* origin's host must equal the RP ID or be a subdomain of it, over https
@@ -70,8 +87,25 @@ export interface WebauthnConfig {
*/
@Injectable()
export class WebauthnConfigService {
private readonly logger = new Logger(WebauthnConfigService.name);
constructor(@InjectRepository(AppSettings) private readonly appSettings: AppSettingsRepository) {}
/** Normalizes every origin, dropping (and naming) the ones that do not parse. */
private normalizeOrigins(origins: string[]): string[] {
const normalized: string[] = [];
const unparseable: string[] = [];
for (const origin of origins) {
const value = normalizeOrigin(origin);
if (value === null) unparseable.push(origin);
else normalized.push(value);
}
if (unparseable.length > 0) {
this.logger.warn(`Ignoring passkey origins that are not valid URLs: ${unparseable.join(', ')}`);
}
return Array.from(new Set(normalized));
}
/** `SELECT value FROM app_settings WHERE key = ?` (WC1), through `AppSettingsRepository.getValue` (Plan 3a). */
private async setting(key: string): Promise<string | null> {
const raw = (await this.appSettings.getValue(key)) ?? undefined;
@@ -85,14 +119,18 @@ export class WebauthnConfigService {
* disabled so nobody can enrol a credential bound to the wrong origin.
*/
async resolve(): Promise<WebauthnConfig | null> {
// 1. Explicit operator config always wins.
const explicitRpId = (readEnv().webauthn.rpId || (await this.setting('webauthn_rp_id')))?.trim() || null;
const explicitOrigins = (readEnv().webauthn.origins || (await this.setting('webauthn_origins')) || '')
// 1. Explicit operator config always wins. Host names compare without case,
// and the verifier refuses an RP ID that is not in its lower-case form.
const explicitRpId =
(readEnv().webauthn.rpId || (await this.setting('webauthn_rp_id')))?.trim().toLowerCase() || null;
const configuredOrigins = (readEnv().webauthn.origins || (await this.setting('webauthn_origins')) || '')
.split(',')
// The lookbehind matches only the first slash of the trailing run. Without it the
// engine retries from every slash, which is quadratic on a slash-heavy value.
.map((o) => o.trim().replace(/(?<!\/)\/+$/, ''))
.filter(Boolean);
const explicitOrigins = this.normalizeOrigins(configuredOrigins);
const hasExplicitOrigins = configuredOrigins.length > 0;
const appUrl = getAppUrl();
const appHost = hostOf(appUrl);
@@ -104,12 +142,14 @@ export class WebauthnConfigService {
}
if (!rpID) return null; // bare IP / unresolved → WebAuthn cannot be used here
// 3. Resolve the allowed origins. Explicit list wins verbatim (operator's
// responsibility). Otherwise derive a SINGLE origin from APP_URL — we never
// silently union dev localhost origins into a production allow-list.
// 3. Resolve the allowed origins. Explicit list wins (operator's
// responsibility); a list whose every entry failed to parse stays explicit
// and leaves the feature unconfigured rather than falling back to APP_URL.
// Otherwise derive a SINGLE origin from APP_URL; we never silently union
// dev localhost origins into a production allow-list.
let origins = explicitOrigins;
if (origins.length === 0) {
if (appHost) origins = [appUrl.replace(/(?<!\/)\/+$/, '')];
if (!hasExplicitOrigins) {
if (appHost) origins = this.normalizeOrigins([appUrl.replace(/(?<!\/)\/+$/, '')]);
if (rpID === 'localhost') {
// Dev: the browser origin is the Vite dev server (:5173), not the API port.
origins = Array.from(new Set([...origins, 'http://localhost:5173', 'http://localhost:3001']));
@@ -117,7 +157,7 @@ export class WebauthnConfigService {
}
if (origins.length === 0) return null;
return { rpID, rpName: 'TREK', origins, explicitOrigins: explicitOrigins.length > 0 };
return { rpID, rpName: 'TREK', origins, explicitOrigins: hasExplicitOrigins };
}
/** True when a usable RP ID resolves for this deployment (exposed as a pure boolean on app-config). */
@@ -77,34 +77,64 @@ const PHOTO_UNION_HINT = [
].join('\n');
/**
* Keyword → reservation type, so an obvious document skips the costlier union/strong path.
* Keyword → reservation type, so an obvious document skips the union schema.
*
* Order is the whole rule: the first pattern that matches wins. Lodging used to be
* tested second, on a group that included "check-in"/"check-out" — words printed on
* nearly every ferry, train and bus ticket there is — so a ferry ticket came back as
* a hotel and the user was handed a booking form with no transport type on it
* (#2076). Transport is tested first now, and the lodging pattern asks for a word
* that actually names lodging.
* A word that names a type is not proof the document IS that type: a hotel
* confirmation names the train station and the airport bus, a ferry ticket lists
* its cabin as "accommodation". When the first matching pattern decided, transport
* sat first in the table (#2076), so a hotel that named a bus came back a bus or
* ferry booking, extracted with a schema that has no hotel name, address or dates,
* and the import dropped it. So readType only decides alone when the document names
* one type. When it names several, the model picks between exactly those.
*
* "pick-up"/"drop-off" are gone from the rental pattern for the same reason: they
* appear on ferry, bus and airport-transfer vouchers. A rental names its rental.
* Lodging asks for a word that names lodging, never "check-in"/"check-out" (printed
* on nearly every ticket there is), and the rental pattern never "pick-up"/"drop-off"
* (printed on ferry, bus and airport-transfer vouchers). A rental names its rental.
*/
const TYPE_KEYWORDS: [FlatType, RegExp][] = [
['train', /\b(deutsche\s*bahn|bahn|train|railway|\bice\b|\bzug\b|gleis|sncf|trenitalia|renfe)\b/i],
['bus', /\b(flixbus|\bbus\b|coach|omnibus)\b/i],
['train', /\b(deutsche\s*bahn|bahn|train|railway|ice|zug|gleis|sncf|trenitalia|renfe)\b/i],
['bus', /\b(flixbus|bus|coach|omnibus)\b/i],
['ferry', /\b(f(?:ä|ae)hre|ferry|cruise|kreuzfahrt|einschiffung)\b/i],
['car', /\b(sixt|europcar|hertz|avis|enterprise|mietwagen|rental\s*car|autovermietung|anmietung)\b/i],
['hotel', /\b(hotel|(?:ü|ue)bernachtung|zimmer|room\s*night|lodging|airbnb|b&b|hostel|pension)\b/i],
['restaurant', /\b(restaurant|\btisch\b|table\s*for|men(?:ü|u)|gedeck)\b/i],
['event', /\b(ticket|concert|konzert|veranstaltung|eintritt|admission)\b/i],
[
'hotel',
/\b(hotels?|motel|(?:ü|ue)bernachtung|unterkunft|ferienwohnung|zimmer|room\s*night|lodging|accommodation|apartment|guest\s*house|airbnb|b&b|hostel|pension)\b/i,
],
['restaurant', /\b(restaurant|tisch|table\s*for|men(?:ü|u)|gedeck)\b/i],
];
/** The transport half of the table, for the flight gate below. */
/**
* "Ticket" is printed on every train, bus and ferry ticket, so the event words
* decide only for a document that names no other type at all.
*/
const EVENT_KEYWORDS = /\b(ticket|concert|konzert|veranstaltung|eintritt|admission)\b/i;
/** The transport half of the table, for the flight gate in readType. */
const TRANSPORT_FLAT_TYPES = new Set<FlatType>(['train', 'bus', 'ferry', 'car']);
function detectType(text: string): FlatType | null {
for (const [type, re] of TYPE_KEYWORDS) if (re.test(text)) return type;
return null;
/**
* What the keywords say about a document: the one type it names, or the types it
* names, in table order, for the model to choose between. Both empty means it names
* none, and the model picks from every type.
*/
interface TypeReading {
type: FlatType | null;
candidates: FlatType[];
}
/** Read the reservation type off the document's own words; see TYPE_KEYWORDS. */
function readType(text: string): TypeReading {
const named = TYPE_KEYWORDS.filter(([, re]) => re.test(text)).map(([type]) => type);
// The flight path forces type 'flight' on everything it returns, so it must not
// claim a document that names another kind of transport: a German rail ticket
// carries numbers like "IC 2023" or "RE 4711", which the two-letters-plus-digits
// test cannot tell from an airline code (#2076).
if (detectFlightNumbers(text).length > 0 && !named.some((type) => TRANSPORT_FLAT_TYPES.has(type))) {
return { type: 'flight', candidates: [] };
}
if (named.length > 1) return { type: null, candidates: named };
if (named.length === 1) return { type: named[0], candidates: [] };
return { type: EVENT_KEYWORDS.test(text) ? 'event' : null, candidates: [] };
}
/** Detect flight numbers (order-preserving, deduped) — also the "is this a flight doc" test. */
@@ -260,10 +290,30 @@ async function extractFlights(text: string, ctx: RouterContext): Promise<FlatLik
return legs.map((leg) => fixArrivalDate(normalizeDates({ ...leg, type: 'flight' as FlatType })));
}
/** One enforced call for a single reservation — a type-specific schema when the type is
* obvious from keywords, else a union schema the model fills with the type it picks. */
async function extractSingle(text: string, ctx: RouterContext, images?: Buffer[]): Promise<FlatLike> {
const known = detectType(text);
/** The union schema with its type narrowed to the given candidates. */
function unionSchemaFor(candidates: FlatType[]): Record<string, unknown> {
const properties = UNION_SINGLE_SCHEMA.properties as Record<string, unknown>;
return { ...UNION_SINGLE_SCHEMA, properties: { ...properties, type: { type: 'string', enum: candidates } } };
}
/** The union hint for a document that names several types: only those, each with its field meanings. */
function candidateHint(candidates: FlatType[]): string {
return [
`Pick the correct "type", one of: ${candidates.join(', ')}. Then fill its fields:`,
...candidates.map((type) => `- ${type}: ${TYPE_HINT[type]}`),
].join('\n');
}
/** One enforced call for a single reservation — a type-specific schema when the keywords
* name one type, a union narrowed to the named types when they name several, else a
* union over every type that the model fills with the type it picks. */
async function extractSingle(
text: string,
ctx: RouterContext,
reading: TypeReading,
images?: Buffer[],
): Promise<FlatLike> {
const known = reading.type;
const call = (schema: Record<string, unknown>, hint: string) =>
extractEnforced({
baseUrl: ctx.baseUrl,
@@ -280,6 +330,14 @@ async function extractSingle(text: string, ctx: RouterContext, images?: Buffer[]
const out = (await call(FLAT_SCHEMA_BY_TYPE[known], `It is a ${TYPE_HINT[known]}`)) ?? {};
return fixArrivalDate(normalizeDates({ ...out, type: known }));
}
if (reading.candidates.length > 0) {
const out = (await call(unionSchemaFor(reading.candidates), candidateHint(reading.candidates))) ?? {};
const raw = typeof out.type === 'string' ? out.type.toLowerCase().trim() : '';
// A server without grammar enforcement can still answer outside the list. The
// document named the candidates, so the first of them is the best reading left.
const type = reading.candidates.find((candidate) => candidate === raw) ?? reading.candidates[0];
return fixArrivalDate(normalizeDates({ ...out, type }));
}
const out = (await call(UNION_SINGLE_SCHEMA, images?.length ? PHOTO_UNION_HINT : 'Pick the correct "type".')) ?? {};
// "I could not tell" used to be written down as "hotel", and a hotel is a
// booking, so a ferry voucher imported from the Transport tab opened the
@@ -337,14 +395,8 @@ export async function routeExtraction(text: string, ctx: RouterContext): Promise
// Schicht 1 — exactly one model call.
let flats: FlatLike[];
try {
// The flight path forces type 'flight' on everything it returns, so it must not
// claim a document that already names another kind of transport: a German rail
// ticket carries numbers like "IC 2023" or "RE 4711", which the two-letters-plus-
// digits test cannot tell from an airline code, and the ticket came back a flight
// without detectType ever running (#2076).
const named = detectType(text);
const looksLikeFlight = detectFlightNumbers(text).length > 0 && !(named && TRANSPORT_FLAT_TYPES.has(named));
flats = looksLikeFlight ? await extractFlights(text, ctx) : [await extractSingle(text, ctx)];
const reading = readType(text);
flats = reading.type === 'flight' ? await extractFlights(text, ctx) : [await extractSingle(text, ctx, reading)];
} catch (err) {
return {
kiItems: [],
@@ -371,7 +423,7 @@ export async function routeExtraction(text: string, ctx: RouterContext): Promise
export async function routeImageExtraction(images: Buffer[], ctx: RouterContext): Promise<RoutedExtraction> {
let flat: FlatLike;
try {
flat = unwrapPrice(await extractSingle('', ctx, images));
flat = unwrapPrice(await extractSingle('', ctx, { type: null, candidates: [] }, images));
} catch (err) {
return {
kiItems: [],
@@ -30,20 +30,23 @@ export const MAX_EXTRACT_BYTES = 4 * 1024 * 1024 * 1024;
const DOWNLOAD_TIMEOUT_MS = 60 * 60 * 1000;
const MAX_REDIRECTS = 3;
const indexSchema = z.object({
features: z.array(
z.object({
properties: z.object({
id: z.string(),
parent: z.string().optional(),
name: z.string(),
urls: z.object({ pbf: z.string().optional() }).passthrough(),
}),
geometry: z.unknown(),
}),
),
/**
* One entry of the list. Geofabrik writes an absent value as null (a
* continent's `parent`), so every optional field takes both spellings.
*/
const featureSchema = z.object({
properties: z.object({
id: z.string(),
parent: z.string().nullish(),
name: z.string(),
urls: z.object({ pbf: z.string().nullish() }).passthrough(),
}),
geometry: z.unknown(),
});
/** The list itself; its entries are read one by one, so one odd entry costs only that region. */
const indexSchema = z.object({ features: z.array(z.unknown()) });
export interface GeofabrikRegion {
id: string;
name: string;
@@ -98,10 +101,16 @@ export class GeofabrikClient {
const parsed = indexSchema.safeParse(await readCappedJson<unknown>(response, MAX_INDEX_BYTES));
if (!parsed.success) throw new Error('Geofabrik index is not the list of extracts');
const regions = new Map<string, GeofabrikRegion>();
for (const feature of parsed.data.features) {
const { id, name, parent, urls } = feature.properties;
let unreadable = 0;
for (const entry of parsed.data.features) {
const feature = featureSchema.safeParse(entry);
if (!feature.success) {
unreadable += 1;
continue;
}
const { id, name, parent, urls } = feature.data.properties;
if (!urls.pbf || !isExtractUrl(urls.pbf)) continue;
const boundary = paddleRegionBoundarySchema.safeParse(feature.geometry);
const boundary = paddleRegionBoundarySchema.safeParse(feature.data.geometry);
regions.set(id, {
id,
name,
@@ -110,6 +119,11 @@ export class GeofabrikClient {
boundary: boundary.success ? boundary.data : null,
});
}
// Entries none of which can be read are a list in another shape, not an empty catalogue.
if (unreadable > 0 && unreadable === parsed.data.features.length) {
throw new Error('Geofabrik index is not the list of extracts');
}
if (unreadable > 0) logWarn(`[Paddle] Geofabrik index: skipped ${unreadable} entries it could not read`);
this.index = { regions, fetchedAt: now };
return regions;
}
@@ -1,5 +1,5 @@
/**
* How TREK 5.2.0 registers with the TREK services.
* How TREK 5.2.1 registers with the TREK services.
*
* The issuer writes this file for each release and the release pipeline
* commits it with the version bump. It is not edited by hand, and its layout
@@ -8,98 +8,76 @@
*/
import type { DialectSelfCheck, RegistrationDialect } from './registration-dialect.types';
import { createHash, createHmac, pbkdf2Sync } from 'node:crypto';
import { createHash, createHmac, hkdfSync, pbkdf2Sync } from 'node:crypto';
const DIALECT = 'MCC2i6oMga-k';
const FLINT_AURORA = Buffer.from('e0bc92393c56a33c8046371de83c00b73975ec200058dcc1c08d07ef234a0997', 'hex');
const CHERRY_FALCON = 'abcdefghijklmnopqrstuvwxyz234567';
const DIALECT = 'Spbb4AEAqsgI';
const OAK_TIDE = Buffer.from('4584bf8b2c5def9bb9faaa5f0b1c73b662da1c97a558ced1f09f27eceeb0ebe9', 'hex');
function glacier(part: Buffer): Buffer {
const head = Buffer.alloc(4);
head.writeUInt32LE(part.length);
return Buffer.concat([head, part]);
function candle(alg: string, key: Buffer, data: Buffer): Buffer {
return createHmac(alg, key).update(data).digest();
}
function lynx(a: Buffer, b: Buffer): Buffer {
const parts: Buffer[] = [];
for (let i = 0; i < Math.max(a.length, b.length); i++) parts.push(a.subarray(i, i + 1), b.subarray(i, i + 1));
return Buffer.concat(parts);
}
function eagle(input: Buffer): string {
const bits = [...input].map((byte) => byte.toString(2).padStart(8, '0')).join('');
let out = '';
for (let i = 0; i < bits.length; i += 5) {
out += CHERRY_FALCON.charAt(parseInt(bits.slice(i, i + 5).padEnd(5, '0'), 2));
function stone(input: Buffer, rotation: number, consts: Buffer): Buffer {
const out = Buffer.from(input);
let previous = 0;
for (let i = 0; i + 4 <= out.length; i += 4) {
const word = (out.readUInt32LE(i) + consts.readUInt32BE(i % consts.length)) >>> 0;
previous = (((word << rotation) | (word >>> (32 - rotation))) ^ previous) >>> 0;
out.writeUInt32LE(previous, i);
}
return out;
}
function rowan(part: Buffer): Buffer {
const head = Buffer.alloc(2);
head.writeUInt16BE(part.length);
return Buffer.concat([head, part]);
}
function saddle(alg: string, key: Buffer, data: Buffer): Buffer {
return createHmac(alg, key).update(data).digest();
}
function cedar(input: Buffer, size: number): Buffer {
const out = Buffer.alloc(size);
input.forEach((byte, i) => out.writeUInt8(out.readUInt8(i % size) ^ byte, i % size));
return out;
}
function alder(alg: string, size: number, data: Buffer): Buffer {
return createHash(alg, { outputLength: size }).update(data).digest();
}
function marsh(part: Buffer): Buffer {
function stamp(part: Buffer): Buffer {
const head = Buffer.alloc(2);
head.writeUInt16LE(part.length);
return Buffer.concat([head, part]);
}
function boulder(a: Buffer, b: Buffer): Buffer {
const parts: Buffer[] = [];
for (let i = 0; i < Math.max(a.length, b.length); i++) parts.push(a.subarray(i, i + 1), b.subarray(i, i + 1));
return Buffer.concat(parts);
}
export const registrationDialect: RegistrationDialect = {
id: DIALECT,
releasedFor: '5.2.0',
createdAt: '2026-11-23',
releasedFor: '5.2.1',
createdAt: '2026-11-25',
challengePath: `/v1/register/${DIALECT}/challenge`,
registerPath: `/v1/register/${DIALECT}`,
begin({ challenge, version, random }) {
const cabin = Buffer.from(challenge.c, 'utf8');
const harrier = Buffer.from(version, 'utf8');
const quarry = createHash('sha256').update(cabin).digest();
const winter = Buffer.concat([marsh(FLINT_AURORA), marsh(harrier), marsh(cabin), marsh(random.subarray(3, 12))]);
const paddle = saddle('sha3-256', winter, FLINT_AURORA);
const cypress = Buffer.from(paddle.toString('hex'), 'utf8');
const tundra = Buffer.from(challenge.c, 'utf8');
const eddy = Buffer.from(version, 'utf8');
const thistle = createHash('sha256').update(tundra).digest();
const valley = Buffer.concat([tundra, eddy, random]);
const pier = Buffer.from(hkdfSync('sha256', valley, tundra, Buffer.from('afef6bd57409b2f4', 'hex'), 0x40));
const jetty = boulder(pier, thistle).subarray(0, pier.length);
return {
work(nonce) {
const atlas = Buffer.concat([random, cabin, Buffer.from(nonce.toString(10)), harrier, FLINT_AURORA].map(rowan));
const blossom = pbkdf2Sync(atlas, quarry.subarray(22, 0x1e), 20, 0x15, 'sha512');
const arbor = lynx(blossom, FLINT_AURORA).subarray(0, blossom.length);
const coast = Buffer.from(arbor.subarray(0, 21));
const wave = alder('shake256', 0x40, coast);
return { password: wave, salt: cypress };
const basalt = Buffer.concat([OAK_TIDE, tundra, random, eddy, Buffer.from(nonce.toString(16)), thistle]);
const falcon = Buffer.concat([Buffer.concat([OAK_TIDE.subarray(0x10, 0x1f), Buffer.from([0x4e])]), basalt]);
const cascade = Buffer.from('435052df4c2d17308c505231dfc4a7b95886b5b7', 'hex');
const cabin = stone(stone(stone(falcon, 5, cascade), 0xd, cascade), 3, cascade);
const flora = boulder(cabin, OAK_TIDE.subarray(2, 32));
const cactus = createHash('sha384').update(flora).digest();
const cliff = candle('sha256', random.subarray(0xa, 0xe), cactus);
const island = Buffer.from(cliff.toString('hex').toUpperCase());
const mint = Buffer.concat([island, eddy]);
return { password: mint, salt: jetty };
},
request(nonce) {
const basin = Buffer.concat([harrier, cabin, Buffer.from(`${nonce}`)].map(glacier));
const wave6 = Buffer.concat([harrier, basin]);
const wing = pbkdf2Sync(wave6, FLINT_AURORA.subarray(23, 0x1d), 0x1c, 0x1a, 'sha512');
const ivy = Buffer.from([
3, 0xe, 0x11, 0xf, 9, 0xa, 7, 18, 13, 4, 11, 5, 16, 8, 0, 6, 1, 12, 2, 19,
].map((from) => wing.readUInt8(from)));
const grove = Buffer.concat([ivy, wing.subarray(20)]);
const dock = saddle('sha256', grove, random);
const pearl = cedar(dock, 0x14);
const harvest = Buffer.concat([random, tundra, Buffer.from(nonce.toString(16), 'utf8'), eddy].map(stamp));
const comet = pbkdf2Sync(harvest, OAK_TIDE, 32, 0x33, 'sha512');
const dune = createHash('sha3-512').update(comet).digest();
return {
body: {
sierra_ridge: version,
paddle_mill: pearl.toString('hex'),
gorge_rowan: challenge.c,
birch_cape: nonce,
ash: eagle(random),
autumnForest: 'bridge-517',
crest: version,
harvestLichen: random.toString('hex'),
rowanCitadel: dune.toString('base64'),
ember: challenge.c,
fountain: nonce.toString(16),
},
headers: {},
};
@@ -110,13 +88,13 @@ export const registrationDialect: RegistrationDialect = {
/** Fixed inputs and what this module must make of them; TREK's tests and release job run it. */
export const SELF_CHECK: DialectSelfCheck = {
challenge: { c: 'v1.selfcheck.MCC2i6oMga-k', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
version: '5.2.0',
challenge: { c: 'v1.selfcheck.Spbb4AEAqsgI', alg: 'scrypt', N: 16, r: 1, p: 1, bits: 0, expires_at: 1 },
version: '5.2.1',
random: '000102030405060708090a0b0c0d0e0f',
nowSeconds: 1800000000,
nonce: 41,
inputSha256: '5840e0d3d6661feeb110032d6bd6ce71653bbaad6695c4919d5dc4a1c90d4887',
saltSha256: 'd6108d62280c10f09c6ed4b68c4ae18934b5c9bd1b0d2f97452cdc4d048bb8cc',
scrypt: '66520ede3f817fec6584440217987d2d5d810f0a1f2f6f05bb7108901ba12070',
requestSha256: '4a6a4228f493fcef6c185c910b2667cf08317c0ac693eba64ea850b32ee79980',
inputSha256: '08c66428b86c79a2891b3bdd1c32e8fa879b4f5c32f1e926e8708cebd8717f80',
saltSha256: 'e5c8ae7aba8548e7053b8f8f2ab1d6639217b9c38e4aed5e5a7338ee3db30a73',
scrypt: 'c092ecce1df2d1d2fa238a6034fe14700641a4e9e759c01967d5834d57b2f3c6',
requestSha256: '59dcea6833950308358e9387e57f62e3f3d8b5f36499fe8a28e9d7931e322092',
};
@@ -83,6 +83,18 @@ export interface WalletPassSource {
tripTitle: string | null;
/** The booking's place (the hotel, the restaurant), when it has coordinates. */
place: { lat: number; lng: number; name: string | null } | null;
/**
* The dates the booking sits on when its own time carries none: the day it is
* linked to and the day it ends on, or for a hotel the first and last day of its
* stay with the stay's check-in and check-out times. The app shows these dates,
* so the pass reads them too.
*/
linked?: {
startDate: string | null;
endDate: string | null;
checkIn?: string | null;
checkOut?: string | null;
} | null;
}
const KIND_OF: Record<string, WalletPassKind> = {
@@ -127,6 +139,20 @@ function splitLocal(value: string | null | undefined): { date: string; time: str
return { date: match[1] as string, time: match[2] ?? null };
}
/** The clock of a time-only value ("12:40", "15:00:00"), which a day-linked booking may carry. */
function clockOnly(value: string | null | undefined): string | null {
return /^\s*(\d{2}:\d{2})/.exec(value ?? '')?.[1] ?? null;
}
/** A linked day's date with the first clock the booking or its stay gives for it. */
function onLinkedDay(
date: string | null | undefined,
...clocks: (string | null | undefined)[]
): { date: string; time: string | null } | null {
if (!date) return null;
return { date, time: clocks.map(clockOnly).find((clock) => clock !== null) ?? null };
}
/** The UTC offset of a zone at a wall-clock time, in minutes ("+09:00" is 540). */
function offsetMinutes(timeZone: string, wallClockAsUtc: number): number {
const parts = new Intl.DateTimeFormat('en-US', {
@@ -233,14 +259,27 @@ export function buildWalletPassRequest(src: WalletPassSource, words: WalletWords
const toEnd = [...endpoints].reverse().find((e) => e.role === 'to');
const journey = kind === 'flight' || kind === 'train' || kind === 'bus' || kind === 'boat';
// When it starts: the departure as the endpoint knows it, else the booking's own time.
// When it starts: the departure as the endpoint knows it, else the booking's own
// time, else the day it is linked to (a hotel's stay), with the clock it has.
const linked = src.linked;
const hotel = kind === 'hotel';
const startLocal =
(journey && fromEnd?.local_date ? { date: fromEnd.local_date, time: fromEnd.local_time } : null) ??
splitLocal(reservation.reservation_time);
splitLocal(reservation.reservation_time) ??
onLinkedDay(
linked?.startDate,
reservation.reservation_time,
...(hotel ? [text(meta, 'check_in_time', 8), linked?.checkIn] : []),
);
if (!startLocal) return null;
const endLocal =
(journey && toEnd?.local_date ? { date: toEnd.local_date, time: toEnd.local_time } : null) ??
splitLocal(reservation.reservation_end_time);
splitLocal(reservation.reservation_end_time) ??
onLinkedDay(
linked?.endDate,
reservation.reservation_end_time,
...(hotel ? [text(meta, 'check_out_time', 8), linked?.checkOut] : []),
);
const place = src.place ?? (fromEnd && !journey ? { lat: fromEnd.lat, lng: fromEnd.lng, name: fromEnd.name } : null);
const startZone =
@@ -5,7 +5,7 @@ import { logWarn } from '../audit/audit-log.logger';
import { DomainError } from '../common/domain-error';
import { RateLimitService } from '../common/rate-limit.service';
import { ReservationsReadService } from '../reservations/reservations-read.service';
import { buildWalletPassRequest, type WalletPassEndpoint } from './wallet-pass.builder';
import { buildWalletPassRequest, type WalletPassEndpoint, type WalletPassSource } from './wallet-pass.builder';
import { loadWalletWords } from './wallet-pass.words';
import { Inject, Injectable } from '@nestjs/common';
import type { ConfigType } from '@nestjs/config';
@@ -27,6 +27,26 @@ const PKPASS = 'application/vnd.apple.pkpass';
/** Every ZIP, and so every .pkpass, starts with a local file header. */
const ZIP_LOCAL_HEADER = 0x04034b50;
/**
* The dates a booking sits on through the days it is linked to, as the app reads
* them (bookingDates): a hotel's stay when it has one, else the booking's own days.
*/
function linkedDates(
type: string | null | undefined,
context: Awaited<ReturnType<ReservationsReadService['passContext']>>,
): WalletPassSource['linked'] {
if (!context) return null;
if (type === 'hotel' && (context.stay_start_date || context.stay_end_date)) {
return {
startDate: context.stay_start_date,
endDate: context.stay_end_date,
checkIn: context.stay_check_in,
checkOut: context.stay_check_out,
};
}
return { startDate: context.day_date, endDate: context.end_day_date };
}
export interface WalletPass {
bytes: Buffer;
filename: string;
@@ -143,6 +163,7 @@ export class WalletPassService {
typeof context?.place_lat === 'number' && typeof context.place_lng === 'number'
? { lat: context.place_lat, lng: context.place_lng, name: context.place_name ?? null }
: null,
linked: linkedDates(row.type, context),
},
await loadWalletWords(language),
);
+5 -2
View File
@@ -59,7 +59,7 @@ export const SYSTEM_NOTICES: SystemNotice[] = [
titleKey: 'system_notice.release_notes.headline',
bodyKey: 'system_notice.release_notes.intro',
release: {
version: '5.2.0',
version: '5.2.1',
eyebrowKey: 'system_notice.release_notes.eyebrow',
headlineKey: 'system_notice.release_notes.headline',
introKey: 'system_notice.release_notes.intro',
@@ -86,9 +86,12 @@ export const SYSTEM_NOTICES: SystemNotice[] = [
},
],
footnoteKey: 'system_notice.release_notes.footnote',
apps: {
titleKey: 'system_notice.release_notes.apps_title',
},
notes: {
labelKey: 'system_notice.release_notes.notes_label',
href: 'https://github.com/liketrek/TREK/releases/tag/v5.2.0',
href: 'https://github.com/liketrek/TREK/releases/tag/v5.2.1',
},
note: {
eyebrowKey: 'system_notice.release_notes.note_eyebrow',
+2
View File
@@ -51,6 +51,8 @@ export interface NoticeRelease {
featuresLabelKey: string;
featuresAsideKey?: string;
features: NoticeReleaseFeature[];
/** A tile across the release column with the app store cards and their QR codes. */
apps?: { titleKey: string };
notes?: { labelKey: string; href: string };
footnoteKey?: string;
note: {
@@ -0,0 +1,457 @@
/**
* Passkey ceremonies through the REAL @simplewebauthn/server, with no mock.
*
* Every other passkey suite mocks the library, so a release that changes what
* it accepts (a stricter origin check, a new default) would pass them all and
* still refuse every passkey in production. Here a software authenticator built
* on node:crypto answers TREK's own options over HTTP: registration with
* attestation format 'none', then a signed login, plus credentials stored the
* way earlier releases stored them.
*/
import { buildApp } from '../../src/bootstrap';
import { WebauthnCredentials } from '../../src/db/entities/WebauthnCredentials.entity';
import { authCookie } from '../helpers/auth';
import { countRows, findRow, insertRow } from '../helpers/factories/rows';
import { setAppSetting } from '../helpers/factories/settings';
import { makeUser } from '../helpers/factories/users';
import { resetDatabase } from '../helpers/reset-database';
import { resetRateLimits } from '../helpers/test-db';
import { MikroORM } from '@mikro-orm/core';
import type { INestApplication } from '@nestjs/common';
import { isoBase64URL, isoCBOR, isoUint8Array } from '@simplewebauthn/server/helpers';
import type { Application } from 'express';
import { createHash, generateKeyPairSync, randomBytes, sign, type KeyObject } from 'node:crypto';
import request from 'supertest';
import { describe, it, expect, beforeAll, beforeEach, afterAll, afterEach, vi } from 'vitest';
type CborValue = Parameters<typeof isoCBOR.encode>[0];
// The byte array type the library helpers take and return.
type Bytes = ReturnType<typeof isoUint8Array.concat>;
const RP_ID = 'trek.example.com';
const ORIGIN = 'https://trek.example.com';
let nestApp: INestApplication;
let app: Application;
let orm: MikroORM;
beforeAll(async () => {
nestApp = await buildApp();
app = nestApp.getHttpAdapter().getInstance();
orm = nestApp.get(MikroORM);
});
beforeEach(async () => {
await resetDatabase(orm);
await resetRateLimits(nestApp);
await setAppSetting(orm, 'passkey_login', 'true');
await setAppSetting(orm, 'webauthn_rp_id', RP_ID);
await setAppSetting(orm, 'webauthn_origins', ORIGIN);
});
afterEach(() => {
vi.restoreAllMocks();
});
afterAll(async () => {
await nestApp.close();
});
// ---------------------------------------------------------------------------
// A software authenticator
// ---------------------------------------------------------------------------
type Alg = -7 | -8 | -257;
interface Authenticator {
alg: Alg;
privateKey: KeyObject;
publicKey: KeyObject;
credentialId: Bytes;
cosePublicKey: Bytes;
}
function sha256(data: Bytes): Bytes {
return new Uint8Array(createHash('sha256').update(data).digest());
}
function jwkBytes(value: string | undefined): Bytes {
if (!value) throw new Error('JWK member missing');
return isoBase64URL.toBuffer(value);
}
/** The credential public key in COSE form (RFC 9053), as an authenticator reports it. */
function coseKey(alg: Alg, publicKey: KeyObject): Bytes {
const jwk = publicKey.export({ format: 'jwk' });
const entries: Array<[number, CborValue]> =
alg === -7
? [
[1, 2],
[3, -7],
[-1, 1],
[-2, jwkBytes(jwk.x)],
[-3, jwkBytes(jwk.y)],
]
: alg === -8
? [
[1, 1],
[3, -8],
[-1, 6],
[-2, jwkBytes(jwk.x)],
]
: [
[1, 3],
[3, -257],
[-1, jwkBytes(jwk.n)],
[-2, jwkBytes(jwk.e)],
];
return isoCBOR.encode(new Map<string | number, CborValue>(entries));
}
function makeAuthenticator(alg: Alg = -7): Authenticator {
const { privateKey, publicKey } =
alg === -7
? generateKeyPairSync('ec', { namedCurve: 'P-256' })
: alg === -8
? generateKeyPairSync('ed25519')
: generateKeyPairSync('rsa', { modulusLength: 2048 });
return {
alg,
privateKey,
publicKey,
credentialId: new Uint8Array(randomBytes(32)),
cosePublicKey: coseKey(alg, publicKey),
};
}
function signWith(auth: Authenticator, data: Bytes): Bytes {
// EdDSA signs the message itself; ES256 (DER encoded) and RS256 hash with SHA-256.
return new Uint8Array(sign(auth.alg === -8 ? null : 'sha256', data, auth.privateKey));
}
function uint32(n: number): Bytes {
const out = new Uint8Array(4);
new DataView(out.buffer).setUint32(0, n);
return out;
}
function clientData(type: 'webauthn.create' | 'webauthn.get', challenge: string, origin: string): Bytes {
return isoUint8Array.fromUTF8String(JSON.stringify({ type, challenge, origin, crossOrigin: false }));
}
// Flags: UP (0x01) and UV (0x04), plus AT (0x40) when credential data follows.
const FLAGS_UP_UV = 0x05;
const FLAGS_UP_UV_AT = 0x45;
/** authData with attested credential data: rpIdHash, flags, counter, AAGUID, credential id, COSE key. */
function registrationAuthData(auth: Authenticator, rpId: string): Bytes {
const idLength = new Uint8Array([auth.credentialId.length >> 8, auth.credentialId.length & 0xff]);
return isoUint8Array.concat([
sha256(isoUint8Array.fromASCIIString(rpId)),
new Uint8Array([FLAGS_UP_UV_AT]),
uint32(0),
new Uint8Array(16),
idLength,
auth.credentialId,
auth.cosePublicKey,
]);
}
function registrationResponse(
auth: Authenticator,
challenge: string,
opts: { origin?: string; rpId?: string; fmt?: string; attStmt?: Map<string | number, CborValue> } = {},
) {
const authData = registrationAuthData(auth, opts.rpId ?? RP_ID);
const clientDataJSON = clientData('webauthn.create', challenge, opts.origin ?? ORIGIN);
const attestationObject = isoCBOR.encode(
new Map<string | number, CborValue>([
['fmt', opts.fmt ?? 'none'],
['attStmt', opts.attStmt ?? new Map<string | number, CborValue>()],
['authData', authData],
]),
);
const id = isoBase64URL.fromBuffer(auth.credentialId);
return {
id,
rawId: id,
type: 'public-key',
response: {
clientDataJSON: isoBase64URL.fromBuffer(clientDataJSON),
attestationObject: isoBase64URL.fromBuffer(attestationObject),
transports: ['internal', 'hybrid'],
},
clientExtensionResults: {},
authenticatorAttachment: 'platform',
};
}
function authenticationResponse(
auth: Authenticator,
challenge: string,
counter: number,
opts: { origin?: string; rpId?: string } = {},
) {
const authData = isoUint8Array.concat([
sha256(isoUint8Array.fromASCIIString(opts.rpId ?? RP_ID)),
new Uint8Array([FLAGS_UP_UV]),
uint32(counter),
]);
const clientDataJSON = clientData('webauthn.get', challenge, opts.origin ?? ORIGIN);
const signature = signWith(auth, isoUint8Array.concat([authData, sha256(clientDataJSON)]));
const id = isoBase64URL.fromBuffer(auth.credentialId);
return {
id,
rawId: id,
type: 'public-key',
response: {
clientDataJSON: isoBase64URL.fromBuffer(clientDataJSON),
authenticatorData: isoBase64URL.fromBuffer(authData),
signature: isoBase64URL.fromBuffer(signature),
},
clientExtensionResults: {},
};
}
// ---------------------------------------------------------------------------
// HTTP steps
// ---------------------------------------------------------------------------
async function registerOptions(userId: number, password: string) {
const res = await request(app)
.post('/api/auth/passkey/register/options')
.set('Cookie', authCookie(userId))
.send({ password });
expect(res.status).toBe(200);
return res.body as { challenge: string; rp: { id: string }; pubKeyCredParams: Array<{ alg: number }> };
}
async function registerVerify(userId: number, attestationResponse: unknown) {
return request(app)
.post('/api/auth/passkey/register/verify')
.set('Cookie', authCookie(userId))
.send({ attestationResponse, name: 'Test key' });
}
async function loginOptions() {
const res = await request(app).post('/api/auth/passkey/login/options').send({});
expect(res.status).toBe(200);
return res.body as { challenge: string; rpId: string };
}
async function storedCredential(credentialId: string) {
const row = await findRow(orm, WebauthnCredentials, { credential_id: credentialId });
if (!row) throw new Error(`no stored credential ${credentialId}`);
return row;
}
async function loginVerify(assertionResponse: unknown) {
return request(app).post('/api/auth/passkey/login/verify').send({ assertionResponse });
}
// ---------------------------------------------------------------------------
// Ceremonies
// ---------------------------------------------------------------------------
describe('passkey ceremonies against the real @simplewebauthn/server', () => {
it('PASSKEY-REAL-001: registers a credential and logs in with it, bumping the counter', async () => {
const { user, password } = await makeUser(orm);
const auth = makeAuthenticator();
const options = await registerOptions(user.id, password);
expect(options.rp.id).toBe(RP_ID);
expect(options.pubKeyCredParams.map((p) => p.alg)).toEqual([-8, -7, -257]);
const reg = await registerVerify(user.id, registrationResponse(auth, options.challenge));
expect(reg.status).toBe(200);
expect(reg.body.success).toBe(true);
const credentialId = isoBase64URL.fromBuffer(auth.credentialId);
const stored = await storedCredential(credentialId);
expect(stored.user_id).toBe(user.id);
expect(Buffer.from(stored.public_key).equals(Buffer.from(auth.cosePublicKey))).toBe(true);
expect(stored.counter).toBe(0);
expect(stored.transports).toBe(JSON.stringify(['internal', 'hybrid']));
expect(stored.name).toBe('Test key');
const login = await loginOptions();
expect(login.rpId).toBe(RP_ID);
const res = await loginVerify(authenticationResponse(auth, login.challenge, 1));
expect(res.status).toBe(200);
expect(res.body.user.id).toBe(user.id);
expect(res.headers['set-cookie']?.[0]).toMatch(/^trek_session=/);
const after = await storedCredential(credentialId);
expect(after.counter).toBe(1);
expect(after.last_used_at).toBeTruthy();
});
it.each([
['ES256', -7],
['EdDSA', -8],
['RS256', -257],
] as const)('PASSKEY-REAL-002: a %s credential stored by an earlier release still logs in', async (_name, alg) => {
const { user } = await makeUser(orm);
const auth = makeAuthenticator(alg);
const credentialId = isoBase64URL.fromBuffer(auth.credentialId);
// The row exactly as 13.x wrote it: base64url id, COSE key bytes, counter, JSON transports.
await insertRow(orm, WebauthnCredentials, {
user: user.id,
credential_id: credentialId,
public_key: Buffer.from(auth.cosePublicKey),
counter: 5,
transports: JSON.stringify(['usb', 'nfc']),
device_type: 'singleDevice',
backed_up: 0,
name: 'Old key',
});
const login = await loginOptions();
const res = await loginVerify(authenticationResponse(auth, login.challenge, 6));
expect(res.status).toBe(200);
expect(res.body.user.id).toBe(user.id);
expect((await storedCredential(credentialId)).counter).toBe(6);
});
it.each([
['an uppercase RP ID and an origin with a path', 'Trek.Example.com', 'https://Trek.Example.com/trek/'],
['an origin with an uppercase host and a trailing slash', RP_ID, 'https://TREK.example.com/'],
])('PASSKEY-REAL-003: %s still verify', async (_case, rpId, origins) => {
await setAppSetting(orm, 'webauthn_rp_id', rpId);
await setAppSetting(orm, 'webauthn_origins', origins);
const { user, password } = await makeUser(orm);
const auth = makeAuthenticator();
// What a browser reports: the serialized, lower-case origin and the hash of the RP ID it was given.
const options = await registerOptions(user.id, password);
const reg = await registerVerify(user.id, registrationResponse(auth, options.challenge, { rpId: options.rp.id }));
expect(reg.status).toBe(200);
const login = await loginOptions();
const res = await loginVerify(authenticationResponse(auth, login.challenge, 1, { rpId: login.rpId }));
expect(res.status).toBe(200);
expect(options.rp.id).toBe(RP_ID);
expect(login.rpId).toBe(RP_ID);
});
it('PASSKEY-REAL-004: a ceremony from a foreign origin is refused with the usual 400 and 401', async () => {
const { user, password } = await makeUser(orm);
const auth = makeAuthenticator();
const options = await registerOptions(user.id, password);
const reg = await registerVerify(
user.id,
registrationResponse(auth, options.challenge, { origin: 'https://evil.example.net' }),
);
expect(reg.status).toBe(400);
expect(reg.body).toEqual({ error: 'Could not register this passkey.' });
expect(await countRows(orm, WebauthnCredentials, { user: user.id })).toBe(0);
// A stored credential signing for the wrong origin is refused like any other failed login.
await insertRow(orm, WebauthnCredentials, {
user: user.id,
credential_id: isoBase64URL.fromBuffer(auth.credentialId),
public_key: Buffer.from(auth.cosePublicKey),
counter: 0,
name: 'Key',
});
const login = await loginOptions();
const res = await loginVerify(
authenticationResponse(auth, login.challenge, 1, { origin: 'https://evil.example.net' }),
);
expect(res.status).toBe(401);
expect(res.body).toEqual({ error: 'Authentication failed' });
});
});
// ---------------------------------------------------------------------------
// A certificate carrying a CRL URL (DER written by hand: the library exports
// CBOR and base64url helpers, nothing for ASN.1)
// ---------------------------------------------------------------------------
function der(tag: number, ...parts: Bytes[]): Bytes {
const body = isoUint8Array.concat(parts);
const n = body.length;
const length = n < 0x80 ? [n] : n < 0x100 ? [0x81, n] : [0x82, n >> 8, n & 0xff];
return isoUint8Array.concat([new Uint8Array([tag, ...length]), body]);
}
const seq = (...parts: Bytes[]) => der(0x30, ...parts);
const smallInt = (n: number) => der(0x02, new Uint8Array([n]));
const octets = (bytes: Bytes) => der(0x04, bytes);
const ascii = (s: string) => isoUint8Array.fromASCIIString(s);
function oid(dotted: string): Bytes {
const [a, b, ...rest] = dotted.split('.').map(Number);
const bytes = [40 * a + b];
for (const arc of rest) {
const groups = [arc & 0x7f];
for (let v = arc >> 7; v > 0; v >>= 7) groups.unshift((v & 0x7f) | 0x80);
bytes.push(...groups);
}
return der(0x06, new Uint8Array(bytes));
}
const ECDSA_WITH_SHA256 = seq(oid('1.2.840.10045.4.3.2'));
/**
* A self-signed certificate for the credential key, shaped like an Android key
* attestation leaf (key description extension with the client data hash as its
* challenge) and naming a CRL distribution point.
*/
function androidKeyCertificate(auth: Authenticator, clientDataHash: Bytes, crlUrl: string): Bytes {
const name = seq(der(0x31, seq(oid('2.5.4.3'), der(0x0c, ascii('Passkey test')))));
const validity = seq(der(0x17, ascii('250101000000Z')), der(0x17, ascii('491231235959Z')));
const spki = new Uint8Array(auth.publicKey.export({ type: 'spki', format: 'der' }));
// distributionPoint [0] { fullName [0] { uniformResourceIdentifier [6] } }
const crlDistributionPoints = seq(seq(der(0xa0, der(0xa0, der(0x86, ascii(crlUrl))))));
const keyDescription = seq(
smallInt(3),
der(0x0a, new Uint8Array([1])),
smallInt(4),
der(0x0a, new Uint8Array([1])),
octets(clientDataHash),
octets(new Uint8Array()),
seq(),
seq(),
);
const extensions = der(
0xa3,
seq(
seq(oid('2.5.29.31'), octets(crlDistributionPoints)),
seq(oid('1.3.6.1.4.1.11129.2.1.17'), octets(keyDescription)),
),
);
const tbs = seq(der(0xa0, smallInt(2)), smallInt(1), ECDSA_WITH_SHA256, name, validity, name, spki, extensions);
const signature = signWith(auth, tbs);
return seq(tbs, ECDSA_WITH_SHA256, der(0x03, new Uint8Array([0]), signature));
}
describe('attestation certificates', () => {
it('PASSKEY-REAL-005: an android-key attestation naming a CRL URL is refused without any outbound fetch', async () => {
const { user, password } = await makeUser(orm);
const auth = makeAuthenticator();
const crlUrl = 'http://crl.attacker.invalid/revoked.crl';
const fetchSpy = vi.spyOn(globalThis, 'fetch').mockRejectedValue(new Error('outbound fetch blocked in test'));
const options = await registerOptions(user.id, password);
const clientDataHash = sha256(clientData('webauthn.create', options.challenge, ORIGIN));
const authData = registrationAuthData(auth, RP_ID);
const attStmt = new Map<string | number, CborValue>([
['alg', -7],
['sig', signWith(auth, isoUint8Array.concat([authData, clientDataHash]))],
['x5c', [androidKeyCertificate(auth, clientDataHash, crlUrl)]],
]);
const res = await registerVerify(
user.id,
registrationResponse(auth, options.challenge, { fmt: 'android-key', attStmt }),
);
expect(fetchSpy).not.toHaveBeenCalled();
expect(res.status).toBe(400);
expect(res.body).toEqual({ error: 'Could not register this passkey.' });
expect(await countRows(orm, WebauthnCredentials, { user: user.id })).toBe(0);
});
});
@@ -28,6 +28,8 @@ describe('resolveEngine', () => {
expect(engine.ormOptions()).toEqual({
driver: TrekPostgreSqlDriver,
clientUrl: PG_URL,
host: 'db.example',
port: 5432,
pool: { min: 0, max: 7 },
driverOptions: {},
// Puts pg_temp last on every new connection's search_path (session-search-path.ts).
@@ -35,6 +37,17 @@ describe('resolveEngine', () => {
});
});
it('ENGINE-004: a Unix socket reaches the pool, as a host parameter or as a percent-encoded host', () => {
const viaParam = resolveEngine(
deriveDb({ TREK_DB_URL: 'postgresql://trek:s3cret@localhost/trek?host=/var/run/postgresql' }),
).ormOptions();
expect(viaParam).toMatchObject({ host: '/var/run/postgresql', port: undefined });
const encoded = resolveEngine(
deriveDb({ TREK_DB_URL: 'postgresql://trek:s3cret@%2Fvar%2Frun%2Fpostgresql:5433/trek' }),
).ormOptions();
expect(encoded).toMatchObject({ host: '/var/run/postgresql', port: 5433 });
});
it('ENGINE-003: describes a Postgres database without its password', () => {
const engine = resolveEngine(deriveDb({ TREK_DB_URL: `${PG_URL}?sslmode=require&password=other` }));
expect(engine.describe()).toBe('Postgres postgresql://trek:***@db.example:5432/trek');
@@ -77,6 +77,15 @@ describe('pg-tools', () => {
PGUSER: 'u',
PGCONNECT_TIMEOUT: '10',
});
// A Unix socket: the host parameter wins over the URL's host, as in libpq, and an encoded host is decoded.
expect(pgConnectionEnv('postgresql://u@localhost/d?host=/var/run/postgresql&port=5433')).toMatchObject({
PGHOST: '/var/run/postgresql',
PGPORT: '5433',
});
expect(pgConnectionEnv('postgresql://u@%2Fvar%2Frun%2Fpostgresql/d')).toMatchObject({
PGHOST: '/var/run/postgresql',
PGPORT: '5432',
});
});
it('PGTOOLS-003: SSL is verified as the app pool verifies it, against the URL root certificate when it names one', () => {
@@ -0,0 +1,38 @@
/**
* Where TREK_DB_URL says the Postgres server listens, read as libpq reads a
* connection URL, so the pool and the client tools reach the same server.
*/
import { pgServerAddress } from '../../../../../src/db/engine/postgres/server-address';
import { describe, expect, it } from 'vitest';
describe('pgServerAddress', () => {
it('PGADDR-001: a TCP host and port come from the URL itself', () => {
expect(pgServerAddress('postgresql://trek:pw@db.example:6543/trek')).toEqual({ host: 'db.example', port: 6543 });
expect(pgServerAddress('postgres://trek@[::1]/trek')).toEqual({ host: '::1', port: undefined });
});
it('PGADDR-002: a host or port parameter takes the place of the URL’s own, as in libpq', () => {
expect(pgServerAddress('postgresql://trek@localhost/trek?host=/var/run/postgresql')).toEqual({
host: '/var/run/postgresql',
port: undefined,
});
expect(pgServerAddress('postgresql:///trek?host=/run/postgresql&port=5433')).toEqual({
host: '/run/postgresql',
port: 5433,
});
});
it('PGADDR-003: a socket directory written into the URL is percent-decoded', () => {
expect(pgServerAddress('postgresql://trek@%2Fvar%2Frun%2Fpostgresql/trek')).toEqual({
host: '/var/run/postgresql',
port: undefined,
});
});
it('PGADDR-004: a port that is no port number is refused', () => {
for (const port of ['0', '65536', 'abc', '54x']) {
expect(() => pgServerAddress(`postgresql://trek@localhost/trek?port=${port}`), port).toThrow(/not a port number/);
}
});
});
@@ -1058,7 +1058,7 @@ describe('ReservationsRepository — findPassContext', () => {
await setReservation(room.id, { accommodation_id: String(stay.id) });
const bare = createReservation(testDb, trip.id, { title: 'Museum', type: 'event' });
expect(await reservationsRepo.findPassContext(dinner.id, trip.id)).toEqual({
expect(await reservationsRepo.findPassContext(dinner.id, trip.id)).toMatchObject({
trip_title: 'Japan 2027',
place_lat: 35.0,
place_lng: 135.77,
@@ -1073,10 +1073,44 @@ describe('ReservationsRepository — findPassContext', () => {
place_lat: null,
place_lng: null,
place_name: null,
day_date: null,
end_day_date: null,
stay_start_date: null,
stay_end_date: null,
stay_check_in: null,
stay_check_out: null,
});
const other = createTrip(testDb, user.id, { title: 'Elsewhere' });
expect(await reservationsRepo.findPassContext(dinner.id, other.id)).toBeUndefined();
});
it('RES-PASS-002: reads the dates of the linked days and of a hotel stay, with its check-in and check-out', async () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id, { title: 'Valencia', start_date: '2027-01-08', end_date: '2027-01-11' });
const first = createDay(testDb, trip.id, { date: '2027-01-08' });
const last = createDay(testDb, trip.id, { date: '2027-01-11' });
const hotel = createPlace(testDb, trip.id, { name: 'Only You Hotel Valencia', lat: 39.47, lng: -0.376 });
const stay = createDayAccommodation(testDb, trip.id, hotel.id, first.id, last.id);
await updateRows(await orm(), DayAccommodations, { id: stay.id }, { check_in: '15:00', check_out: '10:00' });
const room = createReservation(testDb, trip.id, { title: 'Only You', type: 'hotel' });
await setReservation(room.id, { accommodation_id: String(stay.id) });
const dinner = createReservation(testDb, trip.id, { title: 'Dinner', type: 'restaurant' });
await setReservation(dinner.id, { day: first.id, endDay: last.id });
expect(await reservationsRepo.findPassContext(room.id, trip.id)).toMatchObject({
stay_start_date: '2027-01-08',
stay_end_date: '2027-01-11',
stay_check_in: '15:00',
stay_check_out: '10:00',
day_date: null,
});
expect(await reservationsRepo.findPassContext(dinner.id, trip.id)).toMatchObject({
day_date: '2027-01-08',
end_day_date: '2027-01-11',
stay_start_date: null,
});
});
});
describe('ReservationsRepository — the origin of an imported booking', () => {
@@ -36,6 +36,11 @@ vi.mock('../../../../src/utils/ssrfGuard', async (importOriginal) => ({
...(await importOriginal<typeof import('../../../../src/utils/ssrfGuard')>()),
safeFetch,
}));
const { logWarn } = vi.hoisted(() => ({ logWarn: vi.fn() }));
vi.mock('../../../../src/nest/audit/audit-log.logger', async (importOriginal) => ({
...(await importOriginal<typeof import('../../../../src/nest/audit/audit-log.logger')>()),
logWarn,
}));
const db = createSnapshotTestDb();
let t: TestModule;
@@ -361,6 +366,33 @@ describe('finishing a sign-in', () => {
});
});
describe('a refused code (#3196)', () => {
it('CGPT-016: only invalid_grant reads as expired; another refusal names its OAuth error and is logged', async () => {
const user = await caller();
let flow = await started(user.id);
safeFetch.mockResolvedValueOnce(
tokenAnswer(400, { error: 'invalid_client', error_description: 'Client authentication failed' }),
);
const refused = await refusal(
service().finish(user, flow.flowId, callbackUrl({ code: 'c', state: flow.state, client_id: 'oaiapp_x' })),
);
expect(refused.status).toBe(400);
expect(refused.body).toMatchObject({ code: 'generic' });
expect(refused.body.error).toContain('invalid_client');
expect(logWarn.mock.calls.flat().join(' ')).toMatch(/invalid_client.*Client authentication failed/);
flow = await started(user.id);
safeFetch.mockResolvedValueOnce(tokenAnswer(400, { error: 'invalid_grant' }));
expect(
(
await refusal(
service().finish(user, flow.flowId, callbackUrl({ code: 'c', state: flow.state, client_id: 'oaiapp_x' })),
)
).body,
).toMatchObject({ code: 'expired' });
});
});
describe('tokens', () => {
it('CGPT-020: a token that is still good is used as it is', async () => {
const { user } = await makeUser(orm());
@@ -5,6 +5,7 @@
* invented examples and failed against actual data.
*/
import { cityFromAddress } from '../../../src/nest/atlas/city-from-address';
import { isCountryName } from '../../../src/nest/atlas/known-countries';
import { describe, it, expect } from 'vitest';
@@ -79,3 +80,71 @@ describe('cityFromAddress with the postcode in the same part as the city (#3137)
expect(city('CN Tower, Toronto, ON M5V 3L9, Canada')).toBe('Toronto');
});
});
// #3200: a Maldives traveller saw more regions than cities. Each of these addresses
// lost its city, or counted something that is none, before.
describe('cityFromAddress for the cities the count used to miss (#3200)', () => {
const real = (address: string, region?: string | null) => cityFromAddress(address, isCountryName, region);
it('reads the locality of the line the TREK index writes, which ends without a country', () => {
expect(city('Pariser Platz 1, 10117, Berlin', 'Berlin')).toBe('Berlin');
expect(city('Boduthakurufaanu Magu, 20026, Malé', 'Malé')).toBe('Malé');
expect(city('Rue de Rivoli 99, 75001, Paris', 'Île-de-France')).toBe('Paris');
});
it('counts a city that is its own region when its postcode stands beside it', () => {
expect(city('Pariser Platz, 10117 Berlin, Germany', 'Berlin')).toBe('Berlin');
expect(city('Hotel Adlon Kempinski, Unter den Linden 77, 10117 Berlin, Germany', 'Berlin')).toBe('Berlin');
expect(real('Michaelerkuppel, 1010 Wien, Österreich', 'Wien')).toBe('Wien');
expect(real('Boduthakurufaanu Magu, Malé 20026, Maldives', 'Malé')).toBe('Malé');
// A city below the region still wins, as before.
expect(city('Shibuya Crossing, Shibuya City, Tokyo 150-0002, Japan', 'Tokyo')).toBe('Shibuya City');
});
it('never counts a region named without a postcode, so a mountain or an atoll is no city', () => {
expect(real('Zugspitze, Bayern, Deutschland', 'Bayern')).toBeNull();
expect(real('Resort, Kaafu, Maldives', 'Kaafu')).toBeNull();
});
it('reads the island below an atoll the geocoder writes with its generic word', () => {
expect(real('Kurumba Maldives, Vihamanaafushi, Kaafu Atoll, Maldives', 'Kaafu')).toBe('Vihamanaafushi');
expect(real('Maafushi Beach, Maafushi, Kaafu Atoll, 08090, Maldives', 'Kaafu')).toBe('Maafushi');
});
it('never counts a country as the city, in any language TREK speaks', () => {
expect(real('Malé, Maldives', 'Malé')).toBeNull();
expect(real('Maafushi, Maldives', 'Kaafu')).toBeNull();
expect(real('Somewhere, 08090, Maldives')).toBeNull();
expect(real('Piazza Navona, Roma, Italia', 'Lazio')).toBe('Roma');
});
it('keeps the lines it already read right', () => {
expect(real('350 5th Ave, New York, NY 10118, USA')).toBe('New York');
expect(real('CN Tower, Toronto, ON M5V 3L9, Canada')).toBe('Toronto');
expect(real('Museum, Marienplatz, München, Bayern, 80331, Germany', 'Bayern')).toBe('München');
expect(real('Marienplatz 1, München')).toBe('München');
});
});
describe('isCountryName', () => {
it('knows a country by its name in the languages TREK speaks, ignoring case', () => {
for (const name of [
'Maldives',
'Malediven',
'Österreich',
'Italia',
'Sri Lanka',
'maldives',
'Deutschland',
'Japan',
]) {
expect(isCountryName(name)).toBe(true);
}
});
it('does not take a city or a region for a country', () => {
for (const name of ['Malé', 'Berlin', 'Kaafu Atoll', 'München', 'Bayern', 'New York']) {
expect(isCountryName(name)).toBe(false);
}
});
});
@@ -7,6 +7,7 @@ import {
routeExtraction,
routeImageExtraction,
} from '../../../../src/nest/llm-parse/router/extraction-router';
import { FLAT_SCHEMA_BY_TYPE, FLIGHTS_ARRAY_SCHEMA } from '../../../../src/nest/llm-parse/router/flat-schemas';
import { fitTextWindow } from '../../../../src/nest/llm-parse/text-window';
import { describe, it, expect, vi, beforeEach } from 'vitest';
@@ -321,6 +322,86 @@ describe('printed 12-hour clocks and unreadable types (#2094, #2076)', () => {
});
});
// A word that names a type is not proof the document is that type. The first match
// used to decide, with transport first in the table, so a hotel confirmation that named
// the airport bus was extracted with the bus or ferry schema, which has no hotel name,
// address or dates, and the import dropped it.
describe('documents that name more than one type', () => {
const sentSchema = () => extractEnforced.mock.calls[0][0].schema;
const sentSystem = () => extractEnforced.mock.calls[0][0].system as string;
it('lets the model read a hotel confirmation that names the bus, the train and the cruise port as a hotel', async () => {
extractEnforced.mockResolvedValue({
type: 'hotel',
name: 'Hotel Sol',
address: 'Calle Mayor 1, Madrid',
checkin_time: '2026-12-03T15:00:00',
checkout_time: '2026-12-06T11:00:00',
});
await routeExtraction(
'Hotel Sol Madrid\nYour stay, 3 nights.\nGetting here: the airport bus stops 200 m away, ' +
'the train station is 5 minutes away, and the cruise port is close.',
CTX,
);
expect(sentSchema().properties.type).toEqual({ type: 'string', enum: ['train', 'bus', 'ferry', 'hotel'] });
expect(sentSchema().properties.checkin_time).toEqual({ type: 'string' });
expect(sentSystem()).toContain('one of: train, bus, ferry, hotel');
expect(sentSystem()).toContain('- hotel: hotel stay.');
expect(sentSystem()).not.toContain('- car:');
const flat = mapToKi.mock.calls[0][0][0];
expect(flat.type).toBe('hotel');
expect(flat.name).toBe('Hotel Sol');
expect(flat.checkout_time).toBe('2026-12-06T11:00:00');
expect(flat.type_guessed).toBeUndefined();
});
it('keeps a ferry ticket that lists its cabin as accommodation a ferry', async () => {
extractEnforced.mockResolvedValue({ type: 'ferry', from_name: 'Portsmouth', to_name: 'Caen' });
await routeExtraction('Your ferry booking Portsmouth - Caen. Outbound accommodation: 2-berth cabin.', CTX);
expect(sentSchema().properties.type).toEqual({ type: 'string', enum: ['ferry', 'hotel'] });
expect(mapToKi.mock.calls[0][0][0].type).toBe('ferry');
});
it('keeps the first named type when the model answers outside the list', async () => {
extractEnforced.mockResolvedValue({ type: 'flight', name: 'Hostel Luna' });
await routeExtraction('Hostel Luna. The airport bus stops at the door.', CTX);
expect(mapToKi.mock.calls[0][0][0].type).toBe('bus');
});
it('still extracts a document that names one type with that type schema', async () => {
extractEnforced.mockResolvedValue({ name: 'Casa Azul' });
await routeExtraction('Your apartment Casa Azul, 3 nights, check-in from 15:00.', CTX);
expect(sentSchema()).toBe(FLAT_SCHEMA_BY_TYPE.hotel);
expect(mapToKi.mock.calls[0][0][0].type).toBe('hotel');
});
it('keeps a rail ticket with several train numbers off the flight path (#2076)', async () => {
extractEnforced.mockResolvedValue({ from_name: 'Hamburg', to_name: 'Kassel' });
await routeExtraction('Deutsche Bahn. IC 2023 Hamburg Hbf - Hannover Hbf, RE 4711 Hannover - Kassel.', CTX);
expect(sentSchema()).toBe(FLAT_SCHEMA_BY_TYPE.train);
expect(mapToKi.mock.calls[0][0][0].type).toBe('train');
});
it('keeps a flight confirmation with hotel offers on the flight path', async () => {
extractEnforced.mockResolvedValue({ flights: [{ vehicle_number: 'EW9044', from_code: 'CGN', to_code: 'PMI' }] });
await routeExtraction('Hinflug EW 9044 Koeln - Palma. Hotels in Palma ab 39 EUR, jetzt Hotel buchen.', CTX);
expect(sentSchema()).toBe(FLIGHTS_ARRAY_SCHEMA);
expect(mapToKi.mock.calls[0][0][0].type).toBe('flight');
});
it('reads the event words only when the document names no other type', async () => {
extractEnforced.mockResolvedValue({ name: 'Concert' });
await routeExtraction('Concert ticket. Doors open 19:00.', CTX);
expect(sentSchema()).toBe(FLAT_SCHEMA_BY_TYPE.event);
vi.clearAllMocks();
mapToKi.mockReturnValue([{ '@type': 'Mock' }]);
extractEnforced.mockResolvedValue({ from_name: 'Madrid', to_name: 'Lisboa' });
await routeExtraction('Bus ticket Madrid to Lisboa, seat 12.', CTX);
expect(sentSchema()).toBe(FLAT_SCHEMA_BY_TYPE.bus);
});
});
describe('routeImageExtraction', () => {
it('makes one enforced call with the photo attached and lets the model pick the type', async () => {
extractEnforced.mockResolvedValue({
@@ -118,14 +118,20 @@ describe('renditionFor', () => {
it('PMEDIA-006: a copy that takes longer than a request waits is refused as pending and finished for the next one', async () => {
write('journey', 'long.jpg', phonePhoto());
let release = () => {};
let started = () => {};
const held = new Promise<void>((resolve) => (release = resolve));
const building = new Promise<void>((resolve) => (started = resolve));
storage.withLocalFile.mockImplementationOnce(async (category, name, fn) => {
started();
await held;
return fn(at(category, name));
});
vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
try {
const first = expect(service.renditionFor('journey', 'long.jpg')).rejects.toBeInstanceOf(RenditionPendingError);
// Only once the copy has started is its wait armed; advancing before that
// skipped past a timer that did not exist yet, and the test hung on a slow runner.
await building;
await vi.advanceTimersByTimeAsync(50_000);
await first;
} finally {
@@ -123,6 +123,45 @@ describe('GeofabrikClient.regions', () => {
expect(fetchMock).toHaveBeenCalledTimes(2);
});
it('GEOF-016: reads the list Geofabrik serves with null for a top level parent or a missing extract (#3195)', async () => {
// The live index names a continent's parent as null rather than leaving the key out.
const live = {
type: 'FeatureCollection',
features: [
{
properties: {
id: 'europe',
parent: null,
name: 'Europe',
urls: { pbf: `${GEOFABRIK_HOST}europe-latest.osm.pbf` },
},
geometry: null,
},
{
properties: { id: 'oberpfalz', parent: 'bayern', name: 'Oberpfalz', urls: { pbf: EXTRACT } },
geometry: square,
},
{ properties: { id: 'nopbf', parent: 'europe', name: 'No pbf', urls: { pbf: null } }, geometry: null },
],
};
fetchMock.mockResolvedValueOnce(json(live));
const regions = await client.regions(1000);
expect([...regions.keys()]).toEqual(['europe', 'oberpfalz']);
expect(regions.get('europe')?.parent).toBeNull();
expect(regions.get('oberpfalz')?.parent).toBe('bayern');
});
it('GEOF-017: skips an entry it cannot read and keeps the rest, but refuses a list of nothing readable', async () => {
const odd = { properties: { id: 42, name: 'Odd', urls: { pbf: EXTRACT } }, geometry: null };
fetchMock.mockResolvedValueOnce(json({ features: [...index.features, odd] }));
expect([...(await client.regions(1000)).keys()]).toEqual(['bayern', 'oberpfalz']);
fetchMock.mockResolvedValueOnce(json({ features: [odd, odd] }));
await expect(new GeofabrikClient().regions()).rejects.toThrow('Geofabrik index is not the list of extracts');
});
it('GEOF-004: refuses an answer that is not the list, or not a success', async () => {
fetchMock.mockResolvedValueOnce(json({ type: 'FeatureCollection' }));
await expect(client.regions()).rejects.toThrow('Geofabrik index is not the list of extracts');
@@ -329,6 +329,7 @@ describe('passkeyRegisterOptions', () => {
const { user, password } = createUser(testDb);
await insertCredential(user.id, { credential_id: 'cred-a', transports: JSON.stringify(['usb', 'nfc']) });
await insertCredential(user.id, { credential_id: 'cred-b', transports: 'not-json' });
await insertCredential(user.id, { credential_id: 'cred-c', transports: JSON.stringify(['usb', 7, null]) });
await seedChallenge('stale', user.id, 'registration', Date.now() - 1000); // purged on the way in
swMock.generateRegistrationOptions.mockResolvedValue({ challenge: 'reg-chal' });
@@ -345,6 +346,7 @@ describe('passkeyRegisterOptions', () => {
expect(call.excludeCredentials).toEqual([
{ id: 'cred-a', transports: ['usb', 'nfc'] },
{ id: 'cred-b', transports: undefined }, // unparseable transports degrade to undefined
{ id: 'cred-c', transports: ['usb'] }, // only string entries are transports
]);
const stored = await findRows(orm, WebauthnChallenges);
@@ -505,6 +507,8 @@ describe('passkeyRegisterVerify', () => {
aaguid: 'aaguid-1',
});
expect(Buffer.from(row?.public_key as Buffer)).toEqual(Buffer.from([9, 9, 9]));
// Verification accepts exactly the algorithms the options offered.
expect(swMock.verifyRegistrationResponse.mock.calls[0][0].supportedAlgorithmIDs).toEqual([-8, -7, -257]);
});
it('PASSKEY-SVC-012: defaults a blank name by device type and caps a long one at 60 chars', async () => {
@@ -292,4 +292,66 @@ describe('wallet pass builder', () => {
expect(request?.back).toBeUndefined();
expect(request?.start).toBe('2027-04-02T15:00:00+00:00');
});
// A hotel whose dates live on its stay, and a booking linked to a day, carry no
// date of their own. The app shows the stay's and the day's dates, so the pass
// used to refuse a booking the user could see dated ("give the booking a date").
it('WALLET-B-011: a hotel without its own time takes the dates and times of its stay', () => {
const request = buildWalletPassRequest(
source(
{ reservation_time: null, reservation_end_time: null, metadata: {} },
{ linked: { startDate: '2027-01-08', endDate: '2027-01-11', checkIn: '15:00', checkOut: '10:00:00' } },
),
WORDS,
);
expect(request).toMatchObject({
kind: 'hotel',
start: '2027-01-08T15:00:00+09:00',
end: '2027-01-11T10:00:00+09:00',
});
expect(request?.details).toEqual([
{ label: 'Check-in', value: displayTime('en-GB', '2027-01-08', '15:00') },
{ label: 'Check-out', value: displayTime('en-GB', '2027-01-11', '10:00') },
]);
});
it('WALLET-B-012: the booking own check-in time comes before the stay one', () => {
const request = buildWalletPassRequest(
source(
{ reservation_time: null, reservation_end_time: null, metadata: { check_in_time: '16:30' } },
{ linked: { startDate: '2027-01-08', endDate: null, checkIn: '15:00', checkOut: null } },
),
WORDS,
);
expect(request?.start).toBe('2027-01-08T16:30:00+09:00');
expect(request?.end).toBeUndefined();
});
it('WALLET-B-013: a day-linked booking with only a clock is dated by its day', () => {
const request = buildWalletPassRequest(
source(
{
type: 'restaurant',
title: 'Gion Karyo',
reservation_time: '19:30',
reservation_end_time: null,
metadata: {},
},
{ linked: { startDate: '2027-04-03', endDate: null } },
),
WORDS,
);
expect(request).toMatchObject({ kind: 'restaurant', start: '2027-04-03T19:30:00+09:00' });
});
it('WALLET-B-014: its own date still wins over the linked day, and nothing at all still means no pass', () => {
const own = buildWalletPassRequest(
source({}, { linked: { startDate: '2027-01-08', endDate: '2027-01-11' } }),
WORDS,
);
expect(own?.start).toBe('2027-04-02T15:00:00+09:00');
expect(
buildWalletPassRequest(source({ reservation_time: null }, { linked: { startDate: null, endDate: null } }), WORDS),
).toBeNull();
});
});
@@ -145,6 +145,60 @@ describe('WalletPassService', () => {
expect(safeFetchAdminConfigured).not.toHaveBeenCalled();
});
it('WALLET-S-003b: a hotel dated only by its stay gets a pass with the stay dates', async () => {
const { service, reservations } = make();
signerAnswers(200, PASS);
reservations.getReservationWithJoins.mockResolvedValueOnce({
...ROW,
reservation_time: null,
reservation_end_time: null,
metadata: '{}',
});
reservations.passContext.mockResolvedValueOnce({
trip_title: 'Valencia',
place_lat: 39.47,
place_lng: -0.376,
place_name: 'Only You Hotel Valencia',
day_date: null,
end_day_date: null,
stay_start_date: '2027-01-08',
stay_end_date: '2027-01-11',
stay_check_in: '15:00',
stay_check_out: '10:00',
});
await service.passFor(1, 42, 7, 'en');
const body = JSON.parse(String((safeFetchAdminConfigured.mock.calls[0] as [string, RequestInit])[1].body));
expect(body).toMatchObject({ kind: 'hotel', start: '2027-01-08T15:00:00+01:00', end: '2027-01-11T10:00:00+01:00' });
});
it('WALLET-S-003c: any other booking reads the dates of the days it is linked to', async () => {
const { service, reservations } = make();
signerAnswers(200, PASS);
reservations.getReservationWithJoins.mockResolvedValueOnce({
...ROW,
type: 'restaurant',
reservation_time: '19:30',
reservation_end_time: null,
metadata: '{}',
});
reservations.passContext.mockResolvedValueOnce({
trip_title: 'Japan 2027',
place_lat: 35.0,
place_lng: 135.77,
place_name: 'Gion Karyo',
day_date: '2027-04-03',
end_day_date: null,
// A stay the restaurant happens to share is not its date.
stay_start_date: '2027-04-01',
stay_end_date: '2027-04-06',
stay_check_in: '15:00',
stay_check_out: '11:00',
});
await service.passFor(1, 42, 7, 'en');
const body = JSON.parse(String((safeFetchAdminConfigured.mock.calls[0] as [string, RequestInit])[1].body));
expect(body).toMatchObject({ kind: 'restaurant', start: '2027-04-03T19:30:00+09:00' });
});
it('WALLET-S-004: a user asking too often is slowed down before anything is read', async () => {
const { service, rateLimit, reservations } = make();
rateLimit.check.mockResolvedValueOnce(false);
@@ -1,5 +1,6 @@
import type { AppSettingsRepository } from '../../../src/db/repositories/AppSettings.repository';
import { WebauthnConfigService, originWithinRpScope } from '../../../src/nest/auth/webauthn-config.service';
import { Logger } from '@nestjs/common';
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
@@ -129,6 +130,56 @@ describe('WebauthnConfigService.resolve', () => {
vi.stubEnv('WEBAUTHN_ORIGINS', 'https://env.example.org');
expect((await svc.resolve())!.explicitOrigins).toBe(true);
});
// The verifier refuses an expected origin with a path, a trailing slash or an
// uppercase host, and an RP ID that is not lower case. Each is reduced to the
// form the browser reports, so a value that worked before keeps working.
it('WAC-014: configured origins are reduced to scheme, host and port, deduplicated', async () => {
settingsStore.set('webauthn_rp_id', 'example.org');
settingsStore.set(
'webauthn_origins',
'https://A.Example.org/trek/, https://a.example.org, https://b.example.org:8443/x//, http://localhost:5173/',
);
expect(await svc.resolve()).toMatchObject({
origins: ['https://a.example.org', 'https://b.example.org:8443', 'http://localhost:5173'],
explicitOrigins: true,
});
});
it('WAC-015: the RP ID is lower-cased, from the setting and from the env var', async () => {
settingsStore.set('webauthn_rp_id', ' Trek.Example.ORG ');
expect(await svc.resolve()).toMatchObject({ rpID: 'trek.example.org' });
vi.stubEnv('WEBAUTHN_RP_ID', 'ENV.example.org');
expect(await svc.resolve()).toMatchObject({ rpID: 'env.example.org' });
});
it('WAC-016: an APP_URL with a path, a trailing slash or an uppercase host derives its origin', async () => {
appUrlRef.value = 'https://Trek.Example.org/app/';
expect(await svc.resolve()).toMatchObject({
rpID: 'trek.example.org',
origins: ['https://trek.example.org'],
explicitOrigins: false,
});
});
it('WAC-017: an origin that does not parse is dropped and named in a warning; other schemes are kept', async () => {
const warn = vi.spyOn(Logger.prototype, 'warn').mockImplementation(() => undefined);
settingsStore.set('webauthn_rp_id', 'example.org');
settingsStore.set('webauthn_origins', 'example.org, https://example.org, android:apk-key-hash:abc123');
expect(await svc.resolve()).toMatchObject({ origins: ['https://example.org', 'android:apk-key-hash:abc123'] });
expect(warn).toHaveBeenCalledWith('Ignoring passkey origins that are not valid URLs: example.org');
warn.mockRestore();
});
it('WAC-018: an explicit list with no parseable origin leaves passkeys unconfigured instead of falling back', async () => {
const warn = vi.spyOn(Logger.prototype, 'warn').mockImplementation(() => undefined);
appUrlRef.value = 'https://trek.example.org';
settingsStore.set('webauthn_origins', 'trek.example.org');
expect(await svc.resolve()).toBeNull();
expect(warn).toHaveBeenCalledTimes(1);
warn.mockRestore();
});
});
// The scope rule mirrors what the browser enforces for a ceremony: https-only
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@trek/shared",
"version": "5.2.0",
"version": "5.2.1",
"engines": {
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
},
@@ -115,7 +115,7 @@
"prettier-plugin-organize-imports": "^4.3.0",
"tsdown": "^0.23.7",
"typescript": "^6.0.3",
"typescript-eslint": "^8.72.1",
"typescript-eslint": "^8.73.0",
"vitest": "^4.1.11"
}
}
+6
View File
@@ -240,6 +240,12 @@ const settings: TranslationStrings = {
'للحصول على رمز مميز: POST /oauth/token مع grant_type=client_credentials وclient_id وclient_secret. بدون متصفح، بدون رمز تحديث.',
'settings.oauth.badge.machine': 'آلي',
'settings.account': 'الحساب',
'settings.apps.title': 'تطبيق TREK',
'settings.apps.hint': 'امسح رمزًا بهاتفك، ثم اربط التطبيق بهذا الخادم.',
'settings.apps.downloadOn': 'حمّله من',
'settings.apps.getItOn': 'احصل عليه من',
'settings.apps.iosDevices': 'iPhone وiPad',
'settings.apps.androidDevices': 'هاتف وجهاز لوحي',
'settings.about': 'حول',
'settings.about.reportBug': 'الإبلاغ عن خطأ',
'settings.about.reportBugHint': 'وجدت مشكلة؟ أخبرنا',
+7 -9
View File
@@ -57,20 +57,17 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'تم تثبيت التحديث',
'system_notice.release_notes.headline': 'اكتب أقل، سافر أكثر.',
'system_notice.release_notes.intro':
'رسائل الحجز التي تعيد توجيهها تصل إلى رحلتك، ويتابع TREK رحلات طيرانك مباشرةً، وملف PDF للرحلة جديد كليًا. ويعمل TREK الآن على PostgreSQL أيضًا.',
'رسائل الحجز التي تعيد توجيهها تصل إلى رحلتك، ويتابع TREK رحلات طيرانك مباشرةً، وملف PDF للرحلة جديد كليًا.',
'system_notice.release_notes.features_label': 'أبرز الجديد',
'system_notice.release_notes.features_aside': 'وهذا ليس كل شيء',
'system_notice.release_notes.feature_mail_title': 'رسائل الحجز تصل إلى رحلتك',
'system_notice.release_notes.feature_mail_body':
'أعد توجيه التأكيد إلى عنوانك الشخصي، وسيجد TREK رحلتك ويراجع الرسالة ويضيف الحجز مع مستنده.',
'system_notice.release_notes.feature_mail_body': 'أعد توجيه التأكيد وسيضيف TREK الحجز إلى الرحلة الصحيحة.',
'system_notice.release_notes.feature_flight_title': 'حالة الرحلات الجوية مباشرةً، مجانًا',
'system_notice.release_notes.feature_flight_body':
'يتابع TREK كل رحلة طيران لك في يومها: الحالة والتأخير والمطارين وخريطة عليها الطائرة، دون مفتاح API.',
'system_notice.release_notes.feature_flight_body': 'الحالة والتأخير والطائرة على الخريطة، دون مفتاح API.',
'system_notice.release_notes.feature_pdf_title': 'ملف PDF جديد للرحلة',
'system_notice.release_notes.feature_pdf_body':
'غلاف بمسارك، وكل يوم على شكل جدول زمني، وكل حجوزاتك برموزها، جاهز للطباعة أو المشاركة.',
'system_notice.release_notes.feature_pdf_body': 'مسارك وكل يوم وكل حجوزاتك، جاهزة للطباعة.',
'system_notice.release_notes.footnote':
'إضافةً إلى PostgreSQL، والإضافات لكل رحلة، والوسوم على الأماكن، وطرق أكثر لتتبّع التكاليف، وقائمة طويلة من التغييرات الأصغر.',
'إضافةً إلى PostgreSQL، والإضافات لكل رحلة، والوسوم على الأماكن، وتغييرات أصغر كثيرة.',
'system_notice.release_notes.notes_label': 'ملاحظات الإصدار',
'system_notice.release_notes.note_eyebrow': 'كلمة من صاحب المشروع',
'system_notice.release_notes.note_title': 'أنتم السبب في أنني ما زلت أبني TREK.',
@@ -80,7 +77,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_lead': 'سيبقى TREK مجانيًا، إلى الأبد.',
'system_notice.release_notes.promise_text': 'كل ميزة، وكل تحديث، للجميع. لا باقات مدفوعة، لا اشتراكات، لا شروط خفية.',
'system_notice.release_notes.note_body_after':
'ثم جئتم، وسرعان ما صرتم بالآلاف: بنجوم وتقارير أخطاء وترجمات إلى لغات لا أتحدثها وطلبات دمج من أشخاص لم ألتقِ بهم قط. ما زلت أتفقد المستودع أول شيء كل صباح، وما زال الأمر لا يبدو حقيقيًا تمامًا.',
'ثم جئتم بالآلاف: بنجوم وتقارير أخطاء وترجمات وطلبات دمج من أشخاص لم ألتقِ بهم قط. وما زال الأمر لا يبدو حقيقيًا تمامًا.',
'system_notice.release_notes.note_closing': 'شكرًا لوجودك هنا. Maurice',
'system_notice.release_notes.support_label': 'بفضلك أنت',
'system_notice.release_notes.support_lead': 'TREK موجود بفضل التبرعات فقط.',
@@ -89,5 +86,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'اشترِ لي قهوة',
'system_notice.release_notes.cta_kofi': 'ادعمني على Ko-fi',
'system_notice.release_notes.cta_patreon': 'شهريًا على Patreon',
'system_notice.release_notes.apps_title': 'TREK الآن على هاتفك',
};
export default system_notice;
+6
View File
@@ -318,6 +318,12 @@ const settings: TranslationStrings = {
'settings.oauth.badge.machine': 'maşın',
'settings.account': 'Hesab',
'settings.apps.title': 'TREK tətbiqi',
'settings.apps.hint': 'Telefonunuzla kodu skan edin, sonra tətbiqi bu serverə qoşun.',
'settings.apps.downloadOn': 'Yükləyin:',
'settings.apps.getItOn': 'Əldə edin:',
'settings.apps.iosDevices': 'iPhone və iPad',
'settings.apps.androidDevices': 'Telefon və planşet',
'settings.about': 'Haqqında',
'settings.about.reportBug': 'Xəta bildir',
'settings.about.reportBugHint': 'Problem tapmısınız? Bizə bildirin',
+7 -8
View File
@@ -57,20 +57,18 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Yeniləmə quraşdırıldı',
'system_notice.release_notes.headline': 'Az yazın, çox səyahət edin.',
'system_notice.release_notes.intro':
'Yönləndirdiyiniz rezervasiya məktubları səyahətinizə düşür, TREK uçuşlarınızı canlı izləyir, səyahət PDF-i isə tamamilə yenidir. TREK artıq PostgreSQL üzərində də işləyir.',
'Yönləndirdiyiniz rezervasiya məktubları səyahətinizə düşür, TREK uçuşlarınızı canlı izləyir, səyahət PDF-i isə tamamilə yenidir.',
'system_notice.release_notes.features_label': 'Əsas yeniliklər',
'system_notice.release_notes.features_aside': 'Bundan əlavə',
'system_notice.release_notes.feature_mail_title': 'Rezervasiya məktubları səyahətinizə düşür',
'system_notice.release_notes.feature_mail_body':
'Təsdiqi şəxsi ünvanınıza yönləndirin, TREK səyahətinizi tapır, yoxlayır və rezervasiyanı sənədi ilə birlikdə əlavə edir.',
'Təsdiqi yönləndirin, TREK rezervasiyanı düzgün səyahətə əlavə edir.',
'system_notice.release_notes.feature_flight_title': 'Canlı uçuş statusu, pulsuz',
'system_notice.release_notes.feature_flight_body':
'TREK hər uçuşunuzu həmin gün izləyir: vəziyyət, gecikmə, hər iki hava limanı və təyyarənin göründüyü xəritə, API açarı olmadan.',
'system_notice.release_notes.feature_flight_body': 'Vəziyyət, gecikmələr və xəritədə təyyarə, API açarı olmadan.',
'system_notice.release_notes.feature_pdf_title': 'Yeni səyahət PDF-i',
'system_notice.release_notes.feature_pdf_body':
'Marşrutunuzla örtük, hər gün zaman xətti kimi və bütün rezervasiyalarınız kodları ilə, çapa və ya paylaşmağa hazır.',
'system_notice.release_notes.feature_pdf_body': 'Marşrutunuz, hər gün və bütün rezervasiyalarınız, çapa hazır.',
'system_notice.release_notes.footnote':
'Bunlarla yanaşı PostgreSQL, səyahət üzrə əlavələr, məkanlara etiketlər, xərcləri izləməyin daha çox yolu və kiçik dəyişikliklərin uzun siyahısı.',
'Bunlarla yanaşı PostgreSQL, səyahət üzrə əlavələr, məkanlara etiketlər və bir çox kiçik dəyişiklik.',
'system_notice.release_notes.notes_label': 'Buraxılış qeydləri',
'system_notice.release_notes.note_eyebrow': 'Layihə rəhbərindən qeyd',
'system_notice.release_notes.note_title': 'TREK-i inkişaf etdirməyə davam etməyimin səbəbi sizsiniz.',
@@ -81,7 +79,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Hər funksiya və hər yeniləmə hər kəs üçün olacaq. Ödənişli səviyyələr, abunəliklər və gizli şərtlər yoxdur.',
'system_notice.release_notes.note_body_after':
'Sonra siz gəldiniz, tezliklə minlərlə: ulduzlarla, xəta hesabatları ilə, bilmədiyim dillərə tərcümələrlə və heç tanımadığım insanların pull request-ləri ilə. Hər səhər ilk işim repozitoriyaya baxmaqdır və bu, hələ də tam gerçək görünmür.',
'Sonra siz gəldiniz, minlərlə: ulduzlarla, xəta hesabatları ilə, tərcümələrlə və heç tanımadığım insanların pull request-ləri ilə. Bu, hələ də tam gerçək görünmür.',
'system_notice.release_notes.note_closing': 'Burada olduğunuz üçün təşəkkür edirəm. Maurice',
'system_notice.release_notes.support_label': 'Sizin sayənizdə mümkündür',
'system_notice.release_notes.support_lead': 'TREK yalnız ianələr sayəsində mövcuddur.',
@@ -90,6 +88,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Mənə qəhvə al',
'system_notice.release_notes.cta_kofi': 'Ko-fi-da dəstəklə',
'system_notice.release_notes.cta_patreon': 'Patreon-da aylıq',
'system_notice.release_notes.apps_title': 'TREK artıq telefonunuzdadır',
'system_notice.pager.prev': 'Əvvəlki bildiriş',
'system_notice.pager.next': 'Növbəti bildiriş',
'system_notice.pager.counter': '{current} / {total}',
+6
View File
@@ -141,6 +141,12 @@ const settings: TranslationStrings = {
'settings.on': 'Ligado',
'settings.off': 'Desligado',
'settings.account': 'Conta',
'settings.apps.title': 'App TREK',
'settings.apps.hint': 'Escaneie um código com o celular e conecte o app a este servidor.',
'settings.apps.downloadOn': 'Baixar na',
'settings.apps.getItOn': 'Disponível no',
'settings.apps.iosDevices': 'iPhone e iPad',
'settings.apps.androidDevices': 'Celular e tablet',
'settings.about': 'Sobre',
'settings.about.reportBug': 'Reportar um bug',
'settings.about.reportBugHint': 'Encontrou um problema? Nos avise',
+7 -7
View File
@@ -59,20 +59,19 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Atualização instalada',
'system_notice.release_notes.headline': 'Menos digitação, mais viagem.',
'system_notice.release_notes.intro':
'Os e-mails de reserva que você encaminha vão direto para a sua viagem, o TREK acompanha seus voos ao vivo e o PDF da viagem é todo novo. O TREK agora também roda em PostgreSQL.',
'Os e-mails de reserva que você encaminha vão para a sua viagem, o TREK acompanha seus voos ao vivo e o PDF da viagem é todo novo.',
'system_notice.release_notes.features_label': 'Os destaques',
'system_notice.release_notes.features_aside': 'E não é só isso',
'system_notice.release_notes.feature_mail_title': 'E-mails de reserva caem na sua viagem',
'system_notice.release_notes.feature_mail_body':
'Encaminhe uma confirmação para o seu endereço pessoal e o TREK encontra a sua viagem, confere tudo e adiciona a reserva com o documento.',
'Encaminhe uma confirmação e o TREK adiciona a reserva à viagem certa.',
'system_notice.release_notes.feature_flight_title': 'Status de voo ao vivo, de graça',
'system_notice.release_notes.feature_flight_body':
'O TREK acompanha cada um dos seus voos no dia: situação, atraso, os dois aeroportos e um mapa com a aeronave, sem chave de API.',
'system_notice.release_notes.feature_flight_body': 'Situação, atrasos e a aeronave no mapa, sem chave de API.',
'system_notice.release_notes.feature_pdf_title': 'Um novo PDF da viagem',
'system_notice.release_notes.feature_pdf_body':
'Uma capa com o seu roteiro, cada dia como linha do tempo e todas as suas reservas com os códigos, pronto para imprimir ou compartilhar.',
'Seu roteiro, cada dia e todas as suas reservas, pronto para imprimir.',
'system_notice.release_notes.footnote':
'Além disso, PostgreSQL, complementos por viagem, tags em lugares, mais formas de controlar os custos e uma longa lista de mudanças menores.',
'Além disso, PostgreSQL, complementos por viagem, tags em lugares e muitas mudanças menores.',
'system_notice.release_notes.notes_label': 'Notas da versão',
'system_notice.release_notes.note_eyebrow': 'Uma nota do mantenedor',
'system_notice.release_notes.note_title': 'Vocês são a razão de eu continuar construindo o TREK.',
@@ -83,7 +82,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Cada recurso, cada atualização, para todo mundo. Sem planos pagos, sem assinaturas, sem pegadinhas.',
'system_notice.release_notes.note_body_after':
'Aí vocês chegaram, e logo aos milhares: com estrelas, relatos de bugs, traduções para idiomas que não falo e pull requests de pessoas que nunca conheci. Ainda confiro o repositório logo cedo toda manhã, e isso ainda não parece muito real.',
'Aí vocês chegaram, aos milhares: com estrelas, relatos de bugs, traduções e pull requests de pessoas que nunca conheci. Isso ainda não parece muito real.',
'system_notice.release_notes.note_closing': 'Obrigado por estarem aqui. Maurice',
'system_notice.release_notes.support_label': 'Possível graças a você',
'system_notice.release_notes.support_lead': 'O TREK só existe graças às doações.',
@@ -92,5 +91,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Apoiar no Ko-fi',
'system_notice.release_notes.cta_patreon': 'Mensal no Patreon',
'system_notice.release_notes.apps_title': 'O TREK agora está no seu celular',
};
export default system_notice;
+6
View File
@@ -208,6 +208,12 @@ const settings: TranslationStrings = {
"Obtenir token: POST /oauth/token amb grant_type=client_credentials, client_id i client_secret. Sense navegador, sense token d'actualització.",
'settings.oauth.badge.machine': 'màquina',
'settings.account': 'Compte',
'settings.apps.title': 'App de TREK',
'settings.apps.hint': 'Escaneja un codi amb el mòbil i després connecta l’app a aquest servidor.',
'settings.apps.downloadOn': 'Descarrega-la a l’',
'settings.apps.getItOn': 'Disponible a',
'settings.apps.iosDevices': 'iPhone i iPad',
'settings.apps.androidDevices': 'Mòbil i tauleta',
'settings.about': 'Quant a',
'settings.about.reportBug': "Informa d'un error",
'settings.about.reportBugHint': 'Has trobat un problema? Comunica-nos-ho',
+7 -7
View File
@@ -62,15 +62,14 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.features_aside': 'I això no és tot',
'system_notice.release_notes.feature_mail_title': 'Els correus de reserva arriben al teu viatge',
'system_notice.release_notes.feature_mail_body':
'Reenvia una confirmació a la teva adreça personal i TREK troba el teu viatge, ho comprova i afegeix la reserva amb el seu document.',
'Reenvia una confirmació i TREK afegeix la reserva al viatge correcte.',
'system_notice.release_notes.feature_flight_title': 'Estat del vol en directe, gratis',
'system_notice.release_notes.feature_flight_body':
'TREK segueix cadascun dels teus vols el dia que toca: estat, retard, tots dos aeroports i un mapa amb l’avió, sense clau d’API.',
'system_notice.release_notes.feature_flight_body': 'Estat, retards i l’avió al mapa, sense clau d’API.',
'system_notice.release_notes.feature_pdf_title': 'Un PDF del viatge nou',
'system_notice.release_notes.feature_pdf_body':
'Una portada amb la teva ruta, cada dia com a cronologia i totes les teves reserves amb els codis, a punt per imprimir o compartir.',
'La teva ruta, cada dia i totes les teves reserves, a punt per imprimir.',
'system_notice.release_notes.footnote':
'A més, PostgreSQL, complements per viatge, etiquetes als llocs, més maneres de portar les despeses i una llarga llista de canvis més petits.',
'A més, PostgreSQL, complements per viatge, etiquetes als llocs i molts canvis més petits.',
'system_notice.release_notes.notes_label': 'Notes de la versió',
'system_notice.release_notes.note_eyebrow': 'Una nota del mantenidor',
'system_notice.release_notes.note_title': 'Sou el motiu pel qual continuo construint TREK.',
@@ -81,7 +80,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Cada funcionalitat, cada actualització, per a tothom. Sense nivells de pagament, sense subscripcions, sense lletra petita.',
'system_notice.release_notes.note_body_after':
'Després vau arribar vosaltres, aviat per milers: amb estrelles, informes d’errors, traduccions a idiomes que no parlo i pull requests de gent que no havia vist mai. Cada matí encara miro el repositori a primera hora, i encara no se’m fa del tot real.',
'Després vau arribar vosaltres, per milers: amb estrelles, informes d’errors, traduccions i pull requests de gent que no havia vist mai. Encara no se’m fa del tot real.',
'system_notice.release_notes.note_closing': 'Gràcies per ser aquí. Maurice',
'system_notice.release_notes.support_label': 'Possible gràcies a tu',
'system_notice.release_notes.support_lead': 'TREK només existeix gràcies a les donacions.',
@@ -90,7 +89,8 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Dona suport a Ko-fi',
'system_notice.release_notes.cta_patreon': 'Cada mes a Patreon',
'system_notice.release_notes.apps_title': 'TREK ara és al teu mòbil',
'system_notice.release_notes.intro':
'Els correus de reserva que reenvies arriben al teu viatge, TREK segueix els teus vols en directe i el PDF del viatge és totalment nou. TREK també funciona ara amb PostgreSQL.',
'Els correus de reserva que reenvies arriben al teu viatge, TREK segueix els teus vols en directe i el PDF del viatge és totalment nou.',
};
export default system_notice;
+6
View File
@@ -223,6 +223,12 @@ const settings: TranslationStrings = {
'Získat token: POST /oauth/token s grant_type=client_credentials, client_id a client_secret. Bez prohlížeče, bez obnovovacího tokenu.',
'settings.oauth.badge.machine': 'strojový',
'settings.account': 'Účet',
'settings.apps.title': 'Aplikace TREK',
'settings.apps.hint': 'Naskenujte kód telefonem a pak připojte aplikaci k tomuto serveru.',
'settings.apps.downloadOn': 'Stáhnout v',
'settings.apps.getItOn': 'Nyní na',
'settings.apps.iosDevices': 'iPhone a iPad',
'settings.apps.androidDevices': 'Telefon a tablet',
'settings.about': 'O aplikaci',
'settings.about.reportBug': 'Nahlásit chybu',
'settings.about.reportBugHint': 'Našli jste problém? Dejte nám vědět',
+7 -9
View File
@@ -59,20 +59,17 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Aktualizace nainstalována',
'system_notice.release_notes.headline': 'Méně psaní, více cestování.',
'system_notice.release_notes.intro':
'Rezervační e-maily, které přepošlete, skončí ve vaší cestě, TREK sleduje vaše lety živě a PDF cesty je úplně nové. TREK teď běží i na PostgreSQL.',
'Přeposlané rezervační e-maily skončí ve vaší cestě, TREK sleduje vaše lety živě a PDF cesty je úplně nové.',
'system_notice.release_notes.features_label': 'Hlavní novinky',
'system_notice.release_notes.features_aside': 'Zdaleka ne všechno',
'system_notice.release_notes.feature_mail_title': 'E-maily s rezervacemi skončí ve vaší cestě',
'system_notice.release_notes.feature_mail_body':
'Přepošlete potvrzení na svou osobní adresu a TREK najde vaši cestu, zkontroluje e-mail a přidá rezervaci i s dokumentem.',
'system_notice.release_notes.feature_mail_body': 'Přepošlete potvrzení a TREK přidá rezervaci do správné cesty.',
'system_notice.release_notes.feature_flight_title': 'Stav letu živě, zdarma',
'system_notice.release_notes.feature_flight_body':
'TREK sleduje každý váš let v den odletu: stav, zpoždění, obě letiště a mapu s letadlem, bez API klíče.',
'system_notice.release_notes.feature_flight_body': 'Stav, zpoždění a letadlo na mapě, bez API klíče.',
'system_notice.release_notes.feature_pdf_title': 'Nové PDF cesty',
'system_notice.release_notes.feature_pdf_body':
'Titulní strana s vaší trasou, každý den jako časová osa a všechny vaše rezervace s kódy, připravené k tisku i sdílení.',
'system_notice.release_notes.feature_pdf_body': 'Vaše trasa, každý den a všechny vaše rezervace, připravené k tisku.',
'system_notice.release_notes.footnote':
'K tomu PostgreSQL, doplňky pro jednotlivé cesty, štítky u míst, další způsoby, jak hlídat výdaje, a dlouhý seznam menších změn.',
'K tomu PostgreSQL, doplňky pro jednotlivé cesty, štítky u míst a spousta menších změn.',
'system_notice.release_notes.notes_label': 'Poznámky k vydání',
'system_notice.release_notes.note_eyebrow': 'Slovo od autora',
'system_notice.release_notes.note_title': 'Vy jste důvod, proč na TREK pořád pracuji.',
@@ -83,7 +80,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Každá funkce, každá aktualizace, pro všechny. Žádné placené verze, žádná předplatná, žádné háčky.',
'system_notice.release_notes.note_body_after':
'Pak jste přišli vy, brzy po tisících: s hvězdičkami, hlášeními chyb, překlady do jazyků, kterými nemluvím, a pull requesty od lidí, které jsem nikdy nepotkal. Každé ráno stále jako první zkontroluji repozitář a pořád mi to nepřipadá docela skutečné.',
'Pak jste přišli vy, po tisících: s hvězdičkami, hlášeními chyb, překlady a pull requesty od lidí, které jsem nikdy nepotkal. Pořád mi to nepřipadá docela skutečné.',
'system_notice.release_notes.note_closing': 'Děkuji, že jste tady. Maurice',
'system_notice.release_notes.support_label': 'Díky vám',
'system_notice.release_notes.support_lead': 'TREK existuje jen díky darům.',
@@ -92,5 +89,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Kup mi kávu',
'system_notice.release_notes.cta_kofi': 'Podpořit na Ko-fi',
'system_notice.release_notes.cta_patreon': 'Měsíčně na Patreonu',
'system_notice.release_notes.apps_title': 'TREK je teď ve vašem telefonu',
};
export default system_notice;
+6
View File
@@ -227,6 +227,12 @@ const settings: TranslationStrings = {
'Token abrufen: POST /oauth/token mit grant_type=client_credentials, client_id und client_secret. Kein Browser, kein Refresh-Token.',
'settings.oauth.badge.machine': 'Maschine',
'settings.account': 'Konto',
'settings.apps.title': 'TREK-App',
'settings.apps.hint': 'Scanne einen Code mit dem Handy und verbinde die App dann mit diesem Server.',
'settings.apps.downloadOn': 'Laden im',
'settings.apps.getItOn': 'Jetzt bei',
'settings.apps.iosDevices': 'iPhone und iPad',
'settings.apps.androidDevices': 'Handy und Tablet',
'settings.about': 'Über',
'settings.about.reportBug': 'Bug melden',
'settings.about.reportBugHint': 'Problem gefunden? Melde es uns',
+7 -7
View File
@@ -60,20 +60,19 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Update installiert',
'system_notice.release_notes.headline': 'Weniger tippen, mehr reisen.',
'system_notice.release_notes.intro':
'Buchungsmails, die du weiterleitest, landen in deiner Reise, TREK verfolgt deine Flüge live, und das Reise-PDF ist ganz neu. TREK läuft jetzt auch mit PostgreSQL.',
'Weitergeleitete Buchungsmails landen in deiner Reise, TREK verfolgt deine Flüge live und das Reise-PDF ist ganz neu.',
'system_notice.release_notes.features_label': 'Die Highlights',
'system_notice.release_notes.features_aside': 'Längst nicht alles',
'system_notice.release_notes.feature_mail_title': 'Buchungsmails landen in deiner Reise',
'system_notice.release_notes.feature_mail_body':
'Leite eine Bestätigung an deine persönliche Adresse weiter, und TREK findet deine Reise, prüft sie und trägt die Buchung samt Dokument ein.',
'Bestätigung weiterleiten, TREK legt die Buchung in der richtigen Reise an.',
'system_notice.release_notes.feature_flight_title': 'Live-Flugstatus, kostenlos',
'system_notice.release_notes.feature_flight_body':
'TREK verfolgt jeden deiner Flüge an seinem Tag: Status, Verspätung, beide Flughäfen und eine Karte mit dem Flugzeug, ganz ohne API-Key.',
'Status, Verspätung und das Flugzeug auf der Karte, ohne API-Schlüssel.',
'system_notice.release_notes.feature_pdf_title': 'Ein neues Reise-PDF',
'system_notice.release_notes.feature_pdf_body':
'Ein Cover mit deiner Route, jeder Tag als Zeitleiste und alle deine Buchungen mit ihren Codes, bereit zum Drucken oder Teilen.',
'system_notice.release_notes.feature_pdf_body': 'Deine Route, jeder Tag und alle Buchungen, fertig zum Drucken.',
'system_notice.release_notes.footnote':
'Dazu PostgreSQL, Addons pro Reise, Tags für Orte, mehr Möglichkeiten für Kosten und eine lange Liste kleinerer Änderungen.',
'Dazu PostgreSQL, Addons pro Reise, Tags für Orte und viele kleinere Änderungen.',
'system_notice.release_notes.notes_label': 'Release Notes',
'system_notice.release_notes.note_eyebrow': 'Ein Wort vom Maintainer',
'system_notice.release_notes.note_title': 'Du bist der Grund, warum ich TREK weiterbaue.',
@@ -84,7 +83,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Jede Funktion, jedes Update, für alle. Keine Paid Tiers, keine Abos, kein Haken.',
'system_notice.release_notes.note_body_after':
'Dann kamt ihr, schnell zu Tausenden: mit Sternen, Bug-Reports, Übersetzungen in Sprachen, die ich nicht spreche, und Pull Requests von Leuten, die ich nie getroffen habe. Bis heute schaue ich jeden Morgen zuerst ins Repository, und ganz real fühlt es sich immer noch nicht an.',
'Dann kamt ihr, zu Tausenden: mit Sternen, Bug-Reports, Übersetzungen und Pull Requests von Leuten, die ich nie getroffen habe. Ganz real fühlt es sich bis heute nicht an.',
'system_notice.release_notes.note_closing': 'Danke, dass du dabei bist. Maurice',
'system_notice.release_notes.support_label': 'Möglich durch dich',
'system_notice.release_notes.support_lead': 'TREK gibt es nur dank Spenden.',
@@ -93,5 +92,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Ko-fi unterstützen',
'system_notice.release_notes.cta_patreon': 'Monatlich auf Patreon',
'system_notice.release_notes.apps_title': 'TREK gibt es jetzt als App',
};
export default system_notice;
+6
View File
@@ -286,6 +286,12 @@ const settings: TranslationStrings = {
'Get a token: POST /oauth/token with grant_type=client_credentials, client_id, and client_secret. No browser, no refresh token.',
'settings.oauth.badge.machine': 'machine',
'settings.account': 'Account',
'settings.apps.title': 'TREK app',
'settings.apps.hint': 'Scan a code with your phone, then connect the app to this server.',
'settings.apps.downloadOn': 'Download on the',
'settings.apps.getItOn': 'Get it on',
'settings.apps.iosDevices': 'iPhone and iPad',
'settings.apps.androidDevices': 'Phone and tablet',
'settings.about': 'About',
'settings.about.reportBug': 'Report a Bug',
'settings.about.reportBugHint': 'Found an issue? Let us know',
+7 -9
View File
@@ -55,20 +55,17 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Update installed',
'system_notice.release_notes.headline': 'Less typing, more travelling.',
'system_notice.release_notes.intro':
'Booking mails you forward land in your trip, TREK follows your flights live, and the trip PDF is all new. TREK now runs on PostgreSQL too.',
'Booking mails you forward land in your trip, TREK follows your flights live and the trip PDF is all new.',
'system_notice.release_notes.features_label': 'The headliners',
'system_notice.release_notes.features_aside': 'Far from everything',
'system_notice.release_notes.feature_mail_title': 'Booking mails land in your trip',
'system_notice.release_notes.feature_mail_body':
'Forward a confirmation to your personal address and TREK finds your trip, checks it and adds the booking with its document.',
'Forward a confirmation and TREK adds the booking to the right trip.',
'system_notice.release_notes.feature_flight_title': 'Live flight status, for free',
'system_notice.release_notes.feature_flight_body':
'TREK follows each of your flights on its day: state, delay, both airports and a map with the aircraft, with no API key.',
'system_notice.release_notes.feature_flight_body': 'State, delays and the aircraft on a map, with no API key.',
'system_notice.release_notes.feature_pdf_title': 'A new trip PDF',
'system_notice.release_notes.feature_pdf_body':
'A cover with your route, every day as a timeline and all your bookings with their codes, ready to print or share.',
'system_notice.release_notes.footnote':
'Plus PostgreSQL, addons per trip, tags on places, more ways to keep costs and a long list of smaller changes.',
'system_notice.release_notes.feature_pdf_body': 'Your route, every day and all your bookings, ready to print.',
'system_notice.release_notes.footnote': 'Plus PostgreSQL, addons per trip, tags on places and many smaller changes.',
'system_notice.release_notes.notes_label': 'Release notes',
'system_notice.release_notes.note_eyebrow': 'A note from the maintainer',
'system_notice.release_notes.note_title': 'You are the reason I keep building TREK.',
@@ -79,7 +76,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Every feature, every update, for everyone. No paid tiers, no subscriptions, no catch.',
'system_notice.release_notes.note_body_after':
"Then you came, soon by the thousands: with stars, bug reports, translations into languages I don't speak and pull requests from people I've never met. I still check the repository first thing every morning, and it still doesn't quite feel real.",
"Then you came, by the thousands: with stars, bug reports, translations and pull requests from people I've never met. It still doesn't quite feel real.",
'system_notice.release_notes.note_closing': 'Thank you for being here. Maurice',
'system_notice.release_notes.support_label': 'Made possible by you',
'system_notice.release_notes.support_lead': 'TREK only exists thanks to donations.',
@@ -88,6 +85,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Support on Ko-fi',
'system_notice.release_notes.cta_patreon': 'Monthly on Patreon',
'system_notice.release_notes.apps_title': 'TREK is now on your phone',
'system_notice.pager.prev': 'Previous notice',
'system_notice.pager.next': 'Next notice',
'system_notice.pager.counter': '{current} / {total}',
+6
View File
@@ -226,6 +226,12 @@ const settings: TranslationStrings = {
'Obtener token: POST /oauth/token con grant_type=client_credentials, client_id y client_secret. Sin navegador, sin token de actualización.',
'settings.oauth.badge.machine': 'máquina',
'settings.account': 'Cuenta',
'settings.apps.title': 'App de TREK',
'settings.apps.hint': 'Escanea un código con tu móvil y luego conecta la app a este servidor.',
'settings.apps.downloadOn': 'Descárgalo en el',
'settings.apps.getItOn': 'Disponible en',
'settings.apps.iosDevices': 'iPhone y iPad',
'settings.apps.androidDevices': 'Móvil y tableta',
'settings.about': 'Acerca de',
'settings.about.reportBug': 'Reportar un error',
'settings.about.reportBugHint': 'Encontraste un problema? Avísanos',
+7 -8
View File
@@ -59,20 +59,18 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Actualización instalada',
'system_notice.release_notes.headline': 'Menos teclear, más viajar.',
'system_notice.release_notes.intro':
'Los correos de reserva que reenvías llegan a tu viaje, TREK sigue tus vuelos en directo y el PDF del viaje es totalmente nuevo. TREK ahora también funciona con PostgreSQL.',
'Los correos de reserva que reenvías llegan a tu viaje, TREK sigue tus vuelos en directo y el PDF del viaje es totalmente nuevo.',
'system_notice.release_notes.features_label': 'Los protagonistas',
'system_notice.release_notes.features_aside': 'Y eso no es todo',
'system_notice.release_notes.feature_mail_title': 'Los correos de reserva llegan a tu viaje',
'system_notice.release_notes.feature_mail_body':
'Reenvía una confirmación a tu dirección personal y TREK encuentra tu viaje, la comprueba y añade la reserva con su documento.',
'Reenvía una confirmación y TREK añade la reserva al viaje correcto.',
'system_notice.release_notes.feature_flight_title': 'Estado del vuelo en directo, gratis',
'system_notice.release_notes.feature_flight_body':
'TREK sigue cada uno de tus vuelos el día que toca: estado, retraso, ambos aeropuertos y un mapa con el avión, sin clave de API.',
'system_notice.release_notes.feature_flight_body': 'Estado, retrasos y el avión en el mapa, sin clave de API.',
'system_notice.release_notes.feature_pdf_title': 'Un PDF del viaje nuevo',
'system_notice.release_notes.feature_pdf_body':
'Una portada con tu ruta, cada día como cronología y todas tus reservas con sus códigos, listo para imprimir o compartir.',
'system_notice.release_notes.feature_pdf_body': 'Tu ruta, cada día y todas tus reservas, listo para imprimir.',
'system_notice.release_notes.footnote':
'Además, PostgreSQL, complementos por viaje, etiquetas en los lugares, más formas de llevar los gastos y una larga lista de cambios menores.',
'Además, PostgreSQL, complementos por viaje, etiquetas en los lugares y muchos cambios menores.',
'system_notice.release_notes.notes_label': 'Notas de versión',
'system_notice.release_notes.note_eyebrow': 'Una nota del desarrollador',
'system_notice.release_notes.note_title': 'Sois la razón por la que sigo construyendo TREK.',
@@ -83,7 +81,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Cada función, cada actualización, para todo el mundo. Sin planes de pago, sin suscripciones, sin trampa.',
'system_notice.release_notes.note_body_after':
'Y entonces llegasteis vosotros, enseguida por miles: con estrellas, informes de errores, traducciones a idiomas que no hablo y pull requests de gente a la que nunca he conocido. Sigo revisando el repositorio a primera hora cada mañana y todavía no me parece del todo real.',
'Y entonces llegasteis vosotros, por miles: con estrellas, informes de errores, traducciones y pull requests de gente a la que nunca he conocido. Todavía no me parece del todo real.',
'system_notice.release_notes.note_closing': 'Gracias por estar aquí. Maurice',
'system_notice.release_notes.support_label': 'Posible gracias a ti',
'system_notice.release_notes.support_lead': 'TREK solo existe gracias a las donaciones.',
@@ -92,5 +90,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Invítame a un café',
'system_notice.release_notes.cta_kofi': 'Apóyame en Ko-fi',
'system_notice.release_notes.cta_patreon': 'Cada mes en Patreon',
'system_notice.release_notes.apps_title': 'TREK ya está en tu móvil',
};
export default system_notice;
+6
View File
@@ -292,6 +292,12 @@ const settings: TranslationStrings = {
'Pääsme saamine: POST /oauth/token koos parameetritega grant_type=client_credentials, client_id ja client_secret. Brauserita ja värskenduspääsmeta.',
'settings.oauth.badge.machine': 'masin',
'settings.account': 'Konto',
'settings.apps.title': 'TREKi rakendus',
'settings.apps.hint': 'Skanni telefoniga kood ja ühenda siis rakendus selle serveriga.',
'settings.apps.downloadOn': 'Laadi alla',
'settings.apps.getItOn': 'Hangi see',
'settings.apps.iosDevices': 'iPhone ja iPad',
'settings.apps.androidDevices': 'Telefon ja tahvel',
'settings.about': 'Teave',
'settings.about.reportBug': 'Teata veast',
'settings.about.reportBugHint': 'Leidsid probleemi? Anna meile teada',
+7 -8
View File
@@ -55,20 +55,18 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Uuendus paigaldatud',
'system_notice.release_notes.headline': 'Vähem tippimist, rohkem reisimist.',
'system_notice.release_notes.intro':
'Broneeringukirjad, mille edasi saadad, jõuavad sinu reisile, TREK jälgib sinu lende reaalajas ja reisi PDF on täiesti uus. TREK töötab nüüd ka PostgreSQLiga.',
'Edasi saadetud broneeringukirjad jõuavad sinu reisile, TREK jälgib sinu lende reaalajas ja reisi PDF on täiesti uus.',
'system_notice.release_notes.features_label': 'Peamised uuendused',
'system_notice.release_notes.features_aside': 'See pole kaugeltki kõik',
'system_notice.release_notes.feature_mail_title': 'Broneeringukirjad jõuavad sinu reisile',
'system_notice.release_notes.feature_mail_body':
'Edasta kinnitus oma isiklikule aadressile ja TREK leiab sinu reisi, kontrollib selle üle ning lisab broneeringu koos dokumendiga.',
'system_notice.release_notes.feature_mail_body': 'Edasta kinnitus ja TREK lisab broneeringu õigele reisile.',
'system_notice.release_notes.feature_flight_title': 'Lennu staatus reaalajas, tasuta',
'system_notice.release_notes.feature_flight_body':
'TREK jälgib iga sinu lendu selle päeval: olek, hilinemine, mõlemad lennujaamad ja kaart lennukiga, ilma API võtmeta.',
'system_notice.release_notes.feature_flight_body': 'Olek, hilinemised ja lennuk kaardil, ilma API võtmeta.',
'system_notice.release_notes.feature_pdf_title': 'Uus reisi PDF',
'system_notice.release_notes.feature_pdf_body':
'Kaas sinu marsruudiga, iga päev ajajoonena ja kõik sinu broneeringud koodidega, valmis printimiseks või jagamiseks.',
'Sinu marsruut, iga päev ja kõik sinu broneeringud, valmis printimiseks.',
'system_notice.release_notes.footnote':
'Lisaks PostgreSQL, lisandmoodulid reisi kohta, sildid kohtadele, rohkem viise kulude hoidmiseks ja pikk nimekiri väiksemaid muudatusi.',
'Lisaks PostgreSQL, lisandmoodulid reisi kohta, sildid kohtadele ja palju väiksemaid muudatusi.',
'system_notice.release_notes.notes_label': 'Väljalaskemärkmed',
'system_notice.release_notes.note_eyebrow': 'Sõnum hooldajalt',
'system_notice.release_notes.note_title': 'Sina oled põhjus, miks ma TREKi arendamist jätkan.',
@@ -79,7 +77,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Iga funktsioon ja iga uuendus kõigile. Ei tasulisi pakette, tellimusi ega varjatud tingimusi.',
'system_notice.release_notes.note_body_after':
'Siis tulite teie, peagi tuhandete kaupa: tähtede, veateadete, minu jaoks tundmatutesse keeltesse tehtud tõlgete ja inimeste pull requestidega, keda ma pole kunagi kohanud. Vaatan hoidla igal hommikul esimese asjana üle ja see ei tundu ikka veel päris päriselt.',
'Siis tulite teie, tuhandete kaupa: tähtede, veateadete, tõlgete ja pull requestidega inimestelt, keda ma pole kunagi kohanud. See ei tundu ikka veel päris päriselt.',
'system_notice.release_notes.note_closing': 'Aitäh, et oled siin. Maurice',
'system_notice.release_notes.support_label': 'Võimalik tänu sinule',
'system_notice.release_notes.support_lead': 'TREK on olemas ainult tänu annetustele.',
@@ -88,6 +86,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Osta mulle kohv',
'system_notice.release_notes.cta_kofi': 'Toeta Ko-fi kaudu',
'system_notice.release_notes.cta_patreon': 'Igakuiselt Patreonis',
'system_notice.release_notes.apps_title': 'TREK on nüüd sinu telefonis',
'system_notice.pager.prev': 'Eelmine teade',
'system_notice.pager.next': 'Järgmine teade',
'system_notice.pager.counter': '{current} / {total}',
+6
View File
@@ -228,6 +228,12 @@ const settings: TranslationStrings = {
'Obtenir un token : POST /oauth/token avec grant_type=client_credentials, client_id et client_secret. Sans navigateur, sans token de rafraîchissement.',
'settings.oauth.badge.machine': 'machine', // same-as-en
'settings.account': 'Compte',
'settings.apps.title': 'App TREK',
'settings.apps.hint': 'Scannez un code avec votre téléphone, puis connectez l’app à ce serveur.',
'settings.apps.downloadOn': 'Télécharger dans l’',
'settings.apps.getItOn': 'Disponible sur',
'settings.apps.iosDevices': 'iPhone et iPad',
'settings.apps.androidDevices': 'Téléphone et tablette',
'settings.about': 'À propos',
'settings.about.reportBug': 'Signaler un bug',
'settings.about.reportBugHint': 'Un problème ? Faites-le nous savoir',
+7 -7
View File
@@ -58,20 +58,19 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Mise à jour installée',
'system_notice.release_notes.headline': 'Moins de saisie, plus de voyage.',
'system_notice.release_notes.intro':
'Les mails de réservation que vous transférez arrivent dans votre voyage, TREK suit vos vols en direct et le PDF du voyage est entièrement nouveau. TREK fonctionne désormais aussi avec PostgreSQL.',
'Les mails de réservation que vous transférez arrivent dans votre voyage, TREK suit vos vols en direct et le PDF du voyage est entièrement nouveau.',
'system_notice.release_notes.features_label': "Les têtes d'affiche",
'system_notice.release_notes.features_aside': "Et ce n'est pas tout",
'system_notice.release_notes.feature_mail_title': 'Les mails de réservation arrivent dans votre voyage',
'system_notice.release_notes.feature_mail_body':
'Transférez une confirmation à votre adresse personnelle : TREK trouve votre voyage, la vérifie, puis ajoute la réservation avec son document.',
'Transférez une confirmation et TREK ajoute la réservation au bon voyage.',
'system_notice.release_notes.feature_flight_title': 'Statut des vols en direct, gratuit',
'system_notice.release_notes.feature_flight_body':
'TREK suit chacun de vos vols le jour J : statut, retard, les deux aéroports et une carte avec l’avion, sans clé d’API.',
'system_notice.release_notes.feature_flight_body': 'Statut, retards et l’avion sur une carte, sans clé d’API.',
'system_notice.release_notes.feature_pdf_title': 'Un nouveau PDF de voyage',
'system_notice.release_notes.feature_pdf_body':
'Une couverture avec votre itinéraire, chaque jour en frise chronologique et toutes vos réservations avec leurs codes, prêt à imprimer ou à partager.',
'Votre itinéraire, chaque jour et toutes vos réservations, prêt à imprimer.',
'system_notice.release_notes.footnote':
'Sans oublier PostgreSQL, les extensions par voyage, les étiquettes sur les lieux, plus de façons de suivre les dépenses et une longue liste de petits changements.',
'Sans oublier PostgreSQL, les extensions par voyage, les étiquettes sur les lieux et de nombreux petits changements.',
'system_notice.release_notes.notes_label': 'Notes de version',
'system_notice.release_notes.note_eyebrow': 'Un mot du mainteneur',
'system_notice.release_notes.note_title': "C'est pour vous que je continue à construire TREK.",
@@ -82,7 +81,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
"Chaque fonctionnalité, chaque mise à jour, pour tout le monde. Pas de formules payantes, pas d'abonnements, aucun piège.",
'system_notice.release_notes.note_body_after':
'Puis vous êtes venus, bientôt par milliers : avec des étoiles, des rapports de bugs, des traductions dans des langues que je ne parle pas et des pull requests de personnes que je n’ai jamais rencontrées. Je consulte toujours le dépôt dès le matin, et cela ne me semble toujours pas tout à fait réel.',
'Puis vous êtes venus, par milliers : avec des étoiles, des rapports de bugs, des traductions et des pull requests de personnes que je n’ai jamais rencontrées. Cela ne me semble toujours pas tout à fait réel.',
'system_notice.release_notes.note_closing': 'Merci d’être là. Maurice',
'system_notice.release_notes.support_label': 'Rendu possible par vous',
'system_notice.release_notes.support_lead': 'TREK n’existe que grâce aux dons.',
@@ -91,5 +90,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Soutenir sur Ko-fi',
'system_notice.release_notes.cta_patreon': 'Chaque mois sur Patreon',
'system_notice.release_notes.apps_title': 'TREK est maintenant sur votre téléphone',
};
export default system_notice;
+6
View File
@@ -288,6 +288,12 @@ const settings: TranslationStrings = {
'Λήψη token: POST /oauth/token με grant_type=client_credentials, client_id, και client_secret. Χωρίς browser, χωρίς refresh token.',
'settings.oauth.badge.machine': 'μηχανή',
'settings.account': 'Λογαριασμός',
'settings.apps.title': 'Εφαρμογή TREK',
'settings.apps.hint': 'Σαρώστε έναν κωδικό με το κινητό σας και μετά συνδέστε την εφαρμογή με αυτόν τον διακομιστή.',
'settings.apps.downloadOn': 'Λήψη από το',
'settings.apps.getItOn': 'Διαθέσιμο στο',
'settings.apps.iosDevices': 'iPhone και iPad',
'settings.apps.androidDevices': 'Κινητό και tablet',
'settings.about': 'Σχετικά',
'settings.about.reportBug': 'Αναφορά Σφάλματος',
'settings.about.reportBugHint': 'Βρήκατε πρόβλημα; Ενημερώστε μας',
+7 -6
View File
@@ -60,20 +60,20 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'Ενημερώθηκε',
'system_notice.release_notes.headline': 'Λιγότερη πληκτρολόγηση, περισσότερο ταξίδι.',
'system_notice.release_notes.intro':
'Τα μηνύματα κράτησης που προωθείτε καταλήγουν στο ταξίδι σας, το TREK παρακολουθεί ζωντανά τις πτήσεις σας και το PDF του ταξιδιού είναι ολοκαίνουργιο. Το TREK τρέχει πλέον και σε PostgreSQL.',
'Τα μηνύματα κράτησης που προωθείτε καταλήγουν στο ταξίδι σας, το TREK παρακολουθεί ζωντανά τις πτήσεις σας και το PDF του ταξιδιού είναι ολοκαίνουργιο.',
'system_notice.release_notes.features_label': 'Τα σημαντικότερα',
'system_notice.release_notes.features_aside': 'Και δεν είναι μόνο αυτά',
'system_notice.release_notes.feature_mail_title': 'Τα μηνύματα κράτησης βρίσκουν το ταξίδι σας',
'system_notice.release_notes.feature_mail_body':
'Προωθήστε μια επιβεβαίωση στην προσωπική σας διεύθυνση και το TREK βρίσκει το ταξίδι σας, την ελέγχει και προσθέτει την κράτηση μαζί με το έγγραφό της.',
'Προωθήστε μια επιβεβαίωση και το TREK προσθέτει την κράτηση στο σωστό ταξίδι.',
'system_notice.release_notes.feature_flight_title': 'Ζωντανή κατάσταση πτήσεων, δωρεάν',
'system_notice.release_notes.feature_flight_body':
'Το TREK παρακολουθεί κάθε πτήση σας τη μέρα της: κατάσταση, καθυστέρηση, τα δύο αεροδρόμια και χάρτη με το αεροσκάφος, χωρίς κλειδί API.',
'Κατάσταση, καθυστερήσεις και το αεροσκάφος στον χάρτη, χωρίς κλειδί API.',
'system_notice.release_notes.feature_pdf_title': 'Νέο PDF ταξιδιού',
'system_notice.release_notes.feature_pdf_body':
'Εξώφυλλο με τη διαδρομή σας, κάθε μέρα ως χρονολόγιο και όλες οι κρατήσεις σας με τους κωδικούς τους, έτοιμο για εκτύπωση ή κοινοποίηση.',
'Η διαδρομή σας, κάθε μέρα και όλες οι κρατήσεις σας, έτοιμα για εκτύπωση.',
'system_notice.release_notes.footnote':
'Επιπλέον PostgreSQL, πρόσθετα ανά ταξίδι, ετικέτες σε μέρη, περισσότεροι τρόποι για να παρακολουθείτε τα έξοδα και μια μακριά λίστα μικρότερων αλλαγών.',
'Επιπλέον PostgreSQL, πρόσθετα ανά ταξίδι, ετικέτες σε μέρη και πολλές μικρότερες αλλαγές.',
'system_notice.release_notes.notes_label': 'Σημειώσεις έκδοσης',
'system_notice.release_notes.note_eyebrow': 'Μια σημείωση από τον δημιουργό',
'system_notice.release_notes.note_title': 'Εσείς είστε ο λόγος που συνεχίζω να φτιάχνω το TREK.',
@@ -84,7 +84,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_text':
'Κάθε λειτουργία, κάθε ενημέρωση, για όλους. Καμία έκδοση επί πληρωμή, καμία συνδρομή, καμία παγίδα.',
'system_notice.release_notes.note_body_after':
'Μετά ήρθατε εσείς, σύντομα με τα χιλιάδες: με αστέρια, αναφορές σφαλμάτων, μεταφράσεις σε γλώσσες που δεν μιλάω και pull requests από ανθρώπους που δεν έχω γνωρίσει ποτέ. Κάθε πρωί ελέγχω πρώτα το αποθετήριο και ακόμη δεν μου φαίνεται απόλυτα αληθινό.',
'Μετά ήρθατε εσείς, με τα χιλιάδες: με αστέρια, αναφορές σφαλμάτων, μεταφράσεις και pull requests από ανθρώπους που δεν έχω γνωρίσει ποτέ. Ακόμη δεν μου φαίνεται εντελώς αληθινό.',
'system_notice.release_notes.note_closing': 'Σας ευχαριστώ που είστε εδώ. Maurice',
'system_notice.release_notes.support_label': 'Χάρη σε εσάς',
'system_notice.release_notes.support_lead': 'Το TREK υπάρχει μόνο χάρη στις δωρεές.',
@@ -93,5 +93,6 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'Buy me a coffee',
'system_notice.release_notes.cta_kofi': 'Στηρίξτε στο Ko-fi',
'system_notice.release_notes.cta_patreon': 'Μηνιαία στο Patreon',
'system_notice.release_notes.apps_title': 'Το TREK είναι πλέον στο κινητό σας',
};
export default system_notice;
+6
View File
@@ -279,6 +279,12 @@ const settings: TranslationStrings = {
'קבלת אסימון: POST /oauth/token עם grant_type=client_credentials, ‏client_id ו-client_secret. בלי דפדפן, בלי אסימון רענון.',
'settings.oauth.badge.machine': 'מכונה',
'settings.account': 'חשבון',
'settings.apps.title': 'אפליקציית TREK',
'settings.apps.hint': 'סרקו קוד עם הטלפון ואז חברו את האפליקציה לשרת הזה.',
'settings.apps.downloadOn': 'להורדה מה-',
'settings.apps.getItOn': 'זמין ב-',
'settings.apps.iosDevices': 'iPhone ו-iPad',
'settings.apps.androidDevices': 'טלפון וטאבלט',
'settings.about': 'אודות',
'settings.about.reportBug': 'דיווח על באג',
'settings.about.reportBugHint': 'מצאתם בעיה? ספרו לנו',
+7 -10
View File
@@ -53,20 +53,16 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.eyebrow': 'העדכון הותקן',
'system_notice.release_notes.headline': 'פחות הקלדה, יותר טיולים.',
'system_notice.release_notes.intro':
'הודעות הזמנה שתעבירו יגיעו ישר לטיול שלכם, TREK עוקב אחרי הטיסות שלכם בזמן אמת, וקובץ ה-PDF של הטיול חדש לגמרי. TREK רץ עכשיו גם על PostgreSQL.',
'הודעות הזמנה שתעבירו יגיעו לטיול שלכם, TREK עוקב אחרי הטיסות שלכם בזמן אמת, וקובץ ה-PDF של הטיול חדש לגמרי.',
'system_notice.release_notes.features_label': 'החידושים המרכזיים',
'system_notice.release_notes.features_aside': 'ולא רק',
'system_notice.release_notes.feature_mail_title': 'הודעות הזמנה מגיעות לטיול שלכם',
'system_notice.release_notes.feature_mail_body':
'העבירו אישור לכתובת האישית שלכם ו-TREK ימצא את הטיול שלכם, יבדוק ויוסיף את ההזמנה יחד עם המסמך שלה.',
'system_notice.release_notes.feature_mail_body': 'העבירו אישור ו-TREK יוסיף את ההזמנה לטיול הנכון.',
'system_notice.release_notes.feature_flight_title': 'סטטוס טיסה בזמן אמת, בחינם',
'system_notice.release_notes.feature_flight_body':
'TREK עוקב אחרי כל אחת מהטיסות שלכם ביום שלה: מצב, עיכוב, שני שדות התעופה ומפה עם המטוס, בלי מפתח API.',
'system_notice.release_notes.feature_flight_body': 'מצב, עיכובים והמטוס על המפה, בלי מפתח API.',
'system_notice.release_notes.feature_pdf_title': 'PDF חדש לטיול',
'system_notice.release_notes.feature_pdf_body':
'שער עם המסלול שלכם, כל יום כציר זמן וכל ההזמנות שלכם עם הקודים שלהן, מוכן להדפסה או לשיתוף.',
'system_notice.release_notes.footnote':
'ועוד PostgreSQL, תוספים לכל טיול, תגיות על מקומות, עוד דרכים לנהל עלויות ורשימה ארוכה של שינויים קטנים.',
'system_notice.release_notes.feature_pdf_body': 'המסלול שלכם, כל יום וכל ההזמנות שלכם, מוכן להדפסה.',
'system_notice.release_notes.footnote': 'ועוד PostgreSQL, תוספים לכל טיול, תגיות על מקומות והרבה שינויים קטנים.',
'system_notice.release_notes.notes_label': 'הערות גרסה',
'system_notice.release_notes.note_eyebrow': 'מילה מהמתחזק',
'system_notice.release_notes.note_title': 'בזכותכם אני ממשיך לבנות את TREK.',
@@ -76,7 +72,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.promise_lead': 'TREK נשאר חינמי, לתמיד.',
'system_notice.release_notes.promise_text': 'כל תכונה, כל עדכון, לכולם. בלי מסלולים בתשלום, בלי מנויים, בלי מלכודות.',
'system_notice.release_notes.note_body_after':
'ואז הגעתם אתם, ותוך זמן קצר כבר באלפים: עם כוכבים, דיווחי באגים, תרגומים לשפות שאני לא מדבר ובקשות משיכה מאנשים שמעולם לא פגשתי. אני עדיין בודק את המאגר דבר ראשון כל בוקר, וזה עדיין לא לגמרי מרגיש אמיתי.',
'ואז הגעתם אתם, באלפים: עם כוכבים, דיווחי באגים, תרגומים ובקשות משיכה מאנשים שמעולם לא פגשתי. זה עדיין לא לגמרי מרגיש אמיתי.',
'system_notice.release_notes.note_closing': 'תודה שאתם כאן. Maurice',
'system_notice.release_notes.support_label': 'בזכותכם',
'system_notice.release_notes.support_lead': 'TREK קיים רק בזכות תרומות.',
@@ -85,6 +81,7 @@ const system_notice: TranslationStrings = {
'system_notice.release_notes.cta_bmc': 'קנו לי קפה',
'system_notice.release_notes.cta_kofi': 'תמיכה ב-Ko-fi',
'system_notice.release_notes.cta_patreon': 'חודשי ב-Patreon',
'system_notice.release_notes.apps_title': 'TREK עכשיו בטלפון שלכם',
'system_notice.pager.prev': 'ההודעה הקודמת',
'system_notice.pager.next': 'ההודעה הבאה',
'system_notice.pager.counter': '{current} / {total}',

Some files were not shown because too many files have changed in this diff Show More