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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 rrbe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# LocalShare (LAN file sharing)
# LocalShare — share Mac files, scan a QR code to view or save them in your phone's browser

[简体中文](README_CN.md) | English

A small macOS tool that spins up a static file server so you can share specific files/folders from your Mac with other devices on the same local network.
A small macOS app that moves files and text between your Mac and other devices (phone, tablet…) over WiFi — the other end just uses a browser, with no client to install.

- Pick a file or folder, scan the QR code that appears (or just open the link), and browse the files in your phone's browser (HTML, PDF, Markdown, images…)
- Two-way text transfer — type some text and share it via a QR code, or send text back from the phone to the Mac

<table>
<tr>
Expand All @@ -14,31 +17,28 @@ A small macOS tool that spins up a static file server so you can share specific

## Features

- Share via QR code — scan with the Camera app to open in a browser
- Share multiple files / folders at once
- Serves HTML / PDF / video / images; previews Markdown / JSON / CSV right in the browser
- Optional guest upload (read-only by default) — send photos and documents from your phone back to the Mac
- Shows who's currently viewing (device name when it can be resolved, otherwise the IP)
- Optional "visible on current network only" — open on the current Wi-Fi only, unreachable from other networks the Mac is connected to
- Automatic updates (prompts when a new version is found; installs only after you confirm)
- Share files and text by QR code, or just by opening the link
- Serves HTML / PDF / video / images; previews Markdown / JSON / CSV
- After you share, the other end can send files and text back
- Shows who's currently viewing
- `localshare` command line: bring up the window to share, or `--headless` to print the link and QR code in the terminal

## Why this app exists

- iPhone Safari can't open local HTML files directly — they need to be served from a static file server to preview
- When you don't want to actually move files to your phone via AirDrop/LocalSend, you just want to preview them there
- When you want to browse several files at once
- To share files with other people on the same LAN
- When AirDrop is flaky, or the other device isn't an Apple device
- iPhone Safari can't open local HTML files directly, so previewing the web pages you vibe-coded is awkward
- No need to spin up `python3 -m http.server`
- No need to install a client like LocalSend
- Preview only — no need to actually save files onto the phone
- Quickly pass text around, without relying on flaky Handoff

## Usage
## GUI usage

1. Open the app and drag files onto the window, or click "Choose Files or Folders".
2. Connect your phone to **the same Wi-Fi as the Mac**, then scan the QR code in the window with the Camera app.
3. If macOS shows a firewall prompt on first launch, click "Allow".
Scan the QR code, or open the LAN address directly. If macOS shows a firewall prompt on first launch, click "Allow".

The QR code points to something like `http://192.168.x.x:8080/?t=<random-token>`: the link carries a one-time token, so whoever scans it gets in seamlessly, while anyone who only knows the IP:port cannot access it.

> ⚠️ Traffic is plain HTTP (unencrypted). That's fine on trusted networks like home or office; but on public Wi-Fi such as cafés or airports, others on the same network may be able to see what's transferred — don't share sensitive files there. When needed, turn on "visible on current network only" in the window to narrow the exposure.
> ⚠️ Traffic is plain HTTP (unencrypted). Best avoided on public networks like airports and cafés.

## Terminal usage

Expand All @@ -65,6 +65,10 @@ The app is ad-hoc signed, so **opening** it may be blocked by Gatekeeper (warnin
xattr -dr com.apple.quarantine /Applications/LocalShare.app
```

## License

MIT — see [LICENSE](LICENSE).

## Credits

This project was inspired by:
Expand Down
42 changes: 23 additions & 19 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# LocalShare(局域网文件分享)
# LocalShare —— 共享 Mac 文件,扫码在手机浏览器里查看/保存

简体中文 | [English](README.md)

一个 macOS 小工具,启动一个静态文件托管服务,分享你电脑上的特定文件/文件夹,在同一个局域网下的其他设备中访问。
一个 macOS 小工具,在本机和手机等设备之间通过 WiFi 互通文件和文本,对端使用浏览器,无须安装客户端。

- 选中文件或文件夹,相机扫描出现的二维码,或直接打开链接,在手机浏览器里浏览这些文件(HTML、PDF、Markdown、图片……)
- 支持双向传送文本,编辑文字通过二维码分享后传输,并可从手机端发送文本回 Mac

<table>
<tr>
Expand All @@ -14,31 +17,28 @@

## 功能

- 二维码分享,相机 app 扫一下浏览器中打开
- 一次分享多个文件 / 文件夹
- 支持 HTML / PDF / 视频 / 图片,Markdown / JSON / CSV 在浏览器里直接预览
- 可选开启访客上传(默认只读),手机里的照片、文档能传回电脑
- 显示当前在线访客(能反查到就显示设备名,否则显示 IP 尾号)
- 可选「仅当前网络可见」:只在当前 WiFi 开放,电脑连着的其它网络访问不到
- 自动更新(发现新版会提示,确认后再装)
- 命令行 localshare:唤起窗口分享,或 --headless 在终端显示链接和二维码
- 二维码分享或直接打开链接分享文件、文本
- 支持 HTML / PDF / 视频 / 图片,Markdown / JSON / CSV 预览
- 支持分享后,由对端反向传输文件、文本
- 显示当前在线访客
- 命令行 `localshare` 命令:唤起窗口分享,或 `--headless` 在终端显示链接和二维码

## 为什么有这个 app

- iPhone 不支持 html 文件直接在手机 Safari 中打开,需要托管到静态文件服务器才能预览
- 如果你并不想把文件通过 AirDrop/LocalSend 传到手机,只是想在手机预览
- 想同时浏览多个文件
- 分享文件给局域网内的其他人使用
- 避免 AirDrop 的不稳定,或对端并非苹果设备
- iPhone 不支持 html 文件直接在手机 Safari 中打开,不便预览你 Vibe Coding 的网页
- 不需要配置 python 启动 `python3 -m http.server`
- 不需要安装 LocalSend 等客户端
- 可以只预览,不需要传递文件到手机存储
- 快速传递文本,避免 handoff 不稳定

## 使用
## GUI 使用

1. 打开 app,拖拽文件到 app 窗口,或手动点「选择文件夹/单个文件」。
2. 手机连上**与电脑相同的 WiFi**,用相机扫描窗口里的二维码。
3. 首次启动若系统弹出防火墙提示,点「允许」。
扫描二维码或通过局域网连接地址打开,首次启动若系统弹出防火墙提示,点「允许」。

二维码地址形如 `http://192.168.x.x:8080/?t=随机令牌`:链接里带一次性令牌,扫码者无感进入,单纯知道 IP:端口 的人无法访问。

> ⚠️ 传输是明文 HTTP(没有加密)。在家里 / 公司这种可信网络下没问题;但在咖啡馆、机场等公共 WiFi 下,同一网络的人有可能看到传输内容——别在这种网络分享敏感文件。需要时可在窗口里开「仅当前网络可见」收窄暴露面
> ⚠️ 传输是明文 HTTP(没有加密)。机场咖啡厅等公共网络下最好不要使用

## 终端用法

Expand All @@ -65,6 +65,10 @@ ad-hoc 签名,**打开**可能被 Gatekeeper 拦截(提示「已损坏」或
xattr -dr com.apple.quarantine /Applications/LocalShare.app
```

## 协议

MIT —— 见 [LICENSE](LICENSE)。

## 参考项目

本项目受到如下项目的启发
Expand Down
Loading