mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-25 01:57:06 +00:00
fix: resolve UI hangs and contrast issues, improve concurrency
- Prevent UI hang by processing aria2 unpause actions asynchronously - Bypass internal aria2 limits to honor Firelink's max concurrent setting - Improve visibility of the 'Recheck engines' button in Settings - Refactor Speed Limiter checkbox into a toggle and fix text selection - Update Add window font and placeholder to match modern design standards
This commit is contained in:
+38
-22
@@ -2396,30 +2396,45 @@ async fn resume_download(
|
|||||||
let status = aria2_download_status(state.aria2_port, &state.aria2_secret, &gid).await?;
|
let status = aria2_download_status(state.aria2_port, &state.aria2_secret, &gid).await?;
|
||||||
match status.as_str() {
|
match status.as_str() {
|
||||||
"paused" => {
|
"paused" => {
|
||||||
let acquired = state.queue_manager.ensure_aria2_permit(&id).await;
|
use tauri::Emitter;
|
||||||
let result = match rpc_call(
|
let _ = state.emit(
|
||||||
state.aria2_port,
|
"download-state",
|
||||||
&state.aria2_secret,
|
crate::ipc::DownloadStateEvent::new(&id, crate::ipc::DownloadStatus::Queued),
|
||||||
"aria2.unpause",
|
);
|
||||||
serde_json::json!([gid]),
|
|
||||||
)
|
let app_state = state.inner().clone();
|
||||||
.await
|
let id_clone = id.clone();
|
||||||
{
|
let gid_clone = gid.clone();
|
||||||
Ok(result) => result,
|
|
||||||
Err(error) => {
|
tauri::async_runtime::spawn(async move {
|
||||||
if acquired {
|
let acquired = app_state.queue_manager.ensure_aria2_permit(&id_clone).await;
|
||||||
state.queue_manager.release_permit(&id).await;
|
let result = match rpc_call(
|
||||||
|
app_state.aria2_port,
|
||||||
|
&app_state.aria2_secret,
|
||||||
|
"aria2.unpause",
|
||||||
|
serde_json::json!([gid_clone]),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(result) => result,
|
||||||
|
Err(error) => {
|
||||||
|
if acquired {
|
||||||
|
app_state.queue_manager.release_permit(&id_clone).await;
|
||||||
|
}
|
||||||
|
log::error!("failed to resume aria2 gid {}: {}", gid_clone, error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return Err(format!("failed to resume aria2 gid {gid}: {error}"));
|
};
|
||||||
|
if let Err(error) = ensure_aria2_gid_result("unpause", &gid_clone, &result) {
|
||||||
|
if acquired {
|
||||||
|
app_state.queue_manager.release_permit(&id_clone).await;
|
||||||
|
}
|
||||||
|
log::error!("failed to resume aria2 gid {}: {}", gid_clone, error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
log::info!("aria2 resume [{}]: unpaused gid {}", id_clone, gid_clone);
|
||||||
if let Err(error) = ensure_aria2_gid_result("unpause", &gid, &result) {
|
});
|
||||||
if acquired {
|
return Ok(true);
|
||||||
state.queue_manager.release_permit(&id).await;
|
|
||||||
}
|
|
||||||
return Err(error);
|
|
||||||
}
|
|
||||||
log::info!("aria2 resume [{}]: unpaused gid {}", id, gid);
|
|
||||||
}
|
}
|
||||||
"active" | "waiting" => {
|
"active" | "waiting" => {
|
||||||
state.queue_manager.ensure_aria2_permit(&id).await;
|
state.queue_manager.ensure_aria2_permit(&id).await;
|
||||||
@@ -3960,6 +3975,7 @@ pub fn run() {
|
|||||||
.arg("--summary-interval=1")
|
.arg("--summary-interval=1")
|
||||||
.arg("--console-log-level=warn")
|
.arg("--console-log-level=warn")
|
||||||
.arg("--download-result=hide")
|
.arg("--download-result=hide")
|
||||||
|
.arg("--max-concurrent-downloads=9999")
|
||||||
.arg("--check-certificate=true");
|
.arg("--check-certificate=true");
|
||||||
|
|
||||||
if let Some(global_speed_limit) = normalize_speed_limit_for_aria2(&global_speed_limit) {
|
if let Some(global_speed_limit) = normalize_speed_limit_for_aria2(&global_speed_limit) {
|
||||||
|
|||||||
@@ -734,8 +734,8 @@ export const AddDownloadsModal = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<textarea
|
<textarea
|
||||||
className="add-download-control add-download-links-input w-full h-32 p-3 text-[13px] resize-none font-mono"
|
className="add-download-control add-download-links-input w-full h-32 p-3 text-[13px] resize-none"
|
||||||
placeholder="Paste HTTP, HTTPS, FTP, or SFTP URLs here..."
|
placeholder={"Paste HTTP, HTTPS, FTP, or SFTP URLs here...\n\nFor media downloads, paste links from Youtube, X, TikTok, Instagram, Reddit, etc."}
|
||||||
value={urls}
|
value={urls}
|
||||||
onChange={(e) => setUrls(e.target.value)}
|
onChange={(e) => setUrls(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -971,7 +971,7 @@ runEngineChecks(false);
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => runEngineChecks(true)}
|
onClick={() => runEngineChecks(true)}
|
||||||
disabled={isRecheckingEngines}
|
disabled={isRecheckingEngines}
|
||||||
className="flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-bg-modal hover:bg-item-hover disabled:opacity-60 text-[12px] text-text-primary"
|
className="app-button px-3 py-1.5 text-[12px] flex items-center gap-1.5 disabled:opacity-60"
|
||||||
>
|
>
|
||||||
<RefreshCw size={13} className={isRecheckingEngines ? 'animate-spin' : ''} />
|
<RefreshCw size={13} className={isRecheckingEngines ? 'animate-spin' : ''} />
|
||||||
{isRecheckingEngines ? 'Checking…' : 'Recheck engines'}
|
{isRecheckingEngines ? 'Checking…' : 'Recheck engines'}
|
||||||
|
|||||||
@@ -58,10 +58,19 @@ export default function SpeedLimiterView() {
|
|||||||
<WindowDragRegion />
|
<WindowDragRegion />
|
||||||
|
|
||||||
<div className="flex items-center gap-3 border-b border-border-color px-6 pb-4">
|
<div className="flex items-center gap-3 border-b border-border-color px-6 pb-4">
|
||||||
<label className="flex items-center gap-3 text-[17px] font-semibold tracking-tight text-text-primary">
|
<div className="flex items-center gap-3 text-[17px] font-semibold tracking-tight text-text-primary select-none">
|
||||||
<input type="checkbox" checked={enabled} onChange={event => setEnabled(event.target.checked)} className="h-4 w-4 accent-accent" />
|
<button
|
||||||
|
onClick={() => setEnabled(!enabled)}
|
||||||
|
className={`relative inline-flex h-5 w-9 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none ${enabled ? 'bg-accent' : 'bg-item-hover'}`}
|
||||||
|
aria-checked={enabled}
|
||||||
|
role="switch"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={`inline-block h-4 w-4 transform rounded-full bg-white transition duration-200 ease-in-out ${enabled ? 'translate-x-4' : 'translate-x-1'}`}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
Speed Limiter
|
Speed Limiter
|
||||||
</label>
|
</div>
|
||||||
<span className={`rounded-full px-2.5 py-1 text-[11px] font-semibold ${
|
<span className={`rounded-full px-2.5 py-1 text-[11px] font-semibold ${
|
||||||
enabled ? 'bg-accent/15 text-accent' : 'bg-item-hover text-text-muted'
|
enabled ? 'bg-accent/15 text-accent' : 'bg-item-hover text-text-muted'
|
||||||
}`}>
|
}`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user