From a4b3eff90be94a90d0d032150b1c549759aaa444 Mon Sep 17 00:00:00 2001 From: Corbin Davenport Date: Tue, 9 May 2023 23:19:01 -0400 Subject: [PATCH] Update analytics --- bin/main.dart | 4 +++- pubspec.lock | 8 ++++++++ pubspec.yaml | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/main.dart b/bin/main.dart index d4a33c2..6b6bf45 100644 --- a/bin/main.dart +++ b/bin/main.dart @@ -3,6 +3,7 @@ import 'package:http/http.dart' as http; import 'dart:io' as io; import 'package:uuid/uuid.dart'; import 'dart:convert'; +import 'package:dart_ipify/dart_ipify.dart'; import 'package:nexustools/sys.dart' as sys; String macZip = 'https://dl.google.com/android/repository/platform-tools-latest-darwin.zip'; @@ -210,7 +211,8 @@ void connectAnalytics() async { var cpu = await sys.getCPUArchitecture(); // Set data var net = Uri.parse('https://plausible.io/api/event'); - var netHeaders = {'user-agent': 'Nexus Tools', 'X-Forwarded-For': '127.0.0.1', 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 ($realOS) AppleWebKit/500 (KHTML, like Gecko) Chrome/$appVersion $id'}; + final ipv4 = await Ipify.ipv4(); + var netHeaders = {'user-agent': 'Nexus Tools', 'X-Forwarded-For': ipv4, 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 ($realOS) AppleWebKit/500 (KHTML, like Gecko) Chrome/$appVersion $id'}; var netBody = '{"name":"pageview","url":"app://localhost/$realOS/$cpu","domain":"nexustools.corbin.io"}'; // Send request try { diff --git a/pubspec.lock b/pubspec.lock index c553f92..e3fda98 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,6 +49,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + dart_ipify: + dependency: "direct dev" + description: + name: dart_ipify + sha256: "3b70d589504126107e81ad0703d91394cc8e2039cb0a11ebd92b9b824a5e9561" + url: "https://pub.dev" + source: hosted + version: "1.1.1" http: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 962f8b0..5e5eb37 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,4 +14,5 @@ dev_dependencies: io: uuid: archive: ^3.2.2 - console: \ No newline at end of file + console: + dart_ipify: ^1.1.1 \ No newline at end of file