File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ debug() {
1818
1919if [[ " ${DEV:- true} " == true ]]; then
2020 USE_HMR=" $( which inotifywait) "
21+
22+ # disable HMR when using netcat
23+ if [[ " $TCP_PROVIDER " == " nc" ]]; then
24+ USE_HMR=" "
25+ fi
2126fi
2227
2328header () {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ will check:
1111- ` HIDE_LOGO` - if this is set, the "powered by bash" logo will be hidden
1212- ` NO_STYLES` - if this is set, no CSS will be linked in the `<head>`
1313- ` ENABLE_SESSIONS` - if this is 'true', bash stack will manage sessions (using a `_session` cookie).
14+ - `TCP_PROVIDER` (default : tcpserver) - you can optionally use `nc` instead.
1415
1516# # Tailwind
1617
Original file line number Diff line number Diff line change @@ -23,8 +23,28 @@ mkdir -p data
2323mkdir -p uploads
2424
2525PORT=${PORT:- 3000}
26- echo -n " Listening on port "
27- tcpserver -1 -o -l 0 -H -R -c 1000 0 $PORT ./core.sh
26+
27+ TCP_PROVIDER=${TCP_PROVIDER:- tcpserver}
28+
29+ case " $TCP_PROVIDER " in
30+ tcpserver)
31+ echo -n " Listening on port "
32+ tcpserver -1 -o -l 0 -H -R -c 1000 0 $PORT ./core.sh
33+ ;;
34+ nc)
35+ [[ ! -p nc_tunnel ]] && mkfifo nc_tunnel
36+ [[ " ${DEV:- true} " == true ]] && \
37+ echo " WARNING: performance while using netcat will be significantly degraded!"
38+ echo " Listening on port $PORT "
39+ while true ; do
40+ < nc_tunnel nc -l $PORT | ./core.sh > nc_tunnel
41+ done
42+ ;;
43+ * )
44+ echo " ERROR: unsupported TCP_PROVIDER"
45+ exit 1
46+ ;;
47+ esac
2848
2949if [[ ! -z " $PID " ]]; then
3050 kill " $PID "
You can’t perform that action at this time.
0 commit comments