Skip to content

Commit bad0fa2

Browse files
committed
more ui
1 parent 0c93b2c commit bad0fa2

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

client/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const [, , tunnelURL, targetURL] = process.argv;
33
function usage() {
44
console.log("Usage: node client.js <tunnelURL> <targetURL>");
55
console.log(
6-
"Example: node client.js ws://https://webhooks-proxy-tunnel.YOUR_ORG.workers.dev/tunnel http://localhost:3000"
6+
"Example: node client.js https://webhooks-proxy-tunnel.YOUR_ORG.workers.dev/tunnel http://localhost:3000"
77
);
88
}
99

worker/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,20 @@ npm run deploy
99
```
1010

1111
Play with the protocol using [wscat](https://github.com/websockets/wscat).
12+
13+
## How to use
14+
15+
Create a [Cloudflare account](https://www.cloudflare.com/) on the Free plan, or if you plan to test thousands of tunnels try the [Workers Paid](https://developers.cloudflare.com/workers/platform/pricing/) plan.
16+
17+
[Install Node.js](https://nodejs.org/en/download). Tested on `v22.14.0`.
18+
19+
Clone the repo:
20+
21+
```bash
22+
git clone https://github.com/peter-leonov/webhooks-proxy-tunnel.git
23+
cd webhooks-proxy-tunnel
24+
# this step might ask you to log in
25+
( cd worker && npm i && npm run deploy )
26+
```
27+
28+
Then open the URL that the deploment gave you and follow the instructions.

worker/package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

worker/src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,24 @@ function indexPage(origin: string): string {
211211
<p>Public URL: <code>${origin}/proxy/</code></p>
212212
<p>Tunnel URL: <code>${origin}/tunnel</code></p>
213213
<p>
214+
Local server URL: <input type="text" value="http://localhost:3000/" id="target-input" />
214215
Client command:
215-
<pre><code>node client.js ${origin}/tunnel http://localhost:3000/</code></pre>
216+
<pre><code>cd webhooks-proxy-tunnel/client
217+
node src/client.js ${origin}/tunnel <span id="target-span">http://localhost:3000/</span>
218+
</code></pre>
216219
Connecting a new client kicks out the currently connected one.
217220
</p>
218221
<p>Force <a href="/close">close</a> the tunnel if the connected client is stuck.</p>
219222
</main>
223+
<script>
224+
const targetInput = document.getElementById("target-input");
225+
const targetSpan = document.getElementById("target-span");
226+
targetInput.addEventListener("input", (event) => {
227+
console.log("target input changed", event);
228+
const value = event.target.value;
229+
targetSpan.firstChild.nodeValue = value;
230+
})
231+
</script>
220232
</body>
221233
</html>`;
222234
}

0 commit comments

Comments
 (0)