|
1 | 1 | # Terminal Usage |
2 | 2 |
|
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 API — push content directly from your terminal using `curl`, no browser needed. |
4 | 4 |
|
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. |
6 | 6 |
|
7 | 7 | --- |
8 | 8 |
|
9 | 9 | ## Send text or a link |
10 | 10 | ```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" |
14 | 14 | ``` |
15 | 15 |
|
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. |
17 | 30 | ```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 @- |
21 | 50 | ``` |
22 | 51 |
|
23 | | -## Pipe command output directly |
| 52 | +--- |
| 53 | + |
| 54 | +## Send a file's contents as text |
24 | 55 | ```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 |
30 | 59 | ``` |
31 | 60 |
|
| 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 | + |
32 | 67 | ## Upload a file |
| 68 | + |
| 69 | +Any file type — images, PDFs, zips, executables, media. |
33 | 70 | ```bash |
34 | 71 | curl -X POST http://192.168.x.x:3000/upload \ |
35 | | - -F "file=@./build.log" \ |
| 72 | + -F "file=@./screenshot.png" \ |
36 | 73 | -F "channel=general" \ |
37 | 74 | -F "uploader=terminal" |
38 | 75 | ``` |
39 | 76 |
|
| 77 | +--- |
| 78 | + |
40 | 79 | ## With auth enabled |
41 | 80 |
|
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: |
43 | 90 | ```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" |
48 | 96 | ``` |
49 | 97 |
|
50 | 98 | --- |
51 | 99 |
|
| 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 | + |
52 | 110 | ## Use cases |
53 | 111 |
|
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 |
56 | 114 | - 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