pub struct UpdateConfig { /* private fields */ }Expand description
Everything the blocking check and install need, and nothing that can’t cross
onto a background thread. Build one through Updater unless you are driving
the mechanics yourself.
Implementations§
Source§impl UpdateConfig
impl UpdateConfig
Sourcepub fn new(
app: impl Into<String>,
version: impl Into<String>,
source: UpdateSource,
) -> Self
pub fn new( app: impl Into<String>, version: impl Into<String>, source: UpdateSource, ) -> Self
A config for app at version, checking source.
Sourcepub fn codesign_requirement(self, requirement: impl Into<String>) -> Self
pub fn codesign_requirement(self, requirement: impl Into<String>) -> Self
The codesign requirement a macOS update must satisfy before it is
installed — without this, macOS installs refuse to run in place and
the prompt falls back to opening the download page.
Pass the requirement text only; the -R= that codesign needs is added
here. Pin your team, not a certificate: team IDs survive certificate
renewals, so
.codesign_requirement("anchor apple generic and certificate leaf[subject.OU] = XJDC46F35X")keeps working when the signing cert rolls. The practical consequence is that an ad-hoc signed build — what CI produces when the signing secrets are absent — cannot self-update, and shouldn’t be able to.
Sourcepub fn require_checksum(self, require: bool) -> Self
pub fn require_checksum(self, require: bool) -> Self
Refuse to install an update whose release publishes no SHA-256.
A published digest is always checked when it exists. This turns a missing one from a silent pass into a refusal, which is the setting you want on Linux: the AppImage path has no signature to fall back on, so without a digest the only thing vouching for the file that is about to be renamed over the running binary is the feed that named it.
Publish <asset>.sha256 beside each artifact, or a SHA256SUMS
listing, and turn this on.
Sourcepub fn requires_checksum(&self) -> bool
pub fn requires_checksum(&self) -> bool
Whether a missing checksum blocks an install.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Override the User-Agent sent with every request.
Sourcepub fn slug(self, slug: impl Into<String>) -> Self
pub fn slug(self, slug: impl Into<String>) -> Self
Override the filesystem-safe name used for staging paths.
Sourcepub fn source(&self) -> &UpdateSource
pub fn source(&self) -> &UpdateSource
Where releases are published.
Sourcepub fn install_kind(&self) -> InstallKind
pub fn install_kind(&self) -> InstallKind
How this copy was installed — see super::detect.
Sourcepub fn check(&self) -> Result<UpdateCheck, String>
pub fn check(&self) -> Result<UpdateCheck, String>
Fetch the latest release and classify it. Blocking (it spawns curl)
— run it on gpui’s background executor, or let super::start and
super::check_now do that for you.
Sourcepub fn install(
&self,
release: &Release,
kind: &InstallKind,
on_stage: &dyn Fn(UpdateStage),
) -> Result<Relaunch, String>
pub fn install( &self, release: &Release, kind: &InstallKind, on_stage: &dyn Fn(UpdateStage), ) -> Result<Relaunch, String>
Download the release and rewrite this install in place, returning how to
relaunch. Blocking — run it off the UI thread. on_stage is called
from the calling thread as the install progresses, including once per
download sample.
Sourcepub fn can_install(&self, release: &Release, kind: &InstallKind) -> bool
pub fn can_install(&self, release: &Release, kind: &InstallKind) -> bool
Whether this release can be installed in place — the question the prompt’s action button asks before it promises anything.
All three halves matter. The install has to be one we can rewrite; the
release has to have published the asset to do it with (a release still
uploading its artifacts hasn’t); and a macOS install needs a
codesign_requirement to verify the payload
against. Any of them missing and the honest button is “Open Download”.
Trait Implementations§
Source§impl Clone for UpdateConfig
impl Clone for UpdateConfig
Source§fn clone(&self) -> UpdateConfig
fn clone(&self) -> UpdateConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UpdateConfig
impl Debug for UpdateConfig
impl Eq for UpdateConfig
Source§impl PartialEq for UpdateConfig
impl PartialEq for UpdateConfig
impl StructuralPartialEq for UpdateConfig
Auto Trait Implementations§
impl Freeze for UpdateConfig
impl RefUnwindSafe for UpdateConfig
impl Send for UpdateConfig
impl Sync for UpdateConfig
impl Unpin for UpdateConfig
impl UnsafeUnpin for UpdateConfig
impl UnwindSafe for UpdateConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more