Giter VIP home page Giter VIP logo

microplatojs's Introduction

microplatojs

This is a version of PLATOTERM that has been ported to JavaScript by way of the emscripten (http://emscripten.org/) project. It uses portions of PTerm for Z80 emulation and Microtutor execution.

License

This project uses code derived from PTerm. The license is available at pterm-license.txt.

Demo

It can be seen at http://js.irata.online/

Requirements

  • A web server: IRATA.ONLINE uses nginx, but you can use any standard (Apache, IIS, whatever) standard web server.
  • A WebSockets proxy. I use websockify (https://github.com/novnc/websockify), but some web servers, such as IIS have a way to define WebSocket proxies. Your web socket proxy must be pointing to your CYBIS's ASCII port (usually port 8005)
  • Make sure your web socket proxy is protected by TLS (SSL). Many browsers now require this for all websockets.

Building

This is broken into two sections, first covering the build environment, followed by compiling the code.

Installing Emscripten

You can follow the instructions at https://emscripten.org/docs/getting_started/downloads.html , but for TL:DR:

You need:

  • Python 3.6 or newer (this is especially important on Windows)
  • git
  • If you're running in Windows, using the Windows Subsystem for Linux is highly recommended.

From a shell, do the following:

# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk

# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh

NOTE If running from windows CMD, run emsdk instead of ./emsdk, and emsdk_env.bat instead of source ./emsdk_env.sh

Compiling the code

From a shell, do the following:

# Get the code
git clone https://github.com/tschak909/platotermjs.git

# enter that directory
cd platotermjs

# make the code, note the TARGET_URL must point to where the WebSocket will be listening.
TARGET_URL="wss://js.irata.online:2005" make

PLATOTERM will be built inside of build/ and you'll have the following:

  • plato.html - A basic HTML page which will load the PLATO terminal. This can be modified as needed.
  • plato.js - The compiled javascript of PLATOTERM
  • src - Dependency data generated during build process, not needed for deployment.

Setting up The WebSocket Proxy

Because JavaScript does not support connecting to raw sockets, we need to provide a WebSockets proxy. IRATA.ONLINE uses websockify (https://github.com/novnc/websockify), and other web servers have facilities to provide a WebSocket proxy (e.g. IIS)

websockify

You need:

  • websockify, either from source (link above), or via distribution, e.g. the websockify package in Debian or Ubuntu.
  • a TLS certificate and key, so that secure Websockets will function.

To use:

websockify --cert=/etc/letsencrypt/live/js.irata.online/cert.pem --key=/etc/letsencrypt/live/js.irata.online/privkey.pem 2005 localhost:8005

In this case, it is using LetsEncrypt TLS certificates generated by the letsencrypt tool, and it is forwarding websockets requests on port 2005, to the CYBIS ASCII socket on port 8005.

IIS

IIS has support for setting up WebSockets proxies in its user interface. More detailed information can be seen here (https://www.microfocus.com/documentation/extend-acucobol/1011/GUID-81B323FA-6AE6-438A-A1F5-016D7F45A097.html)

Deploying to server

Since PLATOTERM.js is entirely run on the client, all that is needed is to copy the plato.html and plato.js to an accessible directory on the web server.

Additional features

The irata-plato.html file is a more advanced shell showing how to implement on-screen keyboard control.

microplatojs's People

Contributors

tschak909 avatar sgeo avatar

Watchers

 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.