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
feat(admin): a daily limit on Google API calls
Maurice7acf7f56557b
diff --git a/client/src/api/client.ts b/client/src/api/client.tsindex 1b4e0af41..320814376 100644--- a/client/src/api/client.ts+++ b/client/src/api/client.ts@@ -2,7 +2,7 @@ import { isEffectivelyOffline } from '../sync/networkMode'import axios, { AxiosInstance } from 'axios'import type { z } from 'zod'import type { Day, Place, Trip } from '../types'-import type { MapsNearbyRequest, JourneyReorderEntryPhotosRequest, TransitProvider } from '@trek/shared'+import type { MapsNearbyRequest, JourneyReorderEntryPhotosRequest, TransitProvider, GoogleQuotaUpdateRequest } from '@trek/shared'import { randomId } from '../utils/randomId'import { postProviderPhotosInBatches } from './providerPhotoBatches'import {@@ -697,6 +697,8 @@ export const adminApi = {getPlacesGoogleOnly: () => apiClient.get('/admin/places-google-only').then(r => r.data),updatePlacesGoogleOnly: (enabled: boolean) => apiClient.put('/admin/places-google-only', { enabled }).then(r => r.data),getPlacesEnrich: () => apiClient.get('/admin/places-enrich').then(r => r.data),+ getGoogleQuota: () => apiClient.get('/admin/google-quota').then(r => r.data),+ updateGoogleQuota: (dailyLimit: number | null) => apiClient.put('/admin/google-quota', { daily_limit: dailyLimit } satisfies GoogleQuotaUpdateRequest).then(r => r.data),updatePlacesEnrich: (enabled: boolean) => apiClient.put('/admin/places-enrich', { enabled }).then(r => r.data),getTransitProvider: () => apiClient.get('/admin/transit-provider').then(r => r.data),updateTransitProvider: (provider: TransitProvider) => apiClient.put('/admin/transit-provider', { provider }).then(r => r.data),diff --git a/client/src/components/Admin/GoogleDailyLimitRow.test.tsx b/client/src/components/Admin/GoogleDailyLimitRow.test.tsxnew file mode 100644index 000000000..ec52384cd--- /dev/null+++ b/client/src/components/Admin/GoogleDailyLimitRow.test.tsx@@ -0,0 +1,58 @@+// FE-ADMIN-GQUOTA-001 to FE-ADMIN-GQUOTA-004+import { describe, it, expect } from 'vitest'+import { http, HttpResponse } from 'msw'+import userEvent from '@testing-library/user-event'+import { render, screen, waitFor } from '../../../tests/helpers/render'+import { server } from '../../../tests/helpers/msw/server'+import GoogleDailyLimitRow from './GoogleDailyLimitRow'++describe('GoogleDailyLimitRow (#1582)', () => {+ it('FE-ADMIN-GQUOTA-001: shows the stored ceiling and today against it', async () => {+ server.use(http.get('/api/admin/google-quota', () => HttpResponse.json({ daily_limit: 500, used_today: 123, exhausted: false })))+ render(<GoogleDailyLimitRow />)+ expect(await screen.findByText('Today: 123 of 500')).toBeInTheDocument()+ expect(screen.getByLabelText('Daily limit for Google calls')).toHaveValue('500')+ // Nothing to save until the number changes.+ expect(screen.queryByRole('button', { name: 'Save' })).toBeNull()+ })++ it('FE-ADMIN-GQUOTA-002: without a ceiling it counts today only', async () => {+ server.use(http.get('/api/admin/google-quota', () => HttpResponse.json({ daily_limit: null, used_today: 7, exhausted: false })))+ render(<GoogleDailyLimitRow />)+ expect(await screen.findByText('Today: 7')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('No limit')).toHaveValue('')+ })++ it('FE-ADMIN-GQUOTA-003: a used-up day says so', async () => {+ server.use(http.get('/api/admin/google-quota', () => HttpResponse.json({ daily_limit: 10, used_today: 10, exhausted: true })))+ render(<GoogleDailyLimitRow />)+ expect(await screen.findByText('Limit reached (10), Google paused until tomorrow')).toBeInTheDocument()+ })++ it('FE-ADMIN-GQUOTA-004: saving sends the new number, and an empty field sends null', async () => {+ const sent: unknown[] = []+ server.use(+ http.get('/api/admin/google-quota', () => HttpResponse.json({ daily_limit: 500, used_today: 3, exhausted: false })),+ http.put('/api/admin/google-quota', async ({ request }) => {+ const body = (await request.json()) as { daily_limit: number | null }+ sent.push(body)+ return HttpResponse.json({ daily_limit: body.daily_limit, used_today: 3, exhausted: false })+ }),+ )+ const user = userEvent.setup()+ render(<GoogleDailyLimitRow />)+ const input = await screen.findByLabelText('Daily limit for Google calls')+ await waitFor(() => expect(input).toHaveValue('500'))++ await user.clear(input)+ await user.type(input, '800')+ await user.click(screen.getByRole('button', { name: 'Save' }))+ await waitFor(() => expect(sent).toEqual([{ daily_limit: 800 }]))+ expect(await screen.findByText('Today: 3 of 800')).toBeInTheDocument()++ await user.clear(input)+ await user.type(input, '{Enter}')+ await waitFor(() => expect(sent).toEqual([{ daily_limit: 800 }, { daily_limit: null }]))+ expect(await screen.findByText('Today: 3')).toBeInTheDocument()+ })+})diff --git a/client/src/components/Admin/GoogleDailyLimitRow.tsx b/client/src/components/Admin/GoogleDailyLimitRow.tsxnew file mode 100644index 000000000..db462c445--- /dev/null+++ b/client/src/components/Admin/GoogleDailyLimitRow.tsx@@ -0,0 +1,58 @@+import { AlertTriangle, Check } from 'lucide-react'+import { useTranslation } from '../../i18n'+import { NumericInput } from '../shared/NumericInput'+import { useGoogleQuota } from './useGoogleQuota'++/**+ * The daily ceiling on Google calls (#1582), as one row of the Google options:+ * the number on the right with today's count under it, a save button only while+ * there is something to save, and a warning once the day is used up.+ */+export default function GoogleDailyLimitRow() {+ const { t } = useTranslation()+ const { status, draft, setDraft, dirty, saving, save } = useGoogleQuota()++ return (+ <div className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2 py-3">+ <div className="min-w-0 flex-1 basis-60">+ <label htmlFor="admin-google-daily-limit" className="text-sm font-medium text-content-secondary">{t('admin.googleQuota.title')}</label>+ <p className="text-xs text-content-faint mt-0.5">{t('admin.googleQuota.subtitle')}</p>+ </div>+ <div className="flex flex-col items-end gap-1.5">+ <div className="flex items-center gap-2">+ <NumericInput+ id="admin-google-daily-limit"+ mode="integer"+ value={draft}+ onValueChange={setDraft}+ onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); void save() } }}+ placeholder={t('admin.googleQuota.placeholder')}+ disabled={status === null || saving}+ className="w-32 px-3 py-1.5 border border-edge rounded-lg text-sm text-right tabular-nums bg-surface-input text-content focus:ring-2 focus:ring-accent focus:border-transparent disabled:opacity-60"+ />+ {dirty && (+ <button type="button" onClick={() => void save()} disabled={saving}+ className="inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-sm font-medium text-accent-text hover:opacity-90 disabled:opacity-60">+ <Check size={14} />+ {t('common.save')}+ </button>+ )}+ </div>+ {status && (+ status.exhausted ? (+ <span className="inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2.5 py-0.5 text-xs font-medium text-warning">+ <AlertTriangle size={12} />+ {t('admin.googleQuota.reached', { used: status.used_today })}+ </span>+ ) : (+ <span className="inline-flex items-center rounded-full bg-surface-tertiary px-2.5 py-0.5 text-xs font-medium tabular-nums text-content-muted">+ {status.daily_limit == null+ ? t('admin.googleQuota.usedToday', { used: status.used_today })+ : t('admin.googleQuota.usedOfLimit', { used: status.used_today, limit: status.daily_limit })}+ </span>+ )+ )}+ </div>+ </div>+ )+}diff --git a/client/src/components/Admin/useGoogleQuota.ts b/client/src/components/Admin/useGoogleQuota.tsnew file mode 100644index 000000000..b31ddc523--- /dev/null+++ b/client/src/components/Admin/useGoogleQuota.ts@@ -0,0 +1,58 @@+import { useCallback, useEffect, useRef, useState } from 'react'+import type { GoogleQuotaStatus } from '@trek/shared'+import { adminApi } from '../../api/client'+import { useToast } from '../shared/Toast'+import { useTranslation } from '../../i18n'+import { getApiErrorMessage } from '../../utils/apiError'++/**+ * The admin's daily ceiling on Google API calls and today's count (#1582).+ * Admin configuration, online only like the rest of the settings tab.+ */+export function useGoogleQuota() {+ const { t } = useTranslation()+ const toast = useToast()+ const [status, setStatus] = useState<GoogleQuotaStatus | null>(null)+ const [draft, setDraft] = useState('')+ const [saving, setSaving] = useState(false)+ // Read through a ref: the load runs once when the row opens, and a new toast or+ // t identity on a later render must not fetch again and reset what is typed.+ const notify = useRef({ toast, t })+ notify.current = { toast, t }++ useEffect(() => {+ let cancelled = false+ adminApi.getGoogleQuota()+ .then((s: GoogleQuotaStatus) => {+ if (cancelled) return+ setStatus(s)+ setDraft(s.daily_limit == null ? '' : String(s.daily_limit))+ })+ .catch((err: unknown) => {+ if (!cancelled) notify.current.toast.error(getApiErrorMessage(err, notify.current.t('common.error')))+ })+ return () => { cancelled = true }+ }, [])++ const stored = status?.daily_limit == null ? '' : String(status.daily_limit)+ const dirty = status !== null && draft.trim() !== stored++ const save = useCallback(async () => {+ if (!dirty || saving) return+ const parsed = Number.parseInt(draft.trim(), 10)+ const limit = draft.trim() === '' || !Number.isFinite(parsed) || parsed <= 0 ? null : parsed+ setSaving(true)+ try {+ const next: GoogleQuotaStatus = await adminApi.updateGoogleQuota(limit)+ setStatus(next)+ setDraft(next.daily_limit == null ? '' : String(next.daily_limit))+ toast.success(t('admin.googleQuota.saved'))+ } catch (err) {+ toast.error(getApiErrorMessage(err, t('common.error')))+ } finally {+ setSaving(false)+ }+ }, [dirty, saving, draft, toast, t])++ return { status, draft, setDraft, dirty, saving, save }+}diff --git a/client/src/pages/admin/AdminSettingsTab.tsx b/client/src/pages/admin/AdminSettingsTab.tsxindex d19251624..0f28d26f2 100644--- a/client/src/pages/admin/AdminSettingsTab.tsx+++ b/client/src/pages/admin/AdminSettingsTab.tsx@@ -5,6 +5,7 @@ import { Eye, EyeOff, Save, CheckCircle, XCircle, Loader2, RefreshCw, AlertTrianimport ToggleSwitch from '../../components/Settings/ToggleSwitch'import CustomSelect from '../../components/shared/CustomSelect'import GoogleOptions from './GoogleOptions'+import GoogleDailyLimitRow from '../../components/Admin/GoogleDailyLimitRow'import ProviderBlock from './ProviderBlock'import TrekApiCard from './TrekApiCard'import { placesGoogleOnlyHint } from '../../utils/placeSource'@@ -538,6 +539,8 @@ export default function AdminSettingsTab({ admin, t }: AdminSettingsTabProps): RonToggle={handleTogglePlacesGoogleOnly}/></div>++ <GoogleDailyLimitRow /></div></GoogleOptions></ProviderBlock>diff --git a/server/src/db/migrations.ts b/server/src/db/migrations.tsindex 05280c1d7..fe305eda2 100644--- a/server/src/db/migrations.ts+++ b/server/src/db/migrations.ts@@ -5402,6 +5402,13 @@ function runMigrations(db: Database.Database): void {const has = db.prepare("SELECT 1 FROM pragma_table_info('budget_settlements') WHERE name = 'note'").get();if (!has) db.exec('ALTER TABLE budget_settlements ADD COLUMN note TEXT');},+ /**+ * Google API calls per UTC day (#1582), so the admin's daily ceiling has+ * something to count against. One row a day, nothing about who searched.+ */+ () => {+ db.exec('CREATE TABLE IF NOT EXISTS google_api_usage (day TEXT PRIMARY KEY, calls INTEGER NOT NULL DEFAULT 0)');+ },];if (currentVersion < migrations.length) {diff --git a/server/src/nest/app.module.ts b/server/src/nest/app.module.tsindex ee58dbf1f..d421e091e 100644--- a/server/src/nest/app.module.ts+++ b/server/src/nest/app.module.ts@@ -19,6 +19,7 @@ import { ConfigModule } from './config/config.module';import { SystemNoticesModule } from './system-notices/system-notices.module';import { ManagedExtModule } from './managed/managed-ext.module';import { MapsModule } from './maps/maps.module';+import { GoogleQuotaModule } from './google-quota/google-quota.module';import { GeoModule } from './geo/geo.module';import { PlaceEnrichmentModule } from './place-enrichment/place-enrichment.module';import { PlaceShadowModule } from './place-shadow/place-shadow.module';@@ -83,7 +84,7 @@ import { RealtimeGatewayModule } from './realtime/realtime-gateway.module';* migrated.*/@Module({- imports: [AppConfigModule, DatabaseModule, RealtimeModule, RealtimeGatewayModule, SchedulingModule, McpModule.forRoot({ accessPolicy: trekMcpAccessPolicy, validateAccess: trekMcpValidateAccess }), HealthModule, PlatformModule, McpTransportModule, WeatherModule, PublicApiModule, HelpModule, AirportsModule, ConfigModule, SystemNoticesModule, GeoModule, MapsModule, PlaceEnrichmentModule, PlaceShadowModule, RouteUsageModule, CategoriesModule, TagsModule, NotificationsModule, AtlasModule, VacayModule, SchoolHolidaysModule, PackingModule, TodoModule, BudgetModule, ReservationsModule, DaysModule, DayNotesModule, AccommodationsModule, AssignmentsModule, PlacesModule, RoadtripModule, TripsModule, CollabModule, FilesModule, DocSyncModule, PhotosModule, MemoriesModule, AirtrailModule, DawarichModule, JourneyModule, CollectionsModule, ShareModule, TripInviteModule, TransitModule, FeedsModule, SettingsModule, StorageModule, BackupModule, AuthModule, OidcModule, OauthModule, AdminModule, AddonsModule, AuditModule, PermissionsModule, PluginsModule, BookingImportModule, ReservationImportModule, ReceiptScanModule, LlmParseModule, ManagedExtModule],+ imports: [AppConfigModule, DatabaseModule, RealtimeModule, RealtimeGatewayModule, SchedulingModule, McpModule.forRoot({ accessPolicy: trekMcpAccessPolicy, validateAccess: trekMcpValidateAccess }), HealthModule, PlatformModule, McpTransportModule, WeatherModule, PublicApiModule, HelpModule, AirportsModule, ConfigModule, SystemNoticesModule, GeoModule, MapsModule, GoogleQuotaModule, PlaceEnrichmentModule, PlaceShadowModule, RouteUsageModule, CategoriesModule, TagsModule, NotificationsModule, AtlasModule, VacayModule, SchoolHolidaysModule, PackingModule, TodoModule, BudgetModule, ReservationsModule, DaysModule, DayNotesModule, AccommodationsModule, AssignmentsModule, PlacesModule, RoadtripModule, TripsModule, CollabModule, FilesModule, DocSyncModule, PhotosModule, MemoriesModule, AirtrailModule, DawarichModule, JourneyModule, CollectionsModule, ShareModule, TripInviteModule, TransitModule, FeedsModule, SettingsModule, StorageModule, BackupModule, AuthModule, OidcModule, OauthModule, AdminModule, AddonsModule, AuditModule, PermissionsModule, PluginsModule, BookingImportModule, ReservationImportModule, ReceiptScanModule, LlmParseModule, ManagedExtModule],providers: [// Default-deny: a route is authenticated unless it carries @Public() or// @OptionalAuth(), or declares its own @UseGuards chain. Protection used todiff --git a/server/src/nest/google-quota/google-quota.controller.ts b/server/src/nest/google-quota/google-quota.controller.tsnew file mode 100644index 000000000..d731e0a2b--- /dev/null+++ b/server/src/nest/google-quota/google-quota.controller.ts@@ -0,0 +1,33 @@+import { Body, Controller, Get, Put, Req, UseGuards } from '@nestjs/common';+import type { Request } from 'express';+import type { GoogleQuotaStatus } from '@trek/shared';+import { AdminGuard } from '../auth/admin.guard';+import { JwtAuthGuard } from '../auth/jwt-auth.guard';+import { CurrentUser } from '../auth/current-user.decorator';+import { AuditService } from '../audit/audit.service';+import { getClientIp } from '../audit/client-ip';+import type { User } from '../../types';+import { GoogleQuotaUpdateDto } from './google-quota.dto';+import { GoogleQuotaService } from './google-quota.service';++/** /api/admin/google-quota — the daily ceiling on Google API calls and today's count (#1582). */+@Controller('api/admin/google-quota')+@UseGuards(JwtAuthGuard, AdminGuard)+export class GoogleQuotaController {+ constructor(+ private readonly quota: GoogleQuotaService,+ private readonly audit: AuditService,+ ) {}++ @Get()+ status(): GoogleQuotaStatus {+ return this.quota.status();+ }++ @Put()+ update(@CurrentUser() user: User, @Body() body: GoogleQuotaUpdateDto, @Req() req: Request): GoogleQuotaStatus {+ const result = this.quota.setDailyLimit(body.daily_limit);+ this.audit.writeAudit({ userId: user.id, action: 'admin.google_daily_limit', ip: getClientIp(req), details: { daily_limit: result.daily_limit } });+ return result;+ }+}diff --git a/server/src/nest/google-quota/google-quota.dto.ts b/server/src/nest/google-quota/google-quota.dto.tsnew file mode 100644index 000000000..6b4d23fa9--- /dev/null+++ b/server/src/nest/google-quota/google-quota.dto.ts@@ -0,0 +1,4 @@+import { createZodDto } from 'nestjs-zod';+import { googleQuotaUpdateRequestSchema } from '@trek/shared';++export class GoogleQuotaUpdateDto extends createZodDto(googleQuotaUpdateRequestSchema) {}diff --git a/server/src/nest/google-quota/google-quota.module.ts b/server/src/nest/google-quota/google-quota.module.tsnew file mode 100644index 000000000..33686601a--- /dev/null+++ b/server/src/nest/google-quota/google-quota.module.ts@@ -0,0 +1,16 @@+import { Module } from '@nestjs/common';+import { AuditModule } from '../audit/audit.module';+import { GoogleQuotaController } from './google-quota.controller';+import { GoogleQuotaService } from './google-quota.service';++/**+ * The daily ceiling on Google API calls (#1582). A leaf: MapsModule and+ * TransitModule import it for the service, the admin settings use the controller.+ */+@Module({+ imports: [AuditModule],+ controllers: [GoogleQuotaController],+ providers: [GoogleQuotaService],+ exports: [GoogleQuotaService],+})+export class GoogleQuotaModule {}diff --git a/server/src/nest/google-quota/google-quota.service.ts b/server/src/nest/google-quota/google-quota.service.tsnew file mode 100644index 000000000..a94413eea--- /dev/null+++ b/server/src/nest/google-quota/google-quota.service.ts@@ -0,0 +1,81 @@+import { Injectable } from '@nestjs/common';+import type { GoogleQuotaStatus } from '@trek/shared';+import { DatabaseService } from '../database/database.service';++/** The app_settings row holding the admin's ceiling. Absent or 0 means no ceiling. */+export const GOOGLE_DAILY_LIMIT_SETTING = 'google_daily_limit';++/** Counted days kept for the admin's view, a little over a year. */+const RETENTION_DAYS = 400;++/**+ * A daily ceiling on calls to Google's APIs (#1582).+ *+ * Google bills the install that owns the key, and the free allowance runs out+ * without a warning. The admin sets how many calls a day TREK may make; every+ * call through the Places and Routes clients counts, and once the day's count+ * reaches the ceiling the key reads as absent until the day turns over. That+ * is the same state as an install without a key, so search, details and photos+ * fall back to OpenStreetMap on their own instead of failing.+ *+ * Days are UTC days (SQLite's `date('now')`), like the routing counters next+ * door. A call already in flight when the ceiling is reached still lands, so+ * the count can end a call or two above it.+ */+@Injectable()+export class GoogleQuotaService {+ /** The UTC day the "ceiling reached" line was last logged, so it is logged once. */+ private warnedDay: string | null = null;++ constructor(private readonly db: DatabaseService) {}++ dailyLimit(): number | null {+ const raw = this.db.get<{ value: string }>('SELECT value FROM app_settings WHERE key = ?', GOOGLE_DAILY_LIMIT_SETTING)?.value;+ const limit = Number.parseInt(raw ?? '', 10);+ return Number.isFinite(limit) && limit > 0 ? limit : null;+ }++ usedToday(): number {+ return this.db.get<{ calls: number }>("SELECT calls FROM google_api_usage WHERE day = date('now')")?.calls ?? 0;+ }++ /** True once today's calls have reached the admin's ceiling. */+ exhausted(): boolean {+ const limit = this.dailyLimit();+ if (limit === null) return false;+ const reached = this.usedToday() >= limit;+ if (reached) {+ const today = this.db.get<{ day: string }>("SELECT date('now') AS day")?.day ?? null;+ if (today !== this.warnedDay) {+ this.warnedDay = today;+ console.warn(`[Google API] Daily limit of ${limit} calls reached; Google stays off until the next UTC day.`);+ }+ }+ return reached;+ }++ /** Counts one call against today. */+ record(): void {+ this.db.run(+ `INSERT INTO google_api_usage (day, calls) VALUES (date('now'), 1)+ ON CONFLICT(day) DO UPDATE SET calls = calls + 1`,+ );+ }++ status(): GoogleQuotaStatus {+ this.db.run("DELETE FROM google_api_usage WHERE day < date('now', ?)", `-${RETENTION_DAYS} days`);+ const limit = this.dailyLimit();+ const used = this.usedToday();+ return { daily_limit: limit, used_today: used, exhausted: limit !== null && used >= limit };+ }++ setDailyLimit(limit: number | null): GoogleQuotaStatus {+ if (limit === null || limit <= 0) {+ this.db.run('DELETE FROM app_settings WHERE key = ?', GOOGLE_DAILY_LIMIT_SETTING);+ } else {+ this.db.run('INSERT OR REPLACE INTO app_settings (key, value) VALUES (?, ?)', GOOGLE_DAILY_LIMIT_SETTING, String(Math.floor(limit)));+ }+ this.warnedDay = null;+ return this.status();+ }+}diff --git a/server/src/nest/maps/maps.module.ts b/server/src/nest/maps/maps.module.tsindex d0056199b..840436616 100644--- a/server/src/nest/maps/maps.module.ts+++ b/server/src/nest/maps/maps.module.ts@@ -4,6 +4,7 @@ import { MapsService } from './maps.service';import { MapsMcp } from './maps.mcp';import { PlacePhotosModule } from '../place-photos/place-photos.module';import { StorageModule } from '../storage/storage.module';+import { GoogleQuotaModule } from '../google-quota/google-quota.module';/*** Maps / geo domain (L3 leaf module). Registered in AppModule. Exports@@ -12,7 +13,7 @@ import { StorageModule } from '../storage/storage.module';* Nothing outside the container consumes this domain, so there is no bridge.*/@Module({- imports: [PlacePhotosModule, StorageModule],+ imports: [PlacePhotosModule, StorageModule, GoogleQuotaModule],controllers: [MapsController],providers: [MapsService, MapsMcp],exports: [MapsService],diff --git a/server/src/nest/maps/maps.service.ts b/server/src/nest/maps/maps.service.tsindex 5f9c77de8..70f54484d 100644--- a/server/src/nest/maps/maps.service.ts+++ b/server/src/nest/maps/maps.service.ts@@ -25,6 +25,7 @@ import {// ── Photo cache (disk-backed) ────────────────────────────────────────────────import { PlacePhotoCacheService } from '../place-photos/place-photo-cache.service';import { DatabaseService } from '../database/database.service';+import { GoogleQuotaService } from '../google-quota/google-quota.service';import { nominatimFetch, type GeoLane } from '../geo/nominatim.client';import {trekPlacesSearch,@@ -747,8 +748,15 @@ export class MapsService {constructor(private readonly database: DatabaseService,private readonly photoCache: PlacePhotoCacheService,+ private readonly googleQuota: GoogleQuotaService,) {}+ /** Every call to Google goes through here, so the admin's daily ceiling sees it (#1582). */+ private google(endpoint: string, label: string, init?: RequestInit): Promise<Response> {+ this.googleQuota.record();+ return googleFetch(endpoint, label, init);+ }+/** Brand id → logo bytes, or null for "asked, has none". Insertion-ordered, so the* oldest entry is the one evicted when it fills up. */private readonly brandLogoCache = new Map<string, { at: number; logo: BrandLogo | null }>();@@ -1072,7 +1080,13 @@ export class MapsService {return resolveApiKey(this.database, 'maps_api_key', userId, readEnv().maps.placesApiKey);}+ /**+ * The Google key to spend, or null. Also null once today's calls reached the+ * admin's daily ceiling (#1582), which makes every caller fall back to what a+ * keyless install does instead of failing.+ */getMapsKey(userId: number): string | null {+ if (this.googleQuota.exhausted()) return null;return this.resolveMapsKey(userId).key;}@@ -1119,7 +1133,9 @@ export class MapsService {if (choice !== 'amap') {const google = this.resolveMapsKey(userId);- if (google.key) return { id: 'google', key: google.key, source: google.source };+ // Past the daily ceiling (#1582) the key is spent for today: answer as if+ // there were none, so `auto` moves on and OpenStreetMap fills in.+ if (google.key && !this.googleQuota.exhausted()) return { id: 'google', key: google.key, source: google.source };// An explicit 'google' choice with no key is not a reason to query Amap// instead: this install is on Google and is misconfigured. OSM answers,// the way a keyless install has always been answered.@@ -2057,7 +2073,7 @@ export class MapsService {): Promise<{ name: string; attribution: string | null }[]> {if (!isGooglePlaceId(placeId) || cap < 1) return [];try {- const res = await googleFetch(+ const res = await this.google(`https://places.googleapis.com/v1/places/${placeId}`,`fetchGooglePhotoRefs(${placeId})`,{ headers: { 'X-Goog-Api-Key': apiKey, 'X-Goog-FieldMask': 'photos' } },@@ -2076,7 +2092,7 @@ export class MapsService {/** Image bytes for one photo reference. Null on any miss; the caller skips it. */async fetchGooglePhotoBytes(photoName: string, apiKey: string, maxHeightPx = 400): Promise<Buffer | null> {try {- const res = await googleFetch(+ const res = await this.google(`https://places.googleapis.com/v1/${photoName}/media?maxHeightPx=${maxHeightPx}`,`fetchGooglePhotoBytes(${photoName})`,{ headers: { 'X-Goog-Api-Key': apiKey } },@@ -2099,7 +2115,7 @@ export class MapsService {async fetchEditorialSummary(placeId: string, apiKey: string, lang?: string): Promise<string | null> {if (!isGooglePlaceId(placeId)) return null;try {- const res = await googleFetch(+ const res = await this.google(`https://places.googleapis.com/v1/places/${placeId}?languageCode=${toApiLang(lang)}`,`fetchEditorialSummary(${placeId})`,{ headers: { 'X-Goog-Api-Key': apiKey, 'X-Goog-FieldMask': 'editorialSummary' } },@@ -2241,7 +2257,7 @@ export class MapsService {};}- const response = await googleFetch('https://places.googleapis.com/v1/places:searchText', 'searchText', {+ const response = await this.google('https://places.googleapis.com/v1/places:searchText', 'searchText', {method: 'POST',headers: {'Content-Type': 'application/json',@@ -2318,7 +2334,7 @@ export class MapsService {}if (keyed?.id === 'google') {- const response = await googleFetch('https://places.googleapis.com/v1/places:searchNearby', 'searchNearby', {+ const response = await this.google('https://places.googleapis.com/v1/places:searchNearby', 'searchNearby', {method: 'POST',headers: { 'Content-Type': 'application/json', 'X-Goog-Api-Key': keyed.key, 'X-Goog-FieldMask': SEARCH_TEXT_FIELD_MASK },body: JSON.stringify({@@ -2470,7 +2486,7 @@ export class MapsService {};}- const response = await googleFetch('https://places.googleapis.com/v1/places:autocomplete', 'autocomplete', {+ const response = await this.google('https://places.googleapis.com/v1/places:autocomplete', 'autocomplete', {method: 'POST',headers: {'Content-Type': 'application/json',@@ -2677,7 +2693,7 @@ export class MapsService {// here, which is billing-neutral: an unclosed session is charged as a plain// autocomplete session.const sessionParam = sessionToken ? `&sessionToken=${encodeURIComponent(sessionToken)}` : '';- const response = await googleFetch(+ const response = await this.google(`https://places.googleapis.com/v1/places/${placeId}?languageCode=${langKey}${sessionParam}`,`getPlaceDetails(${placeId})`,{@@ -2822,7 +2838,7 @@ export class MapsService {if (cached) return { place: cachedDetails(cached.payload_json) };}- const response = await googleFetch(+ const response = await this.google(`https://places.googleapis.com/v1/places/${placeId}?languageCode=${langKey}`,`getPlaceDetailsExpanded(${placeId})`,{@@ -2972,7 +2988,7 @@ export class MapsService {if (!apiKey) return null;// Fetch details to get the photo name- const detailsRes = await googleFetch(+ const detailsRes = await this.google(`https://places.googleapis.com/v1/places/${placeId}`,`getPlacePhoto/details(${placeId})`,{@@ -3002,7 +3018,7 @@ export class MapsService {const attribution = photo.authorAttributions?.[0]?.displayName || null;// Fetch actual image bytes- const mediaRes = await googleFetch(+ const mediaRes = await this.google(`https://places.googleapis.com/v1/${photoName}/media?maxHeightPx=400`,`getPlacePhoto/media(${placeId})`,{ headers: { 'X-Goog-Api-Key': apiKey } },diff --git a/server/src/nest/transit/google-transit.provider.ts b/server/src/nest/transit/google-transit.provider.tsindex 623e087c1..913bc3321 100644--- a/server/src/nest/transit/google-transit.provider.ts+++ b/server/src/nest/transit/google-transit.provider.ts@@ -3,6 +3,7 @@ import { readEnv } from '../../app-config';import { DatabaseService } from '../database/database.service';import { toApiLang } from '../maps/maps.helpers';import { resolveApiKey, type ApiKeySource } from '../settings/instance-api-keys';+import { GoogleQuotaService } from '../google-quota/google-quota.service';import { readTransitProvider } from './transit-provider';import {decodePolyline,@@ -234,9 +235,14 @@ function stopFrom(stop: GoogleStop | undefined, fallback: GoogleLatLng | undefin@Injectable()export class GoogleTransitProvider {- constructor(private readonly database: DatabaseService) {}+ constructor(+ private readonly database: DatabaseService,+ private readonly googleQuota: GoogleQuotaService,+ ) {}private resolveKey(userId: number): { key: string | null; source: ApiKeySource | null } {+ // Past the admin's daily ceiling (#1582) the key is spent until tomorrow.+ if (this.googleQuota.exhausted()) return { key: null, source: null };return resolveApiKey(this.database, 'maps_api_key', userId, readEnv().maps.placesApiKey);}@@ -253,6 +259,7 @@ export class GoogleTransitProvider {private async call(endpoint: string, label: string, apiKey: string, body: unknown, fieldMask: string): Promise<unknown> {console.debug(`[Google API] ${label} → ${endpoint}`);+ this.googleQuota.record();const res = await fetch(endpoint, {method: 'POST',headers: {diff --git a/server/src/nest/transit/transit.module.ts b/server/src/nest/transit/transit.module.tsindex 2a482f56e..bc4bba25f 100644--- a/server/src/nest/transit/transit.module.ts+++ b/server/src/nest/transit/transit.module.ts@@ -8,6 +8,7 @@ import { DaysModule } from '../days/days.module';import { ReservationsModule } from '../reservations/reservations.module';import { AuthModule } from '../auth/auth.module';import { McpSharedModule } from '../mcp-shared/mcp-shared.module';+import { GoogleQuotaModule } from '../google-quota/google-quota.module';/*** Transit domain (#1065) — the Transitous/MOTIS proxy, with the optional@@ -17,7 +18,7 @@ import { McpSharedModule } from '../mcp-shared/mcp-shared.module';*/@Module({// DaysModule + ReservationsModule: TransitMcp's create_transit_journey injects both.- imports: [McpSharedModule, RateLimitModule, DaysModule, ReservationsModule, AuthModule],+ imports: [McpSharedModule, RateLimitModule, DaysModule, ReservationsModule, AuthModule, GoogleQuotaModule],controllers: [TransitController],providers: [TransitService, TransitMcp, GoogleTransitProvider],exports: [TransitService],diff --git a/server/tests/e2e/google-quota.e2e.test.ts b/server/tests/e2e/google-quota.e2e.test.tsnew file mode 100644index 000000000..8f4538f84--- /dev/null+++ b/server/tests/e2e/google-quota.e2e.test.ts@@ -0,0 +1,92 @@+/**+ * /api/admin/google-quota e2e (#1582): the real JwtAuthGuard, AdminGuard and+ * Zod pipe against a temp SQLite db. Admin only, a validated body, and the+ * status reflecting what was stored.+ */+import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';+import request from 'supertest';+import cookieParser from 'cookie-parser';+import type { Server } from 'http';+import { Test } from '@nestjs/testing';+import { APP_PIPE } from '@nestjs/core';+import { ZodValidationPipe } from 'nestjs-zod';+import { DatabaseModule } from '../../src/nest/database/database.module';+import { seedUser, sessionCookie } from './harness';++const { db } = vi.hoisted(() => {+ // eslint-disable-next-line @typescript-eslint/no-require-imports+ const Database = require('better-sqlite3');+ const tmp = new Database(':memory:');+ tmp.exec(`CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL,+ email TEXT NOT NULL UNIQUE, role TEXT NOT NULL DEFAULT 'user', password_version INTEGER NOT NULL DEFAULT 0);`);+ tmp.exec('CREATE TABLE app_settings (key TEXT PRIMARY KEY, value TEXT);');+ tmp.exec('CREATE TABLE google_api_usage (day TEXT PRIMARY KEY, calls INTEGER NOT NULL DEFAULT 0);');+ return { db: tmp };+});++vi.mock('../../src/db/database', () => ({+ db, canAccessTrip: vi.fn(), isOwner: vi.fn(), getPlaceWithTags: vi.fn(), closeDb: () => {}, reinitialize: () => {},+}));++import { GoogleQuotaModule } from '../../src/nest/google-quota/google-quota.module';+import { AuditService } from '../../src/nest/audit/audit.service';+import { TrekExceptionFilter } from '../../src/nest/common/trek-exception.filter';++const USER = 1;+const ADMIN = 2;++describe('/api/admin/google-quota e2e (real guards + temp SQLite)', () => {+ let server: Server;+ let app: Awaited<ReturnType<typeof build>>;+ const writeAudit = vi.fn();++ async function build() {+ const moduleRef = await Test.createTestingModule({+ imports: [DatabaseModule, GoogleQuotaModule],+ providers: [{ provide: APP_PIPE, useClass: ZodValidationPipe }],+ }).overrideProvider(AuditService).useValue({ writeAudit }).compile();+ const nest = moduleRef.createNestApplication();+ nest.use(cookieParser());+ nest.useGlobalFilters(new TrekExceptionFilter());+ await nest.init();+ return nest;+ }++ beforeAll(async () => {+ seedUser(db as never, { id: USER });+ seedUser(db as never, { id: ADMIN, email: '[email protected]', role: 'admin' });+ app = await build();+ server = app.getHttpServer();+ });++ afterAll(async () => {+ await app.close();+ });++ it('GQUOTA-E2E-001: 401 without a cookie and 403 for a non-admin', async () => {+ expect((await request(server).get('/api/admin/google-quota')).status).toBe(401);+ expect((await request(server).get('/api/admin/google-quota').set('Cookie', sessionCookie(USER))).status).toBe(403);+ expect((await request(server).put('/api/admin/google-quota').set('Cookie', sessionCookie(USER)).send({ daily_limit: 5 })).status).toBe(403);+ });++ it('GQUOTA-E2E-002: stores the ceiling, reports today, and audits the change', async () => {+ db.prepare("INSERT OR REPLACE INTO google_api_usage (day, calls) VALUES (date('now'), 7)").run();+ const put = await request(server).put('/api/admin/google-quota').set('Cookie', sessionCookie(ADMIN)).send({ daily_limit: 5 });+ expect(put.status).toBe(200);+ expect(put.body).toEqual({ daily_limit: 5, used_today: 7, exhausted: true });+ expect(writeAudit).toHaveBeenCalledWith(expect.objectContaining({ action: 'admin.google_daily_limit', details: { daily_limit: 5 } }));++ const get = await request(server).get('/api/admin/google-quota').set('Cookie', sessionCookie(ADMIN));+ expect(get.body).toEqual({ daily_limit: 5, used_today: 7, exhausted: true });++ const off = await request(server).put('/api/admin/google-quota').set('Cookie', sessionCookie(ADMIN)).send({ daily_limit: null });+ expect(off.body).toEqual({ daily_limit: null, used_today: 7, exhausted: false });+ });++ it('GQUOTA-E2E-003: 400 from the pipe for a body that is not a whole, non-negative number or null', async () => {+ for (const bad of [{ daily_limit: -1 }, { daily_limit: 1.5 }, { daily_limit: 'many' }, {}]) {+ const res = await request(server).put('/api/admin/google-quota').set('Cookie', sessionCookie(ADMIN)).send(bad);+ expect(res.status, JSON.stringify(bad)).toBe(400);+ }+ });+});diff --git a/server/tests/helpers/google-quota.ts b/server/tests/helpers/google-quota.tsnew file mode 100644index 000000000..253867780--- /dev/null+++ b/server/tests/helpers/google-quota.ts@@ -0,0 +1,4 @@+import type { GoogleQuotaService } from '../../src/nest/google-quota/google-quota.service';++/** A Google quota that never runs out and counts nothing, for tests that build MapsService by hand (#1582). */+export const noGoogleQuota = { exhausted: () => false, record: () => {} } as unknown as GoogleQuotaService;diff --git a/server/tests/helpers/mcp-test-controllers.ts b/server/tests/helpers/mcp-test-controllers.tsindex 7b53d192f..2f5a31aed 100644--- a/server/tests/helpers/mcp-test-controllers.ts+++ b/server/tests/helpers/mcp-test-controllers.ts@@ -120,6 +120,7 @@ import { AirtrailImportService } from '../../src/nest/integrations/airtrail-impoimport { ReservationImportMcp } from '../../src/nest/reservation-import/reservation-import.mcp';import { HelpMcp } from '../../src/nest/help/help.mcp';import { AddonsMcp } from '../../src/nest/addons/addons.mcp';+import { noGoogleQuota } from './google-quota';/*** Hand-wired counterpart of the boot-time discovery in McpRegistryService,@@ -159,7 +160,7 @@ export function createMcpTestRegistry(): McpRegistry {// Exactly one instance, shared by maps, places and share: its stampede guard// and its on-disk set only work if all three readers see the same maps.const placePhotoCache = new PlacePhotoCacheService(dbService, makeStorageFixture('photos/google/').storage);- const mapsService = new MapsService(dbService, placePhotoCache);+ const mapsService = new MapsService(dbService, placePhotoCache, noGoogleQuota);const journeyDomain = new JourneyDomainService(dbService, realtimeService, new TrekPhotosRepository(dbService));// The last three were previously omitted, which left them `undefined` at// runtime — silently fine while nothing called them, a TypeError the moment@@ -246,7 +247,7 @@ export function createMcpTestRegistry(): McpRegistry {new MapsMcp(mapsService),new PlacesMcp(placesService, mapsService, dbService, authService, journeyDomain, assignmentsService, guards),new CollectionsMcp(new CollectionsService(dbService, permissionsService, realtimeService, notificationsStub(), generalStorage), dbService, authService, addonsService),- new TransitMcp(new TransitService(new GoogleTransitProvider(dbService)), daysService, reservationsService, dbService, authService, guards),+ new TransitMcp(new TransitService(new GoogleTransitProvider(dbService, noGoogleQuota)), daysService, reservationsService, dbService, authService, guards),new AtlasMcp(new AtlasService(dbService), addonsService, authService),new JourneyMcp(journeyDomain, new JourneyShareService(dbService, journeyDomain, new SettingsService(dbService)), addonsService, authService, new JourneyPhotoCaptureService(captureBackfill, journeyDomain)),new MemoriesMcp(immichService, synologyService, dbService, addonsService),diff --git a/server/tests/helpers/plugin-host.ts b/server/tests/helpers/plugin-host.tsindex 6e165a5d6..f4d3512ba 100644--- a/server/tests/helpers/plugin-host.ts+++ b/server/tests/helpers/plugin-host.ts@@ -73,6 +73,7 @@ import { PlacePhotoCacheService } from '../../src/nest/place-photos/place-photo-import { TrekPhotosRepository } from '../../src/nest/photos/trek-photos.repository';import { RuntimeEnvService } from '../../src/nest/app-config/runtime-env.service';import { makeStorageFixture } from './storage-fixture';+import { noGoogleQuota } from './google-quota';/*** Hand-wired counterpart of the PluginsModule DI graph for no-Nest tests@@ -111,7 +112,7 @@ export function createPluginRpcHostFactory(dbs: DatabaseService): PluginRpcHostFconst oauth = new PluginOAuthService(dbs);const accommodations = new AccommodationsService(dbs, permissions, realtime, assignments);// After it: deleting a place cancels the nights booked at it through this one.- const places = new PlacesService(dbs, permissions, realtime, new MapsService(dbs, photoCache), queryHelpers, unsplash, photoCache, journey, generalStorage, accommodations);+ const places = new PlacesService(dbs, permissions, realtime, new MapsService(dbs, photoCache, noGoogleQuota), queryHelpers, unsplash, photoCache, journey, generalStorage, accommodations);// After accommodations: a hotel booking writes the stay's day stop through it.const reservations = new ReservationsService(dbs, permissions, budget, realtime, notificationsStub(), new ReservationsReadRepository(dbs), accommodations);const trips = new TripsService(dbs, reservations, days, permissions, budget, vacay, realtime, unsplash, generalStorage, new SettingsService(dbs));diff --git a/server/tests/unit/nest/google-quota.service.test.ts b/server/tests/unit/nest/google-quota.service.test.tsnew file mode 100644index 000000000..3b3d8104f--- /dev/null+++ b/server/tests/unit/nest/google-quota.service.test.ts@@ -0,0 +1,88 @@+import { describe, it, expect, beforeEach, vi } from 'vitest';+import Database from 'better-sqlite3';+import { GoogleQuotaService, GOOGLE_DAILY_LIMIT_SETTING } from '../../../src/nest/google-quota/google-quota.service';++/** GQUOTA-001..007 — the daily ceiling on Google API calls (#1582). */++function makeDb(): Database.Database {+ const db = new Database(':memory:');+ db.exec(`+ CREATE TABLE app_settings (key TEXT PRIMARY KEY, value TEXT);+ CREATE TABLE google_api_usage (day TEXT PRIMARY KEY, calls INTEGER NOT NULL DEFAULT 0);+ `);+ return db;+}++function serviceOver(db: Database.Database): GoogleQuotaService {+ const bridge = {+ get: <T>(sql: string, ...p: unknown[]) => db.prepare(sql).get(...p) as T | undefined,+ run: (sql: string, ...p: unknown[]) => db.prepare(sql).run(...p),+ };+ return new GoogleQuotaService(bridge as never);+}++describe('GoogleQuotaService', () => {+ let db: Database.Database;+ let quota: GoogleQuotaService;++ beforeEach(() => {+ db = makeDb();+ quota = serviceOver(db);+ });++ it('GQUOTA-001: without a ceiling nothing is ever exhausted, and calls are still counted', () => {+ for (let i = 0; i < 3; i++) quota.record();+ expect(quota.dailyLimit()).toBeNull();+ expect(quota.exhausted()).toBe(false);+ expect(quota.status()).toEqual({ daily_limit: null, used_today: 3, exhausted: false });+ });++ it('GQUOTA-002: the key reads as spent once today reaches the ceiling', () => {+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ quota.setDailyLimit(2);+ quota.record();+ expect(quota.exhausted()).toBe(false);+ quota.record();+ expect(quota.exhausted()).toBe(true);+ expect(quota.exhausted()).toBe(true);+ // Logged once a day, not on every request that finds the door shut.+ expect(warn).toHaveBeenCalledTimes(1);+ warn.mockRestore();+ });++ it('GQUOTA-003: yesterday does not count against today', () => {+ quota.setDailyLimit(1);+ db.prepare("INSERT INTO google_api_usage (day, calls) VALUES (date('now', '-1 day'), 50)").run();+ expect(quota.usedToday()).toBe(0);+ expect(quota.exhausted()).toBe(false);+ });++ it('GQUOTA-004: 0 and null remove the ceiling', () => {+ quota.setDailyLimit(10);+ expect(db.prepare('SELECT value FROM app_settings WHERE key = ?').get(GOOGLE_DAILY_LIMIT_SETTING)).toEqual({ value: '10' });+ expect(quota.setDailyLimit(0).daily_limit).toBeNull();+ quota.setDailyLimit(10);+ expect(quota.setDailyLimit(null).daily_limit).toBeNull();+ expect(db.prepare('SELECT value FROM app_settings WHERE key = ?').get(GOOGLE_DAILY_LIMIT_SETTING)).toBeUndefined();+ });++ it('GQUOTA-005: a stored value that is not a positive number means no ceiling', () => {+ db.prepare('INSERT INTO app_settings (key, value) VALUES (?, ?)').run(GOOGLE_DAILY_LIMIT_SETTING, 'lots');+ expect(quota.dailyLimit()).toBeNull();+ });++ it('GQUOTA-006: the status prunes days past the retention window', () => {+ db.prepare("INSERT INTO google_api_usage (day, calls) VALUES (date('now', '-500 days'), 9), (date('now', '-10 days'), 4)").run();+ quota.status();+ expect(db.prepare('SELECT COUNT(*) AS n FROM google_api_usage').get()).toEqual({ n: 1 });+ });++ it('GQUOTA-007: raising the ceiling reopens the day at once', () => {+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});+ quota.setDailyLimit(1);+ quota.record();+ expect(quota.exhausted()).toBe(true);+ expect(quota.setDailyLimit(5)).toEqual({ daily_limit: 5, used_today: 1, exhausted: false });+ warn.mockRestore();+ });+});diff --git a/server/tests/unit/nest/google-transit.provider.test.ts b/server/tests/unit/nest/google-transit.provider.test.tsindex d5048ddc6..20c2e265e 100644--- a/server/tests/unit/nest/google-transit.provider.test.ts+++ b/server/tests/unit/nest/google-transit.provider.test.ts@@ -17,6 +17,7 @@ import { GoogleTransitProvider, clearGoogleTransitCache } from '../../../src/nesimport { decodePolyline, encodePolyline } from '../../../src/nest/transit/transit.helpers';import { TransitService } from '../../../src/nest/transit/transit.service';import type { DatabaseService } from '../../../src/nest/database/database.service';+import { noGoogleQuota } from '../../helpers/google-quota';vi.mock('../../../src/app-config', async (importOriginal) => {const actual = await importOriginal<typeof import('../../../src/app-config')>();@@ -163,33 +164,33 @@ function subwayRoute(): FixtureRoutes {describe('activation', () => {it('GTRANSIT-001: stays off while the instance is on Transitous, even with a key', () => {- const provider = new GoogleTransitProvider(stubDb({ maps_api_key: 'test-key' }));+ const provider = new GoogleTransitProvider(stubDb({ maps_api_key: 'test-key' }), noGoogleQuota);expect(provider.isActive(1)).toBe(false);});it('GTRANSIT-002: stays off when Google is selected but no key resolves', () => {- const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'google' }));+ const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'google' }), noGoogleQuota);expect(provider.isActive(1)).toBe(false);});it('GTRANSIT-003: is on only with both the setting and a key', () => {- expect(new GoogleTransitProvider(googleDb()).isActive(1)).toBe(true);+ expect(new GoogleTransitProvider(googleDb(), noGoogleQuota).isActive(1)).toBe(true);});it('GTRANSIT-004: an unknown provider value falls back to Transitous', () => {- const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'someday-maps', maps_api_key: 'test-key' }));+ const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'someday-maps', maps_api_key: 'test-key' }), noGoogleQuota);expect(provider.isActive(1)).toBe(false);});it('GTRANSIT-005: TransitService routes to Google only when it is active', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- const service = new TransitService(new GoogleTransitProvider(googleDb()));+ const service = new TransitService(new GoogleTransitProvider(googleDb(), noGoogleQuota));await service.plan({ from: FROM, to: TO });expect(fetchMock.mock.calls[0][0]).toBe('https://routes.googleapis.com/directions/v2:computeRoutes');});it('GTRANSIT-006: TransitService still validates the request before dispatching', async () => {- const service = new TransitService(new GoogleTransitProvider(googleDb()));+ const service = new TransitService(new GoogleTransitProvider(googleDb(), noGoogleQuota));await expect(service.plan({ from: 'nowhere', to: TO })).rejects.toThrow('from must be "lat,lng"');await expect(service.plan({ from: FROM, to: TO, modes: 'ROCKET' })).rejects.toThrow('unsupported transit mode');expect(fetchMock).not.toHaveBeenCalled();@@ -199,7 +200,7 @@ describe('activation', () => {describe('plan mapping', () => {it('GTRANSIT-007: maps a walk/subway/walk route and derives the journey clock', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);expect(itineraries).toHaveLength(1);const it0 = itineraries[0];@@ -236,7 +237,7 @@ describe('plan mapping', () => {fetchMock.mockResolvedValue(okJson({ routes: [{ legs: [{ steps: [{ travelMode: 'WALK', staticDuration: '900s' }] }] }] }),);- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);expect(itineraries).toEqual([]);});@@ -247,7 +248,7 @@ describe('plan mapping', () => {if (details) details.transitLine.vehicle.type = type;return route;};- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);for (const [google, trek] of [['HEAVY_RAIL', 'RAIL'],['HIGH_SPEED_TRAIN', 'HIGHSPEED_RAIL'],@@ -268,7 +269,7 @@ describe('plan mapping', () => {describe('request shape', () => {it('GTRANSIT-010: asks for transit, alternatives and the caller language', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO, time: '2026-09-10T09:00:00Z' }, 'ja', 1);+ await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO, time: '2026-09-10T09:00:00Z' }, 'ja', 1);const body = lastBody();expect(body.travelMode).toBe('TRANSIT');@@ -282,7 +283,7 @@ describe('request shape', () => {it('GTRANSIT-011: arriveBy anchors the time at the destination', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- await new GoogleTransitProvider(googleDb()).plan(+ await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO, time: '2026-09-10T09:00:00Z', arriveBy: true }, 'en', 1,);expect(lastBody().arrivalTime).toBe('2026-09-10T09:00:00.000Z');@@ -291,7 +292,7 @@ describe('request shape', () => {it('GTRANSIT-012: the field mask stays inside the tier the itinerary needs', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);const mask = lastHeaders()['X-Goog-FieldMask'];expect(mask).toContain('routes.legs.steps.transitDetails.stopDetails');@@ -303,7 +304,7 @@ describe('request shape', () => {it('GTRANSIT-013: sends the expressible modes and holds the rest on the response', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);const subwayOnly = await provider.plan({ from: FROM, to: TO, modes: 'SUBWAY' }, 'en', 1);expect(lastBody().transitPreferences).toEqual({ allowedTravelModes: ['SUBWAY'] });@@ -323,7 +324,7 @@ describe('request shape', () => {twoTransfers.routes[0].legs[0].steps.splice(2, 0, JSON.parse(JSON.stringify(rail)));fetchMock.mockResolvedValue(okJson(twoTransfers));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);const capped = await provider.plan({ from: FROM, to: TO, maxTransfers: 0 }, 'en', 1);expect(capped.itineraries).toEqual([]);// A low cap also nudges Google itself, so the one billed call is likelier@@ -337,7 +338,7 @@ describe('request shape', () => {it('GTRANSIT-015: an identical plan is answered from cache, unbilled', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);await provider.plan({ from: FROM, to: TO }, 'en', 1);await provider.plan({ from: FROM, to: TO }, 'en', 1);expect(fetchMock).toHaveBeenCalledTimes(1);@@ -350,7 +351,7 @@ describe('request shape', () => {headers: { get: () => null },json: async () => ({ error: { message: 'Routes API has not been used in project 1' } }),});- await expect(new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1)).rejects.toThrow(+ await expect(new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1)).rejects.toThrow('Routes API has not been used in project 1',);});@@ -358,7 +359,7 @@ describe('request shape', () => {it('GTRANSIT-017: upstream rate limiting stays a 429', async () => {fetchMock.mockResolvedValue({ ok: false, status: 429, headers: { get: () => null }, json: async () => ({}) });await expect(- new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1),+ new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1),).rejects.toMatchObject({ status: 429 });});});@@ -383,7 +384,7 @@ describe('rail mode filter', () => {const TRAIN_CHIP = 'HIGHSPEED_RAIL,LONG_DISTANCE,NIGHT_RAIL,REGIONAL_RAIL,SUBURBAN';it('GTRANSIT-039: the train filter keeps the trains Google labels HEAVY_RAIL', async () => {- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);for (const vehicle of ['HEAVY_RAIL', 'RAIL', 'COMMUTER_TRAIN', 'HIGH_SPEED_TRAIN']) {clearGoogleTransitCache();fetchMock.mockResolvedValue(okJson(withVehicle(vehicle)));@@ -395,7 +396,7 @@ describe('rail mode filter', () => {});it('GTRANSIT-040: the RAIL umbrella keeps the fine-grained rail legs, and neither side leaks a subway', async () => {- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);// An MCP caller may name the umbrella; Google still answers by vehicle.for (const vehicle of ['COMMUTER_TRAIN', 'HIGH_SPEED_TRAIN', 'HEAVY_RAIL']) {clearGoogleTransitCache();@@ -415,7 +416,7 @@ describe('rail mode filter', () => {it('GTRANSIT-041: a bus-only filter still refuses a train', async () => {fetchMock.mockResolvedValue(okJson(withVehicle('HEAVY_RAIL')));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);const { itineraries } = await provider.plan({ from: FROM, to: TO, modes: 'BUS,COACH' }, 'en', 1);expect(itineraries).toEqual([]);});@@ -442,7 +443,7 @@ describe('geocode', () => {it('GTRANSIT-018: maps places, marking stations STOP and everything else PLACE', async () => {fetchMock.mockResolvedValue(okJson(places));- const { results } = await new GoogleTransitProvider(googleDb()).geocode('Nakanoshima', 'en', undefined, 1);+ const { results } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).geocode('Nakanoshima', 'en', undefined, 1);expect(results).toEqual([{ name: 'Nakanoshima Station', lat: 34.6939, lng: 135.4915, type: 'STOP', area: '2 Chome Nakanoshima, Kita Ward, Osaka' },@@ -452,7 +453,7 @@ describe('geocode', () => {it('GTRANSIT-019: biases on `near` and asks only for the cheap Text Search fields', async () => {fetchMock.mockResolvedValue(okJson(places));- await new GoogleTransitProvider(googleDb()).geocode('Temmabashi', 'ja', '34.6875,135.5155', 1);+ await new GoogleTransitProvider(googleDb(), noGoogleQuota).geocode('Temmabashi', 'ja', '34.6875,135.5155', 1);const body = lastBody();expect(body.languageCode).toBe('ja');@@ -467,14 +468,14 @@ describe('geocode', () => {it('GTRANSIT-020: repeat lookups of the same station are answered from cache', async () => {fetchMock.mockResolvedValue(okJson(places));- const service = new TransitService(new GoogleTransitProvider(googleDb()));+ const service = new TransitService(new GoogleTransitProvider(googleDb(), noGoogleQuota));await service.geocode('Kyobashi', 'en', undefined, 1);await service.geocode('Kyobashi', 'en', undefined, 1);expect(fetchMock).toHaveBeenCalledTimes(1);});it('GTRANSIT-021: a short query never reaches Google', async () => {- const service = new TransitService(new GoogleTransitProvider(googleDb()));+ const service = new TransitService(new GoogleTransitProvider(googleDb(), noGoogleQuota));// The provider is still named: the answer comes from the length guard, not// from a backend that declined.expect(await service.geocode('a', 'en', undefined, 1)).toEqual({ results: [], provider: 'google' });@@ -484,7 +485,7 @@ describe('geocode', () => {describe('guards', () => {it('GTRANSIT-022: refuses rather than calling Google when no key resolves', async () => {- const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'google' }));+ const provider = new GoogleTransitProvider(stubDb({ transit_provider: 'google' }), noGoogleQuota);await expect(provider.plan({ from: FROM, to: TO }, 'en', 1)).rejects.toThrow('no Google API key configured');await expect(provider.geocode('Namba', 'en', undefined, 1)).rejects.toThrow('no Google API key configured');expect(fetchMock).not.toHaveBeenCalled();@@ -493,14 +494,14 @@ describe('guards', () => {it('GTRANSIT-023: an oversized response is refused before it is parsed', async () => {const json = vi.fn();fetchMock.mockResolvedValue({ ok: true, status: 200, headers: { get: () => '9000000' }, json });- await expect(new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1)).rejects.toThrow(+ await expect(new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1)).rejects.toThrow('response too large',);expect(json).not.toHaveBeenCalled();});it('GTRANSIT-024: a route with no steps, and one whose transit leg has no clock, are both dropped', async () => {- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);fetchMock.mockResolvedValue(okJson({ routes: [{ legs: [{ steps: [] }] }] }));expect((await provider.plan({ from: FROM, to: TO }, 'en', 1)).itineraries).toEqual([]);@@ -522,7 +523,7 @@ describe('guards', () => {}fetchMock.mockResolvedValue(okJson(unnamed));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);// Every name is non-empty — transitStopSchema rejects a blank one, which// would drop the itinerary at the MCP boundary.for (const leg of itineraries[0].legs) {@@ -538,7 +539,7 @@ describe('guards', () => {noDuration.routes[0].legs[0].steps[2].staticDuration = 'not-a-duration';fetchMock.mockResolvedValue(okJson(noDuration));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);expect(itineraries[0].legs[0].duration).toBe(0);expect(itineraries[0].legs[2].duration).toBe(0);expect(itineraries[0].walkSeconds).toBe(0);@@ -547,7 +548,7 @@ describe('guards', () => {it('GTRANSIT-027: a cache entry past its TTL is re-fetched, not served stale', async () => {const now = vi.spyOn(Date, 'now').mockReturnValue(1_000_000);fetchMock.mockResolvedValue(okJson(subwayRoute()));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);await provider.plan({ from: FROM, to: TO }, 'en', 1);now.mockReturnValue(1_000_000 + 6 * 60 * 1000);@@ -558,7 +559,7 @@ describe('guards', () => {it('GTRANSIT-028: the cache evicts rather than growing without bound', async () => {fetchMock.mockResolvedValue(okJson({ places: [] }));- const provider = new GoogleTransitProvider(googleDb());+ const provider = new GoogleTransitProvider(googleDb(), noGoogleQuota);for (let i = 0; i < 220; i++) await provider.geocode(`station-${i}`, 'en', undefined, 1);expect(fetchMock).toHaveBeenCalledTimes(220);@@ -606,7 +607,7 @@ describe('walk coalescing', () => {it('GTRANSIT-029: a walk split across navigation steps becomes one leg', async () => {fetchMock.mockResolvedValue(okJson(routeWithSlicedWalks()));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);const legs = itineraries[0].legs;expect(legs.map((l) => l.mode)).toEqual(['WALK', 'SUBWAY', 'WALK']);@@ -620,7 +621,7 @@ describe('walk coalescing', () => {it('GTRANSIT-030: the merged walk keeps the endpoints of the whole run', async () => {fetchMock.mockResolvedValue(okJson(routeWithSlicedWalks()));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);const [opening, , closing] = itineraries[0].legs;expect(opening.from.name).toBe('START');@@ -634,7 +635,7 @@ describe('walk coalescing', () => {it('GTRANSIT-031: the merged walk draws the whole path, with no doubled seam', async () => {fetchMock.mockResolvedValue(okJson(routeWithSlicedWalks()));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);const points = decodePolyline(itineraries[0].legs[0].geometry ?? '', 5);// Three two-point steps sharing their seams — four points, not six.@@ -648,7 +649,7 @@ describe('walk coalescing', () => {delete partial.routes[0].legs[0].steps[1].polyline;fetchMock.mockResolvedValue(okJson(partial));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);expect(decodePolyline(itineraries[0].legs[0].geometry ?? '', 5).length).toBeGreaterThan(0);expect(itineraries[0].legs[0].duration).toBe(180);});@@ -661,7 +662,7 @@ describe('walk coalescing', () => {many.routes[0].legs[0].steps = [...crumbs, rail, ...crumbs];fetchMock.mockResolvedValue(okJson(many));- const { itineraries } = await new GoogleTransitProvider(googleDb()).plan({ from: FROM, to: TO }, 'en', 1);+ const { itineraries } = await new GoogleTransitProvider(googleDb(), noGoogleQuota).plan({ from: FROM, to: TO }, 'en', 1);expect(itineraries[0].legs).toHaveLength(3);});});@@ -674,7 +675,7 @@ describe('walk coalescing', () => {describe('provider reporting', () => {it('GTRANSIT-036: names Google when Google answered', async () => {fetchMock.mockResolvedValue(okJson(subwayRoute()));- const service = new TransitService(new GoogleTransitProvider(googleDb()));+ const service = new TransitService(new GoogleTransitProvider(googleDb(), noGoogleQuota));const planned = await service.plan({ from: FROM, to: TO }, 'en', 1);expect(planned.provider).toBe('google');@@ -686,7 +687,7 @@ describe('provider reporting', () => {fetchMock.mockResolvedValue(okJson({ itineraries: [] }));// Google selected, but no key resolves — the request goes to Transitous and// says so, instead of leaving an empty result to be blamed on Google.- const service = new TransitService(new GoogleTransitProvider(stubDb({ transit_provider: 'google' })));+ const service = new TransitService(new GoogleTransitProvider(stubDb({ transit_provider: 'google' }), noGoogleQuota));const planned = await service.plan({ from: '48.8583,2.3470', to: '48.8809,2.3553' }, 'en', 1);expect(planned.provider).toBe('transitous');expect(planned.itineraries).toEqual([]);@@ -695,7 +696,7 @@ describe('provider reporting', () => {it('GTRANSIT-038: a cached answer still names its backend', async () => {fetchMock.mockResolvedValue(okJson({ itineraries: [] }));- const service = new TransitService(new GoogleTransitProvider(stubDb({})));+ const service = new TransitService(new GoogleTransitProvider(stubDb({}), noGoogleQuota));const first = await service.plan({ from: '48.1,2.1', to: '48.2,2.2' }, 'en', 1);const second = await service.plan({ from: '48.1,2.1', to: '48.2,2.2' }, 'en', 1);expect(fetchMock).toHaveBeenCalledTimes(1);diff --git a/server/tests/unit/nest/maps.amap.test.ts b/server/tests/unit/nest/maps.amap.test.tsindex 05db77096..3d2541f97 100644--- a/server/tests/unit/nest/maps.amap.test.ts+++ b/server/tests/unit/nest/maps.amap.test.ts@@ -75,6 +75,7 @@ import {} from '../../../src/nest/maps/providers/amap.provider';import { isGooglePlaceId } from '../../../src/nest/maps/maps.helpers';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';const photoCacheStub = {get: vi.fn(() => null),@@ -86,7 +87,7 @@ const photoCacheStub = {serveKey: vi.fn(() => null),} as unknown as PlacePhotoCacheService;-const svc = new MapsService(new DatabaseService(db as never), photoCacheStub);+const svc = new MapsService(new DatabaseService(db as never), photoCacheStub, noGoogleQuota);/** A provider over a fixed key, which is all these cases need. */function provider(tips = new AmapTipStash()): AmapPlacesProvider {diff --git a/server/tests/unit/nest/maps.area.test.ts b/server/tests/unit/nest/maps.area.test.tsindex 80931ffbe..8d28235b7 100644--- a/server/tests/unit/nest/maps.area.test.ts+++ b/server/tests/unit/nest/maps.area.test.ts@@ -20,6 +20,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';const BOX = { minLat: 54, minLng: 12, maxLat: 54.2, maxLng: 12.3 };@@ -52,7 +53,7 @@ function make(enabled = true) {if (enabled) delete process.env.TREK_PLACES_ENABLED;else process.env.TREK_PLACES_ENABLED = 'false';const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- return new MapsService(database, {} as PlacePhotoCacheService);+ return new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);}beforeEach(() => {diff --git a/server/tests/unit/nest/maps.autocomplete.test.ts b/server/tests/unit/nest/maps.autocomplete.test.tsindex 49e4f132b..9c2ad402e 100644--- a/server/tests/unit/nest/maps.autocomplete.test.ts+++ b/server/tests/unit/nest/maps.autocomplete.test.ts@@ -26,6 +26,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';// The index switch is an environment variable now, not an admin row: it decides// whether a search leaves the instance at all, so it is pinned by the operator@@ -88,7 +89,7 @@ function make(enabled = true, rows: Record<string, string> = {}) {typeof key === 'string' && sql.includes('app_settings') && rows[key] !== undefined ? { value: rows[key] } : undefined,),} as unknown as DatabaseService;- return new MapsService(database, {} as PlacePhotoCacheService);+ return new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);}/** Google's autocomplete envelope, which is not the shape its text search answers in. */diff --git a/server/tests/unit/nest/maps.curated-images.test.ts b/server/tests/unit/nest/maps.curated-images.test.tsindex f73e11c5d..3f9e0ea19 100644--- a/server/tests/unit/nest/maps.curated-images.test.ts+++ b/server/tests/unit/nest/maps.curated-images.test.ts@@ -26,8 +26,9 @@ vi.mock('../../../src/utils/ssrfGuard', () => ({import { db } from '../../../src/db/database';import { DatabaseService } from '../../../src/nest/database/database.service';import { MapsService } from '../../../src/nest/maps/maps.service';+import { noGoogleQuota } from '../../helpers/google-quota';-const svcOf = () => new MapsService(new DatabaseService(db as never), {} as never);+const svcOf = () => new MapsService(new DatabaseService(db as never), {} as never, noGoogleQuota);const filePage = (over: Record<string, unknown> = {}) => ({pageid: 4711,diff --git a/server/tests/unit/nest/maps.geocode.test.ts b/server/tests/unit/nest/maps.geocode.test.tsindex ae07737eb..7529878ea 100644--- a/server/tests/unit/nest/maps.geocode.test.ts+++ b/server/tests/unit/nest/maps.geocode.test.ts@@ -33,6 +33,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';const QUERY = 'Hotel Adlon Kempinski, Unter den Linden 77, Berlin';@@ -65,7 +66,7 @@ function make(enabled = true) {if (enabled) delete process.env.TREK_PLACES_ENABLED;else process.env.TREK_PLACES_ENABLED = 'false';const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- return new MapsService(database, {} as PlacePhotoCacheService);+ return new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);}beforeEach(() => {diff --git a/server/tests/unit/nest/maps.gers-details.test.ts b/server/tests/unit/nest/maps.gers-details.test.tsindex 9d5c0ada5..b8417c299 100644--- a/server/tests/unit/nest/maps.gers-details.test.ts+++ b/server/tests/unit/nest/maps.gers-details.test.ts@@ -20,6 +20,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';const PLACE = {gers: 'abc-123',@@ -38,7 +39,7 @@ const PLACE = {function make(osmTags: Record<string, string> | null) {const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- const svc = new MapsService(database, {} as PlacePhotoCacheService);+ const svc = new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);vi.spyOn(svc, 'resolveOsmIdentity').mockResolvedValue(osmTags ? { tags: osmTags, osmUrl: 'https://www.openstreetmap.org/node/1', matchedName: "L'Osteria" } : null,);@@ -104,7 +105,7 @@ describe('MapsService.getPlaceDetails for a gers: id', () => {// through would turn a working answer into an error for the one user whose// details request happened to land while Overpass was unreachable.const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- const svc = new MapsService(database, {} as PlacePhotoCacheService);+ const svc = new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);vi.spyOn(svc, 'resolveOsmIdentity').mockRejectedValue(new Error('overpass down'));mockById.mockResolvedValue({ ...PLACE, hours: { osm: 'Mo-Su 12:00-22:00' } });diff --git a/server/tests/unit/nest/maps.google-quota.test.ts b/server/tests/unit/nest/maps.google-quota.test.tsnew file mode 100644index 000000000..668d7a79f--- /dev/null+++ b/server/tests/unit/nest/maps.google-quota.test.ts@@ -0,0 +1,66 @@+/**+ * MAPS-QUOTA-001..004 — the Google key reads as absent once the admin's daily+ * ceiling is reached (#1582), so search and details fall back the way a keyless+ * install does, and every call through the Places client is counted.+ */+import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';++vi.mock('../../../src/db/database', () => ({+ db: { prepare: () => ({ get: () => undefined, run: () => undefined, all: () => [] }) },+}));++vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEY: '0'.repeat(64) }));++import { db } from '../../../src/db/database';+import { DatabaseService } from '../../../src/nest/database/database.service';+import { MapsService } from '../../../src/nest/maps/maps.service';+import { GoogleTransitProvider } from '../../../src/nest/transit/google-transit.provider';+import type { GoogleQuotaService } from '../../../src/nest/google-quota/google-quota.service';++function quota(exhausted: boolean) {+ return { exhausted: vi.fn(() => exhausted), record: vi.fn() };+}++const svcWith = (q: ReturnType<typeof quota>) =>+ new MapsService(new DatabaseService(db as never), {} as never, q as unknown as GoogleQuotaService);++beforeEach(() => {+ process.env.PLACES_API_KEY = 'operator-key';+});++afterEach(() => {+ delete process.env.PLACES_API_KEY;+ vi.unstubAllGlobals();+});++describe('Google daily ceiling in MapsService', () => {+ it('MAPS-QUOTA-001: below the ceiling the key is spent as before', () => {+ const svc = svcWith(quota(false));+ expect(svc.getMapsKey(1)).toBe('operator-key');+ expect(svc.keyedProvider(1)).toMatchObject({ id: 'google', key: 'operator-key' });+ });++ it('MAPS-QUOTA-002: past the ceiling there is no key and no keyed Google provider', () => {+ const svc = svcWith(quota(true));+ expect(svc.getMapsKey(1)).toBeNull();+ expect(svc.keyedProvider(1)).toBeNull();+ // The settings view still learns that a key exists.+ expect(svc.resolveMapsKey(1).key).toBe('operator-key');+ });++ it('MAPS-QUOTA-003: every Places call is counted against the day', async () => {+ const q = quota(false);+ const svc = svcWith(q);+ vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ editorialSummary: { text: 'Hi' } }), { status: 200 })));+ await svc.fetchEditorialSummary('ChIJ1', 'key');+ expect(q.record).toHaveBeenCalledTimes(1);+ });+});++describe('Google daily ceiling in the transit provider', () => {+ it('MAPS-QUOTA-004: past the ceiling the Google transit backend is inactive', () => {+ const stubDb = { get: () => ({ value: 'google' }) } as unknown as DatabaseService;+ expect(new GoogleTransitProvider(stubDb, quota(false) as unknown as GoogleQuotaService).isActive(1)).toBe(true);+ expect(new GoogleTransitProvider(stubDb, quota(true) as unknown as GoogleQuotaService).isActive(1)).toBe(false);+ });+});diff --git a/server/tests/unit/nest/maps.identity.test.ts b/server/tests/unit/nest/maps.identity.test.tsindex ec5da4eab..48287cea6 100644--- a/server/tests/unit/nest/maps.identity.test.ts+++ b/server/tests/unit/nest/maps.identity.test.ts@@ -23,8 +23,9 @@ import { db } from '../../../src/db/database';import { DatabaseService } from '../../../src/nest/database/database.service';import { MapsService } from '../../../src/nest/maps/maps.service';import { toWikiLang, haversineMetres, namesOverlap } from '../../../src/nest/maps/maps.helpers';+import { noGoogleQuota } from '../../helpers/google-quota';-const svcOf = () => new MapsService(new DatabaseService(db as never), {} as never);+const svcOf = () => new MapsService(new DatabaseService(db as never), {} as never, noGoogleQuota);// The Brandenburg Gate and the underground station named after it, 250m apart.const GATE = { lat: 52.5163, lng: 13.3777 };diff --git a/server/tests/unit/nest/maps.nearby.test.ts b/server/tests/unit/nest/maps.nearby.test.tsindex 043dfa106..f23b78cd6 100644--- a/server/tests/unit/nest/maps.nearby.test.ts+++ b/server/tests/unit/nest/maps.nearby.test.ts@@ -27,6 +27,7 @@ import {} from '../../../src/nest/maps/maps-nearby.helpers';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';const indexRow = (gers: string, name: string, lat: number, lng: number) => ({gers,@@ -60,7 +61,7 @@ function make(opts: { index?: boolean; google?: boolean } = {}) {if (opts.index === false) process.env.TREK_PLACES_ENABLED = 'false';else delete process.env.TREK_PLACES_ENABLED;const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- const svc = new MapsService(database, {} as PlacePhotoCacheService);+ const svc = new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);vi.spyOn(svc, 'keyedProvider').mockReturnValue(opts.google ? ({ id: 'google', key: 'test-key', source: 'user-row' } as ReturnType<MapsService['keyedProvider']>) : null,);diff --git a/server/tests/unit/nest/maps.pois.test.ts b/server/tests/unit/nest/maps.pois.test.tsindex 1586e826b..38622100b 100644--- a/server/tests/unit/nest/maps.pois.test.ts+++ b/server/tests/unit/nest/maps.pois.test.ts@@ -28,6 +28,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';// 0.1 degrees a side, centred on the equator: cos(lat) is 1 there, so the radius// the service derives is exactly half the box's diagonal and the numbers below@@ -109,7 +110,7 @@ function make(enabled = true) {if (enabled) delete process.env.TREK_PLACES_ENABLED;else process.env.TREK_PLACES_ENABLED = 'false';const database = { get: vi.fn(() => undefined) } as unknown as DatabaseService;- return new MapsService(database, {} as PlacePhotoCacheService);+ return new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);}// Overpass is the one network call this file must never make; stubbing it isdiff --git a/server/tests/unit/nest/maps.search-merge.test.ts b/server/tests/unit/nest/maps.search-merge.test.tsindex 0b306c5ee..9ec843927 100644--- a/server/tests/unit/nest/maps.search-merge.test.ts+++ b/server/tests/unit/nest/maps.search-merge.test.ts@@ -33,6 +33,7 @@ vi.mock('../../../src/config', () => ({ JWT_SECRET: 'test-secret', ENCRYPTION_KEimport { MapsService } from '../../../src/nest/maps/maps.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import type { PlacePhotoCacheService } from '../../../src/nest/place-photos/place-photo-cache.service';+import { noGoogleQuota } from '../../helpers/google-quota';// The index switch is an environment variable now, not an admin row: it decides// whether a search leaves the instance at all, so it is pinned by the operator@@ -87,7 +88,7 @@ function make(enabled = true, rows: Record<string, string> = {}) {typeof key === 'string' && sql.includes('app_settings') && rows[key] !== undefined ? { value: rows[key] } : undefined,),} as unknown as DatabaseService;- return new MapsService(database, {} as PlacePhotoCacheService);+ return new MapsService(database, {} as PlacePhotoCacheService, noGoogleQuota);}const googleAnswer = (name: string) => ({diff --git a/server/tests/unit/nest/maps.service.test.ts b/server/tests/unit/nest/maps.service.test.tsindex 3b03a4b08..54d8f4e95 100644--- a/server/tests/unit/nest/maps.service.test.ts+++ b/server/tests/unit/nest/maps.service.test.ts@@ -32,6 +32,7 @@ import {import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';import { Jimp } from 'jimp';+import { noGoogleQuota } from '../../helpers/google-quota';// The seams below stand in for real collaborators, so they are typed from those// collaborators' signatures rather than from their own default implementations.@@ -181,7 +182,7 @@ import type { SsrfResult } from '../../../src/utils/ssrfGuard';// The service under test, constructed over the mocked db stub — DatabaseService// routes get/run through the stubbed prepare(), so mockDbGet/mockDbRun keep// flowing exactly as they did for the legacy module.-const svc = new MapsService(new DatabaseService(db as never), photoCacheStub);+const svc = new MapsService(new DatabaseService(db as never), photoCacheStub, noGoogleQuota);/*** Switch the TREK Places index off for one case.@@ -2706,7 +2707,7 @@ function makeSettingsDb(row?: { value: string }) {}function settingsSvc(row?: { value: string }) {- return new MapsService(makeSettingsDb(row).db, photoCacheStub);+ return new MapsService(makeSettingsDb(row).db, photoCacheStub, noGoogleQuota);}describe('kill-switch settings reads', () => {@@ -2730,7 +2731,7 @@ describe('kill-switch settings reads', () => {it('queries the matching app_settings key', () => {const { db: settingsDb, get } = makeSettingsDb({ value: 'true' });- const s = new MapsService(settingsDb, photoCacheStub);+ const s = new MapsService(settingsDb, photoCacheStub, noGoogleQuota);s.autocompleteDisabled();expect(get).toHaveBeenCalledWith(expect.stringContaining('app_settings'), 'places_autocomplete_enabled');s.detailsDisabled();@@ -3430,7 +3431,7 @@ describe('readWikiIdentity', () => {describe('brandLogo', () => {// A fresh service per case: the logo cache lives on the instance, and a hit from// one case would answer the next one's question before its fetch stub ran.- const service = (): MapsService => new MapsService(new DatabaseService(db as never), photoCacheStub);+ const service = (): MapsService => new MapsService(new DatabaseService(db as never), photoCacheStub, noGoogleQuota);const claimResponse = (file: string | null) => ({ok: true,diff --git a/server/tests/unit/nest/places.service.test.ts b/server/tests/unit/nest/places.service.test.tsindex ed5718581..430edbf12 100644--- a/server/tests/unit/nest/places.service.test.ts+++ b/server/tests/unit/nest/places.service.test.ts@@ -78,6 +78,7 @@ import { QueryHelpersService } from '../../../src/nest/query-helpers/query-helpeimport { JourneyDomainService } from '../../../src/nest/journey/journey-domain.service';import { TrekPhotosRepository } from '../../../src/nest/photos/trek-photos.repository';import { makeStorageFixture } from '../../helpers/storage-fixture';+import { noGoogleQuota } from '../../helpers/google-quota';const GPX_FIXTURE = path.join(__dirname, '../../fixtures/test.gpx');const KML_FIXTURE = path.join(__dirname, '../../fixtures/test.kml');@@ -95,7 +96,7 @@ const dbs = new DatabaseService(testDb);*/const placesStorageFx = makeStorageFixture('');-function makePlacesService(maps: MapsService = new MapsService(dbs, photoCacheStub)): PlacesService {+function makePlacesService(maps: MapsService = new MapsService(dbs, photoCacheStub, noGoogleQuota)): PlacesService {return new PlacesService(dbs,new PermissionsService(dbs),diff --git a/server/tests/unit/nest/transit.service.test.ts b/server/tests/unit/nest/transit.service.test.tsindex 77c39ed2a..2801023d4 100644--- a/server/tests/unit/nest/transit.service.test.ts+++ b/server/tests/unit/nest/transit.service.test.ts@@ -15,6 +15,7 @@ import { TransitService } from '../../../src/nest/transit/transit.service';import type { DatabaseService } from '../../../src/nest/database/database.service';import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+import { noGoogleQuota } from '../../helpers/google-quota';vi.mock('../../../src/app-config', async (importOriginal) => {const actual = await importOriginal<typeof import('../../../src/app-config')>();@@ -26,7 +27,7 @@ const fetchMock = vi.fn();// No `transit_provider` row means Transitous, so every case below keeps// exercising the MOTIS path — the Google branch has its own suite.const db = { get: () => undefined, run: () => undefined } as unknown as DatabaseService;-const svc = new TransitService(new GoogleTransitProvider(db));+const svc = new TransitService(new GoogleTransitProvider(db, noGoogleQuota));beforeEach(() => {vi.stubGlobal('fetch', fetchMock);diff --git a/server/tests/unit/nest/trip-read-model.service.test.ts b/server/tests/unit/nest/trip-read-model.service.test.tsindex ae468ce17..d16255538 100644--- a/server/tests/unit/nest/trip-read-model.service.test.ts+++ b/server/tests/unit/nest/trip-read-model.service.test.ts@@ -78,6 +78,7 @@ import { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.servimport { makeStorageFixture } from '../../helpers/storage-fixture';import { JourneyDomainService } from '../../../src/nest/journey/journey-domain.service';import { TrekPhotosRepository } from '../../../src/nest/photos/trek-photos.repository';+import { noGoogleQuota } from '../../helpers/google-quota';// Real sibling services over the same in-memory DB — the aggregation runs the// actual SQL of every domain it fans out to, so a shape change downstream shows@@ -90,7 +91,7 @@ const daysSvc = new DaysService(dbs(), new PermissionsService(dbs()), new Realticonst photoCache = new PlacePhotoCacheService(dbs(), makeStorageFixture('photos/google/').storage);const placesSvc = new PlacesService(dbs(), new PermissionsService(dbs()), new RealtimeService(),- new MapsService(dbs(), photoCache), new QueryHelpersService(dbs()),+ new MapsService(dbs(), photoCache, noGoogleQuota), new QueryHelpersService(dbs()),new UnsplashService(dbs(), new RuntimeEnvService(), makeStorageFixture('').storage), photoCache,new JourneyDomainService(dbs(), new RealtimeService(), new TrekPhotosRepository(dbs())),makeStorageFixture('').storage,diff --git a/server/tests/unit/nest/trips.service.test.ts b/server/tests/unit/nest/trips.service.test.tsindex 1e640b8d8..7f2d77826 100644--- a/server/tests/unit/nest/trips.service.test.ts+++ b/server/tests/unit/nest/trips.service.test.ts@@ -89,6 +89,7 @@ import path from 'path';import { notificationsStub } from '../../helpers/notifications';import { EphemeralTokenService } from '../../../src/nest/auth/ephemeral-token.service';import { SettingsService } from '../../../src/nest/settings/settings.service';+import { noGoogleQuota } from '../../helpers/google-quota';// Real sibling services over the same in-memory DB — updateTrip's date-shift// resyncs and the summary/bundle aggregation run their actual SQL.@@ -108,7 +109,7 @@ const placesSvc = new PlacesService(dbs(),new PermissionsService(dbs()),new RealtimeService(),- new MapsService(dbs(), photoCache),+ new MapsService(dbs(), photoCache, noGoogleQuota),new QueryHelpersService(dbs()),new UnsplashService(dbs(), new RuntimeEnvService(), coversFx.storage),photoCache,diff --git a/server/tests/unit/services/conflictUpdate.test.ts b/server/tests/unit/services/conflictUpdate.test.tsindex 8559292ad..4cf1360a2 100644--- a/server/tests/unit/services/conflictUpdate.test.ts+++ b/server/tests/unit/services/conflictUpdate.test.ts@@ -54,6 +54,7 @@ import { TrekPhotosRepository } from '../../../src/nest/photos/trek-photos.reposimport { RuntimeEnvService } from '../../../src/nest/app-config/runtime-env.service';import { notificationsStub } from '../../helpers/notifications';import { makeStorageFixture } from '../../helpers/storage-fixture';+import { noGoogleQuota } from '../../helpers/google-quota';const dbs = new DatabaseService(testDb);const realtime = new RealtimeService();@@ -67,7 +68,7 @@ const places = new PlacesService(dbs,new PermissionsService(dbs),realtime,- new MapsService(dbs, photoCache),+ new MapsService(dbs, photoCache, noGoogleQuota),new QueryHelpersService(dbs),new UnsplashService(dbs, runtimeEnv, makeStorageFixture('').storage),photoCache,diff --git a/shared/src/admin/admin.schema.ts b/shared/src/admin/admin.schema.tsindex 26f27670b..2b4d44caf 100644--- a/shared/src/admin/admin.schema.ts+++ b/shared/src/admin/admin.schema.ts@@ -54,6 +54,22 @@ export const adminFeatureToggleRequestSchema = z.object({});export type AdminFeatureToggleRequest = z.infer<typeof adminFeatureToggleRequestSchema>;+/**+ * PUT /api/admin/google-quota (#1582): the most Google API calls TREK may make+ * in one UTC day. Null or 0 removes the ceiling.+ */+export const googleQuotaUpdateRequestSchema = z.object({+ daily_limit: z.number().int().min(0).max(10_000_000).nullable(),+});+export type GoogleQuotaUpdateRequest = z.infer<typeof googleQuotaUpdateRequestSchema>;++/** The ceiling as stored, today's count, and whether Google is paused until tomorrow. */+export interface GoogleQuotaStatus {+ daily_limit: number | null;+ used_today: number;+ exhausted: boolean;+}+// Shared by all six packing-template create/update routes. `name` is optional so// the service's 'Name is required' / 'Category name is required' / 'Item name is// required' 400s stay the contract, and so the update routes keep treating adiff --git a/shared/src/i18n/ar/admin.ts b/shared/src/i18n/ar/admin.tsindex ed808c599..8ef4f157c 100644--- a/shared/src/i18n/ar/admin.ts+++ b/shared/src/i18n/ar/admin.ts@@ -200,6 +200,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'كل بحث وكل اقتراح يذهب إلى Google Places. عند الإيقاف يجيب فهرس TREK وOpenStreetMap أولًا، ولا يُسأل Google إلا إذا لم يجدا شيئًا.','admin.placesGoogleOnly.missingKey': 'يتطلب مفتاح Google Maps API. من دونه يعمل البحث عبر فهرس TREK وOpenStreetMap مهما كان وضع هذا المفتاح.','admin.placesGoogleOnly.otherProvider': 'يتطلب Google كمزود للأماكن. عند اختيار Amap أو OpenStreetMap لا يذهب أي بحث إلى Google مهما كان وضع هذا المفتاح.',+ 'admin.googleQuota.title': 'الحد اليومي لطلبات Google',+ 'admin.googleQuota.subtitle': 'عند بلوغه يتوقف TREK عن طلب Google حتى اليوم التالي (UTC) ويبحث عبر OpenStreetMap بدلًا منه. اتركه فارغًا لعدم وجود حد.',+ 'admin.googleQuota.placeholder': 'بلا حد',+ 'admin.googleQuota.usedToday': 'اليوم: {used}',+ 'admin.googleQuota.usedOfLimit': 'اليوم: {used} من {limit}',+ 'admin.googleQuota.reached': 'تم بلوغ الحد ({used})، Google متوقف حتى الغد',+ 'admin.googleQuota.saved': 'تم حفظ الحد اليومي','admin.transitProvider.title': 'مزود النقل العام','admin.transitProvider.subtitle': 'الخدمة التي تجيب على بحث النقل العام.','admin.transitProvider.transitous': 'Transitous (مجاني)',diff --git a/shared/src/i18n/az/admin.ts b/shared/src/i18n/az/admin.tsindex b96b142dc..00d4be0c8 100644--- a/shared/src/i18n/az/admin.ts+++ b/shared/src/i18n/az/admin.ts@@ -228,6 +228,13 @@ const admin: TranslationStrings = {'Google Maps API açarı tələb olunur. Açar olmadıqda bu keçidin vəziyyətindən asılı olmayaraq axtarış TREK-in öz indeksi və OpenStreetMap ilə aparılır.','admin.placesGoogleOnly.otherProvider':'Məkan provayderi kimi Google tələb olunur. Amap və ya OpenStreetMap seçildikdə bu keçidin vəziyyətindən asılı olmayaraq axtarış heç vaxt Google-a göndərilmir.',+ 'admin.googleQuota.title': 'Google sorğuları üçün gündəlik limit',+ 'admin.googleQuota.subtitle': 'Limitə çatanda TREK növbəti günə (UTC) qədər Google-a müraciət etmir və OpenStreetMap ilə axtarır. Boş qalsa, limit yoxdur.',+ 'admin.googleQuota.placeholder': 'Limitsiz',+ 'admin.googleQuota.usedToday': 'Bu gün: {used}',+ 'admin.googleQuota.usedOfLimit': 'Bu gün: {used} / {limit}',+ 'admin.googleQuota.reached': 'Limitə çatıldı ({used}), Google sabaha qədər dayandırılıb',+ 'admin.googleQuota.saved': 'Gündəlik limit saxlanıldı','admin.transitProvider.title': 'İctimai nəqliyyat provayderi','admin.transitProvider.subtitle': 'İctimai nəqliyyat axtarışına hansı xidmətin cavab verəcəyi.','admin.transitProvider.transitous': 'Transitous (pulsuz)',diff --git a/shared/src/i18n/br/admin.ts b/shared/src/i18n/br/admin.tsindex da723c3ae..1fb9721ba 100644--- a/shared/src/i18n/br/admin.ts+++ b/shared/src/i18n/br/admin.ts@@ -178,6 +178,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Toda pesquisa e toda sugestão vão para o Google Places. Desligado, o índice do TREK e o OpenStreetMap respondem primeiro, e o Google só é consultado se eles não encontrarem nada.','admin.placesGoogleOnly.missingKey': 'Precisa de uma chave de API do Google Maps. Sem ela, a pesquisa usa o índice do TREK e o OpenStreetMap, independentemente desta chave.','admin.placesGoogleOnly.otherProvider': 'Precisa do Google como provedor de lugares. Com Amap ou OpenStreetMap selecionado, nenhuma busca vai ao Google, seja qual for a posição deste botão.',+ 'admin.googleQuota.title': 'Limite diário de chamadas ao Google',+ 'admin.googleQuota.subtitle': 'Ao ser atingido, o TREK para de chamar o Google até o dia seguinte (UTC) e busca pelo OpenStreetMap. Vazio significa sem limite.',+ 'admin.googleQuota.placeholder': 'Sem limite',+ 'admin.googleQuota.usedToday': 'Hoje: {used}',+ 'admin.googleQuota.usedOfLimit': 'Hoje: {used} de {limit}',+ 'admin.googleQuota.reached': 'Limite atingido ({used}), Google pausado até amanhã',+ 'admin.googleQuota.saved': 'Limite diário salvo','admin.transitProvider.title': 'Provedor de transporte público','admin.transitProvider.subtitle': 'Qual serviço responde à busca de transporte público.','admin.transitProvider.transitous': 'Transitous (grátis)',diff --git a/shared/src/i18n/ca/admin.ts b/shared/src/i18n/ca/admin.tsindex f8553dfb1..99757a2a9 100644--- a/shared/src/i18n/ca/admin.ts+++ b/shared/src/i18n/ca/admin.ts@@ -170,6 +170,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Cada cerca i cada suggeriment van a Google Places. Desactivat, responen primer l\'índex de TREK i OpenStreetMap, i Google només es consulta si no troben res.','admin.placesGoogleOnly.missingKey': 'Cal una clau d\'API de Google Maps. Sense clau, la cerca fa servir l\'índex de TREK i OpenStreetMap, sigui com sigui aquest interruptor.','admin.placesGoogleOnly.otherProvider': 'Necessita Google com a proveïdor de llocs. Amb Amap o OpenStreetMap seleccionats, cap cerca va a Google, digui el que digui aquest interruptor.',+ 'admin.googleQuota.title': 'Límit diari de crides a Google',+ 'admin.googleQuota.subtitle': "Quan s'arriba al límit, TREK deixa de cridar Google fins l'endemà (UTC) i cerca amb OpenStreetMap. Buit vol dir sense límit.",+ 'admin.googleQuota.placeholder': 'Sense límit',+ 'admin.googleQuota.usedToday': 'Avui: {used}',+ 'admin.googleQuota.usedOfLimit': 'Avui: {used} de {limit}',+ 'admin.googleQuota.reached': 'Límit assolit ({used}), Google en pausa fins demà',+ 'admin.googleQuota.saved': 'Límit diari desat','admin.transitProvider.title': 'Proveïdor de transport públic','admin.transitProvider.subtitle': 'Quin servei respon la cerca de transport públic.','admin.transitProvider.transitous': 'Transitous (gratuït)',diff --git a/shared/src/i18n/cs/admin.ts b/shared/src/i18n/cs/admin.tsindex 781bf89c9..2aff5a73d 100644--- a/shared/src/i18n/cs/admin.ts+++ b/shared/src/i18n/cs/admin.ts@@ -180,6 +180,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Každé hledání a každý návrh jde do Google Places. Vypnuto: nejprve odpovídá index TREK a OpenStreetMap, Google se ptáme jen tehdy, když nic nenajdou.','admin.placesGoogleOnly.missingKey': 'Vyžaduje klíč Google Maps API. Bez něj hledání běží přes index TREK a OpenStreetMap bez ohledu na tento přepínač.','admin.placesGoogleOnly.otherProvider': 'Vyžaduje Google jako poskytovatele míst. Při zvoleném Amapu nebo OpenStreetMap nejde na Google žádné hledání, ať je tento přepínač nastaven jakkoli.',+ 'admin.googleQuota.title': 'Denní limit volání Google',+ 'admin.googleQuota.subtitle': 'Po dosažení přestane TREK volat Google až do dalšího dne (UTC) a hledá přes OpenStreetMap. Prázdné znamená bez limitu.',+ 'admin.googleQuota.placeholder': 'Bez limitu',+ 'admin.googleQuota.usedToday': 'Dnes: {used}',+ 'admin.googleQuota.usedOfLimit': 'Dnes: {used} z {limit}',+ 'admin.googleQuota.reached': 'Limit dosažen ({used}), Google pozastaven do zítřka',+ 'admin.googleQuota.saved': 'Denní limit uložen','admin.transitProvider.title': 'Poskytovatel veřejné dopravy','admin.transitProvider.subtitle': 'Která služba odpovídá na vyhledávání veřejné dopravy.','admin.transitProvider.transitous': 'Transitous (zdarma)',diff --git a/shared/src/i18n/de/admin.ts b/shared/src/i18n/de/admin.tsindex 6beb02405..1b51fdfbb 100644--- a/shared/src/i18n/de/admin.ts+++ b/shared/src/i18n/de/admin.ts@@ -181,6 +181,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Jede Suche und jeder Vorschlag geht an Google Places. Aus, antworten zuerst der TREK-Index und OpenStreetMap, Google wird nur gefragt, wenn beide nichts finden.','admin.placesGoogleOnly.missingKey': 'Braucht einen Google-Maps-API-Schlüssel. Ohne ihn läuft die Suche über den TREK-Index und OpenStreetMap, egal wie dieser Schalter steht.','admin.placesGoogleOnly.otherProvider': 'Braucht Google als Orts-Anbieter. Mit Amap oder OpenStreetMap als Auswahl geht keine Suche an Google, egal wie dieser Schalter steht.',+ 'admin.googleQuota.title': 'Tageslimit für Google-Aufrufe',+ 'admin.googleQuota.subtitle': 'Ist es erreicht, ruft TREK Google bis zum nächsten Tag (UTC) nicht mehr auf und sucht stattdessen mit OpenStreetMap. Leer heißt kein Limit.',+ 'admin.googleQuota.placeholder': 'Kein Limit',+ 'admin.googleQuota.usedToday': 'Heute: {used}',+ 'admin.googleQuota.usedOfLimit': 'Heute: {used} von {limit}',+ 'admin.googleQuota.reached': 'Limit erreicht ({used}), Google bis morgen pausiert',+ 'admin.googleQuota.saved': 'Tageslimit gespeichert','admin.transitProvider.title': 'Verkehrsanbieter','admin.transitProvider.subtitle': 'Welcher Dienst die ÖPNV-Suche beantwortet.','admin.transitProvider.transitous': 'Transitous (kostenlos)',diff --git a/shared/src/i18n/en/admin.ts b/shared/src/i18n/en/admin.tsindex 250244066..50263f07a 100644--- a/shared/src/i18n/en/admin.ts+++ b/shared/src/i18n/en/admin.ts@@ -223,6 +223,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Every search and every suggestion goes to Google Places. Off, TREK\'s own index and OpenStreetMap answer first and Google is only asked when they find nothing.','admin.placesGoogleOnly.missingKey': 'Needs a Google Maps API key. Without one, search runs on TREK\'s own index and OpenStreetMap whatever this switch says.','admin.placesGoogleOnly.otherProvider': 'Needs Google as the places provider. With Amap or OpenStreetMap picked, search never goes to Google whatever this switch says.',+ 'admin.googleQuota.title': 'Daily limit for Google calls',+ 'admin.googleQuota.subtitle': 'Once reached, TREK stops calling Google until the next day (UTC) and searches with OpenStreetMap instead. Leave it empty for no limit.',+ 'admin.googleQuota.placeholder': 'No limit',+ 'admin.googleQuota.usedToday': 'Today: {used}',+ 'admin.googleQuota.usedOfLimit': 'Today: {used} of {limit}',+ 'admin.googleQuota.reached': 'Limit reached ({used}), Google paused until tomorrow',+ 'admin.googleQuota.saved': 'Daily limit saved','admin.transitProvider.title': 'Transit Provider','admin.transitProvider.subtitle': 'Which service answers public transit search.','admin.transitProvider.transitous': 'Transitous (free)',diff --git a/shared/src/i18n/es/admin.ts b/shared/src/i18n/es/admin.tsindex fab59b8a2..9d3f62a19 100644--- a/shared/src/i18n/es/admin.ts+++ b/shared/src/i18n/es/admin.ts@@ -180,6 +180,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Cada búsqueda y cada sugerencia van a Google Places. Desactivado, responden primero el índice de TREK y OpenStreetMap, y Google solo se consulta si no encuentran nada.','admin.placesGoogleOnly.missingKey': 'Necesita una clave de API de Google Maps. Sin ella, la búsqueda usa el índice de TREK y OpenStreetMap, esté como esté este interruptor.','admin.placesGoogleOnly.otherProvider': 'Necesita Google como proveedor de lugares. Con Amap u OpenStreetMap seleccionados, ninguna búsqueda va a Google, diga lo que diga este interruptor.',+ 'admin.googleQuota.title': 'Límite diario de llamadas a Google',+ 'admin.googleQuota.subtitle': 'Al alcanzarlo, TREK deja de llamar a Google hasta el día siguiente (UTC) y busca con OpenStreetMap. Vacío significa sin límite.',+ 'admin.googleQuota.placeholder': 'Sin límite',+ 'admin.googleQuota.usedToday': 'Hoy: {used}',+ 'admin.googleQuota.usedOfLimit': 'Hoy: {used} de {limit}',+ 'admin.googleQuota.reached': 'Límite alcanzado ({used}), Google en pausa hasta mañana',+ 'admin.googleQuota.saved': 'Límite diario guardado','admin.transitProvider.title': 'Proveedor de transporte público','admin.transitProvider.subtitle': 'Qué servicio responde a la búsqueda de transporte público.','admin.transitProvider.transitous': 'Transitous (gratis)',diff --git a/shared/src/i18n/et/admin.ts b/shared/src/i18n/et/admin.tsindex 09ab386e5..e133fce10 100644--- a/shared/src/i18n/et/admin.ts+++ b/shared/src/i18n/et/admin.ts@@ -220,6 +220,13 @@ const admin: TranslationStrings = {'Vajab Google Mapsi API-võtit. Ilma selleta kasutab otsing TREKi enda indeksit ja OpenStreetMapi sõltumata selle lüliti asendist.','admin.placesGoogleOnly.otherProvider':"Vajab kohtade teenusepakkujana Google'it. Kui valitud on Amap või OpenStreetMap, ei lähe otsing kunagi Google'isse, olenemata selle lüliti asendist.",+ 'admin.googleQuota.title': "Google'i päringute päevapiirang",+ 'admin.googleQuota.subtitle': "Kui piir täis saab, ei pöördu TREK Google'i poole järgmise päevani (UTC) ja otsib OpenStreetMapiga. Tühi tähendab piiranguta.",+ 'admin.googleQuota.placeholder': 'Piiranguta',+ 'admin.googleQuota.usedToday': 'Täna: {used}',+ 'admin.googleQuota.usedOfLimit': 'Täna: {used} / {limit}',+ 'admin.googleQuota.reached': 'Piir täis ({used}), Google on homseni peatatud',+ 'admin.googleQuota.saved': 'Päevapiirang salvestatud','admin.transitProvider.title': 'Ühistranspordi teenusepakkuja','admin.transitProvider.subtitle': 'Milline teenus vastab ühistranspordi otsingutele.','admin.transitProvider.transitous': 'Transitous (tasuta)',diff --git a/shared/src/i18n/fr/admin.ts b/shared/src/i18n/fr/admin.tsindex 9a27e14c3..bb8355f35 100644--- a/shared/src/i18n/fr/admin.ts+++ b/shared/src/i18n/fr/admin.ts@@ -182,6 +182,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Chaque recherche et chaque suggestion passent par Google Places. Désactivé, l\'index de TREK et OpenStreetMap répondent d\'abord, Google n\'est interrogé que s\'ils ne trouvent rien.','admin.placesGoogleOnly.missingKey': 'Nécessite une clé API Google Maps. Sans elle, la recherche passe par l\'index de TREK et OpenStreetMap, quelle que soit la position de cet interrupteur.','admin.placesGoogleOnly.otherProvider': 'Nécessite Google comme fournisseur de lieux. Avec Amap ou OpenStreetMap sélectionné, aucune recherche ne part vers Google, quelle que soit la position de cet interrupteur.',+ 'admin.googleQuota.title': "Limite quotidienne d'appels à Google",+ 'admin.googleQuota.subtitle': "Une fois atteinte, TREK n'appelle plus Google jusqu'au lendemain (UTC) et cherche avec OpenStreetMap. Laissez vide pour aucune limite.",+ 'admin.googleQuota.placeholder': 'Aucune limite',+ 'admin.googleQuota.usedToday': "Aujourd'hui : {used}",+ 'admin.googleQuota.usedOfLimit': "Aujourd'hui : {used} sur {limit}",+ 'admin.googleQuota.reached': "Limite atteinte ({used}), Google en pause jusqu'à demain",+ 'admin.googleQuota.saved': 'Limite quotidienne enregistrée','admin.transitProvider.title': 'Fournisseur de transports en commun','admin.transitProvider.subtitle': 'Quel service répond à la recherche de transports en commun.','admin.transitProvider.transitous': 'Transitous (gratuit)',diff --git a/shared/src/i18n/gr/admin.ts b/shared/src/i18n/gr/admin.tsindex f54ebad0a..c8d074794 100644--- a/shared/src/i18n/gr/admin.ts+++ b/shared/src/i18n/gr/admin.ts@@ -231,6 +231,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Κάθε αναζήτηση και κάθε πρόταση πηγαίνει στο Google Places. Απενεργοποιημένο, απαντούν πρώτα το ευρετήριο του TREK και το OpenStreetMap, και το Google ρωτιέται μόνο αν δεν βρουν τίποτα.','admin.placesGoogleOnly.missingKey': 'Χρειάζεται κλειδί Google Maps API. Χωρίς αυτό η αναζήτηση τρέχει στο ευρετήριο του TREK και στο OpenStreetMap, όπως κι αν είναι ο διακόπτης.','admin.placesGoogleOnly.otherProvider': 'Χρειάζεται το Google ως πάροχο τοποθεσιών. Με επιλεγμένο Amap ή OpenStreetMap καμία αναζήτηση δεν πηγαίνει στο Google, ό,τι κι αν λέει αυτός ο διακόπτης.',+ 'admin.googleQuota.title': 'Ημερήσιο όριο κλήσεων Google',+ 'admin.googleQuota.subtitle': 'Όταν συμπληρωθεί, το TREK σταματά τις κλήσεις στη Google ως την επόμενη μέρα (UTC) και αναζητά με το OpenStreetMap. Κενό σημαίνει χωρίς όριο.',+ 'admin.googleQuota.placeholder': 'Χωρίς όριο',+ 'admin.googleQuota.usedToday': 'Σήμερα: {used}',+ 'admin.googleQuota.usedOfLimit': 'Σήμερα: {used} από {limit}',+ 'admin.googleQuota.reached': 'Το όριο συμπληρώθηκε ({used}), η Google σε παύση ως αύριο',+ 'admin.googleQuota.saved': 'Το ημερήσιο όριο αποθηκεύτηκε','admin.transitProvider.title': 'Πάροχος μέσων μεταφοράς','admin.transitProvider.subtitle': 'Ποια υπηρεσία απαντά στην αναζήτηση μέσων μεταφοράς.','admin.transitProvider.transitous': 'Transitous (δωρεάν)',diff --git a/shared/src/i18n/hu/admin.ts b/shared/src/i18n/hu/admin.tsindex 16db47374..041fdd812 100644--- a/shared/src/i18n/hu/admin.ts+++ b/shared/src/i18n/hu/admin.ts@@ -182,6 +182,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Minden keresés és minden javaslat a Google Places-hez megy. Kikapcsolva előbb a TREK saját indexe és az OpenStreetMap válaszol, a Google-t csak akkor kérdezzük, ha ők nem találnak semmit.','admin.placesGoogleOnly.missingKey': 'Google Maps API-kulcs kell hozzá. Nélküle a keresés a TREK indexén és az OpenStreetMapen fut, bárhogy áll is ez a kapcsoló.','admin.placesGoogleOnly.otherProvider': 'A Google-t igényli helyszolgáltatóként. Amap vagy OpenStreetMap kiválasztásával egyetlen keresés sem megy a Google-höz, bárhogy áll is ez a kapcsoló.',+ 'admin.googleQuota.title': 'Napi korlát a Google-hívásokra',+ 'admin.googleQuota.subtitle': 'Elérésekor a TREK a következő napig (UTC) nem hívja a Google-t, és OpenStreetMappel keres. Üresen hagyva nincs korlát.',+ 'admin.googleQuota.placeholder': 'Nincs korlát',+ 'admin.googleQuota.usedToday': 'Ma: {used}',+ 'admin.googleQuota.usedOfLimit': 'Ma: {used} / {limit}',+ 'admin.googleQuota.reached': 'Korlát elérve ({used}), a Google holnapig szünetel',+ 'admin.googleQuota.saved': 'Napi korlát mentve','admin.transitProvider.title': 'Tömegközlekedési szolgáltató','admin.transitProvider.subtitle': 'Melyik szolgáltatás válaszol a tömegközlekedési keresésre.','admin.transitProvider.transitous': 'Transitous (ingyenes)',diff --git a/shared/src/i18n/id/admin.ts b/shared/src/i18n/id/admin.tsindex f3ffd973c..ad7778594 100644--- a/shared/src/i18n/id/admin.ts+++ b/shared/src/i18n/id/admin.ts@@ -227,6 +227,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Setiap pencarian dan setiap saran dikirim ke Google Places. Nonaktif, indeks TREK dan OpenStreetMap menjawab lebih dulu, dan Google hanya ditanya jika keduanya tidak menemukan apa pun.','admin.placesGoogleOnly.missingKey': 'Memerlukan kunci API Google Maps. Tanpa kunci, pencarian memakai indeks TREK dan OpenStreetMap, apa pun posisi sakelar ini.','admin.placesGoogleOnly.otherProvider': 'Membutuhkan Google sebagai penyedia tempat. Dengan Amap atau OpenStreetMap yang dipilih, tidak ada pencarian yang dikirim ke Google, apa pun posisi sakelar ini.',+ 'admin.googleQuota.title': 'Batas harian panggilan Google',+ 'admin.googleQuota.subtitle': 'Setelah tercapai, TREK berhenti memanggil Google sampai hari berikutnya (UTC) dan mencari dengan OpenStreetMap. Kosongkan untuk tanpa batas.',+ 'admin.googleQuota.placeholder': 'Tanpa batas',+ 'admin.googleQuota.usedToday': 'Hari ini: {used}',+ 'admin.googleQuota.usedOfLimit': 'Hari ini: {used} dari {limit}',+ 'admin.googleQuota.reached': 'Batas tercapai ({used}), Google dijeda sampai besok',+ 'admin.googleQuota.saved': 'Batas harian disimpan','admin.transitProvider.title': 'Penyedia transportasi umum','admin.transitProvider.subtitle': 'Layanan mana yang menjawab pencarian transportasi umum.','admin.transitProvider.transitous': 'Transitous (gratis)',diff --git a/shared/src/i18n/it/admin.ts b/shared/src/i18n/it/admin.tsindex 19a80ef1c..5c4c6d6aa 100644--- a/shared/src/i18n/it/admin.ts+++ b/shared/src/i18n/it/admin.ts@@ -180,6 +180,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Ogni ricerca e ogni suggerimento vanno a Google Places. Spento, rispondono prima l\'indice di TREK e OpenStreetMap, e Google viene interrogato solo se non trovano nulla.','admin.placesGoogleOnly.missingKey': 'Richiede una chiave API di Google Maps. Senza, la ricerca usa l\'indice di TREK e OpenStreetMap, comunque sia impostato questo interruttore.','admin.placesGoogleOnly.otherProvider': 'Richiede Google come provider dei luoghi. Con Amap o OpenStreetMap selezionati, nessuna ricerca va a Google, qualunque sia la posizione di questo interruttore.',+ 'admin.googleQuota.title': 'Limite giornaliero di chiamate a Google',+ 'admin.googleQuota.subtitle': 'Una volta raggiunto, TREK smette di chiamare Google fino al giorno dopo (UTC) e cerca con OpenStreetMap. Vuoto significa nessun limite.',+ 'admin.googleQuota.placeholder': 'Nessun limite',+ 'admin.googleQuota.usedToday': 'Oggi: {used}',+ 'admin.googleQuota.usedOfLimit': 'Oggi: {used} di {limit}',+ 'admin.googleQuota.reached': 'Limite raggiunto ({used}), Google in pausa fino a domani',+ 'admin.googleQuota.saved': 'Limite giornaliero salvato','admin.transitProvider.title': 'Provider del trasporto pubblico','admin.transitProvider.subtitle': 'Quale servizio risponde alla ricerca di trasporto pubblico.','admin.transitProvider.transitous': 'Transitous (gratuito)',diff --git a/shared/src/i18n/ja/admin.ts b/shared/src/i18n/ja/admin.tsindex 43612bb49..f8aa3e00e 100644--- a/shared/src/i18n/ja/admin.ts+++ b/shared/src/i18n/ja/admin.ts@@ -216,6 +216,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'すべての検索と候補が Google Places に送られます。オフの場合は TREK のインデックスと OpenStreetMap が先に答え、何も見つからないときだけ Google に問い合わせます。','admin.placesGoogleOnly.missingKey': 'Google Maps API キーが必要です。キーがない場合、このスイッチに関係なく検索は TREK のインデックスと OpenStreetMap で行われます。','admin.placesGoogleOnly.otherProvider': '場所プロバイダーとして Google が必要です。Amap または OpenStreetMap を選択している間は、このスイッチの状態にかかわらず検索は Google に送られません。',+ 'admin.googleQuota.title': 'Google 呼び出しの1日の上限',+ 'admin.googleQuota.subtitle': '上限に達すると、翌日(UTC)まで TREK は Google を呼び出さず、OpenStreetMap で検索します。空欄なら上限なし。',+ 'admin.googleQuota.placeholder': '上限なし',+ 'admin.googleQuota.usedToday': '今日: {used}',+ 'admin.googleQuota.usedOfLimit': '今日: {used} / {limit}',+ 'admin.googleQuota.reached': '上限に到達({used})、Google は明日まで停止中',+ 'admin.googleQuota.saved': '1日の上限を保存しました','admin.transitProvider.title': '公共交通のプロバイダー','admin.transitProvider.subtitle': '公共交通の検索に応答するサービス。','admin.transitProvider.transitous': 'Transitous(無料)',diff --git a/shared/src/i18n/ko/admin.ts b/shared/src/i18n/ko/admin.tsindex c83a1059a..bd2abed29 100644--- a/shared/src/i18n/ko/admin.ts+++ b/shared/src/i18n/ko/admin.ts@@ -222,6 +222,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': '모든 검색과 제안이 Google Places로 갑니다. 끄면 TREK 자체 색인과 OpenStreetMap이 먼저 답하고, 둘 다 찾지 못할 때만 Google에 묻습니다.','admin.placesGoogleOnly.missingKey': 'Google Maps API 키가 필요합니다. 키가 없으면 이 스위치와 상관없이 TREK 색인과 OpenStreetMap으로 검색합니다.','admin.placesGoogleOnly.otherProvider': '장소 제공자로 Google이 필요합니다. Amap 또는 OpenStreetMap을 선택한 동안에는 이 스위치와 상관없이 검색이 Google로 가지 않습니다.',+ 'admin.googleQuota.title': 'Google 호출 일일 한도',+ 'admin.googleQuota.subtitle': '한도에 도달하면 다음 날(UTC)까지 Google을 호출하지 않고 OpenStreetMap으로 검색합니다. 비워 두면 한도가 없습니다.',+ 'admin.googleQuota.placeholder': '한도 없음',+ 'admin.googleQuota.usedToday': '오늘: {used}',+ 'admin.googleQuota.usedOfLimit': '오늘: {used} / {limit}',+ 'admin.googleQuota.reached': '한도 도달({used}), 내일까지 Google 일시 중지',+ 'admin.googleQuota.saved': '일일 한도를 저장했습니다','admin.transitProvider.title': '대중교통 제공자','admin.transitProvider.subtitle': '대중교통 검색에 응답하는 서비스입니다.','admin.transitProvider.transitous': 'Transitous (무료)',diff --git a/shared/src/i18n/nl/admin.ts b/shared/src/i18n/nl/admin.tsindex 80aa58c14..0e4ce134d 100644--- a/shared/src/i18n/nl/admin.ts+++ b/shared/src/i18n/nl/admin.ts@@ -181,6 +181,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Elke zoekopdracht en elke suggestie gaat naar Google Places. Uit, antwoorden eerst de TREK-index en OpenStreetMap; Google wordt alleen gevraagd als die niets vinden.','admin.placesGoogleOnly.missingKey': 'Vereist een Google Maps API-sleutel. Zonder sleutel zoekt TREK via de eigen index en OpenStreetMap, wat deze schakelaar ook zegt.','admin.placesGoogleOnly.otherProvider': 'Vereist Google als plaatsenprovider. Met Amap of OpenStreetMap gekozen gaat geen enkele zoekopdracht naar Google, wat deze schakelaar ook zegt.',+ 'admin.googleQuota.title': 'Daglimiet voor Google-aanroepen',+ 'admin.googleQuota.subtitle': 'Is de limiet bereikt, dan roept TREK Google tot de volgende dag (UTC) niet meer aan en zoekt met OpenStreetMap. Leeg betekent geen limiet.',+ 'admin.googleQuota.placeholder': 'Geen limiet',+ 'admin.googleQuota.usedToday': 'Vandaag: {used}',+ 'admin.googleQuota.usedOfLimit': 'Vandaag: {used} van {limit}',+ 'admin.googleQuota.reached': 'Limiet bereikt ({used}), Google gepauzeerd tot morgen',+ 'admin.googleQuota.saved': 'Daglimiet opgeslagen','admin.transitProvider.title': 'Ov-provider','admin.transitProvider.subtitle': 'Welke dienst het ov-zoeken beantwoordt.','admin.transitProvider.transitous': 'Transitous (gratis)',diff --git a/shared/src/i18n/pl/admin.ts b/shared/src/i18n/pl/admin.tsindex a26673878..07c28cecc 100644--- a/shared/src/i18n/pl/admin.ts+++ b/shared/src/i18n/pl/admin.ts@@ -175,6 +175,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Każde wyszukiwanie i każda podpowiedź trafia do Google Places. Wyłączone: najpierw odpowiadają indeks TREK i OpenStreetMap, a Google jest pytany tylko wtedy, gdy nic nie znajdą.','admin.placesGoogleOnly.missingKey': 'Wymaga klucza Google Maps API. Bez niego wyszukiwanie działa przez indeks TREK i OpenStreetMap, niezależnie od tego przełącznika.','admin.placesGoogleOnly.otherProvider': 'Wymaga Google jako dostawcy miejsc. Przy wybranym Amap lub OpenStreetMap żadne wyszukiwanie nie trafia do Google, niezależnie od tego przełącznika.',+ 'admin.googleQuota.title': 'Dzienny limit wywołań Google',+ 'admin.googleQuota.subtitle': 'Po osiągnięciu TREK nie wywołuje Google do następnego dnia (UTC) i wyszukuje przez OpenStreetMap. Puste oznacza brak limitu.',+ 'admin.googleQuota.placeholder': 'Bez limitu',+ 'admin.googleQuota.usedToday': 'Dziś: {used}',+ 'admin.googleQuota.usedOfLimit': 'Dziś: {used} z {limit}',+ 'admin.googleQuota.reached': 'Limit osiągnięty ({used}), Google wstrzymany do jutra',+ 'admin.googleQuota.saved': 'Zapisano dzienny limit','admin.transitProvider.title': 'Dostawca transportu publicznego','admin.transitProvider.subtitle': 'Która usługa odpowiada na wyszukiwanie transportu publicznego.','admin.transitProvider.transitous': 'Transitous (bezpłatnie)',diff --git a/shared/src/i18n/ru/admin.ts b/shared/src/i18n/ru/admin.tsindex da290b4df..a63791243 100644--- a/shared/src/i18n/ru/admin.ts+++ b/shared/src/i18n/ru/admin.ts@@ -182,6 +182,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Каждый поиск и каждая подсказка идут в Google Places. Выключено: сначала отвечают индекс TREK и OpenStreetMap, Google спрашивается, только если они ничего не нашли.','admin.placesGoogleOnly.missingKey': 'Нужен ключ Google Maps API. Без него поиск идёт через индекс TREK и OpenStreetMap независимо от этого переключателя.','admin.placesGoogleOnly.otherProvider': 'Требуется Google как провайдер мест. Если выбран Amap или OpenStreetMap, ни один поиск не уходит в Google, как бы ни стоял этот переключатель.',+ 'admin.googleQuota.title': 'Дневной лимит запросов к Google',+ 'admin.googleQuota.subtitle': 'Когда лимит исчерпан, TREK не обращается к Google до следующего дня (UTC) и ищет через OpenStreetMap. Пусто означает без лимита.',+ 'admin.googleQuota.placeholder': 'Без лимита',+ 'admin.googleQuota.usedToday': 'Сегодня: {used}',+ 'admin.googleQuota.usedOfLimit': 'Сегодня: {used} из {limit}',+ 'admin.googleQuota.reached': 'Лимит исчерпан ({used}), Google приостановлен до завтра',+ 'admin.googleQuota.saved': 'Дневной лимит сохранён','admin.transitProvider.title': 'Поставщик общественного транспорта','admin.transitProvider.subtitle': 'Какая служба отвечает на поиск общественного транспорта.','admin.transitProvider.transitous': 'Transitous (бесплатно)',diff --git a/shared/src/i18n/sk/admin.ts b/shared/src/i18n/sk/admin.tsindex 81c0c899f..24bf9e587 100644--- a/shared/src/i18n/sk/admin.ts+++ b/shared/src/i18n/sk/admin.ts@@ -215,6 +215,13 @@ const admin: TranslationStrings = {'Vyžaduje API kľúč Google Maps. Bez neho vyhľadávanie beží na vlastnom indexe TREK a OpenStreetMap bez ohľadu na tento prepínač.','admin.placesGoogleOnly.otherProvider':'Vyžaduje Google ako poskytovateľa miest. Ak je zvolený Amap alebo OpenStreetMap, vyhľadávanie nikdy nejde do Google bez ohľadu na tento prepínač.',+ 'admin.googleQuota.title': 'Denný limit volaní Google',+ 'admin.googleQuota.subtitle': 'Po dosiahnutí TREK prestane volať Google do ďalšieho dňa (UTC) a hľadá cez OpenStreetMap. Prázdne znamená bez limitu.',+ 'admin.googleQuota.placeholder': 'Bez limitu',+ 'admin.googleQuota.usedToday': 'Dnes: {used}',+ 'admin.googleQuota.usedOfLimit': 'Dnes: {used} z {limit}',+ 'admin.googleQuota.reached': 'Limit dosiahnutý ({used}), Google pozastavený do zajtra',+ 'admin.googleQuota.saved': 'Denný limit uložený','admin.transitProvider.title': 'Poskytovateľ verejnej dopravy','admin.transitProvider.subtitle': 'Ktorá služba odpovedá na vyhľadávanie verejnej dopravy.','admin.transitProvider.transitous': 'Transitous (zdarma)',diff --git a/shared/src/i18n/sv/admin.ts b/shared/src/i18n/sv/admin.tsindex f09058ed4..f44831f49 100644--- a/shared/src/i18n/sv/admin.ts+++ b/shared/src/i18n/sv/admin.ts@@ -229,6 +229,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Varje sökning och varje förslag går till Google Places. Av svarar TREK:s eget index och OpenStreetMap först, och Google tillfrågas bara när de inte hittar något.','admin.placesGoogleOnly.missingKey': 'Kräver en Google Maps API-nyckel. Utan nyckel söker TREK via sitt eget index och OpenStreetMap, oavsett hur den här brytaren står.','admin.placesGoogleOnly.otherProvider': 'Kräver Google som platsleverantör. Med Amap eller OpenStreetMap valt går ingen sökning till Google, oavsett hur den här väljaren står.',+ 'admin.googleQuota.title': 'Daglig gräns för Google-anrop',+ 'admin.googleQuota.subtitle': 'När gränsen nås slutar TREK anropa Google till nästa dag (UTC) och söker med OpenStreetMap i stället. Tomt betyder ingen gräns.',+ 'admin.googleQuota.placeholder': 'Ingen gräns',+ 'admin.googleQuota.usedToday': 'Idag: {used}',+ 'admin.googleQuota.usedOfLimit': 'Idag: {used} av {limit}',+ 'admin.googleQuota.reached': 'Gränsen nådd ({used}), Google pausad till i morgon',+ 'admin.googleQuota.saved': 'Daglig gräns sparad','admin.transitProvider.title': 'Kollektivtrafikleverantör','admin.transitProvider.subtitle': 'Vilken tjänst som besvarar sökningar i kollektivtrafiken.','admin.transitProvider.transitous': 'Transitous (gratis)',diff --git a/shared/src/i18n/th/admin.ts b/shared/src/i18n/th/admin.tsindex b3fb6d6a4..27b83ae7b 100644--- a/shared/src/i18n/th/admin.ts+++ b/shared/src/i18n/th/admin.ts@@ -176,6 +176,13 @@ const admin: TranslationStrings = {'ต้องมีคีย์ API ของ Google Maps หากไม่มี การค้นหาจะใช้ดัชนีของ TREK เองและ OpenStreetMap ไม่ว่าสวิตช์นี้จะตั้งไว้อย่างไร','admin.placesGoogleOnly.otherProvider':'ต้องใช้ Google เป็นผู้ให้บริการสถานที่ หากเลือก Amap หรือ OpenStreetMap การค้นหาจะไม่ส่งไปที่ Google ไม่ว่าสวิตช์นี้จะตั้งไว้อย่างไร',+ 'admin.googleQuota.title': 'ขีดจำกัดการเรียก Google ต่อวัน',+ 'admin.googleQuota.subtitle': 'เมื่อถึงขีดจำกัด TREK จะหยุดเรียก Google จนถึงวันถัดไป (UTC) และค้นหาด้วย OpenStreetMap แทน เว้นว่างไว้หากไม่จำกัด',+ 'admin.googleQuota.placeholder': 'ไม่จำกัด',+ 'admin.googleQuota.usedToday': 'วันนี้: {used}',+ 'admin.googleQuota.usedOfLimit': 'วันนี้: {used} จาก {limit}',+ 'admin.googleQuota.reached': 'ถึงขีดจำกัดแล้ว ({used}) Google หยุดไว้จนถึงพรุ่งนี้',+ 'admin.googleQuota.saved': 'บันทึกขีดจำกัดรายวันแล้ว','admin.bagTracking.title': "ติดตามกระเป๋า",'admin.bagTracking.subtitle': "เปิดใช้งานการกำหนดน้ำหนักและถุงสำหรับการบรรจุสินค้า",'admin.collab.chat.title': "แชท",diff --git a/shared/src/i18n/tr/admin.ts b/shared/src/i18n/tr/admin.tsindex 4db023778..b0dd71f55 100644--- a/shared/src/i18n/tr/admin.ts+++ b/shared/src/i18n/tr/admin.ts@@ -229,6 +229,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Her arama ve her öneri Google Places\'e gider. Kapalıyken önce TREK dizini ve OpenStreetMap yanıtlar, Google yalnızca hiçbir şey bulamadıklarında sorulur.','admin.placesGoogleOnly.missingKey': 'Google Maps API anahtarı gerektirir. Anahtar yoksa arama, bu anahtar ne olursa olsun TREK dizini ve OpenStreetMap üzerinden çalışır.','admin.placesGoogleOnly.otherProvider': 'Yer sağlayıcısı olarak Google gerekir. Amap veya OpenStreetMap seçiliyken bu anahtar ne derse desin hiçbir arama Google\'a gitmez.',+ 'admin.googleQuota.title': 'Google çağrıları için günlük sınır',+ 'admin.googleQuota.subtitle': "Sınıra ulaşıldığında TREK ertesi güne (UTC) kadar Google'ı çağırmaz ve OpenStreetMap ile arar. Boş bırakılırsa sınır yoktur.",+ 'admin.googleQuota.placeholder': 'Sınırsız',+ 'admin.googleQuota.usedToday': 'Bugün: {used}',+ 'admin.googleQuota.usedOfLimit': 'Bugün: {used} / {limit}',+ 'admin.googleQuota.reached': 'Sınıra ulaşıldı ({used}), Google yarına kadar duraklatıldı',+ 'admin.googleQuota.saved': 'Günlük sınır kaydedildi','admin.transitProvider.title': 'Toplu taşıma sağlayıcısı','admin.transitProvider.subtitle': 'Toplu taşıma aramasını hangi hizmetin yanıtlayacağı.','admin.transitProvider.transitous': 'Transitous (ücretsiz)',diff --git a/shared/src/i18n/uk/admin.ts b/shared/src/i18n/uk/admin.tsindex 74743b68e..4098add47 100644--- a/shared/src/i18n/uk/admin.ts+++ b/shared/src/i18n/uk/admin.ts@@ -182,6 +182,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Кожен пошук і кожна підказка йдуть до Google Places. Вимкнено: спершу відповідають індекс TREK та OpenStreetMap, Google запитується лише тоді, коли вони нічого не знайшли.','admin.placesGoogleOnly.missingKey': 'Потрібен ключ Google Maps API. Без нього пошук іде через індекс TREK та OpenStreetMap незалежно від цього перемикача.','admin.placesGoogleOnly.otherProvider': 'Потрібен Google як постачальник місць. Якщо вибрано Amap або OpenStreetMap, жоден пошук не йде до Google, хай як стоїть цей перемикач.',+ 'admin.googleQuota.title': 'Денний ліміт запитів до Google',+ 'admin.googleQuota.subtitle': 'Коли ліміт вичерпано, TREK не звертається до Google до наступного дня (UTC) і шукає через OpenStreetMap. Порожньо означає без ліміту.',+ 'admin.googleQuota.placeholder': 'Без ліміту',+ 'admin.googleQuota.usedToday': 'Сьогодні: {used}',+ 'admin.googleQuota.usedOfLimit': 'Сьогодні: {used} з {limit}',+ 'admin.googleQuota.reached': 'Ліміт вичерпано ({used}), Google призупинено до завтра',+ 'admin.googleQuota.saved': 'Денний ліміт збережено','admin.transitProvider.title': 'Постачальник громадського транспорту','admin.transitProvider.subtitle': 'Яка служба відповідає на пошук громадського транспорту.','admin.transitProvider.transitous': 'Transitous (безкоштовно)',diff --git a/shared/src/i18n/vi/admin.ts b/shared/src/i18n/vi/admin.tsindex 3cdbb92f6..a34d49a9d 100644--- a/shared/src/i18n/vi/admin.ts+++ b/shared/src/i18n/vi/admin.ts@@ -228,6 +228,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': 'Mọi tìm kiếm và mọi gợi ý đều đi tới Google Places. Khi tắt, chỉ mục của TREK và OpenStreetMap trả lời trước, Google chỉ được hỏi khi cả hai không tìm thấy gì.','admin.placesGoogleOnly.missingKey': 'Cần khóa API Google Maps. Không có khóa, tìm kiếm chạy trên chỉ mục của TREK và OpenStreetMap, bất kể công tắc này.','admin.placesGoogleOnly.otherProvider': 'Cần Google làm nhà cung cấp địa điểm. Khi chọn Amap hoặc OpenStreetMap, không tìm kiếm nào được gửi đến Google dù công tắc này đặt thế nào.',+ 'admin.googleQuota.title': 'Giới hạn lượt gọi Google mỗi ngày',+ 'admin.googleQuota.subtitle': 'Khi đạt giới hạn, TREK ngừng gọi Google đến ngày hôm sau (UTC) và tìm kiếm bằng OpenStreetMap. Để trống nếu không giới hạn.',+ 'admin.googleQuota.placeholder': 'Không giới hạn',+ 'admin.googleQuota.usedToday': 'Hôm nay: {used}',+ 'admin.googleQuota.usedOfLimit': 'Hôm nay: {used} / {limit}',+ 'admin.googleQuota.reached': 'Đã đạt giới hạn ({used}), Google tạm dừng đến ngày mai',+ 'admin.googleQuota.saved': 'Đã lưu giới hạn hằng ngày','admin.transitProvider.title': 'Nhà cung cấp giao thông công cộng','admin.transitProvider.subtitle': 'Dịch vụ nào trả lời tìm kiếm giao thông công cộng.','admin.transitProvider.transitous': 'Transitous (miễn phí)',diff --git a/shared/src/i18n/zh-TW/admin.ts b/shared/src/i18n/zh-TW/admin.tsindex e48e2ed36..d77b91ee0 100644--- a/shared/src/i18n/zh-TW/admin.ts+++ b/shared/src/i18n/zh-TW/admin.ts@@ -219,6 +219,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': '所有搜尋和建議都會送到 Google Places。關閉時,TREK 自有索引和 OpenStreetMap 先回答,只有兩者都沒有結果時才詢問 Google。','admin.placesGoogleOnly.missingKey': '需要 Google Maps API 金鑰。沒有金鑰時,無論此開關如何,搜尋都透過 TREK 索引和 OpenStreetMap 進行。','admin.placesGoogleOnly.otherProvider': '需要將 Google 設為地點提供者。選擇 Amap 或 OpenStreetMap 時,無論此開關如何設定,搜尋都不會送往 Google。',+ 'admin.googleQuota.title': 'Google 呼叫每日上限',+ 'admin.googleQuota.subtitle': '達到上限後,TREK 會在隔天(UTC)前停止呼叫 Google,改用 OpenStreetMap 搜尋。留空表示不限制。',+ 'admin.googleQuota.placeholder': '不限制',+ 'admin.googleQuota.usedToday': '今天:{used}',+ 'admin.googleQuota.usedOfLimit': '今天:{used} / {limit}',+ 'admin.googleQuota.reached': '已達上限({used}),Google 暫停至明天',+ 'admin.googleQuota.saved': '已儲存每日上限','admin.transitProvider.title': '公共運輸資料來源','admin.transitProvider.subtitle': '由哪個服務回應大眾運輸搜尋。','admin.transitProvider.transitous': 'Transitous(免費)',diff --git a/shared/src/i18n/zh/admin.ts b/shared/src/i18n/zh/admin.tsindex acd759103..fae1ec5b8 100644--- a/shared/src/i18n/zh/admin.ts+++ b/shared/src/i18n/zh/admin.ts@@ -177,6 +177,13 @@ const admin: TranslationStrings = {'admin.placesGoogleOnly.subtitle': '所有搜索和建议都发送到 Google Places。关闭时,TREK 自有索引和 OpenStreetMap 先回答,只有二者都没有结果时才询问 Google。','admin.placesGoogleOnly.missingKey': '需要 Google Maps API 密钥。没有密钥时,无论此开关如何,搜索都通过 TREK 索引和 OpenStreetMap 进行。','admin.placesGoogleOnly.otherProvider': '需要将 Google 设为地点提供方。选择 Amap 或 OpenStreetMap 时,无论此开关如何设置,搜索都不会发送到 Google。',+ 'admin.googleQuota.title': 'Google 调用每日上限',+ 'admin.googleQuota.subtitle': '达到上限后,TREK 会在次日(UTC)前停止调用 Google,改用 OpenStreetMap 搜索。留空表示不限制。',+ 'admin.googleQuota.placeholder': '不限制',+ 'admin.googleQuota.usedToday': '今天:{used}',+ 'admin.googleQuota.usedOfLimit': '今天:{used} / {limit}',+ 'admin.googleQuota.reached': '已达上限({used}),Google 暂停至明天',+ 'admin.googleQuota.saved': '已保存每日上限','admin.transitProvider.title': '公共交通数据源','admin.transitProvider.subtitle': '由哪个服务响应公共交通搜索。','admin.transitProvider.transitous': 'Transitous(免费)',