All Projects → rowanthorpe → ws-repl

rowanthorpe / ws-repl

Licence: GPL-3.0 license
MIGRATED TO https://vcs.rowanthorpe.com/rowan/ws-repl - THIS IS AN ARCHIVED VERSION... Arbitrary REPL in a web-page using websocketd

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to ws-repl

flhooks
React like Hooks implementation for Flutter.
Stars: ✭ 38 (+0%)
Mutual labels:  widget
shinyTime
A timeInput widget for Shiny
Stars: ✭ 23 (-39.47%)
Mutual labels:  widget
posts-in-sidebar
Publish a list of posts in your sidebar
Stars: ✭ 19 (-50%)
Mutual labels:  widget
KLineChartAndroid
A kline chart UI widget for android(Android版本的k线).
Stars: ✭ 51 (+34.21%)
Mutual labels:  widget
stomt-unreal-plugin
Collect feedback in-game/in-app with STOMT for Unreal Engine.
Stars: ✭ 23 (-39.47%)
Mutual labels:  widget
scope-capture-nrepl
nREPL middleware for scope-capture
Stars: ✭ 27 (-28.95%)
Mutual labels:  repl
AbsTK
The Abstract Toolkit – a widget toolkit for GUI and text-mode applications.
Stars: ✭ 67 (+76.32%)
Mutual labels:  widget
replbot
Slack/Discord bot for running interactive REPLs and shells from a chat.
Stars: ✭ 169 (+344.74%)
Mutual labels:  repl
CheckableTextView
A simple and flexible Checked TextView or Checkable TextView
Stars: ✭ 108 (+184.21%)
Mutual labels:  widget
keyboard layout
Keyboard switcher for Awesome WM with additional layouts
Stars: ✭ 48 (+26.32%)
Mutual labels:  widget
LabPype
Framework for Creating Pipeline Software
Stars: ✭ 18 (-52.63%)
Mutual labels:  widget
DiscoverRandomQuotes
Spontaneous - Random quotes is a free iOS app that generates random quotes. It values ease-of-use just as much as the users' privacy, so there are no ads or trackers to disrupt their experience. The app currently includes more than 75000 quotes, which you can only discover randomly.
Stars: ✭ 34 (-10.53%)
Mutual labels:  widget
NeoConsole
NeoConsole offers a command line (REPL) interface to a Pharo image, as well as other tools.
Stars: ✭ 22 (-42.11%)
Mutual labels:  repl
integrant-repl
Reloaded workflow functions for Integrant
Stars: ✭ 115 (+202.63%)
Mutual labels:  repl
GridFragment
Android parent Fragment for working with GridViews.
Stars: ✭ 17 (-55.26%)
Mutual labels:  widget
widgetci
a Cross-Platform Widget Management App. (Win/Linux/Mac)
Stars: ✭ 36 (-5.26%)
Mutual labels:  widget
covid-19-status
Menu bar widget for MacOS with COVID-19 statistics
Stars: ✭ 50 (+31.58%)
Mutual labels:  widget
lambda
lambda calculus interpreter
Stars: ✭ 23 (-39.47%)
Mutual labels:  repl
VBBNow
A VBB NotificationCenter Widget. It shows the nearby transit information
Stars: ✭ 23 (-39.47%)
Mutual labels:  widget
JShellStandalone
Provides a standalone version of the JShell REPL. Anything needed to run JShell independently is contained, so there is no need to install the full JDK. A minimal Java runtime is embedded and compressed using the jlink tool.
Stars: ✭ 36 (-5.26%)
Mutual labels:  repl

ws-repl

Arbitrary REPL in a web-page using websocketd.

Quick Start

  • Get websocketd
  • Copy the ws-repl.html file into a browsable location
  • Edit your web-server config to expose the websocket (use the provided nginx-config fragment as a guide)
  • Run the backend process in websocketd (see the examples.sh file for inspiration)
  • Browse to the page

Widget detail

The javascript can be used as a widget on arbitrary web-pages. Just place <div id="repl"></div> wherever you want it to appear. It can be customised extensively (including changing the div's id from "repl") by passing parameters to the init function, for example:

wsrepl({socketProto: 'wss', bufferLines=300, replBorderStyle: 'dashed'});

See defArgs in ws-repl.js to see what can be customised.

Notes

  • This just pipes STDIN/STDOUT from/to the browser, so any highly interactive process which uses terminal control-codes (e.g. ncurses) will of course not work.
  • This presumes a relatively recent browser with the usual HTML5 capabilities, code has not been bloated to accomodate old browsers - that can easily be done with backwards-compat javascript shims.
  • In the interests of simplicity this includes no security provisions, so if you use it in a public-facing web-page BE SURE to sandbox it if it does anything invasive or non-trivial, and/or include some form of password/token protection if you intend it for trusted users.
  • Even then, if running anything more complex than a basic echo-server still think hard how much you trust your logged-in users to mess around with it.
  • Lastly, don't run the backend websocketd as root. That would be profoundly silly.

Backend invocation examples

  • picolisp REPL:

    websocketd --address=127.0.0.1 --port=8080 pil
    
  • picolisp REPL (with sed to trim ': '):

    websocketd --address=127.0.0.1 --port=8080 sh -c 'pil | sed -u -e "s/^: //"'
    
  • ruby REPL:

    websocketd --address=127.0.0.1 --port=8080 irb
    
  • simple echo server:

    websocketd --address=127.0.0.1 --port=8080 sh -c 'while IFS= read -r input; do printf "You said: %s\\n" "${input}"; done'
    
  • poor man's SSH if run over https with http-auth? (just kidding)

    websocketd --address=127.0.0.1 --port=8080 sh -c 'sh 2>&1'
    

Screenshots

ws-repl screenshot ws-repl screenshot ws-repl screenshot

Code

This can be found on github. Report bugs either through the issue-tracker there or by email to rowan at rowanthorpe dot com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].