Skip to content

Commit 7cb05c9

Browse files
committed
fix: restore server boot when launched via bin entry point, update README with PWA, security, and terminal usage docs
1 parent 4be2e20 commit 7cb05c9

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ The difference between *a tool you use* and *a tool you own.*
308308
**Read receipts** — see how many devices have viewed each shared item. Updates live as teammates open the page.
309309

310310
**Item management** — add optional titles to label any item for future reference. Edit text items inline without deleting and re-pasting. Pinned items are protected from both manual deletion and auto-cleanup.
311+
312+
**Mobile ready** — install as a PWA directly from your browser. Add to Home Screen on iOS or Android for a native app feel without the App Store.
313+
314+
**Security hardened** — rate limiting on all write endpoints, magic number file validation, filename sanitisation, and forced download for executable file types.
315+
311316
---
312317

313318
## Keyboard Shortcuts
@@ -335,10 +340,46 @@ node server/server.js
335340

336341
## Use Cases
337342

338-
- Moving content between your phone and laptop over WiFi
343+
- Moving content between your phone and laptop, or just any device over WiFi
339344
- Sharing API payloads, logs, or screenshots during a sprint
340345
- A lightweight team clipboard during standups or pair sessions
341346
- Home lab file sharing without setting up NAS or cloud sync
347+
- Piping build logs or stack traces from CI or terminal directly into a shared channel
348+
- Sharing sensitive credentials or config files over LAN without leaving a cloud trail
349+
350+
---
351+
352+
## Terminal Usage
353+
354+
Since Instbyte exposes a simple HTTP API, you can push content directly from your terminal using `curl` — no browser needed.
355+
356+
**Send a log file:**
357+
```bash
358+
curl -X POST http://192.168.x.x:3000/text \
359+
-H "Content-Type: application/json" \
360+
-d "{\"content\": \"$(cat error.log)\", \"channel\": \"general\", \"uploader\": \"terminal\"}"
361+
```
362+
363+
**Pipe command output directly:**
364+
```bash
365+
npm run build 2>&1 | curl -X POST http://192.168.x.x:3000/text \
366+
-H "Content-Type: application/json" \
367+
--data-binary @- \
368+
-H "X-Channel: general" \
369+
-H "X-Uploader: CI"
370+
```
371+
372+
**Upload a file from the terminal:**
373+
```bash
374+
curl -X POST http://192.168.x.x:3000/upload \
375+
-F "file=@./build.log" \
376+
-F "channel=general" \
377+
-F "uploader=terminal"
378+
```
379+
380+
Replace `192.168.x.x:3000` with the URL shown when Instbyte starts. If auth is enabled, add `-b "instbyte_auth=your-token"` to each request.
381+
382+
Useful for piping stack traces, build logs, or environment dumps straight into a channel your whole team can see instantly.
342383

343384
---
344385

@@ -352,6 +393,8 @@ Instbyte follows [Semantic Versioning](https://semver.org). See [Releases](https
352393

353394
Instbyte is intentionally lightweight and LAN-first. If you want to extend it — CLI tools, themes, integrations — open an issue or submit a pull request.
354395

396+
The codebase has a full test suite (184 tests across unit and integration). Run `npm test` before submitting anything. Issues tagged **good first issue** are a good starting point.
397+
355398
---
356399

357400
## License

server/server.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -941,22 +941,19 @@ const PREFERRED = parseInt(process.env.PORT) || config.server.port;
941941
const localIP = getLocalIP();
942942

943943
let PORT;
944-
945-
if (require.main === module) {
946-
findFreePort(PREFERRED).then(p => {
947-
PORT = p;
948-
server.listen(PORT, () => {
949-
console.log("\nInstbyte running");
950-
console.log("Local: http://localhost:" + PORT);
951-
console.log("Network: http://" + localIP + ":" + PORT);
952-
if (PORT !== PREFERRED) {
953-
console.log(`(port ${PREFERRED} was busy, switched to ${PORT})`);
954-
}
955-
console.log("");
956-
scanOrphans();
957-
});
944+
findFreePort(PREFERRED).then(p => {
945+
PORT = p;
946+
server.listen(PORT, () => {
947+
console.log("\nInstbyte running");
948+
console.log("Local: http://localhost:" + PORT);
949+
console.log("Network: http://" + localIP + ":" + PORT);
950+
if (PORT !== PREFERRED) {
951+
console.log(`(port ${PREFERRED} was busy, switched to ${PORT})`);
952+
}
953+
console.log("");
954+
scanOrphans();
958955
});
959-
}
956+
});
960957

961958
module.exports = { app, server, sessions };
962959

0 commit comments

Comments
 (0)