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
50 changes: 50 additions & 0 deletions .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release CLI

on:
push:
tags:
- "v*"

jobs:
build:
name: Build CLI (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin

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

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

- name: Add target
if: matrix.target != 'x86_64-unknown-linux-gnu'
run: rustup target add ${{ matrix.target }}

- name: Build
working-directory: cli
run: cargo build --release --target ${{ matrix.target }}

- name: Package
working-directory: cli
run: |
VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed -E 's/version = "(.*)"/\1/')
BIN_PATH="target/${{ matrix.target }}/release/pairlane"
ASSET="pairlane-${VERSION}-${{ matrix.target }}.tar.gz"
tar -czf "$ASSET" -C "$(dirname "$BIN_PATH")" pairlane
echo "ASSET=$ASSET" >> $GITHUB_ENV

- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: cli/${{ env.ASSET }}
25 changes: 17 additions & 8 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Share Files
# Pairlane

[English](./README.md) | [中文](./README.zh.md)

**デモサイト: https://share-files.karakuri-maker.com/**
**デモサイト: https://getpairlane.com/**

WebRTCを使ったP2Pファイル共有ツール。サーバーを経由せずブラウザ間で直接ファイルを転送します。

Expand Down Expand Up @@ -41,6 +41,15 @@ WebRTCを使ったP2Pファイル共有ツール。サーバーを経由せず

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

### npxで実行

```sh
npx pairlane send /path/to/file
npx pairlane receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

### ソースからビルド

```sh
cd cli
cargo run --release -- send /path/to/file
Expand All @@ -50,27 +59,27 @@ 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=..."
npx pairlane send /path/to/file
npx pairlane receive "https://getpairlane.com/r/ROOM#k=..."
```

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

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

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

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

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

デフォルトではデモ環境へ接続します。`SHARE_FILES_ENDPOINT` 環境変数で上書きできます。
デフォルトではデモ環境へ接続します。`PAIRLANE_ENDPOINT` 環境変数で上書きできます(旧 `SHARE_FILES_ENDPOINT` も利用可)

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

既存ルームに参加したい場合は `--room-id` を明示指定してください。
Expand Down
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Share Files
# Pairlane

[日本語](./README.ja.md) | [中文](./README.zh.md)

**Live Demo: https://share-files.karakuri-maker.com/**
**Live Demo: https://getpairlane.com/**

A P2P file sharing tool using WebRTC. Transfer files directly between browsers without going through a server.

Expand Down Expand Up @@ -41,6 +41,15 @@ The `cli/` directory contains a Rust-based CLI that can send or receive files us

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

### Quick Start (npx)

```sh
npx pairlane send /path/to/file
npx pairlane receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

### Build from source

```sh
cd cli
cargo run --release -- send /path/to/file
Expand All @@ -50,27 +59,27 @@ 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=..."
npx pairlane send /path/to/file
npx pairlane receive "https://getpairlane.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
npx pairlane 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:
By default it connects to the demo endpoint. Override it with the `PAIRLANE_ENDPOINT` environment variable (legacy `SHARE_FILES_ENDPOINT` also supported):

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

You can also provide `--room-id` explicitly if you want to join an existing room.
Expand Down
25 changes: 17 additions & 8 deletions README.zh.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Share Files
# Pairlane

[English](./README.md) | [日本語](./README.ja.md)

**在线演示: https://share-files.karakuri-maker.com/**
**在线演示: https://getpairlane.com/**

基于WebRTC的P2P文件共享工具。无需经过服务器,直接在浏览器之间传输文件。

Expand Down Expand Up @@ -41,6 +41,15 @@

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

### npx快速开始

```sh
npx pairlane send /path/to/file
npx pairlane receive <ROOM_ID_OR_URL> --output-dir ./downloads
```

### 从源码构建

```sh
cd cli
cargo run --release -- send /path/to/file
Expand All @@ -50,27 +59,27 @@ 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=..."
npx pairlane send /path/to/file
npx pairlane receive "https://getpairlane.com/r/ROOM#k=..."
```

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

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

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

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

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

默认连接到演示环境。可通过 `SHARE_FILES_ENDPOINT` 环境变量覆盖:
默认连接到演示环境。可通过 `PAIRLANE_ENDPOINT` 环境变量覆盖(旧 `SHARE_FILES_ENDPOINT` 也可用)

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

如需加入现有房间,请显式指定 `--room-id`。
Expand Down
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[package]
name = "share-files-cli"
name = "pairlane-cli"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "pairlane"
path = "src/main.rs"

[dependencies]
aes-gcm = "0.10"
anyhow = "1.0"
Expand Down
20 changes: 20 additions & 0 deletions cli/npm/bin/pairlane
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const { spawnSync } = require("node:child_process");
const { existsSync } = require("node:fs");
const { join } = require("node:path");

const binaryPath = join(__dirname, "..", "dist", "pairlane");

if (!existsSync(binaryPath)) {
console.error("pairlane: binary not found. Reinstall to download the CLI.");
process.exit(1);
}

const result = spawnSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
if (result.error) {
console.error("pairlane: failed to launch the CLI binary.");
process.exit(1);
}

process.exit(result.status ?? 1);
31 changes: 31 additions & 0 deletions cli/npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "pairlane",
"version": "0.1.0",
"description": "P2P file transfer CLI for Pairlane",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kiyo-e/p2p-share-files.git"
},
"engines": {
"node": ">=18"
},
"bin": {
"pairlane": "bin/pairlane"
},
"files": [
"bin/",
"scripts/"
],
"os": [
"darwin",
"linux"
],
"cpu": [
"x64",
"arm64"
],
"scripts": {
"postinstall": "node scripts/postinstall.js"
}
}
Loading