From 7552c42f6e56fe5e47c0d04f1b5c59e96e1cb7e3 Mon Sep 17 00:00:00 2001 From: Erick Namukolo Date: Thu, 21 Aug 2025 01:58:48 +0200 Subject: [PATCH 1/5] removed the /api prefix from host url user unput --- android/app/build.gradle | 2 +- lib/utils/endpoints.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 9a51f77..f5d14c8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,7 +48,7 @@ android { applicationId = "com.sleepingpanda.pulse" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = 21 + minSdkVersion flutter.minSdkVersion targetSdk = 35 versionCode = flutter.versionCode versionName = flutter.versionName diff --git a/lib/utils/endpoints.dart b/lib/utils/endpoints.dart index 8b7339a..c621ec0 100644 --- a/lib/utils/endpoints.dart +++ b/lib/utils/endpoints.dart @@ -1,7 +1,7 @@ late String baseUrl; -String umamiUrl = 'https://cloud.umami.is/api'; +String umamiUrl = 'https://cloud.umami.is'; class Endpoints { - static final String authLogin = '$baseUrl/auth/login'; - static final String websites = '$baseUrl/websites'; + static final String authLogin = '$baseUrl/api/auth/login'; + static final String websites = '$baseUrl/api/websites'; } From 1f7547e9279b9cadac3338f89d217a2d7923e480 Mon Sep 17 00:00:00 2001 From: Erick Namukolo Date: Thu, 21 Aug 2025 02:22:55 +0200 Subject: [PATCH 2/5] minor fixed --- android/app/build.gradle | 4 ++-- lib/features/auth/repo/auth_repo.dart | 2 +- lib/features/auth/screens/sign_in_screen.dart | 7 ++++--- lib/features/sessions/repo/sessions_repo.dart | 7 +++---- lib/widgets/custom_text_field.dart | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f5d14c8..eaafe03 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -31,7 +31,7 @@ if (keystorePropertiesFile.exists()) { android { namespace = "com.sleepingpanda.pulse" - compileSdk = 35 + compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion compileOptions { @@ -49,7 +49,7 @@ android { // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdkVersion flutter.minSdkVersion - targetSdk = 35 + targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName } diff --git a/lib/features/auth/repo/auth_repo.dart b/lib/features/auth/repo/auth_repo.dart index fe0b5ea..62c53e1 100644 --- a/lib/features/auth/repo/auth_repo.dart +++ b/lib/features/auth/repo/auth_repo.dart @@ -10,7 +10,7 @@ class AuthRepo { {required String email, required String pwd, required String url}) async { String userKey = url == umamiUrl ? 'email' : 'username'; var res = await Requests.post( - endpoint: '$url/auth/login', + endpoint: '$url/api/auth/login', body: { userKey: email, 'password': pwd, diff --git a/lib/features/auth/screens/sign_in_screen.dart b/lib/features/auth/screens/sign_in_screen.dart index c3abc1f..65f6c35 100644 --- a/lib/features/auth/screens/sign_in_screen.dart +++ b/lib/features/auth/screens/sign_in_screen.dart @@ -90,12 +90,13 @@ class _SignInScreenState extends State { data: hostUrl, preIcon: Icons.link_rounded, hint: 'Self-hosted url', - title: 'Host URL', + title: 'Host Domain', type: TextInputType.emailAddress, disabled: hostType == 'Umami Cloud', validator: (val) { - if (!(val!.startsWith('https://'))) { - return 'The url should start with https://'; + if (!(val!.startsWith('https://')) && + !(val.startsWith('http://'))) { + return 'The url should start with https:// or http://'; } return null; }, diff --git a/lib/features/sessions/repo/sessions_repo.dart b/lib/features/sessions/repo/sessions_repo.dart index f064339..60afd02 100644 --- a/lib/features/sessions/repo/sessions_repo.dart +++ b/lib/features/sessions/repo/sessions_repo.dart @@ -2,7 +2,6 @@ import 'package:pulse/features/events/models/event.dart'; import 'package:pulse/features/sessions/model/session.dart'; import 'package:pulse/utils/endpoints.dart'; import 'package:pulse/utils/requests.dart'; -import 'package:pulse/utils/utils.dart'; class SessionsRepo { Future> getSessions({ @@ -19,7 +18,7 @@ class SessionsRepo { var res = await Requests.get( useKey: true, endpoint: - '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1')}/$id/sessions?startAt=$startAt&endAt=$endAt&pageSize=20&page=${pageNumber ?? 1}'); + '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1').replaceAll('api/', '')}/$id/sessions?startAt=$startAt&endAt=$endAt&pageSize=20&page=${pageNumber ?? 1}'); return Session.toList(res['data']); } @@ -27,7 +26,7 @@ class SessionsRepo { var res = await Requests.get( useKey: true, endpoint: - '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1')}/$websiteId/sessions/$id'); + '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1').replaceAll('api/', '')}/$websiteId/sessions/$id'); return Session.fromJson(res); } @@ -43,7 +42,7 @@ class SessionsRepo { var res = await Requests.get( useKey: true, endpoint: - '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1')}/$websiteId/sessions/$id/activity?startAt=$startAt&endAt=$endAt'); + '${Endpoints.websites.replaceAll(umamiUrl, 'https://api.umami.is/v1').replaceAll('api/', '')}/$websiteId/sessions/$id/activity?startAt=$startAt&endAt=$endAt'); return Event.toList(res); } } diff --git a/lib/widgets/custom_text_field.dart b/lib/widgets/custom_text_field.dart index e7ca944..764a7a2 100644 --- a/lib/widgets/custom_text_field.dart +++ b/lib/widgets/custom_text_field.dart @@ -84,7 +84,7 @@ class CustomTextField extends StatelessWidget { errorStyle: kBodyTextStyle.copyWith(fontSize: 10, color: kErrorColor), contentPadding: EdgeInsets.symmetric( - vertical: 20.0, horizontal: preIcon == null ? 10 : 0.0), + vertical: 15.0, horizontal: preIcon == null ? 10 : 0.0), prefixStyle: kBodyTextStyle, enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), From fc310834d95943c8ec1dea8551056f80bd6a1729 Mon Sep 17 00:00:00 2001 From: Erick Namukolo Date: Thu, 21 Aug 2025 02:24:02 +0200 Subject: [PATCH 3/5] version++ --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 8a04ef1..ffb8ef0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: "A new Flutter project." # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.0.7+8 +version: 1.0.8+9 environment: sdk: ^3.6.1 From 6ccbed351da9c1688d5959fd7488a1cc10ce6467 Mon Sep 17 00:00:00 2001 From: Erick Namukolo Date: Mon, 25 Aug 2025 01:13:46 +0200 Subject: [PATCH 4/5] added a hint for self hosted urls --- lib/features/auth/repo/auth_repo.dart | 3 ++- lib/features/auth/screens/sign_in_screen.dart | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/features/auth/repo/auth_repo.dart b/lib/features/auth/repo/auth_repo.dart index 62c53e1..c6dd2fa 100644 --- a/lib/features/auth/repo/auth_repo.dart +++ b/lib/features/auth/repo/auth_repo.dart @@ -1,4 +1,5 @@ import 'package:pulse/features/auth/screens/sign_in_screen.dart'; +import 'package:pulse/features/auth/screens/splash_screen.dart'; import 'package:pulse/utils/endpoints.dart'; import 'package:pulse/utils/local_storage.dart'; import 'package:pulse/utils/navigation.dart'; @@ -28,6 +29,6 @@ class AuthRepo { Future signOut(context) async { await prefs.clear(); - Navigation.go(screen: SignInScreen(), context: context, replace: true); + Navigation.go(screen: SplashScreen(), context: context, replace: true); } } diff --git a/lib/features/auth/screens/sign_in_screen.dart b/lib/features/auth/screens/sign_in_screen.dart index 65f6c35..711b75b 100644 --- a/lib/features/auth/screens/sign_in_screen.dart +++ b/lib/features/auth/screens/sign_in_screen.dart @@ -89,7 +89,7 @@ class _SignInScreenState extends State { CustomTextField( data: hostUrl, preIcon: Icons.link_rounded, - hint: 'Self-hosted url', + hint: 'e.g https://your-domain.com', title: 'Host Domain', type: TextInputType.emailAddress, disabled: hostType == 'Umami Cloud', @@ -98,6 +98,9 @@ class _SignInScreenState extends State { !(val.startsWith('http://'))) { return 'The url should start with https:// or http://'; } + if (val.endsWith('/')) { + return 'Remove the trailing / at the end of the url'; + } return null; }, ), From 4044b1adbdc6323189a8d5b7e52bb710504e5ad9 Mon Sep 17 00:00:00 2001 From: Erick Namukolo Date: Mon, 25 Aug 2025 01:14:30 +0200 Subject: [PATCH 5/5] version++ --- lib/features/auth/repo/auth_repo.dart | 1 - pubspec.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/features/auth/repo/auth_repo.dart b/lib/features/auth/repo/auth_repo.dart index c6dd2fa..1158068 100644 --- a/lib/features/auth/repo/auth_repo.dart +++ b/lib/features/auth/repo/auth_repo.dart @@ -1,4 +1,3 @@ -import 'package:pulse/features/auth/screens/sign_in_screen.dart'; import 'package:pulse/features/auth/screens/splash_screen.dart'; import 'package:pulse/utils/endpoints.dart'; import 'package:pulse/utils/local_storage.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index ffb8ef0..8dd12d0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: "A new Flutter project." # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.0.8+9 +version: 1.0.9+10 environment: sdk: ^3.6.1