Web Console

Provides a simple web interface for command-line applications - quickly publish your Python / Go / Bash / Batch / Powershell / etc script as a basic web app. Turns STDOUT / STDERR into formatted text, alerts and progress indicators (interface written using Bootstrap and JQuery). Simply runs any command-line based script or executable.

Cross-platform (written in Go), runs as a self-contained executable complete with embedded web server on Windows, Linux and MacOS. The install process includes optional setup as a service / deamon on each platform (uses NSSM on Windows), plus the installer includes setup for tunnelto.dev to provide a secure connection through a firewall and a handy subdomain to point a browser at if needed.

Coming in verswion 2: Python (Flask) version also available to run on (for instance) PythonAnywhere.

Simple API, handles authentication (without using cookies), provides a mechanism for third-parties to handle authorisation. Can be used to provide webhook URIs for your scripts for services such as IFTTT and Zapier.

Screenshot of Web Console’s main user interface

Live Demo

See a live demo.

The above link runs the following simple Python 3 application:

import sys
import time

wordArray = ["The","Quick","Brown","Fox","Jumped","Over","The","Lazy","Dog"]

for pl in range(0, len(wordArray)):
    print (wordArray[pl])
    print ("Progress: Progress " + str(int(round(pl / (len(wordArray)-1), 2) * 100)))
    sys.stdout.flush()
    time.sleep(2)

The demo application simply prints a sentance a word at a time, one word every two seconds. It also prints a progress percentage, which is displayed by Web Console as a progress bar.

Installation

Follow the instructions in the section below for your specific platform.

You can download specific releases from the Github releases page.

Or, for the very latest version (built nightly from the Github source, might have bugs), you can download nightly builds:

Platform Binary
Windows 32-bit Download
Windows 64-bit Download
Mac Download
Linux 32-bit Download
Linux 64-bit Download
Linux ARM 32-bit Download
Linux ARM 64-bit Download

Mac / Linux (including Raspberry Pi)

Run install.sh:

curl -L https://github.com/dhicks6345789/web-console/raw/master/install.sh | sudo bash

Dependancies

This project contains binaries from:

The Non-Sucking Service Manager by Iain Patterson, used to set up services on Windows. Public Domain license.

tunnelto.dev, Copyright (c) 2020 Alex Grinman, used to provide secure connections through firewalls. MIT license.

Task Configuration Files

Webconsole will look in the defined “tasks” folder (by default, on Linux, /etc/webconsole) for subfolders. Any subfolders found will be searched for a “config.txt” file and used as a Task ID if found. Task IDs generated by the Webconsole application are random 16-character strings, but any string (no spaces) can be used.

The format of config.txt is as keywords followed by a colon then the given value, i.e.

title: Test Site
public: N
command: /root/buildSite.sh

Valid keywords are: title: The title of the Task, displayed in the header on the Task page and as the page title. description: Descriptive text saying what the task does. secret: A secret phrase / key / password. If present, must be given during the authentication process - can be passed in via GET (not very secure) or POST. public: If “Y”, this Task will be listed on the index page. Obviously, only use for Tasks you want to be made public. ratelimit: If more than 0, then this Task will not be allowed to run more often than the given number of seconds. progress: If “Y”, then a progress bar will be presented on the page. The percentages the progress bar shows will be guessed from previous runtimes of this Task. command: The command line to run. Pretty much any valid command line (or shell / batch script) should work.

Note that changes to config.txt for any Task will be in effect the next time the Task is triggered, without any need to restart / reload anything server side or even refresh the web interface if you already have the Task’s page open.

Custom Output Formatting

Webconsole adds the contents of “formatting.js” to the main HTML user interface to handle text formatting. If you want to customise the way text is formatted you can use your own version. Simpy copy the formatting.js file from the web root folder (/etc/webconsole/www by default on Linux) to the tasks folder (/etc/webconsole/tasks), or to an individual task’s folder if you want to customise formatting for one particular task, then make changes to that file as you wish.

The default contents of formatting.js are fairly simple, just formatting text in different colours if a keyword is found at the start of a line:

// If a string starts with "ERROR:", format the line in red.
if (value.toLowerCase().startsWith("error: ")) {
	value = "<span style='color:red'>" + value + "</span>"
	$("#taskAlerts").html(value);
} else if (value.toLowerCase().startsWith("warning: ") || value.toLowerCase().startsWith("alert: ")) {
	value = "<span style='color:yellow'>" + value + "</span>"
	$("#taskAlerts").html(value);
} else if (value.toLowerCase().startsWith("status: ")) {
	value = "<span style='color:green'>" + value.substr(8); + "</span>"
	$("#taskAlerts").html(value);
}

Custom Favicon

If you create a new Task via the command-line tool you will be given the option to randomly assign a favicon, selected from the “favicons” folder. You can use your own faviocn if preffered, just copy the appropriate icon to an individual Task’s folder, or the root of the “tasks” folder to set the same favicon for all Tasks.

A set of favicons are provided from the free “fruit” collection from Thiago Silva.

Custom Description

If you need a longer description than a singble line of text, then you can place you custom description in a file called description.txt in the root of an individual Task. You can embed HTML in this file if you wish, complete with links or whatever other components you like.