The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(server): judge the address search in the admin status by TREK_PHOTON_URL and an own NOMINATIM_URL
Maurice1da7d0627a13
diff --git a/docker-compose.yml b/docker-compose.ymlindex a8a0fe820..7413278a8 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -64,6 +64,7 @@ services:# - TREK_SERVICES=off # Optional. Places search identifies this installation with a key it registers by itself on first use. off sends no key; searches then use the shared pool. (default: auto)# - TREK_SERVICES_KEY= # Optional. A key issued for this installation; it wins over the stored one and turns self-registration off.# - TREK_PHOTON_URL=https://photon.liketrek.com # Optional. The address search of the TREK services. With a key, search and reverse lookups ask it before Nominatim and fall back to Nominatim when it does not answer; never asked when NOMINATIM_URL is set. (default: https://photon.liketrek.com)+# - TREK_VALHALLA_URL=https://valhalla.liketrek.com # Optional. The Valhalla of the TREK services, which this server relays routing to unless the admin picks another routing service; the browser never talks to it. (default: https://valhalla.liketrek.com)# - PLACES_API_KEY= # Optional. Google Maps API key (Places API (New) enabled) for place search, photos, details and Google transit. Overrides the key set in Admin > Settings > API Keys, whose field then shows this variable read-only.# - GOOGLE_LIST_DATA_BASE= # Optional. HTTP(S) base URL of a list-data service. Pasted URLs beginning with this base are imported directly; unset keeps the Google flow.# - AMAP_API_KEY= # Optional. Amap (高德地图) Web 服务 key for place search and geocoding inside mainland China. Overrides the key set in Admin > Settings > API Keys. A Web 端 (JS API) key is a different credential and is rejected with INVALID_USER_KEY.diff --git a/server/src/nest/service-identity/service-identity.constants.ts b/server/src/nest/service-identity/service-identity.constants.tsindex 6a815c4a9..97ebd17d3 100644--- a/server/src/nest/service-identity/service-identity.constants.ts+++ b/server/src/nest/service-identity/service-identity.constants.ts@@ -1,8 +1,2 @@/** The issuer of installation keys: the Places host itself, so no new egress domain is needed. */export const SERVICE_ISSUER_ORIGIN = 'https://places.liketrek.com';--/** The TREK services' Photon, the address search that stands in for the public Nominatim. */-export const PHOTON_ORIGIN = 'https://photon.liketrek.com';--/** The Nominatim TREK asks when NOMINATIM_URL names none of the admin's own. */-export const PUBLIC_NOMINATIM_URL = 'https://nominatim.openstreetmap.org';diff --git a/server/src/nest/service-identity/service-identity.service.ts b/server/src/nest/service-identity/service-identity.service.tsindex 3063627a4..f45bc2df3 100644--- a/server/src/nest/service-identity/service-identity.service.ts+++ b/server/src/nest/service-identity/service-identity.service.ts@@ -5,8 +5,8 @@ import { SettingsService } from '../settings/settings.service';import { IssuerClient } from './issuer.client';import { QuotaTracker } from './quota-tracker';import { ServiceClock } from './service-clock';-import { PHOTON_ORIGIN, PUBLIC_NOMINATIM_URL, SERVICE_ISSUER_ORIGIN } from './service-identity.constants';-import { isAllowlisted, sameServiceUrl } from './service-identity.helpers';+import { SERVICE_ISSUER_ORIGIN } from './service-identity.constants';+import { isAllowlisted } from './service-identity.helpers';import { ServiceKeyService, type KeySnapshot } from './service-key.service';import { Inject, Injectable } from '@nestjs/common';import type { ConfigType } from '@nestjs/config';@@ -77,14 +77,14 @@ export class ServiceIdentityService {}private originOf(service: ServiceName): string {- if (service === 'photon') return PHOTON_ORIGIN;+ if (service === 'photon') return this.config.photonUrl;return service === 'valhalla' ? this.config.valhallaUrl : SERVICE_ISSUER_ORIGIN;}/*** Whether this instance asks each service right now. Places is in use* whenever the identity is; the other two need the key itself, since they- * have no shared pool. Photon stands in for the public Nominatim only, and+ * have no shared pool. Photon steps aside for an own NOMINATIM_URL, and* the TREK Valhalla answers only where the routing choice comes to it.*/private async servicesInUse(key: KeySnapshot): Promise<Record<ServiceName, boolean>> {@@ -98,7 +98,7 @@ export class ServiceIdentityService {});return {places: true,- photon: keyed('photon') && sameServiceUrl(this.env.env().integrations.nominatimUrl, PUBLIC_NOMINATIM_URL),+ photon: keyed('photon') && !this.env.env().integrations.nominatimOwn,valhalla: routing === 'trek',};}diff --git a/server/tests/e2e/service-identity.e2e.test.ts b/server/tests/e2e/service-identity.e2e.test.tsindex 96886314f..eafffdb5b 100644--- a/server/tests/e2e/service-identity.e2e.test.ts+++ b/server/tests/e2e/service-identity.e2e.test.ts@@ -43,7 +43,13 @@ const VIEW = { limit: 50_000, used: 1_234, remaining: 48_766, resetAt: new Date(const writeAudit = vi.fn();let orm: TestOrm;-type ServicesConfig = { mode: 'auto' | 'off'; key: string | null; hosts: string[]; valhallaUrl: string };+type ServicesConfig = {+ mode: 'auto' | 'off';+ key: string | null;+ hosts: string[];+ photonUrl: string;+ valhallaUrl: string;+};async function build(config: Partial<ServicesConfig> = {}) {const moduleRef = await Test.createTestingModule({@@ -54,6 +60,7 @@ async function build(config: Partial<ServicesConfig> = {}) {mode: 'auto',key: null,hosts: ['places.liketrek.com'],+ photonUrl: 'https://photon.liketrek.com',valhallaUrl: 'https://valhalla.liketrek.com',...config,})diff --git a/server/tests/unit/nest/service-identity/service-identity.service.test.ts b/server/tests/unit/nest/service-identity/service-identity.service.test.tsindex 52f22bdc9..2f05fa112 100644--- a/server/tests/unit/nest/service-identity/service-identity.service.test.ts+++ b/server/tests/unit/nest/service-identity/service-identity.service.test.ts@@ -29,12 +29,13 @@ const config = {mode: 'auto' as const,key: null,hosts: ['places.liketrek.com'],+ photonUrl: 'https://photon.liketrek.com',valhallaUrl: 'https://valhalla.liketrek.com',};const ALL_HOSTS = ['places.liketrek.com', 'photon.liketrek.com', 'valhalla.liketrek.com'];const defaults = vi.fn(async (): Promise<Record<string, unknown>> => ({}));-const nominatim = { url: 'https://nominatim.openstreetmap.org' };-const env = { env: () => ({ integrations: { nominatimUrl: nominatim.url } }) };+const nominatim = { own: false };+const env = { env: () => ({ integrations: { nominatimOwn: nominatim.own } }) };const VIEW = { limit: 10_000, used: 250, remaining: 9_750, resetAt: new Date(1_793_059_200_000).toISOString() };const testDb = createSnapshotTestDb();@@ -44,7 +45,7 @@ let identity: ServiceIdentityService;beforeEach(async () => {vi.clearAllMocks();config.hosts = ['places.liketrek.com'];- nominatim.url = 'https://nominatim.openstreetmap.org';+ nominatim.own = false;defaults.mockResolvedValue({});issuer.quota.mockResolvedValue({ body: QUOTA, serverMs: null });t = await createTestModule({@@ -174,7 +175,7 @@ describe('ServiceIdentityService.status', () => {it('SISVC-009: Photon is not in use beside an own Nominatim, the TREK Valhalla not beside another routing choice', async () => {config.hosts = ALL_HOSTS;- nominatim.url = 'https://geocode.example.org';+ nominatim.own = true;defaults.mockResolvedValue({ valhalla_base_url: 'https://valhalla.example.org' });const status = await identity.status();expect(status.services.map(({ inUse }) => inUse)).toEqual([true, false, false]);