From 62042bd8329fa24d80f857b7073f2441bbc0a2cc Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 15 Jun 2026 14:11:33 +0200 Subject: [PATCH] Rename allauth's URLs --- lib/providers/auth_notifier.dart | 2 +- lib/providers/base_provider.dart | 2 +- lib/providers/helpers.dart | 4 ++-- test/auth/auth_notifier_login_test.dart | 8 ++++---- test/auth/auth_notifier_powersync_test.dart | 6 +++--- test/auth/auth_screen_test.dart | 8 ++++---- test/screens/mfa_challenge_screen_test.dart | 2 +- test/user/account_repository_test.dart | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/providers/auth_notifier.dart b/lib/providers/auth_notifier.dart index c175f8617..d2decfcd6 100644 --- a/lib/providers/auth_notifier.dart +++ b/lib/providers/auth_notifier.dart @@ -51,7 +51,7 @@ import 'package:wger/providers/user_profile_notifier.dart'; part 'auth_notifier.g.dart'; /// `allauth.headless` `app` client endpoints, relative to the -/// `/_allauth/app/v1/` base. +/// `/allauth/app/v1/` base. const HEADLESS_TOKENS_REFRESH_PATH = 'tokens/refresh'; const HEADLESS_AUTH_LOGIN_PATH = 'auth/login'; const HEADLESS_AUTH_SIGNUP_PATH = 'auth/signup'; diff --git a/lib/providers/base_provider.dart b/lib/providers/base_provider.dart index 1ea831c16..3e3cd01e0 100644 --- a/lib/providers/base_provider.dart +++ b/lib/providers/base_provider.dart @@ -71,7 +71,7 @@ class WgerBaseProvider { return makeUri(serverUrl!, path, id: id, objectMethod: objectMethod, query: query); } - /// Builds a `/_allauth/app/v1/` URL for the headless API. + /// Builds a `/allauth/app/v1/` URL for the headless API. Uri makeHeadlessUrl(String path) => makeHeadlessUri(serverUrl!, path); /// Fetch and retrieve the overview list of objects, returns the JSON parsed response diff --git a/lib/providers/helpers.dart b/lib/providers/helpers.dart index ff2765ccf..85fcb3bbc 100644 --- a/lib/providers/helpers.dart +++ b/lib/providers/helpers.dart @@ -89,7 +89,7 @@ Uri makeUri( } /// Builds a URL for the `allauth.headless` `app` client API at -/// `/_allauth/app/v1/`. Used by the auth notifier for login, +/// `/allauth/app/v1/`. Used by the auth notifier for login, /// signup, MFA, refresh, etc. The headless API does not use a trailing /// slash and lives on a separate URL prefix from the DRF data API. Uri makeHeadlessUri(String serverUrl, String path) { @@ -98,7 +98,7 @@ Uri makeHeadlessUri(String serverUrl, String path) { scheme: uriServer.scheme, host: uriServer.host, port: uriServer.port, - path: [uriServer.path, '_allauth', 'app', 'v1', path].join('/'), + path: [uriServer.path, 'allauth', 'app', 'v1', path].join('/'), ); } diff --git a/test/auth/auth_notifier_login_test.dart b/test/auth/auth_notifier_login_test.dart index 3019ea922..22e4596e0 100644 --- a/test/auth/auth_notifier_login_test.dart +++ b/test/auth/auth_notifier_login_test.dart @@ -90,8 +90,8 @@ void main() { isTrustworthy: true, ); - final tHeadlessLogin = Uri.parse('$serverUrl/_allauth/app/v1/auth/login'); - final tHeadlessSignup = Uri.parse('$serverUrl/_allauth/app/v1/auth/signup'); + final tHeadlessLogin = Uri.parse('$serverUrl/allauth/app/v1/auth/login'); + final tHeadlessSignup = Uri.parse('$serverUrl/allauth/app/v1/auth/signup'); final tVersion = Uri.parse('$serverUrl/api/v2/version/'); final tMinAppVersion = Uri.parse('$serverUrl/api/v2/min-app-version/'); final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token'); @@ -503,7 +503,7 @@ void main() { }); group('login: pasted refresh token', () { - final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh'); + final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh'); test('exchanges at tokens/refresh and stores the rotated bundle', () async { final newAccess = makeJwt({'exp': 1900000000}); @@ -600,7 +600,7 @@ void main() { }); group('completeMfa', () { - final tMfa = Uri.parse('$serverUrl/_allauth/app/v1/auth/2fa/authenticate'); + final tMfa = Uri.parse('$serverUrl/allauth/app/v1/auth/2fa/authenticate'); test('200 persists tokens and reaches loggedIn', () async { final accessJwt = makeJwt({'exp': 1900000000}); diff --git a/test/auth/auth_notifier_powersync_test.dart b/test/auth/auth_notifier_powersync_test.dart index 4483cc5a5..4b923c9bc 100644 --- a/test/auth/auth_notifier_powersync_test.dart +++ b/test/auth/auth_notifier_powersync_test.dart @@ -79,7 +79,7 @@ void main() { final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token'); final tLiveness = Uri.parse('${powerSyncUrl}probes/liveness'); final tIssueRefresh = Uri.parse('$serverUrl/api/v2/issue-refresh-token'); - final tHeadlessRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh'); + final tHeadlessRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh'); /// Builds a fresh ProviderContainer with the mock HTTP client wired into /// the auth notifier. Auto-disposes after the test. @@ -956,7 +956,7 @@ void main() { }); group('background revalidation: headless pre-emptive refresh', () { - final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh'); + final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh'); String makeJwt(Map payload) { String enc(Map m) => @@ -1022,7 +1022,7 @@ void main() { }); group('refreshAccessToken', () { - final tRefresh = Uri.parse('$serverUrl/_allauth/app/v1/tokens/refresh'); + final tRefresh = Uri.parse('$serverUrl/allauth/app/v1/tokens/refresh'); /// Builds a JWT-shaped string with the given payload (signature is a sham, /// we only ever decode the middle segment). diff --git a/test/auth/auth_screen_test.dart b/test/auth/auth_screen_test.dart index cfa23ddbf..f0cb64086 100644 --- a/test/auth/auth_screen_test.dart +++ b/test/auth/auth_screen_test.dart @@ -65,17 +65,17 @@ void main() { final Uri tHeadlessLogin = Uri( scheme: 'https', host: 'wger.de', - path: '/_allauth/app/v1/auth/login', + path: '/allauth/app/v1/auth/login', ); final Uri tHeadlessSignup = Uri( scheme: 'https', host: 'wger.de', - path: '/_allauth/app/v1/auth/signup', + path: '/allauth/app/v1/auth/signup', ); final Uri tHeadlessRefresh = Uri( scheme: 'https', host: 'wger.de', - path: '/_allauth/app/v1/tokens/refresh', + path: '/allauth/app/v1/tokens/refresh', ); const validJwt = 'header.payload.signature'; @@ -412,7 +412,7 @@ void main() { final tHeadlessLoginCustom = Uri( scheme: 'https', host: 'my.server', - path: '/_allauth/app/v1/auth/login', + path: '/allauth/app/v1/auth/login', ); when( mockClient.post( diff --git a/test/screens/mfa_challenge_screen_test.dart b/test/screens/mfa_challenge_screen_test.dart index 78be491ee..fa5bd96c2 100644 --- a/test/screens/mfa_challenge_screen_test.dart +++ b/test/screens/mfa_challenge_screen_test.dart @@ -46,7 +46,7 @@ void main() { const serverUrl = 'https://wger.example'; const powerSyncUrl = 'https://ps.example/'; - final tMfa = Uri.parse('$serverUrl/_allauth/app/v1/auth/2fa/authenticate'); + final tMfa = Uri.parse('$serverUrl/allauth/app/v1/auth/2fa/authenticate'); final tVersion = Uri.parse('$serverUrl/api/v2/version/'); final tMinAppVersion = Uri.parse('$serverUrl/api/v2/min-app-version/'); final tPowerSyncToken = Uri.parse('$serverUrl/api/v2/powersync-token'); diff --git a/test/user/account_repository_test.dart b/test/user/account_repository_test.dart index e0351d6e4..2ac8063ba 100644 --- a/test/user/account_repository_test.dart +++ b/test/user/account_repository_test.dart @@ -57,7 +57,7 @@ void main() { }); group('email management via headless', () { - final emailUri = Uri.https('localhost', '/_allauth/app/v1/account/email'); + final emailUri = Uri.https('localhost', '/allauth/app/v1/account/email'); test('requestEmailChange POSTs the new address to account/email', () async { when(mockBase.makeHeadlessUrl('account/email')).thenReturn(emailUri);