فهرست منبع

Use a tunneled transport when necessary

vishnukvmd 3 سال پیش
والد
کامیت
106dbac6b6
4فایلهای تغییر یافته به همراه13 افزوده شده و 0 حذف شده
  1. 1 0
      lib/core/constants.dart
  2. 10 0
      lib/core/error-reporting/super_logging.dart
  3. 1 0
      lib/main.dart
  4. 1 0
      thirdparty/sentry-dart

+ 1 - 0
lib/core/constants.dart

@@ -7,6 +7,7 @@ const String kSentryDSN =
     "https://2235e5c99219488ea93da34b9ac1cb68@sentry.ente.io/4";
 const String kSentryDebugDSN =
     "https://ca5e686dd7f149d9bf94e620564cceba@sentry.ente.io/3";
+const String kSentryTunnel = "https://sentry-reporter.ente.io";
 const String kRoadmapURL = "https://roadmap.ente.io";
 const int kMicroSecondsInDay = 86400000000;
 const int kAndroid11SDKINT = 30;

+ 10 - 0
lib/core/error-reporting/super_logging.dart

@@ -7,11 +7,13 @@ import 'dart:io';
 
 import 'package:flutter/foundation.dart';
 import 'package:flutter/widgets.dart';
+import 'package:http/http.dart' as http;
 import 'package:intl/intl.dart';
 import 'package:logging/logging.dart';
 import 'package:package_info_plus/package_info_plus.dart';
 import 'package:path/path.dart';
 import 'package:path_provider/path_provider.dart';
+import 'package:photos/core/error-reporting/tunneled_transport.dart';
 import 'package:sentry_flutter/sentry_flutter.dart';
 
 typedef FutureOrVoidCallback = FutureOr<void> Function();
@@ -74,6 +76,8 @@ class LogConfig {
   /// If this is [null], Sentry logger is completely disabled (default).
   String sentryDsn;
 
+  String tunnel;
+
   /// A built-in retry mechanism for sending errors to sentry.
   ///
   /// This parameter defines the time to wait for, before retrying.
@@ -118,6 +122,7 @@ class LogConfig {
 
   LogConfig({
     this.sentryDsn,
+    this.tunnel,
     this.sentryRetryDelay = const Duration(seconds: 30),
     this.logDirPath,
     this.maxLogFiles = 10,
@@ -175,6 +180,11 @@ class SuperLogging {
       await SentryFlutter.init(
         (options) {
           options.dsn = config.sentryDsn;
+          options.httpClient = http.Client();
+          if (config.tunnel != null) {
+            options.transport =
+                TunneledTransport(Uri.parse(config.tunnel), options);
+          }
         },
         appRunner: () => config.body(),
       );

+ 1 - 0
lib/main.dart

@@ -159,6 +159,7 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
     logDirPath: (await getTemporaryDirectory()).path + "/logs",
     maxLogFiles: 5,
     sentryDsn: kDebugMode ? kSentryDebugDSN : kSentryDSN,
+    tunnel: kSentryTunnel,
     enableInDebugMode: true,
     prefix: prefix,
   ));

+ 1 - 0
thirdparty/sentry-dart

@@ -0,0 +1 @@
+Subproject commit 1ba4085ad44496f37392ae9172393d741fe65b75