feat: persist account-level offline appearance (skin/cape) on OfflineAccount

Aperta
#266 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend

Direzione di ricerca

Read the existing OfflineAccount, AccountStore, OfflineProfile, and OfflineServer APIs to see how account JSON is loaded and saved. Start by deciding the open path-semantics and validation questions, then add OfflineAppearance with serde defaults so old account files still load. Done means saving and reloading an account preserves skin/cape/model, and offline_profile() reflects the stored appearance consistently.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

OfflineServer already supports local skins and capes through OfflineProfile::with_skin, with_cape, and with_skin_model, but OfflineAccount persists only username and uuid. Any launcher that offers offline appearance settings has to maintain its own AccountId -> texture path registry outside the account store and rebuild OfflineProfile manually at launch time. That duplicates account-level state and makes the textures easy to get out of sync with the selected account.

Proposal

Persist optional account-level appearance on OfflineAccount:

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct OfflineAppearance {
    pub skin: Option<PathBuf>,
    pub cape: Option<PathBuf>,
    pub skin_model: SkinModel,
}

impl OfflineAccount {
    pub fn appearance(&self) -> &OfflineAppearance;
    pub fn set_appearance(&mut self, appearance: OfflineAppearance);
    pub fn offline_profile(&self) -> OfflineProfile;
}

AccountStore::save already persists account state, so updating appearance would be set_appearance followed by save.

Questions to settle

  • Should paths be stored as absolute paths or relative to the launcher's storage_root? Relative paths are more portable, but OfflineAccount is created without storage-root context, so offline_profile() would need the root.
  • Should texture existence and PNG validity be checked when setting appearance, when calling offline_profile(), or left to OfflineServer as today?
  • Existing account JSON has no appearance field; #[serde(default)] should keep it backward compatible.

Scope

This should stay limited to account-level defaults. Per-instance overrides, file pickers, image previews, and size validation messaging belong to downstream launchers.

Why upstream

OfflineProfile, OfflineServer, OfflineAccount, and AccountStore all live in Elemental. Persisting these paths next to the account avoids every launcher reimplementing the same registry and keeps offline_profile() consistent with the account identity.

Particle currently constructs OfflineProfile::new(username) directly and has nowhere to persist the user's skin or cape choice.

Lingua principale
Rust
Stelle
11
Fork
1
Merge medio
3h 32m
PR unite (30g)
52

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ElectronicWave/Elemental

Tutte le issue di ElectronicWave/Elemental

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.