94 lines
2.9 KiB
Markdown
94 lines
2.9 KiB
Markdown
# Internal Drop
|
|
|
|
Internal Drop is a small LAN text and file transfer app for 2 to 3 internal users. It follows the included PRD's recommended MVP: one Go service, embedded static frontend, WebSocket presence/messages, HTTP upload/download, and temporary local file caching.
|
|
|
|
## Features
|
|
|
|
- Opens without login and assigns each browser a 6-digit user code.
|
|
- Restores an unused local code from `localStorage`; issues a new code if the old code is online elsewhere.
|
|
- Shows online peers and nickname changes in real time.
|
|
- Sends short text over WebSocket.
|
|
- Uploads one file to the server's temporary cache and notifies the receiver.
|
|
- Lets the receiver accept, reject, download, and report completion.
|
|
- Removes expired cached files using a TTL cleaner.
|
|
- Exposes `GET /api/health`.
|
|
- Displays the current server URL and LAN address candidates in the UI.
|
|
|
|
## Configuration
|
|
|
|
| Environment variable | Default | Description |
|
|
|---|---:|---|
|
|
| `INTERNAL_DROP_ADDR` | `:10051` | Listen address |
|
|
| `INTERNAL_DROP_TEMP_DIR` | `./tmp/internal-drop` | Temporary file cache |
|
|
| `INTERNAL_DROP_MAX_FILE_SIZE` | `1073741824` | Max single upload bytes |
|
|
| `INTERNAL_DROP_FILE_TTL` | `2h` | Transfer expiry duration |
|
|
| `INTERNAL_DROP_ALLOWED_CIDRS` | empty | Optional comma-separated client CIDR allowlist, for example `192.168.1.0/24,10.0.0.0/8` |
|
|
|
|
## Local Build
|
|
|
|
```bash
|
|
go test ./...
|
|
go build -o internal-drop .
|
|
./internal-drop
|
|
```
|
|
|
|
Then open `http://localhost:10051` in two browser windows.
|
|
|
|
## One-Click macOS Deployment
|
|
|
|
Build or include the `internal-drop` binary, copy this project folder to another Mac, then run:
|
|
|
|
```bash
|
|
./scripts/deploy-macos.sh
|
|
```
|
|
|
|
The default installs a per-user LaunchAgent under `~/Library/LaunchAgents` and starts `http://127.0.0.1:10051`. For a system LaunchDaemon:
|
|
|
|
```bash
|
|
sudo ./scripts/deploy-macos.sh --system --addr :10051
|
|
```
|
|
|
|
Useful options:
|
|
|
|
```bash
|
|
./scripts/deploy-macos.sh --addr :9090 --allowed-cidrs 192.168.1.0/24
|
|
./scripts/deploy-macos.sh --binary ./internal-drop --no-build
|
|
```
|
|
|
|
## Docker Compose
|
|
|
|
```bash
|
|
docker compose up --build -d
|
|
```
|
|
|
|
For production LAN use, put Caddy or Nginx in front of the service and serve it over HTTPS:
|
|
|
|
```text
|
|
https://drop.company.lan -> Caddy/Nginx -> internal-drop:10051
|
|
```
|
|
|
|
## systemd
|
|
|
|
```bash
|
|
sudo useradd --system --home /var/lib/internal-drop --shell /usr/sbin/nologin internal-drop
|
|
sudo mkdir -p /var/lib/internal-drop
|
|
sudo chown internal-drop:internal-drop /var/lib/internal-drop
|
|
sudo cp internal-drop /usr/local/bin/internal-drop
|
|
sudo cp internal-drop.service.example /etc/systemd/system/internal-drop.service
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable --now internal-drop
|
|
```
|
|
|
|
## API Sketch
|
|
|
|
- `POST /api/session`
|
|
- `PATCH /api/me`
|
|
- `POST /api/me/regenerate-code`
|
|
- `POST /api/uploads`
|
|
- `GET /api/downloads/{id}`
|
|
- `GET /api/health`
|
|
- `GET /api/server-info`
|
|
- `GET /ws?session_id=...`
|
|
|
|
The user code is only an identifier. Restrict access with LAN/VPN/firewall/reverse-proxy policy.
|