Skip to content

Commit 2760c9f

Browse files
committed
docs: rewrite terminal-usage.md for text/plain API and X-Passphrase auth
1 parent ff5c407 commit 2760c9f

File tree

1 file changed

+83
-24
lines changed

1 file changed

+83
-24
lines changed

docs/terminal-usage.md

Lines changed: 83 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,116 @@
11
# Terminal Usage
22

3-
Since Instbyte exposes a simple HTTP API, you can push content directly from your terminal using `curl` no browser needed.
3+
Instbyte exposes a simple HTTP APIpush content directly from your terminal using `curl`, no browser needed.
44

5-
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.
5+
Replace `192.168.x.x:3000` with the URL shown when Instbyte starts.
66

77
---
88

99
## Send text or a link
1010
```bash
11-
curl -X POST http://192.168.x.x:3000/text \
12-
-H "Content-Type: application/json" \
13-
-d '{"content": "hello from terminal", "channel": "general", "uploader": "terminal"}'
11+
curl -X POST http://192.168.x.x:3000/push \
12+
-H "Content-Type: text/plain" \
13+
-d "hello from terminal"
1414
```
1515

16-
## Send a file's contents as text
16+
Use `X-Channel` and `X-Uploader` headers to control where it lands. Both default to `general` and `terminal` if omitted.
17+
```bash
18+
curl -X POST http://192.168.x.x:3000/push \
19+
-H "Content-Type: text/plain" \
20+
-H "X-Channel: projects" \
21+
-H "X-Uploader: mohit" \
22+
-d "targeted push"
23+
```
24+
25+
---
26+
27+
## Pipe command output
28+
29+
Any command output — logs, build errors, git history — pipes directly. No quoting or escaping needed.
1730
```bash
18-
curl -X POST http://192.168.x.x:3000/text \
19-
-H "Content-Type: application/json" \
20-
-d "{\"content\": \"$(cat error.log)\", \"channel\": \"general\", \"uploader\": \"terminal\"}"
31+
# build output
32+
npm run build 2>&1 | curl -X POST http://192.168.x.x:3000/push \
33+
-H "Content-Type: text/plain" \
34+
--data-binary @-
35+
36+
# directory listing
37+
ls -la | curl -X POST http://192.168.x.x:3000/push \
38+
-H "Content-Type: text/plain" \
39+
--data-binary @-
40+
41+
# git log
42+
git log --oneline -20 | curl -X POST http://192.168.x.x:3000/push \
43+
-H "Content-Type: text/plain" \
44+
--data-binary @-
45+
46+
# docker logs
47+
docker logs my-container 2>&1 | curl -X POST http://192.168.x.x:3000/push \
48+
-H "Content-Type: text/plain" \
49+
--data-binary @-
2150
```
2251

23-
## Pipe command output directly
52+
---
53+
54+
## Send a file's contents as text
2455
```bash
25-
npm run build 2>&1 | curl -X POST http://192.168.x.x:3000/text \
26-
-H "Content-Type: application/json" \
27-
--data-binary @- \
28-
-H "X-Channel: general" \
29-
-H "X-Uploader: CI"
56+
curl -X POST http://192.168.x.x:3000/push \
57+
-H "Content-Type: text/plain" \
58+
--data-binary @error.log
3059
```
3160

61+
This works for any text file — logs, configs, `.env` snapshots, stack traces. The content appears in the feed with syntax highlighting if the extension is recognised.
62+
63+
> Use `/upload` instead if you want the file itself to be downloadable rather than read inline.
64+
65+
---
66+
3267
## Upload a file
68+
69+
Any file type — images, PDFs, zips, executables, media.
3370
```bash
3471
curl -X POST http://192.168.x.x:3000/upload \
35-
-F "file=@./build.log" \
72+
-F "file=@./screenshot.png" \
3673
-F "channel=general" \
3774
-F "uploader=terminal"
3875
```
3976

77+
---
78+
4079
## With auth enabled
4180

42-
Add the auth cookie to any request:
81+
Pass the passphrase as a header — works from any terminal or CI environment without needing a browser session.
82+
```bash
83+
curl -X POST http://192.168.x.x:3000/push \
84+
-H "Content-Type: text/plain" \
85+
-H "X-Passphrase: yourpassword" \
86+
--data-binary @error.log
87+
```
88+
89+
All endpoints accept `X-Passphrase`. Upload too:
4390
```bash
44-
curl -X POST http://192.168.x.x:3000/text \
45-
-b "instbyte_auth=yourpassphrase" \
46-
-H "Content-Type: application/json" \
47-
-d '{"content": "authenticated push", "channel": "general", "uploader": "terminal"}'
91+
curl -X POST http://192.168.x.x:3000/upload \
92+
-H "X-Passphrase: yourpassword" \
93+
-F "file=@./build.zip" \
94+
-F "channel=assets" \
95+
-F "uploader=CI"
4896
```
4997

5098
---
5199

100+
## Quick reference — headers
101+
102+
| Header | Applies to | Default | Description |
103+
|---|---|---|---|
104+
| `X-Channel` | `/push`, `/text` | `general` | Channel to post into |
105+
| `X-Uploader` | `/push`, `/text` | `terminal` | Display name in the feed |
106+
| `X-Passphrase` | all endpoints || Passphrase if auth is enabled |
107+
108+
---
109+
52110
## Use cases
53111

54-
- Pipe stack traces or build logs from CI straight into a shared channel
55-
- Send environment dumps or config snapshots from a remote server
112+
- Pipe stack traces or build output from CI straight into a shared channel
113+
- Send `.env` snapshots or config dumps from a remote server
56114
- Push deployment notifications to a team channel
57-
- Share curl-accessible API responses without leaving the terminal
115+
- Share API responses or debug output without leaving the terminal
116+
```

0 commit comments

Comments
 (0)