Add fastresume to desktop app
This commit is contained in:
parent
e8ef1f170d
commit
eb2b9e5a41
5 changed files with 22 additions and 1 deletions
|
|
@ -53,6 +53,9 @@ pub struct RqbitDesktopConfigPersistence {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub folder: PathBuf,
|
pub folder: PathBuf,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub fastresume: bool,
|
||||||
|
|
||||||
/// Deprecated, but keeping for backwards compat for serialized / deserialized config.
|
/// Deprecated, but keeping for backwards compat for serialized / deserialized config.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub filename: PathBuf,
|
pub filename: PathBuf,
|
||||||
|
|
@ -77,6 +80,7 @@ impl Default for RqbitDesktopConfigPersistence {
|
||||||
Self {
|
Self {
|
||||||
disable: false,
|
disable: false,
|
||||||
folder,
|
folder,
|
||||||
|
fastresume: false,
|
||||||
filename: PathBuf::new(),
|
filename: PathBuf::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ async fn api_from_config(
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
enable_upnp_port_forwarding: !config.upnp.disable,
|
enable_upnp_port_forwarding: !config.upnp.disable,
|
||||||
|
fastresume: config.persistence.fastresume,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -138,7 +139,13 @@ impl State {
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
if let Ok(config) = read_config(&config_filename) {
|
if let Ok(config) = read_config(&config_filename) {
|
||||||
let api = api_from_config(&init_logging, &config).await.ok();
|
let api = api_from_config(&init_logging, &config)
|
||||||
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
|
warn!(error=?e, "error reading configuration");
|
||||||
|
e
|
||||||
|
})
|
||||||
|
.ok();
|
||||||
let shared = Arc::new(RwLock::new(Some(StateShared { config, api })));
|
let shared = Arc::new(RwLock::new(Some(StateShared { config, api })));
|
||||||
|
|
||||||
return Self {
|
return Self {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ interface RqbitDesktopConfigTcpListen {
|
||||||
interface RqbitDesktopConfigPersistence {
|
interface RqbitDesktopConfigPersistence {
|
||||||
disable: boolean;
|
disable: boolean;
|
||||||
folder: PathLike;
|
folder: PathLike;
|
||||||
|
fastresume: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RqbitDesktopConfigPeerOpts {
|
interface RqbitDesktopConfigPeerOpts {
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,14 @@ export const ConfigModal: React.FC<{
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
disabled={config.persistence.disable}
|
disabled={config.persistence.disable}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<FormCheck
|
||||||
|
label="Enable fast resume (experimental)"
|
||||||
|
name="persistence.fastresume"
|
||||||
|
checked={config.persistence.fastresume}
|
||||||
|
onChange={handleToggleChange}
|
||||||
|
help="If enabled, restarting will not rehash torrents, and thus will be faster. You should not modify the downloaded files in any way if you use that."
|
||||||
|
/>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ async function get_current_config(): Promise<CurrentDesktopState> {
|
||||||
|
|
||||||
Promise.all([get_version(), get_default_config(), get_current_config()]).then(
|
Promise.all([get_version(), get_default_config(), get_current_config()]).then(
|
||||||
([version, defaultConfig, currentState]) => {
|
([version, defaultConfig, currentState]) => {
|
||||||
|
console.log(version, defaultConfig, currentState);
|
||||||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<RqbitDesktop
|
<RqbitDesktop
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue