Skip to content

Commit

Permalink
Merge pull request #2 from zhangyu1818/main
Browse files Browse the repository at this point in the history
Fix issue with Speedtest CLI requiring --accept-license flag
  • Loading branch information
zhangyu1818 authored Nov 19, 2024
2 parents 3c959e8 + 14d5505 commit d4fd503
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

---

A modern and elegant speedtest tool built with Tauri and React, powered by the official Speedtest® CLI.
A modern and elegant speedtest tool built with Tauri and React, based on Speedtest® CLI.

> [!IMPORTANT]
> This software is for learning and research purposes only. Commercial use is strictly prohibited.
Expand All @@ -20,6 +20,22 @@ A modern and elegant speedtest tool built with Tauri and React, powered by the o

Please check the [releases page](https://github.com/zhangyu1818/speedtest-ui/releases).

### MacOS

**The application is damaged**

```bash
xattr -cr /Applications/Speedtest\ UI.app/
```

### Linux

Untested

### Windows

Untested

## Development

### Prerequisites
Expand Down
9 changes: 2 additions & 7 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod models;

use std::io::{BufRead, BufReader, Write};
use std::io::{BufRead, BufReader};
use std::process::{Command, Stdio};
use std::thread;
use tauri::{path::BaseDirectory, AppHandle, Emitter, Manager};
Expand All @@ -21,6 +21,7 @@ async fn run_speedtest(app: AppHandle) -> Result<bool, String> {
.map_err(|e| format!("Failed to resolve resource path: {}", e))?;

let mut child = Command::new(command_path)
.arg("--accept-license")
.arg("--format=json")
.arg("--progress=yes")
.arg("--unit=B/s")
Expand All @@ -30,12 +31,6 @@ async fn run_speedtest(app: AppHandle) -> Result<bool, String> {
.spawn()
.map_err(|e| e.to_string())?;

if let Some(mut stdin) = child.stdin.take() {
thread::spawn(move || {
stdin.write_all(b"y\n").unwrap();
});
}

let stdout = child
.stdout
.take()
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Speedtest UI",
"version": "0.0.1",
"version": "0.0.2",
"identifier": "com.speedtest-ui.app",
"build": {
"beforeDevCommand": "pnpm dev",
Expand Down

0 comments on commit d4fd503

Please sign in to comment.