Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: check server version on sign-in and launch#43

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deansheather merged 12 commits intomainfromdean/login-check-buildinfo
Mar 11, 2025

Conversation

deansheather
Copy link
Member

Updates CredentialModel to have an additional stateUnknown during startup while credentials are validated in the background asynchronously (15s timeout).

While loading credentials on startup, the tray app shows a loading message.

While updating credentials, we now check that the server version falls in our expected range.

The sign in page now uses a WinUI 3 Dialog to show errors.

Closes#42

Updates CredentialModel to have an additional state "Unknown" duringstartup while credentials are validated in the background asynchronously(15s timeout).While loading credentials on startup, the tray app shows a loading message.While updating credentials, we now check that the server version fallsin our expected range.
@deansheatherdeansheather marked this pull request as ready for reviewMarch 6, 2025 05:53
@deansheather
Copy link
MemberAuthor

@spikecurtis I pretty heavily reworked CredentialManager:

  • DuplicateLoadCredentials calls now get merged (the same Task will be returned from both, so they will receive identical exceptions/results)
  • ASetCredentials call during an ongoingLoadCredentials call will cancel it
  • Added tests
    • To add tests I needed to addICoderApiClientFactory andICoderApiClient for mocking purposes
    • Pulled theNativeApi components ofCredentialManager into a new typeWindowsCredentialBackend (and added interfaceICredentialBackend for mocking)

@deansheather
Copy link
MemberAuthor

To protect things from concurrent access:

  • SetCredentials holds_opLock for the entire operation
  • LoadCredentials will hold_opLock while it creates the "inner" task then releases it
    • The "inner" task will grab the lock again when it's ready to write the loaded value

Copy link
Collaborator

@spikecurtisspikecurtis left a comment

Choose a reason for hiding this comment

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

I like the new CredentialManager overall, but still a bit concerned about invoking callbacks while holding the lock. A couple other small nits FYI.

// with no cancellation, the method itself will impose a timeout on the
// HTTP portion.
var credentialManager = _services.GetRequiredService<ICredentialManager>();
_ = credentialManager.LoadCredentials(CancellationToken.None);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to check my understanding here, because we are notawaiting the task, it doesn't matter if the task throws some exception, like being canceled. And, we don't block for it to complete, right?

I ask because we want the rest of this function to still run and handle closing of the tray window.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yep, we run it in the background and ignore all errors. If the credentials fail to load, the state will transition to "invalid" which will show the "please sign in" screen.

@deansheatherdeansheather merged commit0fefe8a intomainMar 11, 2025
3 checks passed
@deansheatherdeansheather deleted the dean/login-check-buildinfo branchMarch 11, 2025 05:46
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@spikecurtisspikecurtisspikecurtis approved these changes

@ethanndicksonethanndicksonAwaiting requested review from ethanndickson

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Validate the server version in the app
3 participants
@deansheather@spikecurtis@ethanndickson

[8]ページ先頭

©2009-2025 Movatter.jp