Skip to content

Commit 035871b

Browse files
committed
Allow calling install runtime command without parameters (fixes #648)
1 parent 2159922 commit 035871b

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

native/src/connector/process.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ impl Process for SetConfig {
8383

8484
impl Process for InstallRuntime {
8585
fn process(&self, _connection: &Connection) -> Result<ConnectorResponse> {
86+
#[cfg(platform_linux)]
87+
let options = self.clone().unwrap_or_default();
88+
8689
let command = RuntimeInstallCommand {
8790
#[cfg(platform_linux)]
88-
link: self.link,
91+
link: options.link,
8992
};
9093
command.run()?;
9194

native/src/connector/request.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! deserialize_unit_struct {
4545
impl<'de> Deserialize<'de> for $msg {
4646
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4747
where
48-
D: serde::de::Deserializer<'de>,
48+
D: Deserializer<'de>,
4949
{
5050
struct Visitor;
5151

@@ -77,7 +77,7 @@ const fn default_as_true() -> bool {
7777
true
7878
}
7979

80-
/// Supports "double option" pattern for update requests.
80+
/// Supports the "double option" pattern for update requests.
8181
///
8282
/// - Parses missing field as `None`.
8383
/// - Parses field with value `None` as `Some(None)`.
@@ -147,22 +147,20 @@ pub struct SetConfig(pub Config);
147147
///
148148
/// # Parameters
149149
///
150-
/// None.
150+
/// See [fields](#fields).
151151
///
152152
/// # Returns
153153
///
154154
/// [`ConnectorResponse::RuntimeInstalled`] - No data.
155155
///
156-
#[cfg(platform_linux)]
157-
#[derive(Deserialize, Debug, Eq, PartialEq, Clone)]
158-
pub struct InstallRuntime {
159-
/// Experimental: Use a linked runtime instead of downloading from Mozilla.
156+
#[derive(Deserialize, Debug, Eq, PartialEq, Clone, Default)]
157+
pub struct InstallRuntimeOptions {
158+
/// Whether to use a linked runtime instead of downloading from Mozilla (experimental, default: `false`).
159+
#[serde(default)]
160160
pub link: bool,
161161
}
162162

163-
#[cfg(not(platform_linux))]
164-
#[derive(Debug, Eq, PartialEq, Clone)]
165-
pub struct InstallRuntime;
163+
pub type InstallRuntime = Option<InstallRuntimeOptions>;
166164

167165
/// Uninstalls the Firefox runtime.
168166
///
@@ -174,8 +172,10 @@ pub struct InstallRuntime;
174172
///
175173
/// [`ConnectorResponse::RuntimeUninstalled`] - No Data
176174
///
177-
#[derive(Debug, Eq, PartialEq, Clone)]
178-
pub struct UninstallRuntime;
175+
#[derive(Deserialize, Debug, Eq, PartialEq, Clone, Default)]
176+
pub struct UninstallRuntimeOptions {}
177+
178+
pub type UninstallRuntime = Option<UninstallRuntimeOptions>;
179179

180180
/// Gets all installed web apps.
181181
///
@@ -376,11 +376,11 @@ pub struct UpdateSite {
376376
/// If empty, no handlers are registered to the operating system.
377377
pub enabled_protocol_handlers: Option<Vec<String>>,
378378

379-
/// Whether the web app should be launched on the system login.
379+
/// Whether the web app should be launched on the system login (default: `false`).
380380
#[serde(default)]
381381
pub launch_on_login: Option<bool>,
382382

383-
/// Whether the web app should be launched on the browser launch.
383+
/// Whether the web app should be launched on the browser launch (default: `false`).
384384
#[serde(default)]
385385
pub launch_on_browser: Option<bool>,
386386

@@ -401,7 +401,7 @@ pub struct UpdateSite {
401401
///
402402
/// # Parameters
403403
///
404-
/// None.
404+
/// See [fields](#fields).
405405
///
406406
/// # Returns
407407
///
@@ -514,7 +514,7 @@ pub struct UpdateProfile {
514514
///
515515
/// # Parameters
516516
///
517-
/// None.
517+
/// See [fields](#fields).
518518
///
519519
/// # Returns
520520
///
@@ -611,9 +611,6 @@ impl Into<crate::console::app::HTTPClientConfig> for HTTPClientConfig {
611611

612612
deserialize_unit_struct!(GetSystemVersions);
613613
deserialize_unit_struct!(GetConfig);
614-
#[cfg(not(platform_linux))]
615-
deserialize_unit_struct!(InstallRuntime);
616-
deserialize_unit_struct!(UninstallRuntime);
617614
deserialize_unit_struct!(GetSiteList);
618615
deserialize_unit_struct!(GetProfileList);
619616

0 commit comments

Comments
 (0)