Giter Site home page Giter Site logo

yash1th / streamhut Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miguelmota/streamhut

0.0 1.0 0.0 17.61 MB

Stream your terminal to web without installing anything

Home Page: https://streamhut.io

License: MIT License

Dockerfile 0.09% Makefile 1.28% JavaScript 75.34% HTML 13.57% Ruby 4.67% CSS 5.06%

streamhut's Introduction


logo


streamhut

Stream and send data, terminal to web and vice versa.

License Build Status dependencies Status NPM version

NOTE: This streamhut server written in node will be deprecated once the golang rewrite is complete.

Synopsis

  • Stream your terminal to anyone without installing anything.
  • Originally created this to quickly share data and files between devices.
  • Path names map to channels.
  • Anyone in the same channel can view what's streamed.
  • Easily self-host your own streamhut server.

Disclaimer: This software is alpha quality and not production ready. Use at your own risk.

Demo

https://streamhut.io

Install

$ npm install -g streamhut

CLI

$ streamhut --help
                           (   )
                          (    )
                           (    )
                          (    )
                            )  )
                           (  (                  /\
                            (_)                 /  \  /\
                    ________[_]________      /\/    \/  \
           /\      /\        ______    \    /   /\/\  /\/\
          /  \    //_\       \    /\    \  /\/\/    \/    \
   /\    / /\/\  //___\       \__/  \    \/
  /  \  /\/    \//_____\       \ |[]|     \
 /\/\/\/       //_______\       \|__|      \
/      \      /XXXXXXXXXX\                  \
        \    /_I_II  I__I_\__________________\
               I_I|  I__I_____[]_|_[]_____I
               I_II  I__I_____[]_|_[]_____I
               I II__I  I     XXXXXXX     I
            ~~~~~"   "~~~~~~~~~~~~~~~~~~~~~~~~
                                    _
        _                          | |            _
  ___ _| |_  ____ _____ _____ ____ | |__  _   _ _| |_
 /___|_   _)/ ___) ___ (____ |    \|  _ \| | | (_   _)
|___ | | |_| |   | ____/ ___ | | | | | | | |_| | | |_
(___/   \__)_|   |_____)_____|_|_|_|_| |_|____/   \__)



  Usage: streamhut <cmd> [options]

  Commands:

    post [options]      post to a channel
    listen [options]    listen on a channel
    server [options]    start a streamhut server

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -h, --host <host>      host name
    -p, --port <port>      host port
    -n, --not-secure       not using SSL
    -c, --channel <id>     channel ID
    -t, --text <text>      text to send

Usage

Listening on a channel:

$ streamhut listen -h streamhut.io -c yo
connected to wss://streamhut.io/yo

received Fri Jun 30 2017 14:40:14 GMT-0700 (PDT):

hello

Posting text data to a channel:

$ streamhut post -h streamhut.io -c yo -t "hello"
posting data to wss://streamhut.io/yo:

hello

Posting file data to a channel:

$ streamhut post -h streamhut.io -c yo -f hello.txt
posting data to wss://streamhut.io/yo:

hello.txt

Posting text data from stdin to a channel:

$ cat hello.txt | streamhut post -h streamhut.io -c yo
posting data to wss://streamhut.io/yo:

hello

Pipe realtime stdout to streamhut xterm using netcat:

$ while true; do date; sleep 1; done | nc streamhut.io 1337
Streaming to: https://streamhut.io/dsa

Don't have netcat installed? No problem! Pipe to a file descriptor with an open TCP connection:

$ exec 3<>/dev/tcp/streamhut.io/1337 && head -1 <&3 && exec &> >(tee >(cat >&3))
Streaming to: https://streamhut.io/qev

Add a delay before piping contents to know the streamhut url ahead of time:

$ (echo -n; sleep 5; cat hello.txt) | nc streamhut.io 1337
Streaming to: https://streamhut.io/aoj
# waits 5 seconds, and then send contents of file.

You can even stream the whole shell session in realtime:

$ exec > >(nc streamhut.io 1337) 2>&1

Example of streaming tail of file:

# terminal 1
$ cat >data.txt

# terminal 2
$ tail -F data.txt | nc streamhut.io 1337

Example of piping to both stdout and netcat:

$ (echo -n; sleep 5; htop) | tee >(nc streamhut.io 1337)

Starting a local server

Starting a streamhut server on localhost:

$ streamhut server -p 1336
HTTP/WebSocket port: 1336
           TCP port: 1337

Then specify local hostname and port to connect:

$ streamhut listen -h 127.0.0.1 -p 1336 -n -c yo
connected to ws://127.0.0.1:1336/yo

Post a message to the channel:

$ echo 'hello' | streamhut post -h 127.0.0.1 -n -p 1336 -c yo
posting data to ws://streamhut.io/yo:

hello

Docker

You can run streamhut as a docker container:

docker pull miguelmota/streamhut
docker run -e PORT=8080 -e NET_PORT=1337 -p 8080:8080 -p 1337:1337 -e HOST_URL='https://example.com' --restart unless-stopped miguelmota/streamhut:latest

Development

Start server

$ make server

HTTP/WebSocket port: 3001
           TCP port: 1337

Start web

$ make web

Test

npm test

FAQ

  • Q: How is the stream log data stored?

    • A: Currently it's stored in a local sqlite3 database. More robust and scalable options are in the works.
  • Q: Are there plans to rewrite streamhut in other languages?

    • A: Yes! A Golang implementation is in the works.
  • Q: Can the same channel be used more than once?

    • A: Yes! send #{channel} (ie #mychannel) as the first stream text to use that channel.

      Example:

      exec > >(nc streamhut.io 1337) 2>&1;echo \#mychannel

License

MIT

streamhut's People

Contributors

miguelmota avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.