MuxWeb

From Crossroads Wiki

Jump to: navigation, search
MuxWeb screen capture

Contents

Purpose

Ever want to connect to a MU* game from just about anywhere you can find a web browser? MuxWeb is your solution.

This script interfaces with a background TinyFugue process on the same server to allow interaction with MU* worlds through any web browser without relying on java, non-HTTP ports, or a variety of other requirements.

Why? The author is behind a highly restrictive firewall and has the need for low bandwidth, high-latency connections. Allowing this server to maintain the persistent telnet connection and only sending/receiving data in small batches through standard HTML GET or POST methods meets this goal.

How does it work? A tinyfugue process is running in the background. This cgi script writes to the input file and then sends tinyfugue a USR1 or USR2 signal. This signal is hooked by tf to read the input file, and after an appropriate delay, the cgi script reads a portion of the output file and sends it back via the web.

WARNING: Tinyfugue's /sh and /quote commands (and a few other macros using them) allow the operator to run commands from the shell. While there is some code to attempt to limit such access, it can be easily overridden with minor changes. Do NOT, I repeat, do NOT install this script without a minimum of security precautions such as password protected directories (.htaccess) or other checks you might add to the code. Opening up your shell (or even a MU* login) to anyone with a web browser and the URL to this cgi would be a Very Bad Thing. Even password protected directories are vulnerable to packet sniffers unless you are using them through SSL.

Features

  • Single line or multi-line input
  • ANSI color (optional; very low bandwidth when turned off)
  • Access to server command line entries when using https or preprogrammed IP

Audience

This script is meant for MU* access from places where conventional telnet or java clients fail. It has been used worldwide on board ships via a satellite connection, and using various PDA devices (Palm Tungsten T5 via bluetooth cellphone, Apple iPhone, Blackberry).

Usage

The client can be accessed by pointing a web browser at the server address where you install the client.

Dependancy

This software requires a publicly accessible web server which allows cgi scripts, on which the user is permitted to leave a background process running. Additionally, the server must have:

  • Perl 5.0 with the following modules
    • HTML::FromANSI
    • Term::ANSIColor
  • TinyFugue 5.0 (must remain running as background process)

License

This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Installation

1. Create a directory in which the program will reside.

2. Use .htaccess to password-protect the directory. For additional security, set up a secure (https) webserver.

3. Add at least one login to your .htpasswd file. This will be the default username attempted from the client, although you will be able to switch at any time once logged in.

4. Set up a .tfrc file with your favorite TinyFugue options. Note that you should not include the common "/visual on" option.

5. Download the MUXweb software (muxweb.zip or muxweb.tar.gz) and extract the files to your protected directory.

6. Choose username(s) and set up username.tfrc files (sample included in the zip) containing the following:
/load .tfrc
/hook SIGUSR1 = /quote -dexec -1 '"mux.in.username"
/hook SIGUSR2 = /quote -1 '"mux.in.username"
(The -1 is a 1 second delay for multiple commands. If you change it, change the calculation for $delay in the script.)

7. Start up your tf processes in the background. A system to make sure the processes remain active is left as an exercise for the reader:

/usr/local/bin/tf -vnfusername.tfrc < /dev/null >> mux.out.username &

The -v is required to suppress visual mode (or you could use the "/visual off" command in the .tfrc file). The -n is optional to not immediately connect to your first world. The -f sets hooks for each file separately. If you change this, change the grep statement later in this file.

8. Access the mux.cgi script through your web browser.

Known Issues / Further Coding Work (Please Help)

  • The frame code works best in Internet Explorer. Not all features (especially auto-scrolling and frame refresh) work in other browsers.
  • TF 5.0 changed the way that /quote treated /-commands: the current version of the script calls the USR1 signal when the first character is a slash, and the USR2 signal otherwise. This does not permit multi-line input which mixes /-commands and regular commands. This could be worked around with creative coding, but hasn't been my priority.
  • I created a version of this file which used a mail interface... but it needs work! Contact me if you want it.
Personal tools