Minetest Remote Chatroom API
minetest_chatroom (by sorcerykid)
Minetest Remote Chatroom API allows for embedding realtime chat from a Minetest server directly onto your homepage using only Javascript/AJAX and a tiny CGILua script for the bridge.
A few pre-requisites apply to get up and running:
- Your Web server must be hosted on the same physical box as your Minetest server.
- You must install the corresponding mod to record the chat output to a local file.
- You must install CGILua and configure your Web server for executing CGILua scripts.
Code: Select all
luarocks install cgilua
https://bitbucket.org/sorcerykid/minetest_chatroom
The following 4 files are contained in the package, in addition to a README.txt with license information:
- chatroom.js
This is the Javascript library for receiving chat messages via AJAX, providing an API for dispatching events to the webpage. It must be placed in a public-facing directory of your web server. In the example below, I've chosen the "/var/www/html/lib" directory, but you can use any suitable location.
stream_chat.lua
This is the CGI-based chat bridge responsible for relaying chat messages to the client from the respective chat log. It must be placed into a public-facing directory of your web server that is configured for script execution, typically "cgi-bin". Be sure to set the correct ownership and permissions.
stream_chat.conf
This is the configuration for the chat bridge above. It must be placed into the same directory as "stream_chat.lua". For security reasons, you should also deny read-access to all files having a ".conf" extension.
sample.html
This is a sample homepage which can also serve as a barebones template for integrating the Javascript library on your site.
- timeout - the maximum length of time that a client can remain connected to the chat bridge, or indefinite by default.
- output_path - the location where chat output is being recorded, as configured within the "remote_chat" mod (see above).
- banned_ips - an optional list of IP addresses that are banned from connecting to the chat bridge.