Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mobile): auto api endpoint #15184

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions mobile/lib/widgets/forms/login/login_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ class LoginForm extends HookConsumerWidget {
);
}

// Automatically add /api to serverUrl if missing
serverUrl = serverUrl.trim();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the input field just doesn't accept whitespace to begin with


// Check if the string ends with '/api/' and remove the trailing slash if it does or add '/api' if the string doesn't end with '/api'
if (serverUrl.endsWith('/api/')) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
} else if (!serverUrl.endsWith('/api')) {
serverUrl = '$serverUrl/api';
}
Comment on lines +101 to +105
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some .well-known endpoint autodiscovery code that already appends /api as one of the discovery steps, in https://github.com/immich-app/immich/blob/main/mobile/lib/services/api.service.dart.



try {
isLoadingServer.value = true;
final endpoint =
Expand Down
Loading