Skip to content

Colota - Android GPS Location tracker

feat(map): identify the app to tile servers with a User-Agent (#601)

Max Dietrichf4b1195e107a
diff --git a/apps/docs/src/pages/privacy-policy.md b/apps/docs/src/pages/privacy-policy.md
index 3cc0354d..cc01c36e 100644
--- a/apps/docs/src/pages/privacy-policy.md
+++ b/apps/docs/src/pages/privacy-policy.md
@@ -4,7 +4,7 @@ title: Privacy Policy
# Privacy Policy
-**Last updated: August 2, 2026**
+**Last updated: August 19, 2026**
Colota ("the App") is a self-hosted GPS tracking application for Android, developed by Max Dietrich. This privacy policy explains what data the App collects, how it is used, and your rights regarding that data.
@@ -103,7 +103,7 @@ The GMS variant of the App is distributed via Google Play, which may collect dat
### Map Tiles (maps.mxd.codes)
-The App displays maps using a self-hosted tile server at [maps.mxd.codes](https://maps.mxd.codes), operated by the developer on a VPS provided by [netcup](https://www.netcup.de). No CDN, proxy or other external service (e.g. Cloudflare) sits in front of the server. When the map is visible or offline map packs are downloaded, your device makes requests to this server to fetch vector tiles. Downloaded tiles are cached in the app's local database for offline use. Access logging is disabled for all requests by default. Logging may be enabled temporarily to investigate abuse or operational issues. No cookies or tracking are used. A custom tile server URL can be configured in Settings. See the [tile server guide](/docs/guides/tile-server) for more details.
+The App displays maps using a self-hosted tile server at [maps.mxd.codes](https://maps.mxd.codes), operated by the developer on a VPS provided by [netcup](https://www.netcup.de). No CDN, proxy or other external service (e.g. Cloudflare) sits in front of the server. When the map is visible or offline map packs are downloaded, your device makes requests to this server to fetch vector tiles. Downloaded tiles are cached in the app's local database for offline use. Requests identify the App by name and version (for example `Colota/1.14.0`) so that app traffic can be told apart from unknown bulk callers when logging is switched on. No device, install or user identifier is sent, and the value is the same for every install of a given version. Access logging is disabled for all requests by default. Logging may be enabled temporarily to investigate abuse or operational issues. No cookies or tracking are used. A custom tile server URL can be configured in Settings and receives the same requests. See the [tile server guide](/docs/guides/tile-server) for more details.
### No Other Third Parties
diff --git a/apps/mobile/App.tsx b/apps/mobile/App.tsx
index 27434346..2a6eba80 100644
--- a/apps/mobile/App.tsx
+++ b/apps/mobile/App.tsx
@@ -41,10 +41,13 @@ import {
} from "./src/screens/"
import { BottomTabBar } from "./src/components"
import { loadDisplayPreferences } from "./src/utils/geo"
+import { registerTileServerUserAgent } from "./src/utils/tileHeaders"
// Load display preferences early
loadDisplayPreferences()
+registerTileServerUserAgent()
+
const Stack = createNativeStackNavigator<RootStackParamList>()
type ScreenConfig = { name: RootStackRoute; component: React.ComponentType<any>; title: string }
diff --git a/apps/mobile/src/utils/__tests__/tileHeaders.test.ts b/apps/mobile/src/utils/__tests__/tileHeaders.test.ts
new file mode 100644
index 00000000..43a06ca8
--- /dev/null
+++ b/apps/mobile/src/utils/__tests__/tileHeaders.test.ts
@@ -0,0 +1,56 @@
+import { tileServerUserAgent, registerTileServerUserAgent } from "../tileHeaders"
+import { REPO_URL } from "../../constants"
+
+const mockGetBuildConfig = jest.fn()
+const mockAddHeader = jest.fn()
+
+jest.mock("@maplibre/maplibre-react-native", () => ({
+ TransformRequestManager: { addHeader: (...args: any[]) => mockAddHeader(...args) }
+}))
+
+jest.mock("../../services/NativeLocationService", () => {
+ const service = { getBuildConfig: (...args: any[]) => mockGetBuildConfig(...args) }
+ return { __esModule: true, default: service }
+})
+
+beforeEach(() => {
+ jest.clearAllMocks()
+ mockGetBuildConfig.mockReturnValue({ VERSION_NAME: "1.14.0" })
+})
+
+describe("tileServerUserAgent", () => {
+ // Exact match rather than a pattern: the privacy policy commits to sending no device, install or
+ // user identifier and nothing in the app misbehaves if one leaks in
+ it("carries the version and the repo URL and nothing else", () => {
+ expect(tileServerUserAgent()).toBe(`Colota/1.14.0 (+${REPO_URL})`)
+ })
+
+ it("ignores the rest of BuildConfig", () => {
+ mockGetBuildConfig.mockReturnValue({
+ VERSION_NAME: "1.14.0",
+ VERSION_CODE: 45,
+ FLAVOR: "gms",
+ NDK_VERSION: "27.1"
+ })
+
+ expect(tileServerUserAgent()).toBe(`Colota/1.14.0 (+${REPO_URL})`)
+ })
+
+ it("falls back when BuildConfig is unavailable", () => {
+ mockGetBuildConfig.mockReturnValue(null)
+
+ expect(tileServerUserAgent()).toBe(`Colota/dev (+${REPO_URL})`)
+ })
+})
+
+describe("registerTileServerUserAgent", () => {
+ it("registers the header under a stable id", () => {
+ registerTileServerUserAgent()
+
+ expect(mockAddHeader).toHaveBeenCalledWith({
+ id: "colota-user-agent",
+ name: "User-Agent",
+ value: `Colota/1.14.0 (+${REPO_URL})`
+ })
+ })
+})
diff --git a/apps/mobile/src/utils/tileHeaders.ts b/apps/mobile/src/utils/tileHeaders.ts
new file mode 100644
index 00000000..f003a8d1
--- /dev/null
+++ b/apps/mobile/src/utils/tileHeaders.ts
@@ -0,0 +1,18 @@
+import { TransformRequestManager } from "@maplibre/maplibre-react-native"
+import NativeLocationService from "../services/NativeLocationService"
+import { REPO_URL } from "../constants"
+
+/** App name and version only. The privacy policy commits to carrying no per-install identifier. */
+export function tileServerUserAgent(): string {
+ const version = NativeLocationService.getBuildConfig()?.VERSION_NAME ?? "dev"
+ return `Colota/${version} (+${REPO_URL})`
+}
+
+/** Applies to the default tile server and any custom one. Call before the first map mounts. */
+export function registerTileServerUserAgent(): void {
+ TransformRequestManager.addHeader({
+ id: "colota-user-agent",
+ name: "User-Agent",
+ value: tileServerUserAgent()
+ })
+}
diff --git a/fastlane/metadata/android/en-US/changelogs/46.txt b/fastlane/metadata/android/en-US/changelogs/46.txt
new file mode 100644
index 00000000..cec2a294
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/46.txt
@@ -0,0 +1 @@
+- Map requests identify the app by name and version, never the device or user