@_nazmiforreal/flutter-ota 0.1.29 → 0.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/bin/flutter-ota-linux-x64 +0 -0
  2. package/bin/flutter-ota.js +0 -0
  3. package/dart-src/packages/cli-tools/.dart_tool/package_config.json +496 -0
  4. package/dart-src/packages/cli-tools/.dart_tool/package_graph.json +754 -0
  5. package/dart-src/packages/cli-tools/.dart_tool/version +1 -0
  6. package/dart-src/packages/cli-tools/lib/src/commands/doctor.dart +22 -1
  7. package/dart-src/packages/cli-tools/lib/src/commands/init.dart +17 -8
  8. package/dart-src/packages/cli-tools/pubspec.lock +636 -0
  9. package/dart-src/packages/cli-tools/pubspec.yaml +6 -6
  10. package/dart-src/packages/cli-tools/test/mocks/mock_pocketbase_client.dart +2 -1
  11. package/dart-src/root/analysis_options.yaml +3 -0
  12. package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/FlutterPatcherPlugin.kt +1 -0
  13. package/dart-src/root/android/src/main/kotlin/com/flutter_patcher/flutter_patcher/PatcherConfig.kt +20 -0
  14. package/dart-src/root/lib/flutter_ota_kit.dart +31 -11
  15. package/dart-src/root/lib/src/aws_update_source.dart +1 -0
  16. package/dart-src/root/lib/src/cloudflare_update_source.dart +1 -0
  17. package/dart-src/root/lib/src/ota_progress_overlay.dart +196 -130
  18. package/dart-src/root/lib/src/patcher_channel.dart +14 -1
  19. package/dart-src/root/lib/src/pkg/plugin_core/src/request_update_bundle_state.dart +2 -1
  20. package/dart-src/root/lib/src/pkg/postgres/src/postgres_types.dart +2 -1
  21. package/dart-src/root/lib/src/pocketbase_update_source.dart +1 -0
  22. package/dart-src/root/lib/src/postgres_update_source.dart +1 -0
  23. package/dart-src/root/lib/src/shared_update_check.dart +30 -2
  24. package/dart-src/root/lib/src/supabase_update_source.dart +1 -0
  25. package/dart-src/root/pubspec.yaml +14 -14
  26. package/package.json +1 -1
@@ -93,9 +93,30 @@ class DoctorCommand extends FlutterPatcherCommand {
93
93
  steps.fail('SUPABASE_URL not set');
94
94
  return;
95
95
  }
96
+ final serviceKey = cfg.supabase.serviceRoleKey;
97
+ final anonKey = cfg.supabase.anonKey;
98
+ final hasServiceKey = serviceKey != null && serviceKey.isNotEmpty;
99
+ final probeKey = hasServiceKey
100
+ ? serviceKey
101
+ : (anonKey != null && anonKey.isNotEmpty ? anonKey : null);
102
+ if (probeKey == null) {
103
+ steps.fail(
104
+ 'No Supabase key configured — set '
105
+ '${bold('supabase.anonKey')} or ${bold('supabase.serviceRoleKey')}',
106
+ );
107
+ return;
108
+ }
109
+ // Supabase now rejects keyless requests and restricts the PostgREST OpenAPI
110
+ // root to secret/service keys (2025 API-key hardening), so probe
111
+ // /rest/v1/ only when a service key is available, otherwise use
112
+ // /auth/v1/health which accepts public (anon/publishable) keys.
113
+ final endpoint = hasServiceKey ? '$url/rest/v1/' : '$url/auth/v1/health';
96
114
  try {
97
115
  final res = await http
98
- .get(Uri.parse('$url/rest/v1/'))
116
+ .get(
117
+ Uri.parse(endpoint),
118
+ headers: {'apikey': probeKey, 'Authorization': 'Bearer $probeKey'},
119
+ )
99
120
  .timeout(const Duration(seconds: 5));
100
121
  if (res.statusCode < 400) {
101
122
  steps.success('Supabase reachable ($url)');
@@ -329,24 +329,33 @@ class InitCommand extends FlutterPatcherCommand {
329
329
  step('Added `flutter_ota_kit` (latest) via `$exe pub add`');
330
330
  return;
331
331
  }
332
- warn('`$exe pub add flutter_ota_kit` failed; falling back to a manual '
333
- 'edit. Run it yourself if the constraint looks wrong.');
332
+ warn(
333
+ '`$exe pub add flutter_ota_kit` failed; falling back to a manual '
334
+ 'edit. Run it yourself if the constraint looks wrong.',
335
+ );
334
336
  }
335
337
  // Fallback: append an unpinned dependency so `pub get` picks the latest
336
338
  // compatible release. Still no hardcoded version.
337
339
  final marker = '\ndependencies:';
338
340
  final idx = content.indexOf(marker);
339
341
  if (idx == -1) {
340
- warn('Could not find a `dependencies:` block; add `flutter_ota_kit` '
341
- 'manually (run `flutter pub add flutter_ota_kit`).');
342
+ warn(
343
+ 'Could not find a `dependencies:` block; add `flutter_ota_kit` '
344
+ 'manually (run `flutter pub add flutter_ota_kit`).',
345
+ );
342
346
  return;
343
347
  }
344
348
  final insertAt = idx + marker.length;
345
- final updated =
346
- content.replaceRange(insertAt, insertAt, '\n flutter_ota_kit: any\n');
349
+ final updated = content.replaceRange(
350
+ insertAt,
351
+ insertAt,
352
+ '\n flutter_ota_kit: any\n',
353
+ );
347
354
  pubspec.writeAsStringSync(updated);
348
- step('Added `flutter_ota_kit` dependency to pubspec.yaml '
349
- '(run `flutter pub get` to resolve the latest version)');
355
+ step(
356
+ 'Added `flutter_ota_kit` dependency to pubspec.yaml '
357
+ '(run `flutter pub get` to resolve the latest version)',
358
+ );
350
359
  }
351
360
 
352
361
  /// Resolve the `flutter` executable (preferred) or `dart` for `pub add`.