Add consistent User-Agent header to all HTTP clients

Create UserAgentClient (http.BaseClient wrapper) that injects a
User-Agent header into every request, reading app name and version
from VersionService and contact/homepage from dev_config.dart.

Format follows OSM tile usage policy:
  DeFlock/<version> (+https://deflock.org; contact: admin@stopflock.com)

Replaces 4 inconsistent hardcoded UA strings and adds UA to the 9
call sites that previously sent none.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Doug BorgandClaude Opus 4.6 committed 2026-02-24 19:31:27 -07:00
1 parent fe20356734
commit 0137fd66aa
16 files changed
+177 -43

No files matched your search

+2
View File
@@ -5,6 +5,7 @@ import 'package:http/http.dart' as http;
import '../models/pending_upload.dart';
import '../dev_config.dart';
import '../state/settings_state.dart';
import 'http_client.dart';
import 'version_service.dart';
class UploadResult {
@@ -348,6 +349,7 @@ class Uploader {
Map<String, String> get _headers => {
'Authorization': 'Bearer $accessToken',
'Content-Type': 'text/xml',
'User-Agent': UserAgentClient.userAgent,
};
/// Sanitize text for safe inclusion in XML attributes and content