Repository navigation
feat(auth)!: add Yggdrasil site metadata store and refactor account providers - #335
Merged
Merged
Conversation
…roviders - Persist normalized Yggdrasil site metadata in accounts/yggdrasil_sites.json with single-flight fetching, TTL refresh, offline fallback, and account-link GC - Integrate SwappableClient into YggdrasilAuthorizer, YggdrasilAccountProvider, MicrosoftAccountProvider, and YggdrasilSiteStore - Separate pure-data Account from TypedAccountProvider and TypedTextureProvider, moving network/texture operations to providers and AccountStore BREAKING CHANGE: Account::credential is now synchronous, network/texture methods moved from Account/SkinStore to TypedAccountProvider/TypedTextureProvider/AccountStore, and AccountRegistry/AccountStore constructors take SwappableClient and provider instances. Closes #302
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Complexity | 2 medium |
🟢 Metrics 211 complexity · 2 duplication
Metric Results Complexity 211 Duplication 2
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Normalize YggdrasilSiteId to lowercase scheme/host without default ports, query/fragment, or trailing slashes, and share it across YggdrasilAuthorizer, YggdrasilAccountProvider, and YggdrasilSiteStore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #302
Summary
Normalized Yggdrasil site metadata store (
accounts/yggdrasil_sites.json):YggdrasilSiteId,YggdrasilSiteMetadata(wrappingnidhogg::types::meta::Meta+fetched_at),YggdrasilSiteIndex, andYggdrasilSiteStore.AccountId -> YggdrasilSiteIdinsideYggdrasilSiteIndexsoAccountRefremains generic ({ account_id, authorizer }) while supporting O(N) memory-backed GC and legacy account backfill.tokio::sync::watch, configurable TTL (DEFAULT_YGGDRASIL_SITE_METADATA_TTL/AccountStore::with_site_metadata_ttl), structuredtracing::warn!on network failure preserving last-known-good metadata, and explicit disk persistence error propagation.AccountStoreAPIs:site_metadata,account_site_metadata,refresh_site_metadata,prune_unused_sites,remove_site_metadata, andclear_site_metadata.Unified
SwappableClientintegration:SwappableClientintoYggdrasilAuthorizer,YggdrasilAccountProvider(viaNidhogg::with_client),MicrosoftAccountProvider(allmicrosoft_protocolcalls), andYggdrasilSiteStore.httpunderyggdrasil-authinelemental-coreandelemental-kit.Pure-data
Account+AccountProvider/TextureProviderseparation:Accountto a pure synchronous data trait (credential(&self) -> Credential, no#[serde(skip)]runtime handles or network methods).TypedAccountProvider/AccountProviderandTypedTextureProvider/TextureProvider, so non-texture providers likeOfflineAccountProviderhave no texture methods andAccountStore::supports_texturescan query capability from the registry.AccountStorefacade methods fortextures,upload_skin,delete_skin,upload_cape,delete_cape, andselect_cape, and updatedSkinStore::uploadto accept(&AccountStore, AccountId, ...).Breaking Changes
Account::credential(&self)is now synchronous (Credentialinstead ofasync fn ... -> Result<Credential>).Account; useAccountStore(refresh,textures,upload_skin,delete_skin,upload_cape,delete_cape,select_cape,account_site_metadata) or theAccountProvider/TextureProvidertraits.AccountRegistry::new(http_client)andAccountRegistry::with/with_texturesnow registerTypedAccountProvider/TypedTextureProviderinstances instead ofAccounttypes.AccountStore::with_registry(scope, http_client, registry)takes a sharedSwappableClient(or useAccountStore::open_with_http_client).YggdrasilAuthorizernow usesYggdrasilAuthorizer::new(...)/YggdrasilAuthorizer::offline(...)constructors with.with_client_token(...)/.with_http_client(...).AccountSkinExtandLocalSkin; useSkinStore::upload(&accounts, account_id, skin_id, model).Verification
.\format.batcargo test -p elemental-launcher --test account_store --test skin_store(9 passed)cargo test -p elemental-launcher --features yggdrasil-auth --test account_store --test offline_yggdrasil --test yggdrasil_site_metadata --test send_futures --test skin_store(19 passed)cargo check -p elemental-kitcargo check -p elemental-kit --features yggdrasil-authcargo check -p launchpaddeslop-please elemental-core -F yggdrasil-auth&deslop-please elemental-launcher -F yggdrasil-auth(no errors inelemental_core::authorelemental_launcher::account)