Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/cli-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build CLI

on:
push:
branches:
- main
paths:
- "cli/**"
- ".github/workflows/cli-build.yml"
pull_request:
paths:
- "cli/**"
- ".github/workflows/cli-build.yml"
workflow_dispatch:

jobs:
build:
name: Build CLI (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Build
working-directory: cli
run: cargo build --release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public/assets/
# deps
node_modules/
.wrangler
cli/target/

# env
.env
Expand Down
45 changes: 45 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,51 @@ WebRTCを使ったP2Pファイル共有ツール。サーバーを経由せず
- [Vite](https://vite.dev/) - SSR対応ビルドツール
- WebRTC - P2Pデータ転送

## CLI (Rust)

`cli/` ディレクトリに Rust 製のCLIを用意しています。ブラウザ⇄ターミナル、ターミナル⇄ターミナルの転送に対応します。

### 対応プラットフォーム

- **Linux** (x86_64)
- **macOS** (Intel / Apple Silicon)

GitHub Actionsにより、`cli/` ディレクトリへのpush/PR時にビルドが自動テストされます。

```sh
cd cli
cargo run --release -- send /path/to/file
cargo run --release -- receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

暗号化は `send` のデフォルトです。`send` が出力する `#k=...` 付きのURLを、そのまま `receive` に渡せます。

```sh
cargo run --release -- send /path/to/file
cargo run --release -- receive "https://share-files.karakuri-maker.com/r/ROOM#k=..."
```

暗号化を無効にする場合は `--no-encrypt` を指定してください。

復号鍵を明示したい場合は `receive` に `--key`(base64url)を渡します。

```sh
cargo run --release -- receive <ROOM_ID> --key <BASE64URL_KEY> --output-dir ./downloads
```

デフォルトでは、`send` と `receive` は転送成功後に終了します。継続して待ちたい場合は `--stay-open` を指定してください。

※ `#k=...` を含むURLはシェルでクォートしてください。従来の `--file` / `--room-id` も引き続き利用できます。

デフォルトではデモ環境へ接続します。`SHARE_FILES_ENDPOINT` 環境変数で上書きできます。

```sh
SHARE_FILES_ENDPOINT=https://share-files.karakuri-maker.com \
cargo run --release -- send /path/to/file
```

既存ルームに参加したい場合は `--room-id` を明示指定してください。

## 必要環境

- [Bun](https://bun.sh/) ランタイム
Expand Down
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,51 @@ A P2P file sharing tool using WebRTC. Transfer files directly between browsers w
- [Vite](https://vite.dev/) - SSR-enabled build tool
- WebRTC - P2P data transfer

## CLI (Rust)

The `cli/` directory contains a Rust-based CLI that can send or receive files using the same WebRTC signaling flow, enabling browser ⇄ terminal and terminal ⇄ terminal transfers.

### Supported Platforms

- **Linux** (x86_64)
- **macOS** (Intel / Apple Silicon)

Builds are automatically tested via GitHub Actions on push/PR to the `cli/` directory.

```sh
cd cli
cargo run --release -- send /path/to/file
cargo run --release -- receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

Encrypted transfers are enabled by default for `send`. The command prints a room URL with `#k=...` that you can pass directly to `receive`:

```sh
cargo run --release -- send /path/to/file
cargo run --release -- receive "https://share-files.karakuri-maker.com/r/ROOM#k=..."
```

To disable encryption for `send`, pass `--no-encrypt`.

If you want to provide the decryption key explicitly, pass `--key` (base64url) to `receive`:

```sh
cargo run --release -- receive <ROOM_ID> --key <BASE64URL_KEY> --output-dir ./downloads
```

By default, `send` and `receive` exit after a successful transfer. Use `--stay-open` to keep the process running for additional transfers.

Note: URLs with `#k=...` should be quoted in the shell. Legacy flags `--file` and `--room-id` are still accepted.

By default it connects to the demo endpoint. Override it with the `SHARE_FILES_ENDPOINT` environment variable:

```sh
SHARE_FILES_ENDPOINT=https://share-files.karakuri-maker.com \
cargo run --release -- send /path/to/file
```

You can also provide `--room-id` explicitly if you want to join an existing room.

## Prerequisites

- [Bun](https://bun.sh/) runtime
Expand Down
45 changes: 45 additions & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,51 @@
- [Vite](https://vite.dev/) - 支持SSR的构建工具
- WebRTC - P2P数据传输

## CLI (Rust)

`cli/` 目录包含一个Rust编写的CLI工具,使用相同的WebRTC信令流程发送和接收文件,支持浏览器⇄终端和终端⇄终端的传输。

### 支持的平台

- **Linux** (x86_64)
- **macOS** (Intel / Apple Silicon)

通过GitHub Actions,在向 `cli/` 目录push/PR时自动测试构建。

```sh
cd cli
cargo run --release -- send /path/to/file
cargo run --release -- receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

`send` 默认启用加密。`send` 输出的带有 `#k=...` 的URL可以直接传给 `receive`:

```sh
cargo run --release -- send /path/to/file
cargo run --release -- receive "https://share-files.karakuri-maker.com/r/ROOM#k=..."
```

要禁用加密,请使用 `--no-encrypt`。

如需显式指定解密密钥,请向 `receive` 传递 `--key`(base64url编码):

```sh
cargo run --release -- receive <ROOM_ID> --key <BASE64URL_KEY> --output-dir ./downloads
```

默认情况下,`send` 和 `receive` 在传输成功后会退出。如需保持运行以进行更多传输,请使用 `--stay-open`。

※ 包含 `#k=...` 的URL在shell中需要用引号包裹。传统的 `--file` / `--room-id` 参数仍然可用。

默认连接到演示环境。可通过 `SHARE_FILES_ENDPOINT` 环境变量覆盖:

```sh
SHARE_FILES_ENDPOINT=https://share-files.karakuri-maker.com \
cargo run --release -- send /path/to/file
```

如需加入现有房间,请显式指定 `--room-id`。

## 环境要求

- [Bun](https://bun.sh/) 运行时
Expand Down
Loading