Skip to content

Commit 55fac41

Browse files
MrAlders0nclaude
andcommitted
Log Custom API host only, quiet disabled path, note offline iata semantics
Review follow-ups on the offline Custom API forward: - Log the endpoint host instead of the full URL — debug log files are uploaded with bug reports and custom endpoint URLs may embed tokens. - Skip the "Forward requested/skipped" logging entirely when the Custom API feature is disabled (no per-flush noise for users who never enabled it). - Document that offline batches are stamped with the upload-location zone, not the record-location zone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BaNcifvtSbfDh5v538ExxL
1 parent 298dbd8 commit 55fac41

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

lib/providers/app_state_provider.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5242,6 +5242,10 @@ class AppStateProvider extends ChangeNotifier with WidgetsBindingObserver {
52425242
}
52435243

52445244
/// Forward a successfully uploaded offline batch to the Custom API endpoint.
5245+
///
5246+
/// The whole batch is stamped with the upload-location zone (the fresh
5247+
/// /auth at the current GPS position), not where the pings were recorded —
5248+
/// the client cannot compute per-ping zones for sessions that span regions.
52455249
void _forwardOfflineBatchToCustomApi(
52465250
List<Map<String, dynamic>> batch, {
52475251
required int batchNum,

lib/services/custom_api_service.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ class CustomApiService {
5252
if (pings.isEmpty) return;
5353

5454
final prefs = _prefsGetter();
55+
if (!prefs.customApiEnabled) return;
56+
5557
debugLog(
5658
'[CUSTOM API] Forward requested ($source): ${pings.length} item(s)');
5759

58-
if (!prefs.customApiEnabled) {
59-
debugLog('[CUSTOM API] Forward skipped ($source): Custom API disabled');
60-
return;
61-
}
6260
if (prefs.customApiUrl == null || prefs.customApiUrl!.isEmpty) {
6361
debugLog('[CUSTOM API] Forward skipped ($source): URL not configured');
6462
return;
@@ -74,8 +72,12 @@ class CustomApiService {
7472
: null;
7573
final iata = iataOverride ?? iataGetter?.call();
7674

77-
debugLog(
78-
'[CUSTOM API] Forwarding ($source) → ${prefs.customApiUrl} '
75+
// Log the endpoint host only — the full URL may embed auth tokens, and
76+
// debug log files are uploaded verbatim with bug reports.
77+
var endpointHost = Uri.tryParse(prefs.customApiUrl!)?.host ?? '';
78+
if (endpointHost.isEmpty) endpointHost = 'custom endpoint';
79+
80+
debugLog('[CUSTOM API] Forwarding ($source) → $endpointHost '
7981
'(contact=${contact ?? "off"}, iata=${iata ?? "none"})');
8082

8183
final enriched = pings.map((ping) {

0 commit comments

Comments
 (0)