Files
proton-stream/crates/pstr-core/src/lib.rs
T
nvrl 0b2813cd42 feat(core,stream,meta,app,android,cli): sign in to Proton and sync watch history
A Proton account is now optional alongside public links. Signing in (password,
then a second-factor code and a mailbox password where the account has them;
a CAPTCHA gate is solved in the Android app) stores one session blob in the OS
credential store under `proton-account`, writing back every refreshed token
since refresh tokens are single-use. With an account, folders of the viewer's
own Drive — My Files, other devices, shared with me — can be added as shares
through the same `ShareClient` surface as a public link.

Watch history syncs through a `proton-stream` device in that Drive: one
`watch-history/<installation>.json` per installation, so no two devices ever
write the same file. Each sync reads the others and merges per episode, newer
`updated_at` wins, with a deterministic tie-break. It runs at launch, after
sign-in, whenever the player closes and every five minutes. A session that can
no longer refresh signs the app out instead of failing on every launch.

The CLI gains `login`, `logout`, `account`, `browse` and `sync`.

Also in this change:
- Android offline downloads no longer look stuck (B64): two transfer at once,
  through a copy stream with no read-ahead, with a smoothed transfer rate.
- Choosing a metadata match by hand now enriches the title too, instead of
  keeping the old match's episodes and artwork.

The catalog schema is unchanged.
2026-10-06 13:06:54 +02:00

32 lines
837 B
Rust

//! Shares, catalog, naming and persistence for `proton-stream`.
//!
//! Everything that is not the player or the UI. Front ends depend on this crate
//! rather than on `proton-drive-rs` directly, so there is one place that knows
//! how a share is opened and how its contents are modelled.
#![forbid(unsafe_code)]
pub mod account;
pub mod appearance;
pub mod browse;
pub mod catalog;
pub mod chapters;
pub mod config;
pub mod error;
pub mod franchise;
pub mod library;
pub mod metadata;
pub mod naming;
pub mod prefs;
pub mod shares;
pub mod shelves;
pub mod sync;
pub use account::{Account, AccountStore};
pub use error::{Error, Result};
#[cfg(not(target_os = "android"))]
pub use shares::KeyringSecretStore;
pub use shares::{SecretStore, Share, ShareClient, ShareStore, SharedLibrary};
pub use proton_drive_rs;
pub use proton_sdk;