Skip to content

Support custom PDSs - #45

Open
aleksrutins wants to merge 2 commits into
jenius-apps:mainfrom
aleksrutins:custom-pds
Open

Support custom PDSs#45
aleksrutins wants to merge 2 commits into
jenius-apps:mainfrom
aleksrutins:custom-pds

Conversation

@aleksrutins

Copy link
Copy Markdown

Closes #7

Currently no translations for the new UI other than English.

@dpaulino dpaulino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

image

I see your UI here. I would like to test this. Where could I make an account that uses a custom PDS so I play with your PR further?

{
var authUrl = $"{UrlConstants.BlueskyBaseUrl}/{UrlConstants.AuthPath}";
_baseUrl = baseUrl;
var authUrl = $"{baseUrl}/{UrlConstants.AuthPath}";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This url is resolving to bsky.social/<authPath>. This is leading to an HTTP error because the url is missing https://.

Comment on lines +21 to +24
public async Task<Result<AuthResponse>> RefreshAsync(string refreshToken, string baseUrl = UrlConstants.BlueskyBaseUrl)
{
var refreshUrl = $"{UrlConstants.BlueskyBaseUrl}/{UrlConstants.RefreshAuthPath}";
_baseUrl = baseUrl;
var refreshUrl = $"{baseUrl}/{UrlConstants.RefreshAuthPath}";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Recommend making the following changes:

  • change new parameter to string? baseUrl = null. Make sure to apply this change in the interface as well.
  • Then on line 23, do this _baseUrl = baseUrl ?? UrlConstants.BlueskyBaseUrl;
  • Then make sure on line 24 to use the correct variable: {_baseUrl}/{UrlConstants.RefreshAuthPath}


/// <inheritdoc/>
public async Task<Result<AuthResponse>> AuthenticateAsync(string identifer, string appPassword)
public async Task<Result<AuthResponse>> AuthenticateAsync(string identifer, string appPassword, string baseUrl = UrlConstants.BlueskyBaseUrl)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same comments here as the comment on RefreshAsync

}

return await SignInWithValidatedCredentialsAsync(userHandleOrEmail, password);
return await SignInWithValidatedCredentialsAsync(userHandleOrEmail, password, baseUrl ?? "bsky.social");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

After making my recommended changes on BlueskyApiClient.cs, then we don't need this null coalesce anymore. In fact, this is one of the reasons why the PR had an http error

Suggested change
return await SignInWithValidatedCredentialsAsync(userHandleOrEmail, password, baseUrl ?? "bsky.social");
return await SignInWithValidatedCredentialsAsync(userHandleOrEmail, password, baseUrl);

private async Task<Result<AuthResponse>> SignInWithValidatedCredentialsAsync(string identifier, string password, string? baseUrl)
{
Result<AuthResponse> result = await _apiClient.AuthenticateAsync(identifier, password);
Result<AuthResponse> result = await _apiClient.AuthenticateAsync(identifier, password, baseUrl ?? "bsky.social");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Result<AuthResponse> result = await _apiClient.AuthenticateAsync(identifier, password, baseUrl ?? "bsky.social");
Result<AuthResponse> result = await _apiClient.AuthenticateAsync(identifier, password, baseUrl);

@Turtlepaw

Copy link
Copy Markdown

just dropping this in here: you don't need UI for users to enter a PDS, it can be resolved from the handle

@aleksrutins

Copy link
Copy Markdown
Author

Sorry for the radio silence - I no longer have either a windows system or a custom PDS to test with, so if someone else wants to pick this up, feel free, but I don't really have a way to keep working on this. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for other PDSs

3 participants