From 4adeedd8948c964b0d8ea41a0089626030b8414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Wala?= Date: Wed, 24 Jan 2024 18:46:48 +0100 Subject: [PATCH] Remove build.rs --- .github/workflows/ci.yml | 38 +++++++--------------- .gitignore | 2 +- Cargo.toml | 1 + README.md | 49 +---------------------------- build.rs | 17 ---------- client/src/app/rtp_packets_table.rs | 2 +- 6 files changed, 16 insertions(+), 93 deletions(-) delete mode 100644 build.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d7586b..ee5ddda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,37 +14,23 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - - run: cargo fmt --check --manifest-path ${{ matrix.dir }}/Cargo.toml + - name: Check formatting + run: cargo fmt --check --manifest-path ${{ matrix.dir }}/Cargo.toml - linting: - name: Build and linting + build: + name: Build runs-on: ubuntu-latest - strategy: - matrix: - dir: [., ./client, ./common] - target: [x86_64-unknown-linux-gnu, wasm32-unknown-unknown] - exclude: - - dir: . - target: wasm32-unknown-unknown - - dir: ./client - target: x86_64-unknown-linux-gnu steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable with: targets: wasm32-unknown-unknown - components: clippy - - run: cargo clippy --manifest-path ${{ matrix.dir }}/Cargo.toml --target ${{ matrix.target }} -- -Dwarnings + - name: Install trunk + run: cargo install --locked --version ~0.18 trunk + - name: Compile the client + working-directory: ./client + run: trunk build --release + - name: Install rtpeeker + run: cargo install --locked --path . - test: - name: Tests - runs-on: ubuntu-latest - strategy: - matrix: - # all tests are run on host target - dir: [., ./client, ./common] - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - - run: sudo apt-get install libpcap-dev - - run: cargo test --manifest-path ${{ matrix.dir }}/Cargo.toml +# TODO: add clippy check and tests diff --git a/.gitignore b/.gitignore index 63abc7c..eedeffc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ target/ dist/ -.idea \ No newline at end of file +.idea diff --git a/Cargo.toml b/Cargo.toml index 38a9231..5edf259 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "rtpeeker" version = "0.1.0" edition = "2021" +include = ["/client"] [dependencies] rtpeeker_common = { path = "./common" } diff --git a/README.md b/README.md index b48b041..2c27714 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,4 @@ _Work in progress_ ## Installation -1. [Install Rust and cargo](https://www.rust-lang.org/tools/install) - -2. Add WASM32 target -```console -rustup target add wasm32-unknown-unknown -``` - -3. Install native dependencies, for Ubuntu/Debian: -```console -sudo apt install build-essential pkg-config libssl-dev libpcap-dev -``` - -4. Install Trunk, WASM bundling tool -```console -cargo install --locked trunk -``` - -5. Install RTPeeker -```console -cargo install --locked --git https://github.com/LVala/rtpeeker --branch easier-install rtpeeker -``` - -6. Run the app -```console -rtpeeker --help -``` - -## Usage - -List local network interfaces -```console -rtpeeker list -``` - -Capture from interface "en0" and file `./rtp.pcap` -```console -rtpeeker run -i en0 -f ./rtp.pcap -``` - -Apply capture filter (the same as in Wireshark or tcpdump) -```console -rtpeeker run -i en0 -c "src 192.0.0.5" -``` - -Show help explaining these options -```console -rtpeeker --help -``` +_TODO_ diff --git a/build.rs b/build.rs deleted file mode 100644 index 27a5968..0000000 --- a/build.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::env; -use std::process::Command; - -fn main() { - let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - - // TODO: in theory we shouldn't modify files outside of OUT_DIR - // but oh well - Command::new("trunk") - .args(["build", "--release", "--dist"]) - .arg(&format!("{}/client/dist", manifest_dir)) - .arg(&format!("{}/client/index.html", manifest_dir)) - .status() - .unwrap(); - - println!("cargo:rerun-if-changed=client"); -} diff --git a/client/src/app/rtp_packets_table.rs b/client/src/app/rtp_packets_table.rs index 3cab47f..84e23d9 100644 --- a/client/src/app/rtp_packets_table.rs +++ b/client/src/app/rtp_packets_table.rs @@ -120,7 +120,7 @@ impl RtpPacketsTable { ssrc_to_display_name.insert(*key, stream.alias.to_string()); }); - let first_ts = rtp_packets.get(0).unwrap().timestamp; + let first_ts = rtp_packets.first().unwrap().timestamp; body.rows(25.0, rtp_packets.len(), |row_ix, mut row| { let packet = rtp_packets.get(row_ix).unwrap();